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

Unified Diff: third_party/WebKit/LayoutTests/shadow-dom/slots-api-1.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-api-1.html
diff --git a/third_party/WebKit/LayoutTests/shadow-dom/slots-api-1.html b/third_party/WebKit/LayoutTests/shadow-dom/slots-api-1.html
new file mode 100644
index 0000000000000000000000000000000000000000..412bc26627aff1c7d8def65b49958b74b2b12d2b
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/shadow-dom/slots-api-1.html
@@ -0,0 +1,41 @@
+<!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="s1" name="slot1"></slot>
+ <slot id="s2" name="slot2"></slot>
+ <slot id="s3" name="slot3"></slot>
+ </template>
+ <div id="c1" slot="slot1"></div>
+ <div id="c2" slot="slot1"></div>
+ <div id="c3" slot="slot2"></div>
+ <div id="c4" slot="nonexistent"></div>
+</div>
+<script>
+'use strict';
+
+let n = createTestTree(host);
+removeWhiteSpaceOnlyTextNodes(n.host);
+
+test(() => {
+ assert_equals(n.host.assignedSlot, null);
+ assert_equals(n.c1.assignedSlot, n.s1);
+ assert_equals(n.c2.assignedSlot, n.s1);
+ assert_equals(n.c3.assignedSlot, n.s2);
+ assert_equals(n.c4.assignedSlot, null);
+}, 'assignedSlot');
+
+test(() => {
+ assert_array_equals(n.s1.assignedNodes(), [n.c1, n.c2]);
+ assert_array_equals(n.s2.assignedNodes(), [n.c3]);
+ assert_array_equals(n.s3.assignedNodes(), []);
+}, 'assignedNodes');
+
+test(() => {
+ assert_array_equals(n.s1.assignedNodes({flatten: true}), [n.c1, n.c2]);
+ assert_array_equals(n.s2.assignedNodes({flatten: true}), [n.c3]);
+ assert_array_equals(n.s3.assignedNodes({flatten: true}), []);
+}, 'assignedNodes({flatten: true})');
+</script>

Powered by Google App Engine
This is Rietveld 408576698