OLD | NEW |
1 description("Tests whether immutable properties can not be modified."); | 1 description("Tests whether immutable properties can not be modified."); |
2 | 2 |
3 var svgDoc = document.implementation.createDocument("http://www.w3.org/2000/svg"
, "svg", null); | 3 var svgDoc = document.implementation.createDocument("http://www.w3.org/2000/svg"
, "svg", null); |
4 | 4 |
5 // 'viewport' attribute is immutable (Spec: The object itself and its contents a
re both readonly.) | 5 // 'viewport' attribute is immutable (Spec: The object itself and its contents a
re both readonly.) |
6 var viewport = svgDoc.documentElement.viewport; | 6 var viewport = svgDoc.documentElement.viewport; |
7 | 7 |
8 shouldBe("viewport.x", "0"); | 8 shouldBe("viewport.x", "0"); |
9 viewport.x = 100; | 9 viewport.x = 100; |
10 | 10 |
11 shouldBe("viewport.x", "100"); | 11 shouldBe("viewport.x", "100"); |
12 shouldBe("svgDoc.documentElement.viewport.x", "0"); | 12 shouldBe("svgDoc.documentElement.viewport.x", "0"); |
13 | 13 |
14 // Every attribute of SVGZoomEvent is immutable (Spec: The object itself and its
contents are both readonly.) | |
15 var zoomEvent = svgDoc.createEvent("SVGZoomEvents"); | |
16 | |
17 // 'zoomRectScreen' property | |
18 var zoomRectScreen = zoomEvent.zoomRectScreen; | |
19 | |
20 shouldBe("zoomRectScreen.x", "0"); | |
21 shouldThrow("zoomRectScreen.x = 100;"); | |
22 | |
23 // 'previousScale' property | |
24 shouldBe("zoomEvent.previousScale", "0") | |
25 zoomEvent.previousScale = 200; | |
26 shouldBe("zoomEvent.previousScale", "0") | |
27 | |
28 // 'previousTranslate' property | |
29 var previousTranslate = zoomEvent.previousTranslate; | |
30 | |
31 shouldBe("previousTranslate.x", "0"); | |
32 shouldThrow("previousTranslate.x = 300;"); | |
33 | |
34 shouldBe("zoomEvent.previousTranslate.x", "0"); | |
35 | |
36 // 'newScale' property | |
37 shouldBe("zoomEvent.newScale", "0"); | |
38 shouldThrow("zoomEvent.newScale = 200;"); | |
39 shouldBe("zoomEvent.newScale", "0"); | |
40 | |
41 // 'newTranslate' property | |
42 var newTranslate = zoomEvent.newTranslate; | |
43 | |
44 shouldBe("newTranslate.x", "0"); | |
45 shouldThrow("newTranslate.x = 300;"); | |
46 shouldBe("newTranslate.x", "0"); | |
47 | |
48 var successfullyParsed = true; | 14 var successfullyParsed = true; |
OLD | NEW |