JS Test Harness: Remove successfullyParsed from more tests
[WebKit-https.git] / LayoutTests / svg / dom / SVGStringList-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="50" y="50" requiredFeatures="1 2 3">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 SVGStringList API parts.");
16
17     var text1 = document.getElementById("text1");
18     shouldBe("text1.requiredFeatures.numberOfItems", "3");
19
20     debug("");
21     debug("Test uncommon arguments for initialize()");
22     shouldBeEqualToString("text1.requiredFeatures.initialize('30')", "30");
23     shouldBe("text1.requiredFeatures.numberOfItems", "1");
24     shouldBeEqualToString("text1.requiredFeatures.getItem(0)", "30");
25     shouldBeEqualToString("text1.getAttribute('requiredFeatures')", "30");
26
27     shouldBeEqualToString("text1.requiredFeatures.initialize(text1)", "[object SVGTextElement]");
28     shouldBe("text1.requiredFeatures.numberOfItems", "1");
29     shouldBeEqualToString("text1.requiredFeatures.getItem(0)", "[object SVGTextElement]");
30     shouldBeEqualToString("text1.getAttribute('requiredFeatures')", "[object SVGTextElement]");
31
32     shouldBeEqualToString("text1.requiredFeatures.initialize(0)", "0");
33     shouldBe("text1.requiredFeatures.numberOfItems", "1");
34     shouldBeEqualToString("text1.requiredFeatures.getItem(0)", "0");
35     shouldBeEqualToString("text1.getAttribute('requiredFeatures')", "0");
36
37     shouldBeEqualToString("text1.requiredFeatures.initialize('aString')", "aString");
38     shouldBe("text1.requiredFeatures.numberOfItems", "1");
39     shouldBeEqualToString("text1.requiredFeatures.getItem(0)", "aString");
40     shouldBeEqualToString("text1.getAttribute('requiredFeatures')", "aString");
41
42     debug("");
43     debug("Test uncommon arguments for getItem()");
44     shouldThrow("text1.requiredFeatures.getItem(30)");
45     shouldBe("text1.requiredFeatures.getItem('aString')", "text1.requiredFeatures.getItem(0)");
46     shouldBe("text1.requiredFeatures.getItem(text1)", "text1.requiredFeatures.getItem(0)");
47     shouldBe("text1.requiredFeatures.getItem(null)", "text1.requiredFeatures.getItem(0)");
48
49     debug("");
50     debug("Test uncommon arguments for insertItemBefore()");
51     shouldThrow("text1.requiredFeatures.insertItemBefore(30)");
52     shouldThrow("text1.requiredFeatures.insertItemBefore('aString')");
53     shouldThrow("text1.requiredFeatures.insertItemBefore(text1)");
54     shouldThrow("text1.requiredFeatures.insertItemBefore(null)");
55     shouldThrow("text1.requiredFeatures.insertItemBefore(text1.requiredFeatures.getItem(1), 'aString')");
56     shouldThrow("text1.requiredFeatures.insertItemBefore(text1.requiredFeatures.getItem(1), text1)");
57     shouldThrow("text1.requiredFeatures.insertItemBefore(text1.requiredFeatures.getItem(1), null)");
58     shouldThrow("text1.requiredFeatures.insertItemBefore(text1.requiredFeatures.getItem(1), 0)");
59
60     shouldBeEqualToString("text1.requiredFeatures.insertItemBefore(30, 0)", "30");
61     shouldBe("text1.requiredFeatures.numberOfItems", "2");
62     shouldBeEqualToString("text1.requiredFeatures.getItem(0)", "30");
63     shouldBeEqualToString("text1.requiredFeatures.getItem(1)", "aString");
64     shouldBeEqualToString("text1.getAttribute('requiredFeatures')", "30 aString");
65
66     shouldBeEqualToString("text1.requiredFeatures.insertItemBefore('aString', 0)", "aString");
67     shouldBe("text1.requiredFeatures.numberOfItems", "3");
68     shouldBeEqualToString("text1.requiredFeatures.getItem(0)", "aString");
69     shouldBeEqualToString("text1.requiredFeatures.getItem(1)", "30");
70     shouldBeEqualToString("text1.requiredFeatures.getItem(2)", "aString");
71     shouldBeEqualToString("text1.getAttribute('requiredFeatures')", "aString 30 aString");
72
73     shouldBeEqualToString("text1.requiredFeatures.insertItemBefore(text1, 0)", "[object SVGTextElement]");
74     shouldBe("text1.requiredFeatures.numberOfItems", "4");
75     shouldBeEqualToString("text1.requiredFeatures.getItem(0)", "[object SVGTextElement]");
76     shouldBeEqualToString("text1.requiredFeatures.getItem(1)", "aString");
77     shouldBeEqualToString("text1.requiredFeatures.getItem(2)", "30");
78     shouldBeEqualToString("text1.requiredFeatures.getItem(3)", "aString");
79     shouldBeEqualToString("text1.getAttribute('requiredFeatures')", "[object SVGTextElement] aString 30 aString");
80
81     shouldBeEqualToString("text1.requiredFeatures.insertItemBefore(null, 0)", "null");
82     shouldBe("text1.requiredFeatures.numberOfItems", "5");
83     shouldBeEqualToString("text1.requiredFeatures.getItem(0)", "null");
84     shouldBeEqualToString("text1.requiredFeatures.getItem(1)", "[object SVGTextElement]");
85     shouldBeEqualToString("text1.requiredFeatures.getItem(2)", "aString");
86     shouldBeEqualToString("text1.requiredFeatures.getItem(3)", "30");
87     shouldBeEqualToString("text1.requiredFeatures.getItem(4)", "aString");
88     shouldBeEqualToString("text1.getAttribute('requiredFeatures')", "null [object SVGTextElement] aString 30 aString");
89
90     debug("");
91     debug("Set requiredFeatures='1 2 3 4' for text1");
92     shouldBeUndefined("text1.setAttribute('requiredFeatures', '1 2 3 4')");
93     shouldBe("text1.requiredFeatures.numberOfItems", "4");
94     shouldBeEqualToString("text1.requiredFeatures.getItem(0)", "1");
95     shouldBeEqualToString("text1.requiredFeatures.getItem(1)", "2");
96     shouldBeEqualToString("text1.requiredFeatures.getItem(2)", "3");
97     shouldBeEqualToString("text1.requiredFeatures.getItem(3)", "4");
98     shouldBeEqualToString("text1.getAttribute('requiredFeatures')", "1 2 3 4");
99
100     debug("");
101     debug("Test uncommon arguments for replaceItem() - part 1");
102     shouldThrow("text1.requiredFeatures.replaceItem(30)");
103     shouldThrow("text1.requiredFeatures.replaceItem('aString')");
104     shouldThrow("text1.requiredFeatures.replaceItem(text1)");
105
106     shouldBeEqualToString("text1.requiredFeatures.replaceItem(null, 0)", "null");
107     shouldBe("text1.requiredFeatures.numberOfItems", "4");
108     shouldBeEqualToString("text1.requiredFeatures.getItem(0)", "null");
109     shouldBeEqualToString("text1.requiredFeatures.getItem(1)", "2");
110     shouldBeEqualToString("text1.requiredFeatures.getItem(2)", "3");
111     shouldBeEqualToString("text1.requiredFeatures.getItem(3)", "4");
112     shouldBeEqualToString("text1.getAttribute('requiredFeatures')", "null 2 3 4");
113
114     shouldBeEqualToString("text1.requiredFeatures.replaceItem('aString', 3)", "aString");
115     shouldBe("text1.requiredFeatures.numberOfItems", "4");
116     shouldBeEqualToString("text1.requiredFeatures.getItem(0)", "null");
117     shouldBeEqualToString("text1.requiredFeatures.getItem(1)", "2");
118     shouldBeEqualToString("text1.requiredFeatures.getItem(2)", "3");
119     shouldBeEqualToString("text1.requiredFeatures.getItem(3)", "aString");
120     shouldBeEqualToString("text1.getAttribute('requiredFeatures')", "null 2 3 aString");
121
122     shouldBeEqualToString("text1.requiredFeatures.replaceItem(text1, 2)", "[object SVGTextElement]");
123     shouldBe("text1.requiredFeatures.numberOfItems", "4");
124     shouldBeEqualToString("text1.requiredFeatures.getItem(0)", "null");
125     shouldBeEqualToString("text1.requiredFeatures.getItem(1)", "2");
126     shouldBeEqualToString("text1.requiredFeatures.getItem(2)", "[object SVGTextElement]");
127     shouldBeEqualToString("text1.requiredFeatures.getItem(3)", "aString");
128     shouldBeEqualToString("text1.getAttribute('requiredFeatures')", "null 2 [object SVGTextElement] aString");
129
130     shouldBeEqualToString("text1.requiredFeatures.replaceItem(1, 1)", "1");
131     shouldBe("text1.requiredFeatures.numberOfItems", "4");
132     shouldBeEqualToString("text1.requiredFeatures.getItem(0)", "null");
133     shouldBeEqualToString("text1.requiredFeatures.getItem(1)", "1");
134     shouldBeEqualToString("text1.requiredFeatures.getItem(2)", "[object SVGTextElement]");
135     shouldBeEqualToString("text1.requiredFeatures.getItem(3)", "aString");
136     shouldBeEqualToString("text1.getAttribute('requiredFeatures')", "null 1 [object SVGTextElement] aString");
137
138     debug("");
139     debug("Set requiredFeatures='1 2 3 4' for text1");
140     shouldBeUndefined("text1.setAttribute('requiredFeatures', '1 2 3 4')");
141     shouldBe("text1.requiredFeatures.numberOfItems", "4");
142     shouldBeEqualToString("text1.requiredFeatures.getItem(0)", "1");
143     shouldBeEqualToString("text1.requiredFeatures.getItem(1)", "2");
144     shouldBeEqualToString("text1.requiredFeatures.getItem(2)", "3");
145     shouldBeEqualToString("text1.requiredFeatures.getItem(3)", "4");
146     shouldBeEqualToString("text1.getAttribute('requiredFeatures')", "1 2 3 4");
147
148     debug("");
149     debug("Test uncommon arguments for replaceItem() - part 2");
150     shouldBeEqualToString("text1.requiredFeatures.replaceItem(text1.requiredFeatures.getItem(0), 0)", "1");
151     shouldBe("text1.requiredFeatures.numberOfItems", "4");
152     shouldBeEqualToString("text1.requiredFeatures.getItem(0)", "1");
153     shouldBeEqualToString("text1.requiredFeatures.getItem(1)", "2");
154     shouldBeEqualToString("text1.requiredFeatures.getItem(2)", "3");
155     shouldBeEqualToString("text1.requiredFeatures.getItem(3)", "4");
156     shouldBeEqualToString("text1.getAttribute('requiredFeatures')", "1 2 3 4");
157
158     shouldBeEqualToString("text1.requiredFeatures.replaceItem(text1.requiredFeatures.getItem(0), 'aString')", "1");
159     shouldBe("text1.requiredFeatures.numberOfItems", "4");
160     shouldBeEqualToString("text1.requiredFeatures.getItem(0)", "1");
161     shouldBeEqualToString("text1.requiredFeatures.getItem(1)", "2");
162     shouldBeEqualToString("text1.requiredFeatures.getItem(2)", "3");
163     shouldBeEqualToString("text1.requiredFeatures.getItem(3)", "4");
164     shouldBeEqualToString("text1.getAttribute('requiredFeatures')", "1 2 3 4");
165
166     shouldBeEqualToString("text1.requiredFeatures.replaceItem(text1.requiredFeatures.getItem(0), text1)", "1");
167     shouldBe("text1.requiredFeatures.numberOfItems", "4");
168     shouldBeEqualToString("text1.requiredFeatures.getItem(0)", "1");
169     shouldBeEqualToString("text1.requiredFeatures.getItem(1)", "2");
170     shouldBeEqualToString("text1.requiredFeatures.getItem(2)", "3");
171     shouldBeEqualToString("text1.requiredFeatures.getItem(3)", "4");
172     shouldBeEqualToString("text1.getAttribute('requiredFeatures')", "1 2 3 4"); 
173
174     shouldBeEqualToString("text1.requiredFeatures.replaceItem(text1.requiredFeatures.getItem(0), null)", "1");
175     shouldBe("text1.requiredFeatures.numberOfItems", "4");
176     shouldBeEqualToString("text1.requiredFeatures.getItem(0)", "1");
177     shouldBeEqualToString("text1.requiredFeatures.getItem(1)", "2");
178     shouldBeEqualToString("text1.requiredFeatures.getItem(2)", "3");
179     shouldBeEqualToString("text1.requiredFeatures.getItem(3)", "4");
180     shouldBeEqualToString("text1.getAttribute('requiredFeatures')", "1 2 3 4");
181
182     debug("");
183     debug("Test uncommon arguments for removeItem()");
184     shouldThrow("text1.requiredFeatures.removeItem(30)");
185
186     shouldBeEqualToString("text1.requiredFeatures.removeItem('aString')", "1");
187     shouldBe("text1.requiredFeatures.numberOfItems", "3");
188     shouldBeEqualToString("text1.getAttribute('requiredFeatures')", "2 3 4"); 
189
190     shouldBeEqualToString("text1.requiredFeatures.removeItem(text1)", "2");
191     shouldBe("text1.requiredFeatures.numberOfItems", "2");
192     shouldBeEqualToString("text1.requiredFeatures.getItem(0)", "3");
193     shouldBeEqualToString("text1.requiredFeatures.getItem(1)", "4");
194     shouldBeEqualToString("text1.getAttribute('requiredFeatures')", "3 4"); 
195
196     shouldBeEqualToString("text1.requiredFeatures.removeItem(null)", "3");
197     shouldBe("text1.requiredFeatures.numberOfItems", "1");
198     shouldBeEqualToString("text1.getAttribute('requiredFeatures')", "4"); 
199     shouldBeEqualToString("text1.requiredFeatures.getItem(0)", "4");
200  
201     debug("");
202     debug("Test uncommon arguments for appendItem()");
203     shouldBeEqualToString("text1.requiredFeatures.appendItem(30)", "30");
204     shouldBe("text1.requiredFeatures.numberOfItems", "2");
205     shouldBeEqualToString("text1.requiredFeatures.getItem(0)", "4");
206     shouldBeEqualToString("text1.requiredFeatures.getItem(1)", "30");
207     shouldBeEqualToString("text1.getAttribute('requiredFeatures')", "4 30"); 
208
209     shouldBeEqualToString("text1.requiredFeatures.appendItem('aString')", "aString");
210     shouldBe("text1.requiredFeatures.numberOfItems", "3");
211     shouldBeEqualToString("text1.requiredFeatures.getItem(0)", "4");
212     shouldBeEqualToString("text1.requiredFeatures.getItem(1)", "30");
213     shouldBeEqualToString("text1.requiredFeatures.getItem(2)", "aString");
214     shouldBeEqualToString("text1.getAttribute('requiredFeatures')", "4 30 aString"); 
215
216     shouldBeEqualToString("text1.requiredFeatures.appendItem(text1)", "[object SVGTextElement]");
217     shouldBe("text1.requiredFeatures.numberOfItems", "4");
218     shouldBeEqualToString("text1.requiredFeatures.getItem(0)", "4");
219     shouldBeEqualToString("text1.requiredFeatures.getItem(1)", "30");
220     shouldBeEqualToString("text1.requiredFeatures.getItem(2)", "aString");
221     shouldBeEqualToString("text1.requiredFeatures.getItem(3)", "[object SVGTextElement]");
222     shouldBeEqualToString("text1.getAttribute('requiredFeatures')", "4 30 aString [object SVGTextElement]");
223
224     shouldBeEqualToString("text1.requiredFeatures.appendItem(null)", "null");
225     shouldBe("text1.requiredFeatures.numberOfItems", "5");
226     shouldBeEqualToString("text1.requiredFeatures.getItem(0)", "4");
227     shouldBeEqualToString("text1.requiredFeatures.getItem(1)", "30");
228     shouldBeEqualToString("text1.requiredFeatures.getItem(2)", "aString");
229     shouldBeEqualToString("text1.requiredFeatures.getItem(3)", "[object SVGTextElement]");
230     shouldBeEqualToString("text1.requiredFeatures.getItem(4)", "null");
231     shouldBeEqualToString("text1.getAttribute('requiredFeatures')", "4 30 aString [object SVGTextElement] null");
232
233     debug("");
234     debug("clear() requiredFeatures list so text on top shows up");
235     shouldBeUndefined("text1.requiredFeatures.clear()");
236
237 ]]>
238 </script>
239 <script src="../../fast/js/resources/js-test-post.js"></script>
240 </body>
241 </html>