OLD | NEW |
1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
2 <title>SVGLengthList, removeItem()</title> | 2 <title>SVGLengthList, removeItem()</title> |
3 <script src="../../resources/testharness.js"></script> | 3 <script src="../../resources/testharness.js"></script> |
4 <script src="../../resources/testharnessreport.js"></script> | 4 <script src="../../resources/testharnessreport.js"></script> |
| 5 <script src="resources/SVGLengthList-helper.js"></script> |
5 <svg width="200" height="200"> | 6 <svg width="200" height="200"> |
6 <text x="500 50 100 900 150" y="50">ABC</text> | 7 <text x="500 50 100 900 150" y="50">ABC</text> |
7 </svg> | 8 </svg> |
8 <script> | 9 <script> |
9 test(function() { | 10 test(function() { |
10 // This is a test of the SVGLengthList.removeItem() API. | 11 // This is a test of the SVGLengthList.removeItem() API. |
11 var list = document.querySelector("text").x.baseVal; | 12 var list = document.querySelector("text").x.baseVal; |
12 | 13 |
13 // Check initial list state of text. | 14 // Check initial list state of text. |
14 assert_equals(list.numberOfItems, 5); | 15 assert_list(list, [500, 50, 100, 900, 150]); |
15 assert_equals(list.getItem(0).value, 500); | |
16 assert_equals(list.getItem(1).value, 50); | |
17 assert_equals(list.getItem(2).value, 100); | |
18 assert_equals(list.getItem(3).value, 900); | |
19 assert_equals(list.getItem(4).value, 150); | |
20 assert_throws("IndexSizeError", function() { list.getItem(5); }); | |
21 | 16 |
22 // Remove first item. | 17 // Remove first item. |
23 assert_equals(list.removeItem(0).value, 500); | 18 assert_equals(list.removeItem(0).value, 500); |
24 | 19 |
25 // Remove third item. | 20 // Remove third item. |
26 assert_equals(list.removeItem(2).value, 900); | 21 assert_equals(list.removeItem(2).value, 900); |
27 }); | 22 }); |
28 </script> | 23 </script> |
OLD | NEW |