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

Side by Side Diff: LayoutTests/imported/web-platform-tests/shadow-dom/shadow-trees/composition/test-001.html

Issue 560893005: First checked-in import of the W3C's test suites. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: add new expectations for newly failing w3c tests Created 6 years, 3 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <!--
3 Distributed under both the W3C Test Suite License [1] and the W3C
4 3-clause BSD License [2]. To contribute to a W3C Test Suite, see the
5 policies and contribution forms [3].
6
7 [1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license
8 [2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license
9 [3] http://www.w3.org/2004/10/27-testcases
10 -->
11 <html>
12 <head>
13 <title>Shadow DOM Test: A_04_07_01</title>
14 <link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
15 <link rel="help" href="http://www.w3.org/TR/2013/WD-shadow-dom-20130514/#multipl e-shadow-subtrees">
16 <meta name="assert" content="Composition:Composition algorithm">
17 <script src="../../../../../resources/testharness.js"></script>
18 <script src="../../../../../resources/testharnessreport.js"></script>
19 <script src="../../testcommon.js"></script>
20 <link rel="stylesheet" href="../../../../../resources/testharness.css">
21 </head>
22 <body>
23 <div id="log"></div>
24 <script>
25 test(unit(function (ctx) {
26 var d = newRenderedHTMLDocument(ctx);
27 var div = d.createElement('div');
28 div.innerHTML = '' +
29 '<ul id="host">' +
30 '<li id="li1" class="shadow">' +
31 '<a id="a11" class="cl1" href="#">Link11 Shadow</a>' +
32 '<a id="a12" class="cl2" href="#">Link12 Shadow</a>' +
33 '<a id="a13" class="cl1" href="#">Link13 Shadow</a>' +
34 '</li>' +
35 '<li id="li2">' +
36 '<a id="a21" href="#">Link21</a><a id="a22" href="#">Lin k22</a>' +
37 '</li>' +
38 '<li id="li3" class="shadow">' +
39 '<a id="a31" href="#">Link31 Shadow</a><a id="a32" href= "#">Link32 Shadow</a>' +
40 '</li>' +
41 '<li id="li4" class="shadow2">' +
42 '<a id="a41" href="#">Link41 Shadow 2</a><a id="a42" hre f="#">Link22 Shadow 2</a>' +
43 '</li>' +
44 '<li id="li5" class="shadow2">' +
45 '<a id="a51" href="#">Link51 Shadow</a><a id="a52" href= "#">Link52 Shadow 2</a>' +
46 '</li>' +
47 '</ul>';
48
49 d.body.appendChild(div);
50
51 //make nested shadow tree to check the reprojection
52 var li1 = d.querySelector('#li1');
53 var s = li1.createShadowRoot();
54 var shadowLI1 = document.createElement('li');
55 shadowLI1.innerHTML = '<content select=".cl1"></content>';
56 s.appendChild(shadowLI1);
57
58 //Shadow root to play with
59 var ul = d.querySelector('#host');
60
61 //make an old shadow tree
62 var s2 = ul.createShadowRoot();
63 var div2 = d.createElement('div');
64 div2.innerHTML = '<ul><content select=".shadow2"></content></ul>';
65 s2.appendChild(div2);
66
67 // At this point visible: li4 and li5
68 assert_true(d.querySelector('#li4').offsetTop > 0, 'Point 1: Node that match insertion ' +
69 'point criteria should be rendered');
70 assert_true(d.querySelector('#li5').offsetTop > 0, 'Point 2: Node that m atch insertion ' +
71 'point criteria should be rendered');
72 assert_equals(d.querySelector('#li1').offsetTop, 0, 'Point 3: Node that doen\'t match ' +
73 'insertion point criteria shouldn\'t be rendered');
74 assert_equals(d.querySelector('#li2').offsetTop, 0, 'Point 4: Node that doen\'t match ' +
75 'insertion point criteria shouldn\'t be rendered');
76 assert_equals(d.querySelector('#li3').offsetTop, 0, 'Point 5: Node that doen\'t match ' +
77 'insertion point criteria shouldn\'t be rendered');
78
79 //check the nested tree
80 assert_equals(d.querySelector('#a11').offsetTop, 0,
81 'Point 6: Aleady distributed nodes should behave like a shadow host child nodes');
82 assert_equals(d.querySelector('#a13').offsetTop, 0,
83 'Point 7: Aleady distributed nodes should behave like a shadow h ost child nodes');
84 assert_equals(d.querySelector('#a12').offsetTop, 0,
85 'Point 8: Aleady distributed nodes should behave like a shadow h ost child nodes');
86
87
88
89 //make a young shadow tree
90 var s3 = ul.createShadowRoot();
91 var div3 = d.createElement('div');
92 div3.innerHTML = '<ul><content select=".shadow"></content></ul>';
93 s3.appendChild(div3);
94
95 //At this point: li1 and li3 visible, others not
96 assert_true(d.querySelector('#li1').offsetTop > 0, 'Point 21: Node that matc h insertion ' +
97 'point criteria should be rendered');
98 assert_true(d.querySelector('#li3').offsetTop > 0, 'Point 22: Node that match insertion ' +
99 'point criteria should be rendered');
100 assert_equals(d.querySelector('#li2').offsetTop, 0, 'Point 23: Node that doen\'t match ' +
101 'insertion point criteria shouldn\'t be rendered');
102 assert_equals(d.querySelector('#li4').offsetTop, 0, 'Point 24: Node that doen\'t match ' +
103 'insertion point criteria shouldn\'t be rendered');
104 assert_equals(d.querySelector('#li5').offsetTop, 0, 'Point 25: Node that doen\'t match ' +
105 'insertion point criteria shouldn\'t be rendered');
106
107 //check the reprojected nodes (a11 and a13 visible, a12 not)
108 assert_true(d.querySelector('#a11').offsetTop > 0,
109 'Point 26: Aleady distributed nodes should behave like a shadow host child nodes');
110 assert_equals(d.querySelector('#a12').offsetTop, 0,
111 'Point 27: Aleady distributed nodes should behave like a shadow host child nodes');
112 assert_true(d.querySelector('#a13').offsetTop > 0,
113 'Point 28: Aleady distributed nodes should behave like a shadow host child nodes');
114
115 var shadow = d.createElement('shadow');
116 s3.appendChild(shadow);
117
118 //At this point: li1, li3, li4 and li5 visible li2 not
119 assert_true(d.querySelector('#li1').offsetTop > 0, 'Point 31: Node that matc h insertion ' +
120 'point criteria should be rendered');
121 assert_true(d.querySelector('#li3').offsetTop > 0, 'Point 32: Node that match insertion ' +
122 'point criteria should be rendered');
123 assert_equals(d.querySelector('#li2').offsetTop, 0, 'Point 33: Node that doen\'t match ' +
124 'insertion point criteria shouldn\'t be rendered');
125 assert_true(d.querySelector('#li4').offsetTop > 0, 'Point 34: Node that doen\'t match ' +
126 'insertion point criteria shouldn\'t be rendered');
127 assert_true(d.querySelector('#li5').offsetTop > 0, 'Point 35: Node that doen\'t match ' +
128 'insertion point criteria shouldn\'t be rendered');
129
130 //check the reprojected nodes (a11 and a13 visible, a12 not)
131 assert_true(d.querySelector('#a11').offsetTop > 0,
132 'Point 36: Aleady distributed nodes should behave like a shadow host child nodes');
133 assert_equals(d.querySelector('#a12').offsetTop, 0,
134 'Point 37: Aleady distributed nodes should behave like a shadow host child nodes');
135 assert_true(d.querySelector('#a13').offsetTop > 0,
136 'Point 38: Aleady distributed nodes should behave like a shadow host child nodes');
137
138 var shadow2 = d.createElement('shadow');
139 s3.appendChild(shadow2);
140
141 // Nothing should be changed
142 //At this point: li1, li3, li4 and li5 visible li2 not
143 assert_true(d.querySelector('#li1').offsetTop > 0, 'Point 41: Node that matc h insertion ' +
144 'point criteria should be rendered');
145 assert_true(d.querySelector('#li3').offsetTop > 0, 'Point 42: Node that match insertion ' +
146 'point criteria should be rendered');
147 assert_equals(d.querySelector('#li2').offsetTop, 0, 'Point 43: Node that doen\'t match ' +
148 'insertion point criteria shouldn\'t be rendered');
149 assert_true(d.querySelector('#li4').offsetTop > 0, 'Point 44: Node that doen\'t match ' +
150 'insertion point criteria shouldn\'t be rendered');
151 assert_true(d.querySelector('#li5').offsetTop > 0, 'Point 45: Node that doen\'t match ' +
152 'insertion point criteria shouldn\'t be rendered');
153
154 //check the reprojected nodes (a11 and a13 visible, a12 not)
155 assert_true(d.querySelector('#a11').offsetTop > 0,
156 'Point 46: Aleady distributed nodes should behave like a shadow host child nodes');
157 assert_equals(d.querySelector('#a12').offsetTop, 0,
158 'Point 47: Aleady distributed nodes should behave like a shadow host child nodes');
159 assert_true(d.querySelector('#a13').offsetTop > 0,
160 'Point 48: Aleady distributed nodes should behave like a shadow host child nodes');
161 }), 'A_04_07_01');
162 </script>
163 </body>
164 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698