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> |