OLD | NEW |
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML> |
2 <html> | 2 <title>SVGAnimatedNumberList interface - utilizing the rotate property of SVGTex
tElement</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 SVGAnimatedNumberList API - utilizing the rotate prope
rty of SVGTextElement. |
8 <div id="console"></div> | 8 |
9 <script src="script-tests/SVGAnimatedNumberList.js"></script> | 9 var textElement = document.createElementNS("http://www.w3.org/2000/svg", "text
"); |
10 </body> | 10 textElement.setAttribute("rotate", "50"); |
11 </html> | 11 |
| 12 // Check initial rotate value. |
| 13 assert_true(textElement.rotate instanceof SVGAnimatedNumberList); |
| 14 assert_true(textElement.rotate.baseVal instanceof SVGNumberList); |
| 15 assert_equals(textElement.rotate.baseVal.getItem(0).value, 50); |
| 16 |
| 17 // Check that number lists are dynamic, caching value in a local variable and
modifying it, should take effect. |
| 18 var numRef = textElement.rotate.baseVal; |
| 19 numRef.getItem(0).value = 100; |
| 20 assert_equals(numRef.getItem(0).value, 100); |
| 21 assert_equals(textElement.rotate.baseVal.getItem(0).value, 100); |
| 22 |
| 23 // Check that assigning to baseVal has no effect, as no setter is defined. |
| 24 textElement.rotate.baseVal = -1; |
| 25 assert_equals(textElement.rotate.baseVal.getItem(0).value, 100); |
| 26 textElement.rotate.baseVal = 'aString'; |
| 27 assert_equals(textElement.rotate.baseVal.getItem(0).value, 100); |
| 28 textElement.rotate.baseVal = textElement; |
| 29 assert_equals(textElement.rotate.baseVal.getItem(0).value, 100); |
| 30 |
| 31 // Check that the rotate baseVal type has not been changed. |
| 32 assert_true(textElement.rotate.baseVal instanceof SVGNumberList); |
| 33 }); |
| 34 </script> |
OLD | NEW |