This repository has been archived by the owner on Mar 13, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
244 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
<!doctype html> | ||
<!-- | ||
Copyright (c) 2014 The Polymer Project Authors. All rights reserved. | ||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt | ||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | ||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt | ||
Code distributed by Google as part of the polymer project is also | ||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt | ||
--> | ||
<html> | ||
<head> | ||
<title>core-selector-next-previous-wrap</title> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"> | ||
|
||
<script src="../../../platform/platform.js"></script> | ||
<script src="../../../polymer-test-tools/chai/chai.js"></script> | ||
<script src="../../../polymer-test-tools/htmltest.js"></script> | ||
|
||
<link rel="import" href="../../core-selector.html"> | ||
|
||
<style> | ||
.core-selected { | ||
background: #ccc; | ||
} | ||
</style> | ||
|
||
</head> | ||
<body unresolved> | ||
|
||
<core-selector id="selector" selected="0"> | ||
<div>Item 1</div> | ||
<div>Item 2</div> | ||
<div>Item 3</div> | ||
</core-selector> | ||
|
||
<script> | ||
|
||
function async(fn) { | ||
setTimeout(function() { | ||
fn(); | ||
Platform.flush(); | ||
}, 50); | ||
} | ||
|
||
document.addEventListener('polymer-ready', function() { | ||
var assert = chai.assert; | ||
var s = document.querySelector('#selector'); | ||
assert.equal(s.selected, 0); | ||
async(function() { | ||
// select next item | ||
s.selectNext(true); | ||
async(function() { | ||
assert.equal(s.selected, 1); | ||
// select next item | ||
s.selectNext(true); | ||
async(function() { | ||
assert.equal(s.selected, 2); | ||
// select next item (already at the end) | ||
s.selectNext(true); | ||
async(function() { | ||
assert.equal(s.selected, 0); | ||
// select previous item (already at the beginning) | ||
s.selectPrevious(true); | ||
async(function() { | ||
assert.equal(s.selected, 2); | ||
// select previous item | ||
s.selectPrevious(true); | ||
async(function() { | ||
assert.equal(s.selected, 1); | ||
// select previous item | ||
s.selectPrevious(true); | ||
async(function() { | ||
assert.equal(s.selected, 0); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
|
||
</script> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
<!doctype html> | ||
<!-- | ||
Copyright (c) 2014 The Polymer Project Authors. All rights reserved. | ||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt | ||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | ||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt | ||
Code distributed by Google as part of the polymer project is also | ||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt | ||
--> | ||
<html> | ||
<head> | ||
<title>core-selector-next-previous</title> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"> | ||
|
||
<script src="../../../platform/platform.js"></script> | ||
<script src="../../../polymer-test-tools/chai/chai.js"></script> | ||
<script src="../../../polymer-test-tools/htmltest.js"></script> | ||
|
||
<link rel="import" href="../../core-selector.html"> | ||
|
||
<style> | ||
.core-selected { | ||
background: #ccc; | ||
} | ||
</style> | ||
|
||
</head> | ||
<body unresolved> | ||
|
||
<core-selector id="selector" selected="0"> | ||
<div>Item 1</div> | ||
<div>Item 2</div> | ||
<div>Item 3</div> | ||
</core-selector> | ||
|
||
<script> | ||
|
||
function async(fn) { | ||
setTimeout(function() { | ||
fn(); | ||
Platform.flush(); | ||
}, 50); | ||
} | ||
|
||
document.addEventListener('polymer-ready', function() { | ||
var assert = chai.assert; | ||
var s = document.querySelector('#selector'); | ||
assert.equal(s.selected, 0); | ||
async(function() { | ||
// select next item | ||
s.selectNext(); | ||
async(function() { | ||
assert.equal(s.selected, 1); | ||
// select next item | ||
s.selectNext(); | ||
async(function() { | ||
assert.equal(s.selected, 2); | ||
// select next item (already at the end) | ||
s.selectNext(); | ||
async(function() { | ||
assert.equal(s.selected, 2); | ||
// select previous item | ||
s.selectPrevious(); | ||
async(function() { | ||
assert.equal(s.selected, 1); | ||
// select previous item | ||
s.selectPrevious(); | ||
async(function() { | ||
assert.equal(s.selected, 0); | ||
// select previous item (already at the beginning) | ||
s.selectPrevious(); | ||
async(function() { | ||
assert.equal(s.selected, 0); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
|
||
</script> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<!doctype html> | ||
<!-- | ||
Copyright (c) 2014 The Polymer Project Authors. All rights reserved. | ||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt | ||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | ||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt | ||
Code distributed by Google as part of the polymer project is also | ||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt | ||
--> | ||
<html> | ||
<head> | ||
<title>core-selector-selected-attr-prop</title> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"> | ||
|
||
<script src="../../../platform/platform.js"></script> | ||
<script src="../../../polymer-test-tools/chai/chai.js"></script> | ||
<script src="../../../polymer-test-tools/htmltest.js"></script> | ||
|
||
<link rel="import" href="../../core-selector.html"> | ||
|
||
<style> | ||
.core-selected { | ||
background: #ccc; | ||
} | ||
</style> | ||
|
||
</head> | ||
<body> | ||
|
||
<core-selector id="selector" selected="2" selectedProperty="myprop"> | ||
<div>Item 1</div> | ||
<div>Item 2</div> | ||
<div>Item 3</div> | ||
<div>Item 4</div> | ||
<div>Item 5</div> | ||
</core-selector> | ||
|
||
<script> | ||
|
||
document.addEventListener('polymer-ready', function() { | ||
var assert = chai.assert; | ||
var s = document.querySelector('#selector'); | ||
// select Item 4 | ||
s.selected = 4; | ||
Platform.flush(); | ||
setTimeout(function() { | ||
// check Item2's attribute and property (should be unselect) | ||
assert.isFalse(s.children[2].hasAttribute('active')); | ||
assert.notEqual(s.children[2].myprop, true); | ||
// check Item4's attribute and property | ||
assert.isTrue(s.children[4].hasAttribute('active')); | ||
assert.isTrue(s.children[4].myprop); | ||
done(); | ||
}, 50); | ||
}); | ||
|
||
</script> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters