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

Side by Side Diff: third_party/WebKit/LayoutTests/shadow-dom/slots-api-2.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 <meta charset="utf-8">
3 <script src="../resources/testharness.js"></script>
4 <script src="../resources/testharnessreport.js"></script>
5 <script src="resources/shadow-dom.js"></script>
6 <div id="d1">
7 <template data-mode="open">
8 <div id="d1_1">
9 <template data-mode="open">
10 <div id="d1_1_1"></div>
11 <slot id="d1_1_s1" name="d1_1_s1"></slot>
12 <slot id="d1_1_s2" name="d1_1_s2"></slot>
13 <div id="d1_1_2"></div>
14 </template>
15 <div id="d1_2"></div>
16 <slot id="d1_s0"></slot>
17 <slot id="d1_s1" name="d1_s1" slot="d1_1_s1"></slot>
18 <slot id="d1_s2" name="d1_s2"></slot>
19 <div id="d1_3"></div>
20 <div id="d1_4" slot="d1_1_s1"></div>
21 </div>
22 </template>
23 <div id="d2" slot="d1_s1"></div>
24 <div id="d3" slot="d1_s2"></div>
25 <div id="d4" slot="non_existent"></div>
26 <div id="d5"></div>
27 </div>
28 <script>
29 'use strict';
30
31 let n = createTestTree(d1);
32 removeWhiteSpaceOnlyTextNodes(n.d1);
33
34 test(() => {
35 assert_equals(n.d1.assignedSlot, null);
36 assert_equals(n.d2.assignedSlot, n.d1_s1);
37 assert_equals(n.d3.assignedSlot, n.d1_s2);
38 assert_equals(n.d4.assignedSlot, null);
39 assert_equals(n.d5.assignedSlot, n.d1_s0);
40
41 assert_equals(n.d1_2.assignedSlot, null);
42 assert_equals(n.d1_s0.assignedSlot, null);
43 assert_equals(n.d1_s1.assignedSlot, n.d1_1_s1);
44 assert_equals(n.d1_s2.assignedSlot, null);
45 assert_equals(n.d1_3.assignedSlot, null);
46 assert_equals(n.d1_4.assignedSlot, n.d1_1_s1);
47 }, "assignedSlot");
48
49 test(() => {
50 assert_array_equals(n.d1_s0.assignedNodes(), [n.d5]);
51 assert_array_equals(n.d1_s1.assignedNodes(), [n.d2]);
52 assert_array_equals(n.d1_s2.assignedNodes(), [n.d3]);
53
54 assert_array_equals(n.d1_1_s1.assignedNodes(), [n.d1_s1, n.d1_4]);
55 assert_array_equals(n.d1_1_s2.assignedNodes(), []);
56 }, "assignedNodes");
57
58 test(() => {
59 assert_array_equals(n.d1_1_s1.assignedNodes({flatten: false}), [n.d1_s1, n.d1_ 4],
60 "{flatten: false} should not have any effect");
61 }, "assignedNodes({flatten: false})");
62
63 test(() => {
64 assert_array_equals(n.d1_s0.assignedNodes({flatten: true}), [n.d5]);
65 assert_array_equals(n.d1_s1.assignedNodes({flatten: true}), [n.d2]);
66 assert_array_equals(n.d1_s2.assignedNodes({flatten: true}), [n.d3]);
67
68 assert_array_equals(n.d1_1_s1.assignedNodes({flatten: true}), [n.d2, n.d1_4]);
69 assert_array_equals(n.d1_1_s1.assignedNodes({flatten: true}), [n.d2, n.d1_4]);
70 assert_array_equals(n.d1_1_s2.assignedNodes({flatten: true}), []);
71 }, "assignedNodes({flatten: true})");
72 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698