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