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

Side by Side Diff: third_party/WebKit/LayoutTests/shadow-dom/slots-api-with-closed-shadow-tree.html

Issue 2053503003: Clean up layout tests in LayoutTests/shadow-dom/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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="d1">
6 <template data-mode="closed">
7 <div id="d1_1">
8 <template data-mode="open">
9 <slot id="d1_1_s1" name="d1_1_s1"></slot>
10 </template>
11 <div id="d1_2" slot="d1_1_s1"></div>
12 <slot id="d1_s1" name="d1_s1" slot="d1_1_s1"></slot>
13 <slot id="d1_s2" name="d1_s2"></slot>
14 </div>
15 </template>
16 <div id="d2" slot="d1_s1"></div>
17 <div id="d3" slot="d1_s2"></div>
18 </div>
19 <script>
20 'use strict';
21
22 let n = createTestTree(d1);
23 removeWhiteSpaceOnlyTextNodes(n.d1);
24
25 test(() => {
26 assert_equals(n.d1.assignedSlot, null);
27 assert_equals(n.d2.assignedSlot, null);
28 assert_equals(n.d3.assignedSlot, null);
29 }, 'A slot in a closed shadow tree should not be accessed via assignedSlot');
30
31 test(() => {
32 assert_equals(n.d1_2.assignedSlot, n.d1_1_s1);
33 assert_equals(n.d1_s1.assignedSlot, n.d1_1_s1);
34 assert_equals(n.d1_s2.assignedSlot, null);
35 }, 'A slot in an open shadow tree should be accessed via assignedSlot from a clo sed shadow tree');
36
37 test(() => {
38 assert_array_equals(n.d1_s1.assignedNodes(), [n.d2]);
39 assert_array_equals(n.d1_s2.assignedNodes(), [n.d3]);
40 assert_array_equals(n.d1_1_s1.assignedNodes(), [n.d1_2, n.d1_s1]);
41 }, 'A closed shadow tree has nothing to do with the behavior of assignedNodes');
42
43 test(() => {
44 assert_array_equals(n.d1_s1.assignedNodes({flatten: true}), [n.d2]);
45 assert_array_equals(n.d1_s2.assignedNodes({flatten: true}), [n.d3]);
46 assert_array_equals(n.d1_1_s1.assignedNodes({flatten: true}), [n.d1_2, n.d2]);
47 }, 'A closed shadow tree has nothing to do with the behavior of assignedNodes({f latten: true}}');
48 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698