OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <script src="../resources/testharness.js"></script> | |
3 <script src="../resources/testharnessreport.js"></script> | |
4 <script src="resources/shadow-dom.js"></script> | |
5 <div id="host"> | |
6 <template data-mode="open"> | |
7 <slot id="slot1"></slot> | |
8 <slot id="slot2"></slot> | |
9 <slot id="slot3" name="slot3"></slot> | |
10 </template> | |
11 <div id="child1" slot="nonexistent"></div> | |
12 <div id="child2"></div> | |
13 <div id="child3" slot="slot3"></div> | |
14 <div id="child4"></div> | |
15 </div> | |
16 <script> | |
17 'use strict'; | |
18 | |
19 let n = createTestTree(host); | |
20 removeWhiteSpaceOnlyTextNodes(n.host); | |
21 | |
22 test(() => { | |
23 assert_equals(n.child1.assignedSlot, null); | |
24 assert_equals(n.child2.assignedSlot, n.slot1); | |
25 assert_equals(n.child3.assignedSlot, n.slot3); | |
26 assert_equals(n.child4.assignedSlot, n.slot1); | |
27 }, "assignedSlot"); | |
28 | |
29 test(() => { | |
30 assert_array_equals(n.slot1.assignedNodes(), [n.child2, n.child4]); | |
31 assert_array_equals(n.slot2.assignedNodes(), []); | |
32 assert_array_equals(n.slot3.assignedNodes(), [n.child3]); | |
33 }, "assignedNodes"); | |
34 | |
35 test(() => { | |
36 assert_array_equals(n.slot1.assignedNodes({ flatten: true }), [n.child2, n.chi
ld4]); | |
37 assert_array_equals(n.slot2.assignedNodes({ flatten: true }), []); | |
38 assert_array_equals(n.slot3.assignedNodes({ flatten: true }), [n.child3]); | |
39 }, "assignedNodes({ flatten: true })"); | |
40 </script> | |
OLD | NEW |