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