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

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

Issue 2060793002: Rewrite tests for slots (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@events-related
Patch Set: 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="s1" name="slot1"></slot>
8 <slot id="s2" name="slot2"></slot>
9 <slot id="s3" name="slot3"></slot>
10 </template>
11 <div id="c1" slot="slot1"></div>
12 <div id="c2" slot="slot1"></div>
13 <div id="c3" slot="slot2"></div>
14 <div id="c4" slot="nonexistent"></div>
15 </div>
16 <script>
17 'use strict';
18
19 let n = createTestTree(host);
20 removeWhiteSpaceOnlyTextNodes(n.host);
21
22 test(() => {
23 assert_equals(n.host.assignedSlot, null);
24 assert_equals(n.c1.assignedSlot, n.s1);
25 assert_equals(n.c2.assignedSlot, n.s1);
26 assert_equals(n.c3.assignedSlot, n.s2);
27 assert_equals(n.c4.assignedSlot, null);
28 }, 'assignedSlot');
29
30 test(() => {
31 assert_array_equals(n.s1.assignedNodes(), [n.c1, n.c2]);
32 assert_array_equals(n.s2.assignedNodes(), [n.c3]);
33 assert_array_equals(n.s3.assignedNodes(), []);
34 }, 'assignedNodes');
35
36 test(() => {
37 assert_array_equals(n.s1.assignedNodes({flatten: true}), [n.c1, n.c2]);
38 assert_array_equals(n.s2.assignedNodes({flatten: true}), [n.c3]);
39 assert_array_equals(n.s3.assignedNodes({flatten: true}), []);
40 }, 'assignedNodes({flatten: true})');
41 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698