OLD | NEW |
| (Empty) |
1 <!doctype html> | |
2 <!-- | |
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 | |
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 | |
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 | |
9 --> | |
10 <html> | |
11 <head> | |
12 <title>core-selection</title> | |
13 | |
14 <script src="../../../platform/platform.js"></script> | |
15 <script src="../../../polymer-test-tools/chai/chai.js"></script> | |
16 <script src="../../../polymer-test-tools/htmltest.js"></script> | |
17 | |
18 <link rel="import" href="../../core-selection.html"> | |
19 | |
20 </head> | |
21 <body> | |
22 | |
23 <core-selection></core-selection> | |
24 | |
25 <script> | |
26 | |
27 document.addEventListener('polymer-ready', function() { | |
28 var assert = chai.assert; | |
29 var s = document.querySelector('core-selection'); | |
30 s.addEventListener("core-select", function(event) { | |
31 if (test === 1) { | |
32 // check test1 | |
33 assert.isTrue(event.detail.isSelected); | |
34 assert.equal(event.detail.item, '(item)'); | |
35 assert.isTrue(s.isSelected(event.detail.item)); | |
36 assert.isFalse(s.isSelected('(some_item_not_selected)')); | |
37 // test2 | |
38 test++; | |
39 s.select(null); | |
40 } else if (test === 2) { | |
41 // check test2 | |
42 assert.isFalse(event.detail.isSelected); | |
43 assert.equal(event.detail.item, '(item)'); | |
44 assert.isFalse(s.isSelected(event.detail.item)); | |
45 done(); | |
46 } | |
47 }); | |
48 // test1 | |
49 var test = 1; | |
50 s.select('(item)'); | |
51 }); | |
52 | |
53 </script> | |
54 | |
55 </body> | |
56 </html> | |
OLD | NEW |