OLD | NEW |
1 description("Test the parsing of the -webkit-image-set function."); | 1 description("Test the parsing of the -webkit-image-set function."); |
2 | 2 |
3 // These have to be global for the test helpers to see them. | 3 // These have to be global for the test helpers to see them. |
4 var cssRule; | 4 var cssRule; |
5 | 5 |
6 function testInvalidImageSet(description, property, rule) | 6 function testInvalidImageSet(description, rule) |
7 { | 7 { |
8 debug(""); | 8 debug(""); |
9 debug(description + " : " + rule); | 9 debug(description + " : " + rule); |
10 | 10 |
11 var div = document.createElement("div"); | 11 var div = document.createElement("div"); |
12 div.setAttribute("style", property + ": -webkit-image-set(" + rule + ")"); | 12 div.style.backgroundImage = "-webkit-image-set(" + rule + ")"; |
13 document.body.appendChild(div); | 13 document.body.appendChild(div); |
14 | 14 |
15 cssRule = div.style.getPropertyCSSValue(property); | 15 cssRule = div.style.backgroundImage; |
16 shouldBe("cssRule", "null"); | 16 shouldBeEmptyString("cssRule"); |
17 | 17 |
18 document.body.removeChild(div); | 18 document.body.removeChild(div); |
19 } | 19 } |
20 | 20 |
21 testInvalidImageSet("Too many url parameters", "background-image", "url(#a #b)")
; | 21 testInvalidImageSet("Too many url parameters", "url(#a #b)"); |
22 testInvalidImageSet("No x", "background-image", "url('#a') 1"); | 22 testInvalidImageSet("No x", "url('#a') 1"); |
23 testInvalidImageSet("No comma", "background-image", "url('#a') 1x url('#b') 2x")
; | 23 testInvalidImageSet("No comma", "url('#a') 1x url('#b') 2x"); |
24 testInvalidImageSet("Too many scale factor parameters", "background-image", "url
('#a') 1x 2x"); | 24 testInvalidImageSet("Too many scale factor parameters", "url('#a') 1x 2x"); |
25 testInvalidImageSet("Scale factor is 0", "background-image", "url('#a') 0x"); | 25 testInvalidImageSet("Scale factor is 0", "url('#a') 0x"); |
26 testInvalidImageSet("No url function", "background-image", "'#a' 1x"); | 26 testInvalidImageSet("No url function", "'#a' 1x"); |
27 | 27 |
28 successfullyParsed = true; | 28 successfullyParsed = true; |
OLD | NEW |