JS Test Harness: Remove successfullyParsed from more tests
[WebKit-https.git] / LayoutTests / svg / dom / SVGLengthList-basics.xhtml
1 <html xmlns="http://www.w3.org/1999/xhtml">
2 <head>
3 <script>window.enablePixelTesting = true;</script>
4 <script src="../../fast/js/resources/js-test-pre.js"></script>
5 </head>
6 <body>
7 <svg id="svg" xmlns="http://www.w3.org/2000/svg" width="200" height="200">
8     <text id="text1" x="500 1000 1500" y="50">   ABC  </text>
9 </svg>
10
11 <p id="description"></p>
12 <div id="console"></div>
13 <script type="text/javascript">
14 <![CDATA[
15     description("This is a test of the simple SVGLengthList API parts.");
16
17     var text1 = document.getElementById("text1");
18  
19     // Spec: The object referenced by animVal will always be distinct from the one referenced by baseVal, even when the attribute is not animated.
20     shouldBeTrue("text1.x.baseVal != text1.x.animVal");
21
22     shouldBe("text1.x.baseVal.numberOfItems", "3");
23     shouldBe("text1.x.animVal.numberOfItems", "3");
24     shouldBe("text1.x.baseVal.getItem(0).value", "500");
25     shouldBe("text1.x.baseVal.getItem(1).value", "1000");
26     shouldBe("text1.x.baseVal.getItem(2).value", "1500");
27
28     debug("");
29     debug("Test uncommon arguments for initialize()");
30     shouldThrow("text1.x.baseVal.initialize(30)");
31     shouldThrow("text1.x.baseVal.initialize('aString')");
32     shouldThrow("text1.x.baseVal.initialize(text1)");
33     shouldThrow("text1.x.baseVal.initialize(null)");
34
35     debug("");
36     debug("Test uncommon arguments for getItem()");
37     shouldThrow("text1.x.baseVal.getItem(30)");
38     shouldBe("text1.x.baseVal.getItem('aString')", "text1.x.baseVal.getItem(0)");
39     shouldBe("text1.x.baseVal.getItem(text1)", "text1.x.baseVal.getItem(0)");
40     shouldBe("text1.x.baseVal.getItem(null)", "text1.x.baseVal.getItem(0)");
41
42     debug("");
43     debug("Test uncommon arguments for insertItemBefore()");
44     shouldThrow("text1.x.baseVal.insertItemBefore(30)");
45     shouldThrow("text1.x.baseVal.insertItemBefore('aString')");
46     shouldThrow("text1.x.baseVal.insertItemBefore(text1)");
47     shouldThrow("text1.x.baseVal.insertItemBefore(null)");
48
49     shouldBe("text1.x.baseVal.insertItemBefore(text1.x.baseVal.getItem(1), 'aString')", "text1.x.baseVal.getItem(0)");
50     shouldBe("text1.x.baseVal.numberOfItems", "3");
51     shouldBe("text1.x.baseVal.getItem(0).value", "1000");
52     shouldBe("text1.x.baseVal.getItem(1).value", "500");
53     shouldBe("text1.x.baseVal.getItem(2).value", "1500");
54     shouldBeEqualToString("text1.getAttribute('x')", "1000 500 1500");
55
56     shouldBe("text1.x.baseVal.insertItemBefore(text1.x.baseVal.getItem(1), text1)", "text1.x.baseVal.getItem(0)");
57     shouldBe("text1.x.baseVal.numberOfItems", "3");
58     shouldBe("text1.x.baseVal.getItem(0).value", "500");
59     shouldBe("text1.x.baseVal.getItem(1).value", "1000");
60     shouldBe("text1.x.baseVal.getItem(2).value", "1500");
61     shouldBeEqualToString("text1.getAttribute('x')", "500 1000 1500");
62
63     shouldBe("text1.x.baseVal.insertItemBefore(text1.x.baseVal.getItem(1), null)", "text1.x.baseVal.getItem(0)");
64     shouldBe("text1.x.baseVal.numberOfItems", "3");
65     shouldBe("text1.x.baseVal.getItem(0).value", "1000");
66     shouldBe("text1.x.baseVal.getItem(1).value", "500");
67     shouldBe("text1.x.baseVal.getItem(2).value", "1500");
68     shouldBeEqualToString("text1.getAttribute('x')", "1000 500 1500");
69
70     shouldBe("text1.x.baseVal.insertItemBefore(text1.x.baseVal.getItem(1), 0)", "text1.x.baseVal.getItem(0)");
71     shouldBe("text1.x.baseVal.numberOfItems", "3");
72     shouldBe("text1.x.baseVal.getItem(0).value", "500");
73     shouldBe("text1.x.baseVal.getItem(1).value", "1000");
74     shouldBe("text1.x.baseVal.getItem(2).value", "1500");
75     shouldBeEqualToString("text1.getAttribute('x')", "500 1000 1500");
76
77     shouldThrow("text1.x.baseVal.insertItemBefore(30, 0)");
78     shouldThrow("text1.x.baseVal.insertItemBefore('aString', 0)");
79     shouldThrow("text1.x.baseVal.insertItemBefore(text1, 0)");
80     shouldThrow("text1.x.baseVal.insertItemBefore(null, 0)");
81
82     debug("");
83     debug("Set x='1 2 3 4' for text1");
84     shouldBeUndefined("text1.setAttribute('x', '1 2 3 4')");
85     shouldBe("text1.x.baseVal.numberOfItems", "4");
86     shouldBe("text1.x.baseVal.getItem(0).value", "1");
87     shouldBe("text1.x.baseVal.getItem(1).value", "2");
88     shouldBe("text1.x.baseVal.getItem(2).value", "3");
89     shouldBe("text1.x.baseVal.getItem(3).value", "4");
90     shouldBeEqualToString("text1.getAttribute('x')", "1 2 3 4");
91
92     debug("");
93     debug("Test uncommon arguments for replaceItem()");
94     shouldThrow("text1.x.baseVal.replaceItem(30)");
95     shouldThrow("text1.x.baseVal.replaceItem('aString')");
96     shouldThrow("text1.x.baseVal.replaceItem(text1)");
97     shouldThrow("text1.x.baseVal.replaceItem(null)");
98     shouldThrow("text1.x.baseVal.replaceItem(30, 0)");
99     shouldThrow("text1.x.baseVal.replaceItem('aString', 0)");
100     shouldThrow("text1.x.baseVal.replaceItem(text1, 0)");
101     shouldThrow("text1.x.baseVal.replaceItem(null, 0)");
102
103     shouldBe("text1.x.baseVal.replaceItem(text1.x.baseVal.getItem(0), 0)", "text1.x.baseVal.getItem(0)");
104     shouldBe("text1.x.baseVal.numberOfItems", "3");
105     shouldBe("text1.x.baseVal.getItem(0).value", "1");
106     shouldBe("text1.x.baseVal.getItem(1).value", "3");
107     shouldBe("text1.x.baseVal.getItem(2).value", "4");
108     shouldBeEqualToString("text1.getAttribute('x')", "1 3 4");
109
110     shouldBe("text1.x.baseVal.replaceItem(text1.x.baseVal.getItem(0), 'aString')", "text1.x.baseVal.getItem(0)");
111     shouldBe("text1.x.baseVal.numberOfItems", "2");
112     shouldBe("text1.x.baseVal.getItem(0).value", "1");
113     shouldBe("text1.x.baseVal.getItem(1).value", "4");
114     shouldBeEqualToString("text1.getAttribute('x')", "1 4");
115
116     shouldBe("text1.x.baseVal.replaceItem(text1.x.baseVal.getItem(0), text1)", "text1.x.baseVal.getItem(0)");
117     shouldBe("text1.x.baseVal.numberOfItems", "1");
118     shouldBeEqualToString("text1.getAttribute('x')", "1");
119
120     shouldThrow("text1.x.baseVal.replaceItem(text1.x.baseVal.getItem(0), null)");
121     shouldBe("text1.x.baseVal.numberOfItems", "0");
122     shouldBeEqualToString("text1.getAttribute('x')", "");
123
124     debug("");
125     debug("Set x='1 2 3 4' for text1");
126     shouldBeUndefined("text1.setAttribute('x', '1 2 3 4')");
127
128     debug("");
129     debug("Test uncommon arguments for removeItem()");
130     shouldThrow("text1.x.baseVal.removeItem(30)");
131
132     shouldBe("text1.x.baseVal.removeItem(0).value", "1");
133     shouldBe("text1.x.baseVal.numberOfItems", "3");
134     shouldBe("text1.x.baseVal.getItem(0).value", "2");
135     shouldBe("text1.x.baseVal.getItem(1).value", "3");
136     shouldBe("text1.x.baseVal.getItem(2).value", "4");
137     shouldBeEqualToString("text1.getAttribute('x')", "2 3 4");
138
139     shouldBe("text1.x.baseVal.removeItem(text1).value", "2");
140     shouldBe("text1.x.baseVal.numberOfItems", "2");
141     shouldBe("text1.x.baseVal.getItem(0).value", "3");
142     shouldBe("text1.x.baseVal.getItem(1).value", "4");
143     shouldBeEqualToString("text1.getAttribute('x')", "3 4");
144
145     debug("");
146     debug("Test uncommon arguments for appendItem()");
147     shouldThrow("text1.x.baseVal.appendItem(30)");
148     shouldThrow("text1.x.baseVal.appendItem('aString')");
149     shouldThrow("text1.x.baseVal.appendItem(text1)");
150     shouldThrow("text1.x.baseVal.appendItem(null)");
151
152     debug("");
153     debug("Testing animVal clear throws");
154     shouldThrow("text1.x.animVal.clear()");
155     shouldBeUndefined("text1.x.baseVal.clear()");
156  
157 ]]>
158 </script>
159 <script src="../../fast/js/resources/js-test-post.js"></script>
160 </body>
161 </html>