Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / css / background-repeat-serialize.html
blobf8056204e15840240eaf7959b158a3061e40f025
1 <!DOCTYPE html>
2 <script src="../../resources/testharness.js"></script>
3 <script src="../../resources/testharnessreport.js"></script>
4 <script>
5 // Test serializing background-repeat values on CSSOM objects
7 function serialize(css) {
8 document.documentElement.style.cssText = css;
9 return document.documentElement.style.backgroundRepeat;
12 test(function() {
13 assert_equals(serialize('background-repeat: initial;'), 'initial');
14 assert_equals(serialize('background-repeat: inherit;'), 'inherit');
15 }, 'initial and inherit should serialize properly');
17 test(function() {
18 assert_equals(serialize('background-repeat: no-repeat;'), 'no-repeat');
19 assert_equals(serialize('background-repeat: repeat;'), 'repeat');
20 assert_equals(serialize('background-repeat: repeat-x;'), 'repeat-x');
21 assert_equals(serialize('background-repeat: repeat-y;'), 'repeat-y');
22 assert_equals(serialize('background-repeat: repeat no-repeat;'), 'repeat-x');
23 assert_equals(serialize('background-repeat: no-repeat repeat;'), 'repeat-y');
24 }, 'Single values should serialize properly');
26 test(function() {
27 assert_equals(serialize('background-repeat: repeat, no-repeat;'), 'repeat, no-repeat');
28 assert_equals(serialize('background-repeat: repeat-x, repeat-y;'), 'repeat-x, repeat-y');
29 assert_equals(serialize('background-repeat: repeat, no-repeat, repeat no-repeat, no-repeat repeat, repeat-x, repeat-y;'),
30 'repeat, no-repeat, repeat-x, repeat-y, repeat-x, repeat-y');
31 }, 'Multiple values should serialize properly');
33 test(function() {
34 // FIXME (crbug.com/376179): Make setting background-repeat-x/y to multiple values work on CSSStyleDeclarations.
35 // assert_equals(serialize('background-repeat-x: repeat, no-repeat; background-repeat-y: no-repeat, repeat, no-repeat'),
36 // 'repeat-x, repeat-y, repeat-x, no-repeat, repeat, no-repeat');
37 assert_equals(serialize('background-repeat: repeat, no-repeat, repeat; background-repeat-y: no-repeat;'), 'repeat-x, no-repeat, repeat-x');
38 }, 'Mismatched value lengths should repeat to their lowest common multiple');
40 test(function() {
41 assert_equals(serialize('background: url(#1), url(#2), url(#3);'), 'repeat, repeat, repeat');
42 assert_equals(serialize('background: repeat-x, repeat-y, url(#);'), 'repeat-x, repeat-y, repeat');
43 assert_equals(serialize('background: url(#), no-repeat; background-repeat-x: no-repeat'), 'repeat-y, no-repeat');
44 assert_equals(serialize('background: url(#), no-repeat; background-repeat-y: no-repeat'), 'repeat-x, no-repeat');
45 }, 'Initial values introduced by the background shorthand should be handled as repeat.');
46 </script>