OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE HTML> |
| 2 <title>SVGLengthList, getItem()</title> |
| 3 <script src="../../resources/testharness.js"></script> |
| 4 <script src="../../resources/testharnessreport.js"></script> |
| 5 <svg width="200" height="200"> |
| 6 <text x="50 100 150" y="50">ABC</text> |
| 7 </svg> |
| 8 <script> |
| 9 test(function() { |
| 10 // This is a test of the SVGLengthList::getItem() API. |
| 11 var xList = document.querySelector("text").x.baseVal; |
| 12 |
| 13 // Check lengths of text x item lists. |
| 14 assert_equals(xList.numberOfItems, 3); |
| 15 |
| 16 // Test with various index parameters. |
| 17 assert_throws("IndexSizeError", function() { xList.getItem(-100); }); |
| 18 assert_throws("IndexSizeError", function() { xList.getItem(-1); }); |
| 19 assert_equals(xList.getItem(0).value, 50); |
| 20 assert_equals(xList.getItem(1).value, 100); |
| 21 assert_equals(xList.getItem(2).value, 150); |
| 22 assert_throws("IndexSizeError", function() { xList.getItem(3); }); |
| 23 assert_throws("IndexSizeError", function() { xList.getItem(100); }); |
| 24 }); |
| 25 </script> |
OLD | NEW |