OLD | NEW |
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML> |
2 <html> | 2 <title>SVGAnimatedLengthList interface - utilizing the dx property of SVGTextEle
ment</title> |
3 <head> | 3 <script src="../../resources/testharness.js"></script> |
4 <script src="../../resources/js-test.js"></script> | 4 <script src="../../resources/testharnessreport.js"></script> |
5 </head> | 5 <script> |
6 <body> | 6 test(function() { |
7 <p id="description"></p> | 7 // This test checks the SVGAnimatedLengthList API - utilizing the dx property
of SVGTextElement. |
8 <div id="console"></div> | 8 |
9 <script src="script-tests/SVGAnimatedLengthList.js"></script> | 9 var textElement = document.createElementNS("http://www.w3.org/2000/svg", "text
"); |
10 </body> | 10 textElement.setAttribute("dx", "50"); |
11 </html> | 11 |
| 12 // Check initial dx value. |
| 13 assert_true(textElement.dx instanceof SVGAnimatedLengthList); |
| 14 assert_true(textElement.dx.baseVal instanceof SVGLengthList); |
| 15 assert_equals(textElement.dx.baseVal.getItem(0).value, 50); |
| 16 |
| 17 // Check that length lists are dynamic, caching value in a local variable and
modifying it, should take effect. |
| 18 var numRef = textElement.dx.baseVal; |
| 19 numRef.getItem(0).value = 100; |
| 20 assert_equals(numRef.getItem(0).value, 100); |
| 21 assert_equals(textElement.dx.baseVal.getItem(0).value, 100); |
| 22 |
| 23 // Check that assigning to baseVal has no effect, as no setter is defined. |
| 24 textElement.dx.baseVal = -1; |
| 25 assert_equals(textElement.dx.baseVal.getItem(0).value, 100); |
| 26 textElement.dx.baseVal = 'aString'; |
| 27 assert_equals(textElement.dx.baseVal.getItem(0).value, 100); |
| 28 textElement.dx.baseVal = textElement; |
| 29 assert_equals(textElement.dx.baseVal.getItem(0).value, 100); |
| 30 |
| 31 // Check that the dx baseVal type has not been changed. |
| 32 assert_true(textElement.dx.baseVal instanceof SVGLengthList); |
| 33 }); |
| 34 </script> |
OLD | NEW |