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

Unified Diff: third_party/WebKit/LayoutTests/fast/dom/shadow/v1-slots-api-2.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-slots-api-2.html
diff --git a/third_party/WebKit/LayoutTests/fast/dom/shadow/v1-slots-api-2.html b/third_party/WebKit/LayoutTests/fast/dom/shadow/v1-slots-api-2.html
new file mode 100644
index 0000000000000000000000000000000000000000..55d78ff6921cf898096eee41fe2b5d318b394fa1
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/dom/shadow/v1-slots-api-2.html
@@ -0,0 +1,81 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<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-1'>
+ <template data-mode='open'>
+ <div id='d1-1-1'></div>
+ <slot name='d1-1-s1'></slot>
+ <slot name='d1-1-s2'></slot>
+ <div id='d1-1-2'></div>
+ </template>
+ <div id='d1-2'></div>
+ <slot id='d1-s0'></slot>
+ <slot name='d1-s1' slot='d1-1-s1'></slot>
+ <slot name='d1-s2'></slot>
+ <div id='d1-3'></div>
+ <div id='d1-4' slot='d1-1-s1'></div>
+ </div>
+ </template>
+ <div id='d2' slot='d1-s1'></div>
+ <div id='d3' slot='d1-s2'></div>
+ <div id='d4' slot='non-existent'></div>
+ <div id='d5'></div>
+</div>
+<script>
+'use strict';
+convertTemplatesToShadowRootsWithin(d1);
+removeWhiteSpaceOnlyTextNodes(d1);
+document.body.offsetLeft;
+
+const d1_shadow = d1.shadowRoot;
+const d1_1 = d1_shadow.querySelector('#d1-1');
+const d1_2 = d1_shadow.querySelector('#d1-2');
+const d1_3 = d1_shadow.querySelector('#d1-3');
+const d1_4 = d1_shadow.querySelector('#d1-4');
+const d1_s0= d1_shadow.querySelector('#d1-s0');
+const d1_s1 = d1_shadow.querySelector('[name=d1-s1]');
+const d1_s2 = d1_shadow.querySelector('[name=d1-s2]');
+
+const d1_1_shadow = d1_1.shadowRoot;
+const d1_1_1 = d1_1_shadow.querySelector('#d1-1-1');
+const d1_1_2 = d1_1_shadow.querySelector('#d1-1-2');
+const d1_1_s1 = d1_1_shadow.querySelector('[name=d1-1-s1]');
+const d1_1_s2 = d1_1_shadow.querySelector('[name=d1-1-s2]');
+
+test(() => {
+ assert_equals(d1.assignedSlot, null);
+ assert_equals(d2.assignedSlot, d1_s1);
+ assert_equals(d3.assignedSlot, d1_s2);
+ assert_equals(d4.assignedSlot, null);
+ assert_equals(d5.assignedSlot, d1_s0);
+
+ assert_equals(d1_2.assignedSlot, null);
+ assert_equals(d1_s0.assignedSlot, null);
+ assert_equals(d1_s1.assignedSlot, d1_1_s1);
+ assert_equals(d1_s2.assignedSlot, null);
+ assert_equals(d1_3.assignedSlot, null);
+ assert_equals(d1_4.assignedSlot, d1_1_s1);
+}, "assignedSlot");
+
+test(() => {
+ assert_array_equals(d1_s0.getAssignedNodes(), [d5]);
+ assert_array_equals(d1_s1.getAssignedNodes(), [d2]);
+ assert_array_equals(d1_s2.getAssignedNodes(), [d3]);
+
+ assert_array_equals(d1_1_s1.getAssignedNodes(), [d1_s1, d1_4]);
+ assert_array_equals(d1_1_s2.getAssignedNodes(), []);
+}, "getAssignedNodes");
+
+test(() => {
+ assert_array_equals(d1_s0.getDistributedNodes(), [d5]);
+ assert_array_equals(d1_s1.getDistributedNodes(), [d2]);
+ assert_array_equals(d1_s2.getDistributedNodes(), [d3]);
+
+ assert_array_equals(d1_1_s1.getDistributedNodes(), [d2, d1_4]);
+ assert_array_equals(d1_1_s2.getDistributedNodes(), []);
+}, "getDistributedNodes");
+</script>

Powered by Google App Engine
This is Rietveld 408576698