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-multi</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 multi></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, '(item1)'); | |
35 assert.isTrue(s.isSelected(event.detail.item)); | |
36 assert.equal(s.getSelection().length, 1); | |
37 // test2 | |
38 test++; | |
39 s.select('(item2)'); | |
40 } else if (test === 2) { | |
41 // check test2 | |
42 assert.isTrue(event.detail.isSelected); | |
43 assert.equal(event.detail.item, '(item2)'); | |
44 assert.isTrue(s.isSelected(event.detail.item)); | |
45 assert.equal(s.getSelection().length, 2); | |
46 done(); | |
47 } | |
48 }); | |
49 // test1 | |
50 var test = 1; | |
51 s.select('(item1)'); | |
52 }); | |
53 | |
54 </script> | |
55 | |
56 </body> | |
57 </html> | |
OLD | NEW |