OLD | NEW |
1 description("This tests checks that all of the input values for background-size
parse correctly."); | 1 description("This tests checks that all of the input values for background-size
parse correctly."); |
2 | 2 |
3 function test(value) | 3 function test(value) |
4 { | 4 { |
5 var div = document.createElement("div"); | 5 var div = document.createElement("div"); |
6 div.setAttribute("style", value); | 6 div.setAttribute("style", value); |
7 document.body.appendChild(div); | 7 document.body.appendChild(div); |
8 | 8 |
9 var result = div.style.getPropertyValue(value.substring(0, value.indexOf(":"
))); | 9 var result = div.style.getPropertyValue(value.substring(0, value.indexOf(":"
))); |
10 document.body.removeChild(div); | 10 document.body.removeChild(div); |
11 return result; | 11 return result; |
12 } | 12 } |
13 | 13 |
14 shouldBe('test("background-size: contain;")', '"contain"'); | 14 shouldBe('test("background-size: contain;")', '"contain"'); |
15 shouldBe('test("background-size: cover;")', '"cover"'); | 15 shouldBe('test("background-size: cover;")', '"cover"'); |
16 shouldBe('test("background-size: 100 100;")', '"100px"'); | 16 shouldBe('test("background-size: 100 100;")', '"100px 100px"'); |
17 shouldBe('test("background-size: 100px 100px;")', '"100px"'); | 17 shouldBe('test("background-size: 100px 100px;")', '"100px 100px"'); |
18 shouldBe('test("background-size: auto 50px;")', '"auto 50px"'); | 18 shouldBe('test("background-size: auto 50px;")', '"auto 50px"'); |
19 shouldBe('test("background-size: 50px auto;")', '"50px"'); | 19 shouldBe('test("background-size: 50px auto;")', '"50px"'); |
20 shouldBe('test("background-size: auto auto;")', '"auto"'); | 20 shouldBe('test("background-size: auto auto;")', '"auto"'); |
21 shouldBe('test("background-size: 30% 20%;")', '"30% 20%"'); | 21 shouldBe('test("background-size: 30% 20%;")', '"30% 20%"'); |
22 shouldBe('test("background-size: 4em auto;")', '"4em"'); | 22 shouldBe('test("background-size: 4em auto;")', '"4em"'); |
23 shouldBe('test("background-size: 5em;")', '"5em"'); | 23 shouldBe('test("background-size: 5em;")', '"5em"'); |
24 shouldBe('test("-webkit-background-size: 5em ;")', '"5em"'); | 24 shouldBe('test("-webkit-background-size: 5em ;")', '"5em"'); |
25 | 25 |
26 shouldBe('test("background-size: 100 100 100;")', 'null'); | 26 shouldBe('test("background-size: 100 100 100;")', 'null'); |
27 shouldBe('test("background-size: coconut;")', 'null'); | 27 shouldBe('test("background-size: coconut;")', 'null'); |
28 | 28 |
29 shouldBe('test("background-size: 100px,;")', 'null'); | 29 shouldBe('test("background-size: 100px,;")', 'null'); |
30 shouldBe('test("background-size: 100px, 50%;")', '"100px, 50%"'); | 30 shouldBe('test("background-size: 100px, 50%;")', '"100px, 50%"'); |
31 shouldBe('test("-webkit-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%"'); | 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% 10
0px, 2em, 100px 50%"'); | 33 shouldBe('test("-webkit-background-size: 50% 100px, 2em, 100px 50%;")', '"50% 10
0px, 2em, 100px 50%"'); |
OLD | NEW |