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

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

Issue 2053503003: Clean up layout tests in LayoutTests/shadow-dom/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « third_party/WebKit/LayoutTests/shadow-dom/v1-slots-in-v0-expected.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <!-- comment node -->
18 </div>
19 <script>
20 'use strict';
21 convertTemplatesToShadowRootsWithin(host);
22 removeWhiteSpaceOnlyTextNodes(host);
23 document.body.offsetLeft;
24
25 const slot1 = host.shadowRoot.querySelector('slot[name=slot1]');
26 const defaultSlot = host.shadowRoot.querySelector('slot');
27 const shadowChild1 = host.shadowRoot.querySelector('#shadow-child1');
28 const shadowChild2 = host.shadowRoot.querySelector('#shadow-child2');
29
30 const textHello = host.childNodes[1];
31 const textWorld = host.childNodes[3];
32 const commentNode = child3.nextSibling;
33
34 test(() => {
35 assert_equals(textHello.nodeValue.trim(), 'Hello');
36 assert_equals(textWorld.nodeValue.trim(), 'World');
37 assert_equals(commentNode.nodeType, Node.COMMENT_NODE);
38
39 assert_equals(textHello.assignedSlot, defaultSlot);
40 assert_equals(textWorld.assignedSlot, defaultSlot);
41 assert_equals(commentNode.assignedSlot, undefined, "Comment Node does not defi ne assignedSlot");
42 assert_equals(child1.assignedSlot, slot1);
43 assert_equals(child2.assignedSlot, defaultSlot);
44 assert_equals(child3.assignedSlot, null);
45 }, "assignedSlot");
46
47 test(() => {
48 assert_array_equals(defaultSlot.assignedNodes({flatten: true}), [textHello, ch ild2, textWorld]);
49 assert_array_equals(slot1.assignedNodes({flatten: true}), [child1]);
50 }, "assignedNodes");
51
52 add_completion_callback(() => {
53 if (window.testRunner)
54 host.style.display = "none";
55 });
56 </script>
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/shadow-dom/v1-slots-in-v0-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698