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 <div id="host2"> | |
8 <template data-mode="open"> | |
9 <slot id="slot_a" name="slot_a"> | |
10 <slot id="slot_b" name="slot_b"></slot> | |
11 <div id="fallback_a"></div> | |
12 </slot> | |
13 </template> | |
14 <slot id="slot1" name="slot1" slot="slot_b"> | |
15 <div id="fallback1"></div> | |
16 <slot id="slot2" name="slot2"> | |
17 <div id="fallback2"></div> | |
18 </slot> | |
19 </slot> | |
20 <slot id="slot3" name="slot3"> | |
21 <slot id="slot4" name="slot4"> | |
22 <div id="fallback3"></div> | |
23 </slot> | |
24 </slot> | |
25 </div> | |
26 </template> | |
27 <div id="child1" slot="slot2"></div> | |
28 </div> | |
29 <script> | |
30 'use strict'; | |
31 | |
32 let n = createTestTree(host); | |
33 removeWhiteSpaceOnlyTextNodes(n.host); | |
34 | |
35 test(() => { | |
36 assert_equals(n.child1.assignedSlot, n.slot2); | |
37 assert_equals(n.fallback1.assignedSlot, null); | |
38 assert_equals(n.fallback2.assignedSlot, null); | |
39 assert_equals(n.fallback3.assignedSlot, null); | |
40 | |
41 assert_equals(n.slot1.assignedSlot, n.slot_b); | |
42 assert_equals(n.slot2.assignedSlot, null); | |
43 assert_equals(n.slot3.assignedSlot, null); | |
44 assert_equals(n.slot4.assignedSlot, null); | |
45 | |
46 assert_equals(n.slot_a.assignedSlot, null); | |
47 assert_equals(n.slot_b.assignedSlot, null); | |
48 assert_equals(n.fallback_a.assignedSlot, null); | |
49 }, 'assignedSlot'); | |
50 | |
51 test(() => { | |
52 assert_array_equals(n.slot1.assignedNodes(), []); | |
53 assert_array_equals(n.slot2.assignedNodes(), [n.child1]); | |
54 assert_array_equals(n.slot3.assignedNodes(), []); | |
55 assert_array_equals(n.slot4.assignedNodes(), []); | |
56 | |
57 assert_array_equals(n.slot_a.assignedNodes(), []); | |
58 assert_array_equals(n.slot_b.assignedNodes(), [n.slot1]); | |
59 }, 'assignedNodes'); | |
60 | |
61 test(() => { | |
62 assert_array_equals(n.slot1.assignedNodes({ flatten: true }), [n.fallback1, n.
child1]); | |
63 assert_array_equals(n.slot2.assignedNodes({ flatten: true }), [n.child1]); | |
64 assert_array_equals(n.slot3.assignedNodes({ flatten: true }), [n.fallback3]); | |
65 assert_array_equals(n.slot4.assignedNodes({ flatten: true }), [n.fallback3]); | |
66 | |
67 assert_array_equals(n.slot_a.assignedNodes({ flatten: true }), [n.fallback1, n
.child1, n.fallback_a]); | |
68 assert_array_equals(n.slot_b.assignedNodes({ flatten: true }), [n.fallback1, n
.child1]); | |
69 }, 'assignedNodes({ flatten: true })'); | |
70 </script> | |
OLD | NEW |