OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <!-- | 2 <!-- |
3 Copyright (c) 2014 The Polymer Project Authors. All rights reserved. | 3 Copyright (c) 2014 The Polymer Project Authors. All rights reserved. |
4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt | 4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt | 6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
7 Code distributed by Google as part of the polymer project is also | 7 Code distributed by Google as part of the polymer project is also |
8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt | 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
9 --> | 9 --> |
10 <html> | 10 <html> |
11 <head> | 11 <head> |
12 <meta charset="UTF-8"> | 12 <meta charset="UTF-8"> |
13 <title>core-selector-next-previous-wrap</title> | 13 <title>core-selector-next-previous-wrap</title> |
14 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-
scale=1.0"> | 14 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-
scale=1.0"> |
15 | 15 |
16 <script src="../../platform/platform.js"></script> | 16 <script src="../../webcomponentsjs/webcomponents.js"></script> |
17 <script src="../../web-component-tester/browser.js"></script> | 17 <script src="../../web-component-tester/browser.js"></script> |
18 | 18 |
19 <link rel="import" href="../core-selector.html"> | 19 <link rel="import" href="../core-selector.html"> |
20 | 20 |
21 <style> | 21 <style> |
22 .core-selected { | 22 .core-selected { |
23 background: #ccc; | 23 background: #ccc; |
24 } | 24 } |
25 </style> | 25 </style> |
26 | 26 |
27 </head> | 27 </head> |
28 <body unresolved> | 28 <body unresolved> |
29 | 29 |
30 <core-selector id="selector" selected="0"> | 30 <core-selector id="selector" selected="0"> |
31 <div>Item 1</div> | 31 <div>Item 1</div> |
32 <div>Item 2</div> | 32 <div>Item 2</div> |
33 <div>Item 3</div> | 33 <div>Item 3</div> |
34 </core-selector> | 34 </core-selector> |
35 | 35 |
36 <script> | 36 <script> |
37 | 37 |
38 var s = document.querySelector('#selector'); | 38 var s = document.querySelector('#selector'); |
39 | 39 |
40 function assertAndSelect(method, expectedIndex, wrap) { | 40 function assertAndSelect(method, expectedIndex, wrap) { |
41 return function(done) { | 41 return function(done) { |
42 assert.equal(s.selected, expectedIndex); | 42 assert.equal(s.selected, expectedIndex); |
43 s[method](wrap); | 43 s[method](wrap); |
44 asyncPlatformFlush(done); | 44 flush(done); |
45 } | 45 } |
46 } | 46 } |
47 | 47 |
48 suite('next/previous', function() { | 48 suite('next/previous', function() { |
49 | 49 |
50 test('selectNext(true) wraps', function(done) { | 50 test('selectNext(true) wraps', function(done) { |
51 assert.equal(s.selected, 0); | 51 assert.equal(s.selected, 0); |
52 | 52 |
53 async.series([ | 53 async.series([ |
54 assertAndSelect('selectNext', 0, true), | 54 assertAndSelect('selectNext', 0, true), |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 assertAndSelect('selectPrevious', 0), | 104 assertAndSelect('selectPrevious', 0), |
105 ], done); | 105 ], done); |
106 }); | 106 }); |
107 | 107 |
108 }); | 108 }); |
109 | 109 |
110 </script> | 110 </script> |
111 | 111 |
112 </body> | 112 </body> |
113 </html> | 113 </html> |
OLD | NEW |