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" name="slot1"> | |
8 <div id="fallback1"></div> | |
9 <slot id="slot2" name="slot2"> | |
10 <div id="fallback2"></div> | |
11 </slot> | |
12 </slot> | |
13 <slot id="slot3" name="slot3"> | |
14 <slot id="slot4" name="slot4"> | |
15 <div id="fallback3"></div> | |
16 </slot> | |
17 </slot> | |
18 </template> | |
19 <div id="child1" slot="slot2"></div> | |
20 </div> | |
21 <script> | |
22 'use strict'; | |
23 | |
24 let n = createTestTree(host); | |
25 removeWhiteSpaceOnlyTextNodes(n.host); | |
26 | |
27 test(() => { | |
28 assert_equals(n.child1.assignedSlot, n.slot2); | |
29 assert_equals(n.fallback1.assignedSlot, null); | |
30 assert_equals(n.fallback2.assignedSlot, null); | |
31 assert_equals(n.fallback3.assignedSlot, null); | |
32 }, "assignedSlot"); | |
33 | |
34 test(() => { | |
35 assert_array_equals(n.slot1.assignedNodes(), []); | |
36 assert_array_equals(n.slot2.assignedNodes(), [n.child1]); | |
37 assert_array_equals(n.slot3.assignedNodes(), []); | |
38 assert_array_equals(n.slot4.assignedNodes(), []); | |
39 }, "assignedNodes"); | |
40 | |
41 test(() => { | |
42 assert_array_equals(n.slot1.assignedNodes({ flatten: true }), [n.fallback1, n.
child1]); | |
43 assert_array_equals(n.slot2.assignedNodes({ flatten: true }), [n.child1]); | |
44 assert_array_equals(n.slot3.assignedNodes({ flatten: true }), [n.fallback3]); | |
45 assert_array_equals(n.slot4.assignedNodes({ flatten: true }), [n.fallback3]); | |
46 }, "assignedNodes({ flatten: true })"); | |
47 </script> | |
OLD | NEW |