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

Side by Side Diff: third_party/WebKit/LayoutTests/shadow-dom/default-slots.html

Issue 2051373002: Rewrite and organize tests in LayoutTests/shadow-dom (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@clean-test2-3
Patch Set: clean up 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src='../resources/testharness.js'></script>
3 <script src='../resources/testharnessreport.js'></script>
4 <script src='resources/shadow-dom.js'></script>
5 <div id='host'>
6 <template data-mode='open'>
7 <slot id='slot1'></slot>
8 <slot id='slot2'></slot>
9 <slot id='slot3' name='slot3'></slot>
10 </template>
11 <div id='child1' slot='nonexistent'></div>
12 <div id='child2'></div>
13 <div id='child3' slot='slot3'></div>
14 <div id='child4'></div>
15 </div>
16 <script>
17 'use strict';
18 convertTemplatesToShadowRootsWithin(host);
19 removeWhiteSpaceOnlyTextNodes(host);
20
21 const slot1 = host.shadowRoot.querySelector('#slot1');
22 const slot2 = host.shadowRoot.querySelector('#slot2');
23 const slot3 = host.shadowRoot.querySelector('#slot3');
24
25 test(() => {
26 assert_equals(child1.assignedSlot, null);
27 assert_equals(child2.assignedSlot, slot1);
28 assert_equals(child3.assignedSlot, slot3);
29 assert_equals(child4.assignedSlot, slot1);
30 }, "assignedSlot");
31
32 test(() => {
33 assert_array_equals(slot1.assignedNodes(), [child2, child4]);
34 assert_array_equals(slot2.assignedNodes(), []);
35 assert_array_equals(slot3.assignedNodes(), [child3]);
36 }, "assignedNodes");
37
38 test(() => {
39 assert_array_equals(slot1.assignedNodes({flatten: true}), [child2, child4]);
40 assert_array_equals(slot2.assignedNodes({flatten: true}), []);
41 assert_array_equals(slot3.assignedNodes({flatten: true}), [child3]);
42 }, "getDistributedNodes");
43 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698