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

Side by Side Diff: third_party/WebKit/LayoutTests/shadow-dom/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
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 id="default_slot"></slot>
9 <slot id="slot1" 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
22 let n = createTestTree(host);
23 removeWhiteSpaceOnlyTextNodes(n.host);
24
25 let textHello = n.host.childNodes[1];
26 let textWorld = n.host.childNodes[3];
27 let commentNode = n.child3.nextSibling;
28
29 test(() => {
30 assert_equals(textHello.nodeValue.trim(), 'Hello');
31 assert_equals(textWorld.nodeValue.trim(), 'World');
32 assert_equals(commentNode.nodeType, Node.COMMENT_NODE);
33
34 assert_equals(textHello.assignedSlot, n.default_slot);
35 assert_equals(textWorld.assignedSlot, n.default_slot);
36 assert_equals(commentNode.assignedSlot, undefined, "Comment Node does not defi ne assignedSlot");
37 assert_equals(n.child1.assignedSlot, n.slot1);
38 assert_equals(n.child2.assignedSlot, n.default_slot);
39 assert_equals(n.child3.assignedSlot, null);
40 }, "assignedSlot");
41
42 test(() => {
43 assert_array_equals(n.default_slot.assignedNodes({flatten: true}), [textHello, n.child2, textWorld]);
44 assert_array_equals(n.slot1.assignedNodes({flatten: true}), [n.child1]);
45 }, "assignedNodes");
46 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698