OLD | NEW |
| (Empty) |
1 description("This tests that the methods on CSSPrimitiveValue throw exceptions "
); | |
2 | |
3 div = document.createElement('div'); | |
4 div.style.width = "10px"; | |
5 div.style.height = "90%"; | |
6 div.style.content = "counter(dummy, square)"; | |
7 div.style.clip = "rect(0, 0, 1, 1)"; | |
8 div.style.color = "rgb(0, 0, 0)"; | |
9 | |
10 // Test passing invalid unit to getFloatValue | |
11 shouldThrow("div.style.getPropertyCSSValue('width').getFloatValue(CSSPrimitiveVa
lue.CSS_UNKNOWN)"); | |
12 shouldThrow("div.style.getPropertyCSSValue('width').getFloatValue(CSSPrimitiveVa
lue.CSS_STRING)"); | |
13 | |
14 // Test invalid unit conversions in getFloatValue | |
15 shouldThrow("div.style.getPropertyCSSValue('width').getFloatValue(CSSPrimitiveVa
lue.CSS_HZ)"); | |
16 shouldThrow("div.style.getPropertyCSSValue('width').getFloatValue(CSSPrimitiveVa
lue.CSS_S)"); | |
17 shouldThrow("div.style.getPropertyCSSValue('width').getFloatValue(CSSPrimitiveVa
lue.CSS_RAD)"); | |
18 shouldThrow("div.style.getPropertyCSSValue('width').getFloatValue(CSSPrimitiveVa
lue.CSS_PERCENTAGE)"); | |
19 shouldThrow("div.style.getPropertyCSSValue('height').getFloatValue(CSSPrimitiveV
alue.CSS_PX)"); | |
20 shouldThrow("div.style.getPropertyCSSValue('height').getFloatValue(CSSPrimitiveV
alue.CSS_DEG)"); | |
21 | |
22 // Test calling get*Value for CSSPrimitiveValue of the wrong type | |
23 shouldBe("div.style.getPropertyCSSValue('clip').primitiveType", "CSSPrimitiveVal
ue.CSS_RECT"); | |
24 shouldThrow("div.style.getPropertyCSSValue('clip').getFloatValue(CSSPrimitiveVal
ue.CSS_PX)"); | |
25 shouldThrow("div.style.getPropertyCSSValue('clip').getStringValue()"); | |
26 shouldThrow("div.style.getPropertyCSSValue('clip').getCounterValue()"); | |
27 shouldThrow("div.style.getPropertyCSSValue('clip').getRGBColorValue()"); | |
28 | |
29 shouldBe("div.style.getPropertyCSSValue('color').primitiveType", "CSSPrimitiveVa
lue.CSS_RGBCOLOR"); | |
30 shouldThrow("div.style.getPropertyCSSValue('color').getFloatValue(CSSPrimitiveVa
lue.CSS_PX)"); | |
31 shouldThrow("div.style.getPropertyCSSValue('color').getStringValue()"); | |
32 shouldThrow("div.style.getPropertyCSSValue('color').getCounterValue()"); | |
33 shouldThrow("div.style.getPropertyCSSValue('color').getRectValue()"); | |
OLD | NEW |