Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / fast / backgrounds / size / resources / parsing-background-size-values.js
1 description("This tests checks that all of the input values for background-size parse correctly.");
2
3 function test(value)
4 {
5     var div = document.createElement("div");
6     div.setAttribute("style", value);
7     document.body.appendChild(div);
8     
9     var result = div.style.getPropertyValue(value.substring(0, value.indexOf(":")));
10     document.body.removeChild(div);
11     return result;
12 }
13
14 shouldBe('test("background-size: contain;")', '"contain"');
15 shouldBe('test("background-size: cover;")', '"cover"');
16 shouldBe('test("background-size: 100 100;")', '"100px 100px"');
17 shouldBe('test("background-size: 100px 100px;")', '"100px 100px"');
18 shouldBe('test("background-size: auto 50px;")', '"auto 50px"');
19 shouldBe('test("background-size: 50px auto;")', '"50px"');
20 shouldBe('test("background-size: auto auto;")', '"auto"');
21 shouldBe('test("background-size: 30% 20%;")', '"30% 20%"');
22 shouldBe('test("background-size: 4em auto;")', '"4em"');
23 shouldBe('test("background-size: 5em;")', '"5em"');
24 shouldBe('test("-webkit-background-size: 5em ;")', '"5em"');
25
26 shouldBe('test("background-size: 100 100 100;")', 'null');
27 shouldBe('test("background-size: coconut;")', 'null');
28
29 shouldBe('test("background-size: 100px,;")', 'null');
30 shouldBe('test("background-size: 100px, 50%;")', '"100px, 50%"');
31 shouldBe('test("-webkit-background-size: 100px, 50%;")', '"100px, 50%"');
32 shouldBe('test("background-size: 50% 100px, 2em, 100px 50%;")', '"50% 100px, 2em, 100px 50%"');
33 shouldBe('test("-webkit-background-size: 50% 100px, 2em, 100px 50%;")', '"50% 100px, 2em, 100px 50%"');