Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(214)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/dom/shadow/v1-slots-fallback-api-3.html

Issue 1530643003: Support slot element's fallback content feature (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 name='slot-a'>
10 <slot name='slot-b'>
11 </slot>
12 <div id='fallback-a'></div>
13 </slot>
14 </template>
15 <slot name='slot1' slot='slot-b'>
16 <div id='fallback1'></div>
17 <slot name='slot2'>
18 <div id='fallback2'></div>
19 </slot>
20 </slot>
21 <slot name='slot3'>
22 <slot name='slot4'>
23 <div id='fallback3'></div>
24 </slot>
25 </slot>
26 </div>
27 </template>
28 <div id='child1' slot='slot2'></div>
29 </div>
30 <script>
31 'use strict';
32 convertTemplatesToShadowRootsWithin(host);
33 removeWhiteSpaceOnlyTextNodes(host);
34 document.body.offsetLeft;
35
36 const slot1 = host.shadowRoot.querySelector('[name=slot1]');
37 const slot2 = host.shadowRoot.querySelector('[name=slot2]');
38 const slot3 = host.shadowRoot.querySelector('[name=slot3]');
39 const slot4 = host.shadowRoot.querySelector('[name=slot4]');
40 const fallback1 = host.shadowRoot.querySelector('#fallback1');
41 const fallback2 = host.shadowRoot.querySelector('#fallback2');
42 const fallback3 = host.shadowRoot.querySelector('#fallback3');
43
44 const host2 = host.shadowRoot.querySelector('#host2');
45
46 const slot_a = host2.shadowRoot.querySelector('[name=slot-a]');
47 const slot_b = host2.shadowRoot.querySelector('[name=slot-b]');
48 const fallback_a = host2.shadowRoot.querySelector('#fallback-a');
49
50 test(() => {
51 assert_equals(child1.assignedSlot, slot2);
52 assert_equals(fallback1.assignedSlot, null);
53 assert_equals(fallback2.assignedSlot, null);
54 assert_equals(fallback3.assignedSlot, null);
55
56 assert_equals(slot1.assignedSlot, slot_b);
57 assert_equals(slot2.assignedSlot, null);
58 assert_equals(slot3.assignedSlot, null);
59 assert_equals(slot4.assignedSlot, null);
60
61 assert_equals(slot_a.assignedSlot, null);
62 assert_equals(slot_b.assignedSlot, null);
63 assert_equals(fallback_a.assignedSlot, null);
64 }, "assignedSlot");
65
66 test(() => {
67 assert_array_equals(slot1.getAssignedNodes(), []);
68 assert_array_equals(slot2.getAssignedNodes(), [child1]);
69 assert_array_equals(slot3.getAssignedNodes(), []);
70 assert_array_equals(slot4.getAssignedNodes(), []);
71
72 assert_array_equals(slot_a.getAssignedNodes(), []);
73 assert_array_equals(slot_b.getAssignedNodes(), [slot1]);
74 }, "getAssignedNodes");
75
76 test(() => {
77 assert_array_equals(slot1.getDistributedNodes(), [fallback1, child1]);
78 assert_array_equals(slot2.getDistributedNodes(), [child1]);
79 assert_array_equals(slot3.getDistributedNodes(), [fallback3]);
80 assert_array_equals(slot4.getDistributedNodes(), [fallback3]);
81
82 assert_array_equals(slot_a.getDistributedNodes(), [fallback1, child1, fallback _a]);
83 assert_array_equals(slot_b.getDistributedNodes(), [fallback1, child1]);
84 }, "getDistributedNodes");
85 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698