<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script>
// Test serializing background-repeat values on CSSOM objects
function serialize(css) {
document.documentElement.style.cssText = css;
return document.documentElement.style.backgroundRepeat;
}
test(function() {
assert_equals(serialize('background-repeat: initial;'), 'initial');
assert_equals(serialize('background-repeat: inherit;'), 'inherit');
}, 'initial and inherit should serialize properly');
test(function() {
assert_equals(serialize('background-repeat: no-repeat;'), 'no-repeat');
assert_equals(serialize('background-repeat: repeat;'), 'repeat');
assert_equals(serialize('background-repeat: repeat-x;'), 'repeat-x');
assert_equals(serialize('background-repeat: repeat-y;'), 'repeat-y');
assert_equals(serialize('background-repeat: repeat no-repeat;'), 'repeat-x');
assert_equals(serialize('background-repeat: no-repeat repeat;'), 'repeat-y');
}, 'Single values should serialize properly');
test(function() {
assert_equals(serialize('background-repeat: repeat, no-repeat;'), 'repeat, no-repeat');
assert_equals(serialize('background-repeat: repeat-x, repeat-y;'), 'repeat-x, repeat-y');
assert_equals(serialize('background-repeat: repeat, no-repeat, repeat no-repeat, no-repeat repeat, repeat-x, repeat-y;'),
'repeat, no-repeat, repeat-x, repeat-y, repeat-x, repeat-y');
}, 'Multiple values should serialize properly');
test(function() {
assert_equals(serialize('background: url(#1), url(#2), url(#3);'), 'initial, initial, initial');
assert_equals(serialize('background: repeat-x, repeat-y, url(#);'), 'repeat-x, repeat-y, initial');
assert_equals(serialize('background: url(#), no-repeat;'), 'initial, no-repeat');
assert_equals(serialize('background: url(#), no-repeat;'), 'initial, no-repeat');
}, 'Initial values introduced by the background shorthand should be handled as repeat but serialize as initial.');
</script>