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