OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../../../resources/testharness.js"></script> | 2 <script src="../../../resources/testharness.js"></script> |
3 <script src="../../../resources/testharnessreport.js"></script> | 3 <script src="../../../resources/testharnessreport.js"></script> |
4 <style> | 4 <style> |
5 .t1 span.c#r1, | 5 .t1 span.c#r1, |
6 .t2 *.c#r2, | 6 .t2 *.c#r2, |
7 .t3 span.c, | 7 .t3 span.c, |
8 .t4 *.ca.cb, | 8 .t4 *.ca.cb, |
9 .t5 :-webkit-any(div.ca.cb, *.cc.cd#r5b), | 9 .t5 :-webkit-any(div.ca.cb, *.cc.cd#r5b), |
10 .t6 ~ div > span.c#r6, | 10 .t6 ~ div > span.c#r6, |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 document.body.offsetTop; | 123 document.body.offsetTop; |
124 | 124 |
125 test(function() { | 125 test(function() { |
126 assert_true(!!window.internals, "This test only works with internals exposed
present"); | 126 assert_true(!!window.internals, "This test only works with internals exposed
present"); |
127 }, "internals are exposed"); | 127 }, "internals are exposed"); |
128 | 128 |
129 test(function() { | 129 test(function() { |
130 assert_equals(getComputedStyle(r1).backgroundColor, "rgba(0, 0, 0, 0)", "Bac
kground color should initially be transparent"); | 130 assert_equals(getComputedStyle(r1).backgroundColor, "rgba(0, 0, 0, 0)", "Bac
kground color should initially be transparent"); |
131 | 131 |
132 t1.className = "t1"; | 132 t1.className = "t1"; |
133 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 5, "Subt
ree style recalc"); | 133 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 4, "Subt
ree style recalc"); |
134 assert_equals(getComputedStyle(r1).backgroundColor, "rgb(0, 128, 0)", "Backg
round color is green after class change"); | 134 assert_equals(getComputedStyle(r1).backgroundColor, "rgb(0, 128, 0)", "Backg
round color is green after class change"); |
135 }, "Descendant with compound selector containing id"); | 135 }, "Descendant with compound selector containing id"); |
136 | 136 |
137 test(function() { | 137 test(function() { |
138 assert_equals(getComputedStyle(r2).backgroundColor, "rgba(0, 0, 0, 0)", "Bac
kground color should initially be transparent"); | 138 assert_equals(getComputedStyle(r2).backgroundColor, "rgba(0, 0, 0, 0)", "Bac
kground color should initially be transparent"); |
139 | 139 |
140 t2.className = "t2"; | 140 t2.className = "t2"; |
141 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 3, "Subt
ree style recalc"); | 141 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 2, "Subt
ree style recalc"); |
142 assert_equals(getComputedStyle(r2).backgroundColor, "rgb(0, 128, 0)", "Backg
round color is green after class change"); | 142 assert_equals(getComputedStyle(r2).backgroundColor, "rgb(0, 128, 0)", "Backg
round color is green after class change"); |
143 }, "Descendant with compound selector containing universal and id"); | 143 }, "Descendant with compound selector containing universal and id"); |
144 | 144 |
145 test(function() { | 145 test(function() { |
146 assert_equals(getComputedStyle(r3).backgroundColor, "rgba(0, 0, 0, 0)", "Bac
kground color should initially be transparent"); | 146 assert_equals(getComputedStyle(r3).backgroundColor, "rgba(0, 0, 0, 0)", "Bac
kground color should initially be transparent"); |
147 | 147 |
148 t3.className = "t3"; | 148 t3.className = "t3"; |
149 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 4, "Subt
ree style recalc"); | 149 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 3, "Subt
ree style recalc"); |
150 assert_equals(getComputedStyle(r3).backgroundColor, "rgb(0, 128, 0)", "Backg
round color is green after class change"); | 150 assert_equals(getComputedStyle(r3).backgroundColor, "rgb(0, 128, 0)", "Backg
round color is green after class change"); |
151 }, "Descendant with compound selector"); | 151 }, "Descendant with compound selector"); |
152 | 152 |
153 test(function() { | 153 test(function() { |
154 assert_equals(getComputedStyle(r4).backgroundColor, "rgba(0, 0, 0, 0)", "Bac
kground color should initially be transparent"); | 154 assert_equals(getComputedStyle(r4).backgroundColor, "rgba(0, 0, 0, 0)", "Bac
kground color should initially be transparent"); |
155 | 155 |
156 t4.className = "t4"; | 156 t4.className = "t4"; |
157 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 4, "Subt
ree style recalc"); | 157 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 3, "Subt
ree style recalc"); |
158 assert_equals(getComputedStyle(r4).backgroundColor, "rgb(0, 128, 0)", "Backg
round color is green after class change"); | 158 assert_equals(getComputedStyle(r4).backgroundColor, "rgb(0, 128, 0)", "Backg
round color is green after class change"); |
159 }, "Descendant with compound selector containing universal"); | 159 }, "Descendant with compound selector containing universal"); |
160 | 160 |
161 test(function() { | 161 test(function() { |
162 assert_equals(getComputedStyle(r5a).backgroundColor, "rgba(0, 0, 0, 0)", "Ba
ckground color a should initially be transparent"); | 162 assert_equals(getComputedStyle(r5a).backgroundColor, "rgba(0, 0, 0, 0)", "Ba
ckground color a should initially be transparent"); |
163 assert_equals(getComputedStyle(r5b).backgroundColor, "rgba(0, 0, 0, 0)", "Ba
ckground color b should initially be transparent"); | 163 assert_equals(getComputedStyle(r5b).backgroundColor, "rgba(0, 0, 0, 0)", "Ba
ckground color b should initially be transparent"); |
164 | 164 |
165 t5.className = "t5"; | 165 t5.className = "t5"; |
166 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 6, "Subt
ree style recalc"); | 166 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 5, "Subt
ree style recalc"); |
167 assert_equals(getComputedStyle(r5a).backgroundColor, "rgb(0, 128, 0)", "Back
ground color a is green after class change"); | 167 assert_equals(getComputedStyle(r5a).backgroundColor, "rgb(0, 128, 0)", "Back
ground color a is green after class change"); |
168 assert_equals(getComputedStyle(r5b).backgroundColor, "rgb(0, 128, 0)", "Back
ground color b is green after class change"); | 168 assert_equals(getComputedStyle(r5b).backgroundColor, "rgb(0, 128, 0)", "Back
ground color b is green after class change"); |
169 }, "Descendant with :-webkit-any containing compound selector"); | 169 }, "Descendant with :-webkit-any containing compound selector"); |
170 | 170 |
171 test(function() { | 171 test(function() { |
172 assert_equals(getComputedStyle(r6).backgroundColor, "rgba(0, 0, 0, 0)", "Bac
kground color should initially be transparent"); | 172 assert_equals(getComputedStyle(r6).backgroundColor, "rgba(0, 0, 0, 0)", "Bac
kground color should initially be transparent"); |
173 | 173 |
174 t6.className = "t6"; | 174 t6.className = "t6"; |
175 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 6, "Subt
ree style recalc"); | 175 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 4, "Subt
ree style recalc"); |
176 assert_equals(getComputedStyle(r6).backgroundColor, "rgb(0, 128, 0)", "Backg
round color is green after class change"); | 176 assert_equals(getComputedStyle(r6).backgroundColor, "rgb(0, 128, 0)", "Backg
round color is green after class change"); |
177 }, "Sibling with compound descendant containing id"); | 177 }, "Sibling with compound descendant containing id"); |
178 | 178 |
179 test(function() { | 179 test(function() { |
180 assert_equals(getComputedStyle(r7).backgroundColor, "rgba(0, 0, 0, 0)", "Bac
kground color should initially be transparent"); | 180 assert_equals(getComputedStyle(r7).backgroundColor, "rgba(0, 0, 0, 0)", "Bac
kground color should initially be transparent"); |
181 | 181 |
182 t7.className = "t7"; | 182 t7.className = "t7"; |
183 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 1, "Subt
ree style recalc"); | 183 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 3, "Subt
ree style recalc"); |
184 // TODO(ericwilligers): Update Blink's implementation of sibling selector in
validation, so the following passes: | |
185 assert_equals(getComputedStyle(r7).backgroundColor, "rgb(0, 128, 0)", "Backg
round color is green after class change"); | 184 assert_equals(getComputedStyle(r7).backgroundColor, "rgb(0, 128, 0)", "Backg
round color is green after class change"); |
186 }, "Sibling with compound descendant"); | 185 }, "Sibling with compound descendant"); |
187 | 186 |
188 test(function() { | 187 test(function() { |
189 assert_equals(getComputedStyle(r8).backgroundColor, "rgba(0, 0, 0, 0)", "Bac
kground color should initially be transparent"); | 188 assert_equals(getComputedStyle(r8).backgroundColor, "rgba(0, 0, 0, 0)", "Bac
kground color should initially be transparent"); |
190 | 189 |
191 t8.className = "t8"; | 190 t8.className = "t8"; |
192 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 11, "Sub
tree style recalc"); | 191 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 4, "Subt
ree style recalc"); |
193 assert_equals(getComputedStyle(r8).backgroundColor, "rgb(0, 128, 0)", "Backg
round color is green after class change"); | 192 assert_equals(getComputedStyle(r8).backgroundColor, "rgb(0, 128, 0)", "Backg
round color is green after class change"); |
194 }, "Compound sibling selector containing id"); | 193 }, "Compound sibling selector containing id"); |
195 | 194 |
196 test(function() { | 195 test(function() { |
197 assert_equals(getComputedStyle(r9).backgroundColor, "rgba(0, 0, 0, 0)", "Bac
kground color should initially be transparent"); | 196 assert_equals(getComputedStyle(r9).backgroundColor, "rgba(0, 0, 0, 0)", "Bac
kground color should initially be transparent"); |
198 | 197 |
199 t9.className = "t9"; | 198 t9.className = "t9"; |
200 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 9, "Subt
ree style recalc"); | 199 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 3, "Subt
ree style recalc"); |
201 assert_equals(getComputedStyle(r9).backgroundColor, "rgb(0, 128, 0)", "Backg
round color is green after class change"); | 200 assert_equals(getComputedStyle(r9).backgroundColor, "rgb(0, 128, 0)", "Backg
round color is green after class change"); |
202 }, "Compound sibling selector"); | 201 }, "Compound sibling selector"); |
203 | 202 |
204 test(function() { | 203 test(function() { |
205 assert_equals(getComputedStyle(r10a).backgroundColor, "rgba(0, 0, 0, 0)", "B
ackground color a should initially be transparent"); | 204 assert_equals(getComputedStyle(r10a).backgroundColor, "rgba(0, 0, 0, 0)", "B
ackground color a should initially be transparent"); |
206 assert_equals(getComputedStyle(r10b).backgroundColor, "rgba(0, 0, 0, 0)", "B
ackground color b should initially be transparent"); | 205 assert_equals(getComputedStyle(r10b).backgroundColor, "rgba(0, 0, 0, 0)", "B
ackground color b should initially be transparent"); |
207 | 206 |
208 t10.className = "t10"; | 207 t10.className = "t10"; |
209 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 9, "Subt
ree style recalc"); | 208 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 5, "Subt
ree style recalc"); |
210 assert_equals(getComputedStyle(r10a).backgroundColor, "rgb(0, 128, 0)", "Bac
kground color a is green after class change"); | 209 assert_equals(getComputedStyle(r10a).backgroundColor, "rgb(0, 128, 0)", "Bac
kground color a is green after class change"); |
211 assert_equals(getComputedStyle(r10b).backgroundColor, "rgb(0, 128, 0)", "Bac
kground color b is green after class change"); | 210 assert_equals(getComputedStyle(r10b).backgroundColor, "rgb(0, 128, 0)", "Bac
kground color b is green after class change"); |
212 }, "Sibling with descendant :-webkit-any containing compound selector"); | 211 }, "Sibling with descendant :-webkit-any containing compound selector"); |
213 | 212 |
214 </script> | 213 </script> |
OLD | NEW |