OLD | NEW |
| (Empty) |
1 description("This test checks the SVGAnimatedEnumeration API - utilizing the cli
pPathUnits property of SVGClipPathElement"); | |
2 | |
3 var clipPathElement = document.createElementNS("http://www.w3.org/2000/svg", "cl
ipPath"); | |
4 | |
5 debug(""); | |
6 debug("Check initial clipPathUnits value"); | |
7 shouldBeEqualToString("clipPathElement.clipPathUnits.toString()", "[object SVGAn
imatedEnumeration]"); | |
8 shouldBeEqualToString("typeof(clipPathElement.clipPathUnits.baseVal)", "number")
; | |
9 shouldBe("clipPathElement.clipPathUnits.baseVal", "SVGUnitTypes.SVG_UNIT_TYPE_US
ERSPACEONUSE"); | |
10 | |
11 debug(""); | |
12 debug("Check that enumerations are static, caching value in a local variable and
modifying it, should have no effect"); | |
13 var enumRef = clipPathElement.clipPathUnits.baseVal; | |
14 enumRef = SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX; | |
15 shouldBe("enumRef", "SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX"); | |
16 shouldBe("clipPathElement.clipPathUnits.baseVal", "SVGUnitTypes.SVG_UNIT_TYPE_US
ERSPACEONUSE"); | |
17 | |
18 debug(""); | |
19 debug("Check assigning various valid and invalid values"); | |
20 shouldThrow("clipPathElement.clipPathUnits.baseVal = 3"); | |
21 shouldBe("clipPathElement.clipPathUnits.baseVal", "SVGUnitTypes.SVG_UNIT_TYPE_US
ERSPACEONUSE"); | |
22 shouldThrow("clipPathElement.clipPathUnits.baseVal = -1"); | |
23 shouldBe("clipPathElement.clipPathUnits.baseVal", "SVGUnitTypes.SVG_UNIT_TYPE_US
ERSPACEONUSE"); | |
24 | |
25 // ECMA-262, 9.7, "ToUint16" | |
26 shouldBeEqualToString("clipPathElement.clipPathUnits.baseVal = '1'", SVGUnitType
s.SVG_UNIT_TYPE_USERSPACEONUSE.toString()); | |
27 shouldBe("clipPathElement.clipPathUnits.baseVal", "SVGUnitTypes.SVG_UNIT_TYPE_US
ERSPACEONUSE"); | |
28 | |
29 // ECMA-262, 9.7, "ToUint16" | |
30 shouldThrow("clipPathElement.clipPathUnits.baseVal = 'aString'"); | |
31 shouldBe("clipPathElement.clipPathUnits.baseVal", "SVGUnitTypes.SVG_UNIT_TYPE_US
ERSPACEONUSE"); | |
32 | |
33 shouldBe("clipPathElement.clipPathUnits.baseVal = 2", "SVGUnitTypes.SVG_UNIT_TYP
E_OBJECTBOUNDINGBOX"); | |
34 shouldThrow("clipPathElement.clipPathUnits.baseVal = clipPathElement"); | |
35 shouldBe("clipPathElement.clipPathUnits.baseVal", "SVGUnitTypes.SVG_UNIT_TYPE_OB
JECTBOUNDINGBOX"); | |
36 | |
37 successfullyParsed = true; | |
OLD | NEW |