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

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

Issue 1489433002: Support the essential part of Shadow DOM v1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert Internals.* 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 <div id='shadow-child1'></div>
8 <slot></slot>
9 <slot name='slot1'></slot>
10 <div id='shadow-child2'></div>
11 </template>
12 <div id='child1' slot='slot1'></div>
13 Hello
14 <div id='child2'></div>
15 World
16 <div id='child3' slot='nonexistent'></div>
17 </div>
18 <script>
19 'use strict';
20 convertTemplatesToShadowRootsWithin(host);
21 removeWhiteSpaceOnlyTextNodes(host);
22 document.body.offsetLeft;
23
24 const slot1 = host.shadowRoot.querySelector('slot[name=slot1]');
25 const defaultSlot = host.shadowRoot.querySelector('slot');
26 const shadowChild1 = host.shadowRoot.querySelector('#shadow-child1');
27 const shadowChild2 = host.shadowRoot.querySelector('#shadow-child2');
28
29 const textHello = host.childNodes[1];
30 const textWorld = host.childNodes[3];
31
32 test(() => {
33 assert_equals(textHello.nodeValue.trim(), 'Hello');
34 assert_equals(textWorld.nodeValue.trim(), 'World');
35 assert_equals(textHello.assignedSlot, defaultSlot);
36 assert_equals(textWorld.assignedSlot, defaultSlot);
37 assert_equals(child1.assignedSlot, slot1);
38 assert_equals(child2.assignedSlot, defaultSlot);
39 assert_equals(child3.assignedSlot, null);
40 }, "assignedSlot");
41
42 test(() => {
43 assert_array_equals(defaultSlot.getDistributedNodes(), [textHello, child2, tex tWorld]);
44 assert_array_equals(slot1.getDistributedNodes(), [child1]);
45 }, "getDistributedNodes");
46
47 add_completion_callback(() => {
48 if (window.testRunner)
49 host.style.display = "none";
50 });
51 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698