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

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

Issue 1489433002: Support the essential part of Shadow DOM v1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert Internals.* Created 5 years 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/fast/dom/shadow/v1-default-slots.html
diff --git a/third_party/WebKit/LayoutTests/fast/dom/shadow/v1-default-slots.html b/third_party/WebKit/LayoutTests/fast/dom/shadow/v1-default-slots.html
new file mode 100644
index 0000000000000000000000000000000000000000..db41b3e5182c1d6ea3e5d561993b439b9ce5af50
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/dom/shadow/v1-default-slots.html
@@ -0,0 +1,44 @@
+<!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';
+convertTemplatesToShadowRootsWithin(host);
+removeWhiteSpaceOnlyTextNodes(host);
+document.body.offsetLeft;
+
+const slot1 = host.shadowRoot.querySelector('#slot1');
+const slot2 = host.shadowRoot.querySelector('#slot2');
+const slot3 = host.shadowRoot.querySelector('#slot3');
+
+test(() => {
+ assert_equals(child1.assignedSlot, null);
+ assert_equals(child2.assignedSlot, slot1);
+ assert_equals(child3.assignedSlot, slot3);
+ assert_equals(child4.assignedSlot, slot1);
+}, "assignedSlot");
+
+test(() => {
+ assert_array_equals(slot1.getAssignedNodes(), [child2, child4]);
+ assert_array_equals(slot2.getAssignedNodes(), []);
+ assert_array_equals(slot3.getAssignedNodes(), [child3]);
+}, "getAssignedNodes");
+
+test(() => {
+ assert_array_equals(slot1.getDistributedNodes(), [child2, child4]);
+ assert_array_equals(slot2.getDistributedNodes(), []);
+ assert_array_equals(slot3.getDistributedNodes(), [child3]);
+}, "getDistributedNodes");
+</script>

Powered by Google App Engine
This is Rietveld 408576698