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

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

Issue 1489433002: Support the essential part of Shadow DOM v1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: wip Created 5 years 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 <slot name='slot1'></slot>
8 <slot name='slot2'></slot>
9 <slot name='slot3'></slot>
10 </template>
11 <div id='child1' slot='slot1'></div>
12 <div id='child2' slot='slot1'></div>
13 <div id='child3' slot='slot2'></div>
14 <div id='child4' slot='nonexistent'></div>
15 </div>
16 <script>
17 convertTemplatesToShadowRootsWithin(host);
18 removeWhiteSpaceOnlyTextNodes(host);
19 document.body.offsetLeft;
20
21 const slot1 = host.shadowRoot.querySelector('[name=slot1]');
22 const slot2 = host.shadowRoot.querySelector('[name=slot2]');
23 const slot3 = host.shadowRoot.querySelector('[name=slot3]');
24
25 test(() => {
26 assert_equals(host.assignedSlot, null);
27 assert_equals(child1.assignedSlot, slot1);
28 assert_equals(child2.assignedSlot, slot1);
29 assert_equals(child3.assignedSlot, slot2);
30 assert_equals(child4.assignedSlot, null);
31 }, "assignedSlot");
32
33 test(() => {
34 assert_array_equals(slot1.getAssignedNodes(), [child1, child2]);
35 assert_array_equals(slot2.getAssignedNodes(), [child3]);
36 assert_array_equals(slot3.getAssignedNodes(), []);
37 }, "getAssignedNodes");
38
39 test(() => {
40 assert_array_equals(slot1.getDistributedNodes(), [child1, child2]);
41 assert_array_equals(slot2.getDistributedNodes(), [child3]);
42 assert_array_equals(slot3.getDistributedNodes(), []);
43 }, "getDistributedNodes");
44 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698