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

Side by Side Diff: third_party/WebKit/LayoutTests/imported/wpt/quirks-mode/hashless-hex-color.html

Issue 1974833002: Import quirks-mode tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add separate Release and Debug entries 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 <html>
3 <head>
4 <title>The hashless hex color quirk</title>
5 <meta name="timeout" content="long">
6 <script src="../../../resources/testharness.js"></script>
7 <script src="../../../resources/testharnessreport.js"></script>
8 <style> iframe { width:20px; height:20px; } </style>
9 </head>
10 <body>
11 <div id=log></div>
12 <iframe id=quirks></iframe>
13 <iframe id=almost></iframe>
14 <iframe id=standards></iframe>
15 <script>
16 setup({explicit_done:true});
17 onload = function() {
18 var html = "<style id=style></style><div id=test></div><div id=ref></div ><svg><circle id=svg /><circle id=svg_ref /></svg>";
19 var a_doctype = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transition al//EN" "http://www.w3.org/TR/html4/loose.dtd">';
20 var s_doctype = '<!DOCTYPE HTML>';
21 var q = document.getElementById('quirks').contentWindow;
22 var a = document.getElementById('almost').contentWindow;
23 var s = document.getElementById('standards').contentWindow;
24 q.document.open();
25 q.document.write(html);
26 q.document.close();
27 a.document.open();
28 a.document.write(a_doctype + html);
29 a.document.close();
30 s.document.open();
31 s.document.write(s_doctype + html);
32 s.document.close();
33 [q, a, s].forEach(function(win) {
34 ['style', 'test', 'ref', 'svg', 'svg_ref'].forEach(function(id) {
35 win[id] = win.document.getElementById(id);
36 });
37 });
38
39 var tests = [
40 {input:"123", q:"#000123"},
41 {input:"023", q:"#000023"},
42 {input:"003", q:"#000003"},
43 {input:"000", q:"#000"},
44 {input:"abc", q:"#abc"},
45 {input:"ABC", q:"#abc"},
46 {input:"1ab", q:"#0001ab"},
47 {input:"1AB", q:"#0001ab"},
48 {input:"112233", q:"#123"},
49 {input:"012233", q:"#012233"},
50 {input:"002233", q:"#023"},
51 {input:"000233", q:"#000233"},
52 {input:"000033", q:"#003"},
53 {input:"000003", q:"#000003"},
54 {input:"000000", q:"#000000"},
55 {input:"aabbcc", q:"#abc"},
56 {input:"AABBCC", q:"#abc"},
57 {input:"11aabb", q:"#1ab"},
58 {input:"11AABB", q:"#1ab"},
59 {input:"\\31 23", q:"#123"},
60 {input:"\\61 bc", q:"#abc"},
61 {input:"\\41 BC", q:"#abc"},
62 {input:"\\31 ab", q:"#1ab"},
63 {input:"\\31 AB", q:"#1ab"},
64 {input:"\\31 12233", q:"#123"},
65 {input:"\\61 abbcc", q:"#abc"},
66 {input:"\\41 ABBCC", q:"#abc"},
67 {input:"\\31 1aabb", q:"#1ab"},
68 {input:"\\31 1AABB", q:"#1ab"},
69 {input:"12\\33 ", q:"#000123"},
70 {input:"1", q:"#000001"},
71 {input:"12", q:"#000012"},
72 {input:"1234", q:"#001234"},
73 {input:"12345", q:"#012345"},
74 {input:"1234567"},
75 {input:"12345678"},
76 {input:"a"},
77 {input:"aa"},
78 {input:"aaaa"},
79 {input:"aaaaa"},
80 {input:"aaaaaaa"},
81 {input:"aaaaaaaa"},
82 {input:"A"},
83 {input:"AA"},
84 {input:"AAAA"},
85 {input:"AAAAA"},
86 {input:"AAAAAAA"},
87 {input:"AAAAAAAA"},
88 {input:"1a", q:"#00001a"},
89 {input:"1abc", q:"#001abc"},
90 {input:"1abcd", q:"#01abcd"},
91 {input:"1abcdef"},
92 {input:"1abcdeff"},
93 {input:"+1", q:"#000001"},
94 {input:"+12", q:"#000012"},
95 {input:"+123", q:"#000123"},
96 {input:"+1234", q:"#001234"},
97 {input:"+12345", q:"#012345"},
98 {input:"+123456", q:"#123456"},
99 {input:"+1234567"},
100 {input:"+12345678"},
101 {input:"-1"},
102 {input:"-12"},
103 {input:"-123"},
104 {input:"-1234"},
105 {input:"-12345"},
106 {input:"-123456"},
107 {input:"-1234567"},
108 {input:"-12345678"},
109 {input:"+1a", q:"#00001a"},
110 {input:"+12a", q:"#00012a"},
111 {input:"+123a", q:"#00123a"},
112 {input:"+1234a", q:"#01234a"},
113 {input:"+12345a", q:"#12345a"},
114 {input:"+123456a"},
115 {input:"+1234567a"},
116 {input:"-1a"},
117 {input:"-12a"},
118 {input:"-123a"},
119 {input:"-1234a"},
120 {input:"-12345a"},
121 {input:"-123456a"},
122 {input:"-1234567a"},
123 {input:"-12345678a"},
124 {input:"+1A", q:"#00001a"},
125 {input:"+12A", q:"#00012a"},
126 {input:"+123A", q:"#00123a"},
127 {input:"+1234A", q:"#01234a"},
128 {input:"+12345A", q:"#12345a"},
129 {input:"+123456A"},
130 {input:"+1234567A"},
131 {input:"-1A"},
132 {input:"-12A"},
133 {input:"-123A"},
134 {input:"-1234A"},
135 {input:"-12345A"},
136 {input:"-123456A"},
137 {input:"-1234567A"},
138 {input:"-12345678A"},
139 {input:"+a"},
140 {input:"+aa"},
141 {input:"+aaa"},
142 {input:"+aaaa"},
143 {input:"+aaaaa"},
144 {input:"+aaaaaa"},
145 {input:"+aaaaaaa"},
146 {input:"+aaaaaaaa"},
147 {input:"-a"},
148 {input:"-aa"},
149 {input:"-aaa"},
150 {input:"-aaaa"},
151 {input:"-aaaaa"},
152 {input:"-aaaaaa"},
153 {input:"-aaaaaaa"},
154 {input:"-aaaaaaaa"},
155 {input:"-aaaaaaaaa"},
156 {input:"+A"},
157 {input:"+AA"},
158 {input:"+AAA"},
159 {input:"+AAAA"},
160 {input:"+AAAAA"},
161 {input:"+AAAAAA"},
162 {input:"+AAAAAAA"},
163 {input:"+AAAAAAAA"},
164 {input:"-A"},
165 {input:"-AA"},
166 {input:"-AAA"},
167 {input:"-AAAA"},
168 {input:"-AAAAA"},
169 {input:"-AAAAAA"},
170 {input:"-AAAAAAA"},
171 {input:"-AAAAAAAA"},
172 {input:"-AAAAAAAAA"},
173 {input:"1.1"},
174 {input:"1.11"},
175 {input:"1.111"},
176 {input:"1.1111"},
177 {input:"1.11111"},
178 {input:"1.111111"},
179 {input:"1.1111111"},
180 {input:"+1.1"},
181 {input:"+1.11"},
182 {input:"+1.111"},
183 {input:"+1.1111"},
184 {input:"+1.11111"},
185 {input:"+1.111111"},
186 {input:"+1.1111111"},
187 {input:"-1.1"},
188 {input:"-1.11"},
189 {input:"-1.111"},
190 {input:"-1.1111"},
191 {input:"-1.11111"},
192 {input:"-1.111111"},
193 {input:"-1.1111111"},
194 {input:"1.1a"},
195 {input:"1.11a"},
196 {input:"1.111a"},
197 {input:"1.1111a"},
198 {input:"1.11111a"},
199 {input:"1.111111a"},
200 {input:"+1.1a"},
201 {input:"+1.11a"},
202 {input:"+1.111a"},
203 {input:"+1.1111a"},
204 {input:"+1.11111a"},
205 {input:"+1.111111a"},
206 {input:"-1.1a"},
207 {input:"-1.11a"},
208 {input:"-1.111a"},
209 {input:"-1.1111a"},
210 {input:"-1.11111a"},
211 {input:"-1.111111a"},
212 {input:"1.0"},
213 {input:"11.0"},
214 {input:"111.0"},
215 {input:"1111.0"},
216 {input:"11111.0"},
217 {input:"111111.0"},
218 {input:"1111111.0"},
219 {input:"11111111.0"},
220 {input:"+1.0"},
221 {input:"+11.0"},
222 {input:"+111.0"},
223 {input:"+1111.0"},
224 {input:"+11111.0"},
225 {input:"+111111.0"},
226 {input:"+1111111.0"},
227 {input:"+11111111.0"},
228 {input:"-1.0"},
229 {input:"-11.0"},
230 {input:"-111.0"},
231 {input:"-1111.0"},
232 {input:"-11111.0"},
233 {input:"-111111.0"},
234 {input:"-1111111.0"},
235 {input:"-11111111.0"},
236 {input:"1.0a"},
237 {input:"11.0a"},
238 {input:"111.0a"},
239 {input:"1111.0a"},
240 {input:"11111.0a"},
241 {input:"111111.0a"},
242 {input:"1111111.0a"},
243 {input:"+1.0a"},
244 {input:"+11.0a"},
245 {input:"+111.0a"},
246 {input:"+1111.0a"},
247 {input:"+11111.0a"},
248 {input:"+111111.0a"},
249 {input:"+1111111.0a"},
250 {input:"-1.0a"},
251 {input:"-11.0a"},
252 {input:"-111.0a"},
253 {input:"-1111.0a"},
254 {input:"-11111.0a"},
255 {input:"-111111.0a"},
256 {input:"-1111111.0a"},
257 {input:"+/**/123"},
258 {input:"-/**/123"},
259 {input:"+/**/123456"},
260 {input:"-/**/123456"},
261 {input:"+/**/abc"},
262 {input:"-/**/abc"},
263 {input:"+/**/abcdef"},
264 {input:"-/**/abcdef"},
265 {input:"+/**/12a"},
266 {input:"-/**/12a"},
267 {input:"+/**/12345a"},
268 {input:"-/**/12345a"},
269 {input:"abg"},
270 {input:"aabbcg"},
271 {input:"1ag"},
272 {input:"1122ag"},
273 {input:"ABG"},
274 {input:"AABBCG"},
275 {input:"1AG"},
276 {input:"1122AG"},
277 {input:"@a"},
278 {input:"@ab"},
279 {input:"@abc"},
280 {input:"@abcd"},
281 {input:"@abcde"},
282 {input:"@abcdef"},
283 {input:"@1"},
284 {input:"@11"},
285 {input:"@111"},
286 {input:"@1111"},
287 {input:"@11111"},
288 {input:"@111111"},
289 {input:"@1a"},
290 {input:"@11a"},
291 {input:"@111a"},
292 {input:"@1111a"},
293 {input:"@11111a"},
294 {input:'"a"'},
295 {input:'"ab"'},
296 {input:'"abc"'},
297 {input:'"abcd"'},
298 {input:'"abcde"'},
299 {input:'"abcdef"'},
300 {input:'"1"'},
301 {input:'"11"'},
302 {input:'"111"'},
303 {input:'"1111"'},
304 {input:'"11111"'},
305 {input:'"111111"'},
306 {input:'"1a"'},
307 {input:'"11a"'},
308 {input:'"111a"'},
309 {input:'"1111a"'},
310 {input:'"11111a"'},
311 {input:"url(a)", svg:'url(a)'},
312 {input:"url(aa)", svg:'url(aa)'},
313 {input:"url(aaa)", svg:'url(aaa)'},
314 {input:"url(aaaa)", svg:'url(aaaa)'},
315 {input:"url(aaaaa)", svg:'url(aaaaa)'},
316 {input:"url(aaaaaa)", svg:'url(aaaaaa)'},
317 {input:"url('a')", svg:'url(a)'},
318 {input:"url('aa')", svg:'url(aa)'},
319 {input:"url('aaa')", svg:'url(aaa)'},
320 {input:"url('aaaa')", svg:'url(aaaa)'},
321 {input:"url('aaaaa')", svg:'url(aaaaa)'},
322 {input:"url('aaaaaa')", svg:'url(aaaaaa)'},
323 {input:"#a"},
324 {input:"#aa"},
325 {input:"#aaaaa"},
326 {input:"#aaaaaaa"},
327 {input:"#1"},
328 {input:"#11"},
329 {input:"#11111"},
330 {input:"#1111111"},
331 {input:"#1a"},
332 {input:"#1111a"},
333 {input:"#111111a"},
334 {input:"1%"},
335 {input:"11%"},
336 {input:"111%"},
337 {input:"1111%"},
338 {input:"11111%"},
339 {input:"111111%"},
340 {input:"calc(123)"},
341 {input:"rgb(119, 255, 255)", q:"#7ff", s:"#7ff", svg:"#7ff"},
342 {input:"rgba(119, 255, 255, 001)", q:"#7ff", s:"#7ff", svg:"#7ff"},
343 {input:"hsl(100, 100%, 100%)", q:"#fff", s:"#fff", svg:"#fff"},
344 {input:"hsla(100, 100%, 100%, 001)", q:"#fff", s:"#fff", svg:"#fff"},
345 {input:"rgb(calc(100 + 155), 255, 255)", q:"#fff", s:"#fff", svg:"#fff"} ,
346 {input:"rgba(calc(100 + 155), 255, 255, 001)", q:"#fff", s:"#fff", svg:" #fff"},
347 {input:"hsl(calc(050 + 050), 100%, 100%)", q:"#fff", s:"#fff", svg:"#fff "},
348 {input:"hsla(calc(050 + 050), 100%, 100%, 001)", q:"#fff", s:"#fff", svg :"#fff"},
349 {input:"rgb(/**/255, 255, 255)", q:"#fff", s:"#fff", svg:"#fff"},
350 {input:"rgb(/**/255/**/, /**/255/**/, /**/255/**/)", q:"#fff", s:"#fff", svg:"#fff"},
351 {input:"rgb(calc(/**/100/**/ + /**/155/**/), 255, 255)", q:"#fff", s:"#f ff", svg:"#fff"},
352 {input:"#123 123 abc 12a", q:"#123 #000123 #abc #00012a", shorthand:true },
353 {input:"rgb(119, 255, 255) 123", q:"#7ff #000123", shorthand:true},
354 {input:"123 rgb(119, 255, 255)", q:"#000123 #7ff", shorthand:true},
355 {input:"1e1"},
356 {input:"11e1"},
357 {input:"111e1"},
358 {input:"1111e1"},
359 {input:"11111e1"},
360 {input:"111111e1"},
361 {input:"1e+1"},
362 {input:"11e+1"},
363 {input:"111e+1"},
364 {input:"1111e+1"},
365 {input:"11111e+1"},
366 {input:"111111e+1"},
367 {input:"1e-0"},
368 {input:"11e-0"},
369 {input:"111e-0"},
370 {input:"1111e-0"},
371 {input:"11111e-0"},
372 {input:"111111e-0"},
373 {input:"1e1a"},
374 {input:"11e1a"},
375 {input:"111e1a"},
376 {input:"1111e1a"},
377 {input:"11111e1a"},
378 {input:"111111e1a"},
379 {desc:"1111111111...", input:"111111111111111111111111111111111111111111 11111111111111111111111111111111111111111111111111111111111111111111111111111111 11111111111111111111111111111111111111111111111111111111111111111111111111111111 11111111111111111111111111111111111111111111111111111111111111111111111111111111 1111111111111111111111111111"},
380 {desc:"1111111111...a", input:"11111111111111111111111111111111111111111 11111111111111111111111111111111111111111111111111111111111111111111111111111111 11111111111111111111111111111111111111111111111111111111111111111111111111111111 11111111111111111111111111111111111111111111111111111111111111111111111111111111 11111111111111111111111111111a"},
381 {desc:"a1111111111...", input:"a1111111111111111111111111111111111111111 11111111111111111111111111111111111111111111111111111111111111111111111111111111 11111111111111111111111111111111111111111111111111111111111111111111111111111111 11111111111111111111111111111111111111111111111111111111111111111111111111111111 111111111111111111111111111111"},
382 ];
383
384 var props = [
385 {prop:'background-color', check:'background-color'},
386 {prop:'border-color', check:'border-top-color', check_also:['border-righ t-color', 'border-bottom-color', 'border-left-color']},
387 {prop:'border-top-color', check:'border-top-color'},
388 {prop:'border-right-color', check:'border-right-color'},
389 {prop:'border-bottom-color', check:'border-bottom-color'},
390 {prop:'border-left-color', check:'border-left-color'},
391 {prop:'color', check:'color'},
392 ];
393 var style_template = '#test{{prop}:{test};}' +
394 '#ref{{prop}:{ref};}';
395
396 tests.forEach(function(t) {
397 var name = t.desc || t.input;
398 var test_q = async_test(name + ' (quirks)');
399 var test_a = async_test(name + ' (almost standards)');
400 var test_s = async_test(name + ' (standards)');
401 var test_svg = async_test(name + ' (SVG)');
402 for (var i in props) {
403 if (t.shorthand && !(props[i].check_also)) {
404 continue;
405 }
406 test_q.step(function() {
407 q.style.textContent = style_template.replace('{test}', t.inp ut)
408 .replace('{ref}', t.q).replace(/\{prop\}/g, prop s[i].prop);
409 assert_equals(q.getComputedStyle(q.test).getPropertyValue(pr ops[i].check),
410 q.getComputedStyle(q.ref).getPropertyValue(pro ps[i].check),
411 props[i].prop);
412 if (t.shorthand && props[i].check_also) {
413 for (var j in props[i].check_also) {
414 assert_equals(q.getComputedStyle(q.test).getProperty Value(props[i].check_also[j]),
415 q.getComputedStyle(q.ref).getPropertyV alue(props[i].check_also[j]),
416 props[i].prop + ' checking ' + props[i ].check_also[j]);
417 }
418 }
419 });
420 test_a.step(function() {
421 a.style.textContent = style_template.replace('{test}', t.inp ut)
422 .replace('{ref}', t.s).replace(/\{prop\}/g, prop s[i].prop);
423 assert_equals(a.getComputedStyle(a.test).getPropertyValue(pr ops[i].check),
424 a.getComputedStyle(a.ref).getPropertyValue(pro ps[i].check),
425 props[i].prop);
426 if (t.shorthand && props[i].check_also) {
427 for (var j in props[i].check_also) {
428 assert_equals(a.getComputedStyle(q.test).getProperty Value(props[i].check_also[j]),
429 a.getComputedStyle(q.ref).getPropertyV alue(props[i].check_also[j]),
430 props[i].prop + ' checking ' + props[i ].check_also[j]);
431 }
432 }
433 });
434 test_s.step(function() {
435 s.style.textContent = style_template.replace('{test}', t.inp ut)
436 .replace('{ref}', t.s).replace(/\{prop\}/g, prop s[i].prop);
437 assert_equals(s.getComputedStyle(s.test).getPropertyValue(pr ops[i].check),
438 s.getComputedStyle(s.ref).getPropertyValue(pro ps[i].check),
439 props[i].prop);
440 if (t.shorthand && props[i].check_also) {
441 for (var j in props[i].check_also) {
442 assert_equals(s.getComputedStyle(q.test).getProperty Value(props[i].check_also[j]),
443 s.getComputedStyle(q.ref).getPropertyV alue(props[i].check_also[j]),
444 props[i].prop + ' checking ' + props[i ].check_also[j]);
445 }
446 }
447 });
448 test_svg.step(function() {
449 q.svg.setAttribute('fill', t.input);
450 a.svg.setAttribute('fill', t.input);
451 s.svg.setAttribute('fill', t.input);
452 if (t.svg) {
453 q.svg_ref.setAttribute('fill', t.svg);
454 a.svg_ref.setAttribute('fill', t.svg);
455 s.svg_ref.setAttribute('fill', t.svg);
456 } else {
457 q.svg_ref.removeAttribute('fill');
458 a.svg_ref.removeAttribute('fill');
459 s.svg_ref.removeAttribute('fill');
460 }
461 assert_equals(q.getComputedStyle(q.svg).fill, q.getComputedS tyle(q.svg_ref).fill, 'SVG fill="" in quirks mode');
462 assert_equals(a.getComputedStyle(a.svg).fill, a.getComputedS tyle(a.svg_ref).fill, 'SVG fill="" in almost standards mode');
463 assert_equals(s.getComputedStyle(s.svg).fill, s.getComputedS tyle(s.svg_ref).fill, 'SVG fill="" in standards mode');
464 });
465 }
466 test_q.done();
467 test_a.done();
468 test_s.done();
469 test_svg.done();
470 });
471
472 var other_tests = [
473 {input:'background:abc', prop:'background-color'},
474 {input:'border-top:1px solid abc', prop:'border-top-color'},
475 {input:'border-right:1px solid abc', prop:'border-right-color'},
476 {input:'border-bottom:1px solid abc', prop:'border-bottom-color'},
477 {input:'border-left:1px solid abc', prop:'border-left-color'},
478 {input:'border:1px solid abc', prop:'border-top-color'},
479 {input:'outline-color:abc', prop:'outline-color'},
480 {input:'outline:1px solid abc', prop:'outline-color'}
481 ];
482
483 var other_template = "#test{{test};}"
484
485 other_tests.forEach(function(t) {
486 test(function() {
487 q.style.textContent = other_template.replace('{test}', t.input);
488 assert_equals(q.getComputedStyle(q.test).getPropertyValue(t.prop ),
489 q.getComputedStyle(q.ref).getPropertyValue(t.prop) ,
490 'quirk was supported');
491 }, document.title+', excluded property '+t.input);
492 });
493
494 done();
495 }
496 </script>
497 </body>
498 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698