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

Unified Diff: third_party/WebKit/LayoutTests/fast/dom/shadow/v1-slots-fallback-api-3.html

Issue 1530643003: Support slot element's fallback content feature (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed Created 4 years, 11 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/fast/dom/shadow/v1-slots-fallback-api-3.html
diff --git a/third_party/WebKit/LayoutTests/fast/dom/shadow/v1-slots-fallback-api-3.html b/third_party/WebKit/LayoutTests/fast/dom/shadow/v1-slots-fallback-api-3.html
new file mode 100644
index 0000000000000000000000000000000000000000..b548272d28804805e3931c217ad0bb6c95707439
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/dom/shadow/v1-slots-fallback-api-3.html
@@ -0,0 +1,85 @@
+<!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'>
+ <div id='host2'>
+ <template data-mode='open'>
+ <slot name='slot-a'>
+ <slot name='slot-b'>
+ </slot>
+ <div id='fallback-a'></div>
+ </slot>
+ </template>
+ <slot name='slot1' slot='slot-b'>
+ <div id='fallback1'></div>
+ <slot name='slot2'>
+ <div id='fallback2'></div>
+ </slot>
+ </slot>
+ <slot name='slot3'>
+ <slot name='slot4'>
+ <div id='fallback3'></div>
+ </slot>
+ </slot>
+ </div>
+ </template>
+ <div id='child1' slot='slot2'></div>
+</div>
+<script>
+'use strict';
+convertTemplatesToShadowRootsWithin(host);
+removeWhiteSpaceOnlyTextNodes(host);
+document.body.offsetLeft;
+
+const slot1 = host.shadowRoot.querySelector('[name=slot1]');
+const slot2 = host.shadowRoot.querySelector('[name=slot2]');
+const slot3 = host.shadowRoot.querySelector('[name=slot3]');
+const slot4 = host.shadowRoot.querySelector('[name=slot4]');
+const fallback1 = host.shadowRoot.querySelector('#fallback1');
+const fallback2 = host.shadowRoot.querySelector('#fallback2');
+const fallback3 = host.shadowRoot.querySelector('#fallback3');
+
+const host2 = host.shadowRoot.querySelector('#host2');
+
+const slot_a = host2.shadowRoot.querySelector('[name=slot-a]');
+const slot_b = host2.shadowRoot.querySelector('[name=slot-b]');
+const fallback_a = host2.shadowRoot.querySelector('#fallback-a');
+
+test(() => {
+ assert_equals(child1.assignedSlot, slot2);
+ assert_equals(fallback1.assignedSlot, null);
+ assert_equals(fallback2.assignedSlot, null);
+ assert_equals(fallback3.assignedSlot, null);
+
+ assert_equals(slot1.assignedSlot, slot_b);
+ assert_equals(slot2.assignedSlot, null);
+ assert_equals(slot3.assignedSlot, null);
+ assert_equals(slot4.assignedSlot, null);
+
+ assert_equals(slot_a.assignedSlot, null);
+ assert_equals(slot_b.assignedSlot, null);
+ assert_equals(fallback_a.assignedSlot, null);
+}, "assignedSlot");
+
+test(() => {
+ assert_array_equals(slot1.getAssignedNodes(), []);
+ assert_array_equals(slot2.getAssignedNodes(), [child1]);
+ assert_array_equals(slot3.getAssignedNodes(), []);
+ assert_array_equals(slot4.getAssignedNodes(), []);
+
+ assert_array_equals(slot_a.getAssignedNodes(), []);
+ assert_array_equals(slot_b.getAssignedNodes(), [slot1]);
+}, "getAssignedNodes");
+
+test(() => {
+ assert_array_equals(slot1.getDistributedNodes(), [fallback1, child1]);
+ assert_array_equals(slot2.getDistributedNodes(), [child1]);
+ assert_array_equals(slot3.getDistributedNodes(), [fallback3]);
+ assert_array_equals(slot4.getDistributedNodes(), [fallback3]);
+
+ assert_array_equals(slot_a.getDistributedNodes(), [fallback1, child1, fallback_a]);
+ assert_array_equals(slot_b.getDistributedNodes(), [fallback1, child1]);
+}, "getDistributedNodes");
+</script>

Powered by Google App Engine
This is Rietveld 408576698