OLD | NEW |
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML> |
2 <html> | 2 <title>SVGAnimatedLength interface - utilizing the width property of SVGRectElem
ent</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 SVGAnimatedLength API - utilizing the width property o
f SVGRectElement. |
8 <div id="console"></div> | 8 |
9 <script src="script-tests/SVGAnimatedLength.js"></script> | 9 var rectElement = document.createElementNS("http://www.w3.org/2000/svg", "rect
"); |
10 </body> | 10 |
11 </html> | 11 // Check initial width value. |
| 12 assert_true(rectElement.width instanceof SVGAnimatedLength); |
| 13 assert_true(rectElement.width.baseVal instanceof SVGLength); |
| 14 assert_equals(rectElement.width.baseVal.value, 0); |
| 15 |
| 16 // Check that lengths are dynamic, caching value in a local variable and modif
ying it, should take effect. |
| 17 var numRef = rectElement.width.baseVal; |
| 18 numRef.value = 100; |
| 19 assert_equals(numRef.value, 100); |
| 20 assert_equals(rectElement.width.baseVal.value, 100); |
| 21 |
| 22 // Check that assigning to baseVal has no effect, as no setter is defined. |
| 23 rectElement.width.baseVal = -1; |
| 24 assert_equals(rectElement.width.baseVal.value, 100); |
| 25 rectElement.width.baseVal = 'aString'; |
| 26 assert_equals(rectElement.width.baseVal.value, 100); |
| 27 rectElement.width.baseVal = rectElement; |
| 28 assert_equals(rectElement.width.baseVal.value, 100); |
| 29 |
| 30 // Check that the width baseVal type has not been changed. |
| 31 assert_true(rectElement.width.baseVal instanceof SVGLength); |
| 32 }); |
| 33 </script> |
OLD | NEW |