<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../../resources/js-test-pre.js"></script>
</head>
<body>
<script>
description("This tests checks that all of the input values for background-repeat parse correctly.");

function test(value)
{
    var div = document.createElement("div");
    div.setAttribute("style", value);
    document.body.appendChild(div);
    
    var result = div.style.getPropertyValue("background-repeat");
    document.body.removeChild(div);
    return result;
}

function testPropertyCount(value)
{
    var div = document.createElement("div");
    div.setAttribute("style", value);
    document.body.appendChild(div);
    
    var result = div.style.length;
    document.body.removeChild(div);
    return result;
}

shouldBe('test("background-repeat: repeat-x;")', '"repeat-x"');
shouldBe('testPropertyCount("background-repeat: repeat-x;")', '1');

shouldBe('test("background-repeat: repeat-x, repeat-y;")', '"repeat-x, repeat-y"');
shouldBe('testPropertyCount("background-repeat: repeat-x;")', '1');

shouldBe('test("background-image: url(test1.gif); background-repeat: repeat-x;")', '"repeat-x"');
shouldBe('testPropertyCount("background-image: url(test1.gif); background-repeat: repeat-x;")', '2');

shouldBe('test("background-image: url(test1.gif), url(test1.gif); background-repeat: repeat-x;")', '"repeat-x"');

shouldBe('test("background-repeat: repeat-y;")', '"repeat-y"');
shouldBe('test("background-repeat: repeat;")', '"repeat"');
shouldBe('test("background-repeat: no-repeat;")', '"no-repeat"');
shouldBe('test("background-repeat: round;")', '"round"');
shouldBe('test("background-repeat: space;")', '"space"');

shouldBe('test("background-repeat: repeat repeat;")', '"repeat"');
shouldBe('test("background-repeat: no-repeat space;")', '"no-repeat space"');
shouldBe('test("background-repeat: round round;")', '"round"');
shouldBe('test("background-repeat: space repeat;")', '"space repeat"');

shouldBe('test("background: purple url(resources/gradient.gif) repeat-x top left")', '"repeat-x"');
shouldBe('test("background: purple url(resources/gradient.gif) repeat-y 50% 50%")', '"repeat-y"');
shouldBe('test("background: purple url(resources/gradient.gif) repeat center")', '"repeat"');
shouldBe('test("background: purple url(resources/gradient.gif) no-repeat 12px")', '"no-repeat"');
shouldBe('test("background: purple url(resources/gradient.gif) round left 50px")', '"round"');
shouldBe('test("background: purple url(resources/gradient.gif) space 25px 25px")', '"space"');

shouldBe('testPropertyCount("background: purple url(resources/gradient.gif) space 25px 25px;")', '9');

shouldBe('test("background-repeat: 45;")', '""');
shouldBe('test("background-repeat: coconut;")', '""');
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>
</html>
