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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/shadow-dom/slots-text-nodes.html
diff --git a/third_party/WebKit/LayoutTests/shadow-dom/slots-text-nodes.html b/third_party/WebKit/LayoutTests/shadow-dom/slots-text-nodes.html
new file mode 100644
index 0000000000000000000000000000000000000000..009be7cf70b25186e495824947e8f15489bdb33d
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/shadow-dom/slots-text-nodes.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="resources/shadow-dom.js"></script>
+<div id="host">
+ <template data-mode="open">
+ <div id="shadow_child1"></div>
+ <slot id="default_slot"></slot>
+ <slot id="slot1" name="slot1"></slot>
+ <div id="shadow_child2"></div>
+ </template>
+ <div id="child1" slot="slot1"></div>
+ Hello
+ <div id="child2"></div>
+ World
+ <div id="child3" slot="nonexistent"></div>
+ <!-- comment node -->
+</div>
+<script>
+'use strict';
+
+let n = createTestTree(host);
+removeWhiteSpaceOnlyTextNodes(n.host);
+
+let textHello = n.host.childNodes[1];
+let textWorld = n.host.childNodes[3];
+let commentNode = n.child3.nextSibling;
+
+test(() => {
+ assert_equals(textHello.nodeValue.trim(), 'Hello');
+ assert_equals(textWorld.nodeValue.trim(), 'World');
+ assert_equals(commentNode.nodeType, Node.COMMENT_NODE);
+
+ assert_equals(textHello.assignedSlot, n.default_slot);
+ assert_equals(textWorld.assignedSlot, n.default_slot);
+ assert_equals(commentNode.assignedSlot, undefined, "Comment Node does not define assignedSlot");
+ assert_equals(n.child1.assignedSlot, n.slot1);
+ assert_equals(n.child2.assignedSlot, n.default_slot);
+ assert_equals(n.child3.assignedSlot, null);
+}, "assignedSlot");
+
+test(() => {
+ assert_array_equals(n.default_slot.assignedNodes({flatten: true}), [textHello, n.child2, textWorld]);
+ assert_array_equals(n.slot1.assignedNodes({flatten: true}), [n.child1]);
+}, "assignedNodes");
+</script>

Powered by Google App Engine
This is Rietveld 408576698