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

Unified Diff: third_party/WebKit/LayoutTests/shadow-dom/slots-default-slot.html

Issue 2051373002: Rewrite and organize tests in LayoutTests/shadow-dom (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@clean-test2-3
Patch Set: clean up 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-default-slot.html
diff --git a/third_party/WebKit/LayoutTests/shadow-dom/slots-default-slot.html b/third_party/WebKit/LayoutTests/shadow-dom/slots-default-slot.html
new file mode 100644
index 0000000000000000000000000000000000000000..2dc79a096005d2001672126959582e8be1232e4e
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/shadow-dom/slots-default-slot.html
@@ -0,0 +1,40 @@
+<!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">
+ <slot id="slot1"></slot>
+ <slot id="slot2"></slot>
+ <slot id="slot3" name="slot3"></slot>
+ </template>
+ <div id="child1" slot="nonexistent"></div>
+ <div id="child2"></div>
+ <div id="child3" slot="slot3"></div>
+ <div id="child4"></div>
+</div>
+<script>
+'use strict';
+
+let n = createTestTree(host);
+removeWhiteSpaceOnlyTextNodes(n.host);
+
+test(() => {
+ assert_equals(n.child1.assignedSlot, null);
+ assert_equals(n.child2.assignedSlot, n.slot1);
+ assert_equals(n.child3.assignedSlot, n.slot3);
+ assert_equals(n.child4.assignedSlot, n.slot1);
+}, "assignedSlot");
+
+test(() => {
+ assert_array_equals(n.slot1.assignedNodes(), [n.child2, n.child4]);
+ assert_array_equals(n.slot2.assignedNodes(), []);
+ assert_array_equals(n.slot3.assignedNodes(), [n.child3]);
+}, "assignedNodes");
+
+test(() => {
+ assert_array_equals(n.slot1.assignedNodes({ flatten: true }), [n.child2, n.child4]);
+ assert_array_equals(n.slot2.assignedNodes({ flatten: true }), []);
+ assert_array_equals(n.slot3.assignedNodes({ flatten: true }), [n.child3]);
+}, "assignedNodes({ flatten: true })");
+</script>

Powered by Google App Engine
This is Rietveld 408576698