OLD | NEW |
1 description("Test the parsing of box-shadow."); | 1 description("Test the parsing of box-shadow."); |
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 stylesheet, cssRule, declaration; | 4 var stylesheet, cssRule, declaration; |
5 var styleElement = document.createElement("style"); | 5 var styleElement = document.createElement("style"); |
6 document.head.appendChild(styleElement); | 6 document.head.appendChild(styleElement); |
7 stylesheet = styleElement.sheet; | 7 stylesheet = styleElement.sheet; |
8 | 8 |
9 function testInvalidFilterRule(description, rule) | 9 function testInvalidFilterRule(description, rule) |
10 { | 10 { |
11 debug(""); | 11 debug(""); |
12 debug(description + " : " + rule); | 12 debug(description + " : " + rule); |
13 | 13 |
14 stylesheet.insertRule("body { box-shadow: " + rule + "; }", 0); | 14 stylesheet.insertRule("body { box-shadow: " + rule + "; }", 0); |
15 cssRule = stylesheet.cssRules.item(0); | 15 cssRule = stylesheet.cssRules.item(0); |
16 | 16 |
17 shouldBe("cssRule.type", "1"); | 17 shouldBe("cssRule.type", "1"); |
18 | 18 |
19 declaration = cssRule.style; | 19 declaration = cssRule.style; |
20 shouldBe("declaration.length", "0"); | 20 shouldBe("declaration.length", "0"); |
21 shouldBeEqualToString("declaration.getPropertyValue('box-shadow')", ""); | 21 shouldBeEqualToString("declaration.getPropertyValue('box-shadow')", ""); |
22 } | 22 } |
23 | 23 |
24 // FIXME A whole bunch of negative parsing tests are missing, see bug | 24 // FIXME A whole bunch of negative parsing tests are missing, see bug |
25 // http://webkit.org/b/111498 | 25 // http://webkit.org/b/111498 |
26 testInvalidFilterRule("Negative blur radius value", "10px 10px -1px rgb(255, 0,
0)"); | 26 testInvalidFilterRule("Negative blur radius value", "10px 10px -1px rgb(255, 0,
0)"); |
27 testInvalidFilterRule("Negative blur radius value, with a spread defined", "10px
10px -1px 10px rgb(255, 0, 0)"); | 27 testInvalidFilterRule("Negative blur radius value, with a spread defined", "10px
10px -1px 10px rgb(255, 0, 0)"); |
28 testInvalidFilterRule("Negative blur radius value, with a negative spread define
d", "10px 10px -1px -1px rgb(255, 0, 0)"); | 28 testInvalidFilterRule("Negative blur radius value, with a negative spread define
d", "10px 10px -1px -1px rgb(255, 0, 0)"); |
| 29 testInvalidFilterRule("Extraneous commas at beginning", ",,,,,10px 10px rgb(255,
0, 0)"); |
| 30 testInvalidFilterRule("Extraneous commas at end", "10px 10px rgb(255, 0, 0),,,,,
"); |
29 | 31 |
30 successfullyParsed = true; | 32 successfullyParsed = true; |
OLD | NEW |