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

Unified Diff: third_party/WebKit/LayoutTests/shadow-dom/slots-api-dynamic.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-dynamic.html
diff --git a/third_party/WebKit/LayoutTests/shadow-dom/slots-api-dynamic.html b/third_party/WebKit/LayoutTests/shadow-dom/slots-api-dynamic.html
new file mode 100644
index 0000000000000000000000000000000000000000..84d3dfc12f4211c43ba1e2d53f1e198d5907b5ed
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/shadow-dom/slots-api-dynamic.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="d1">
+ <template data-mode="open">
+ <div id="d1_d1">
+ <template data-mode="open">
+ <slot id="d1_d1_s1" name="d1_d1_s1"></slot>
+ </template>
+ <slot id="d1_s1" name="d1_s1" slot="d1_d1_s1"></slot>
+ </div>
+ </template>
+ <div id="d2" slot="d1_s1"></div>
+</div>
+<script>
+'use strict';
+
+let n = createTestTree(d1);
+removeWhiteSpaceOnlyTextNodes(n.d1);
+
+test(() => {
+ assert_array_equals(n.d1_s1.assignedNodes(), [n.d2]);
+ assert_array_equals(n.d1_s1.assignedNodes({'flatten': true}), [n.d2]);
+
+ assert_array_equals(n.d1_d1_s1.assignedNodes(), [n.d1_s1]);
+ assert_array_equals(n.d1_d1_s1.assignedNodes({'flatten': true}), [n.d2]);
+
+ let d3 = document.createElement('div');
+ d3.setAttribute('id', 'd3');
+ d3.setAttribute('slot', 'd1_s1');
+ n.d1.appendChild(d3);
+
+ assert_array_equals(n.d1_s1.assignedNodes(), [n.d2, d3]);
+ assert_array_equals(n.d1_s1.assignedNodes({'flatten': true}), [n.d2, d3]);
+
+ assert_array_equals(n.d1_d1_s1.assignedNodes(), [n.d1_s1]);
+ assert_array_equals(n.d1_d1_s1.assignedNodes({'flatten': true}), [n.d2, d3]);
+}, 'Distribution should be re-calcualted when assigned nodes of a slot in the parent tree is changed');
+</script>

Powered by Google App Engine
This is Rietveld 408576698