OLD | NEW |
1 <html> | 1 <!DOCTYPE HTML> |
2 <head> | 2 <title>SVGLengthList, appendItem() from cleared list</title> |
3 <script src="../../resources/js-test.js"></script> | 3 <script src="../../resources/testharness.js"></script> |
4 </head> | 4 <script src="../../resources/testharnessreport.js"></script> |
5 <body> | 5 <svg width="200" height="200"> |
6 <svg id="svg" xmlns="http://www.w3.org/2000/svg" width="200" height="200"> | |
7 <text id="text1" x="1 2 3">ABC</text> | 6 <text id="text1" x="1 2 3">ABC</text> |
8 <text id="text2" x="10 20">ABC</text> | 7 <text id="text2" x="10 20">ABC</text> |
9 </svg> | 8 </svg> |
| 9 <script> |
| 10 test(function() { |
| 11 // This is a test of the SVGLengthList::appendItem() API. |
10 | 12 |
11 <script> | 13 var list1 = document.getElementById("text1").x.baseVal; |
12 description("This is a test of the SVGLengthList::appendItem() API."); | 14 var list2 = document.getElementById("text2").x.baseVal; |
13 | 15 |
14 var list1 = document.getElementById("text1").x.baseVal; | 16 var itemFromClearedList = list2.getItem(0); |
15 var list2 = document.getElementById("text2").x.baseVal; | 17 list2.clear(); |
| 18 assert_equals(list2.numberOfItems, 0); |
16 | 19 |
17 var itemFromClearedList = list2.getItem(0); | 20 list1.appendItem(itemFromClearedList); |
18 list2.clear(); | 21 |
19 shouldBe("list2.numberOfItems", "0"); | 22 assert_equals(list1.numberOfItems, 4); |
| 23 assert_equals(list1.getItem(0).value, 1); |
| 24 assert_equals(list1.getItem(1).value, 2); |
| 25 assert_equals(list1.getItem(2).value, 3); |
| 26 assert_equals(list1.getItem(3).value, 10); |
20 | 27 |
21 list1.appendItem(itemFromClearedList); | 28 assert_equals(list2.numberOfItems, 0); |
22 | 29 }); |
23 shouldBe("list1.numberOfItems", "4"); | 30 </script> |
24 shouldBe("list1.getItem(0).value", "1"); | |
25 shouldBe("list1.getItem(1).value", "2"); | |
26 shouldBe("list1.getItem(2).value", "3"); | |
27 shouldBe("list1.getItem(3).value", "10"); | |
28 | |
29 shouldBe("list2.numberOfItems", "0"); | |
30 | |
31 debug("The test passes if you only see 'PASS' messages, and test doesn't cra
sh"); | |
32 | |
33 gc(); | |
34 </script> | |
35 </body> | |
36 </html> | |
OLD | NEW |