OLD | NEW |
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML> |
2 <html> | 2 <title>Use of SVGAnimatedEnumeration within SVGTextContentElement</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 use of SVGAnimatedEnumeration within SVGTextContentEle
ment. |
8 <div id="console"></div> | 8 |
9 <script src="script-tests/SVGAnimatedEnumeration-SVGTextContentElement.js"></scr
ipt> | 9 var textContentElement = document.createElementNS("http://www.w3.org/2000/svg"
, "text"); |
10 </body> | 10 textContentElement.setAttribute("lengthAdjust", "spacing"); |
11 </html> | 11 |
| 12 // Check initial 'lengthAdjust' value. |
| 13 assert_true(textContentElement.lengthAdjust instanceof SVGAnimatedEnumeration)
; |
| 14 assert_equals(typeof(textContentElement.lengthAdjust.baseVal), "number"); |
| 15 assert_equals(textContentElement.lengthAdjust.baseVal, SVGTextContentElement.L
ENGTHADJUST_SPACING); |
| 16 |
| 17 // Switch to 'spacingAndGlyphs'. |
| 18 textContentElement.lengthAdjust.baseVal = SVGTextContentElement.LENGTHADJUST_S
PACINGANDGLYPHS; |
| 19 assert_equals(textContentElement.lengthAdjust.baseVal, SVGTextContentElement.L
ENGTHADJUST_SPACINGANDGLYPHS); |
| 20 assert_equals(textContentElement.getAttribute('lengthAdjust'), "spacingAndGlyp
hs"); |
| 21 |
| 22 // Try setting invalid values. |
| 23 assert_throws(new TypeError(), function() { textContentElement.lengthAdjust.ba
seVal = 3; }); |
| 24 assert_equals(textContentElement.lengthAdjust.baseVal, SVGTextContentElement.L
ENGTHADJUST_SPACINGANDGLYPHS); |
| 25 assert_equals(textContentElement.getAttribute('lengthAdjust'), "spacingAndGlyp
hs"); |
| 26 |
| 27 assert_throws(new TypeError(), function() { textContentElement.lengthAdjust.ba
seVal = -1; }); |
| 28 assert_equals(textContentElement.lengthAdjust.baseVal, SVGTextContentElement.L
ENGTHADJUST_SPACINGANDGLYPHS); |
| 29 assert_equals(textContentElement.getAttribute('lengthAdjust'), "spacingAndGlyp
hs"); |
| 30 |
| 31 assert_throws(new TypeError(), function() { textContentElement.lengthAdjust.ba
seVal = 0; }); |
| 32 assert_equals(textContentElement.lengthAdjust.baseVal, SVGTextContentElement.L
ENGTHADJUST_SPACINGANDGLYPHS); |
| 33 assert_equals(textContentElement.getAttribute('lengthAdjust'), "spacingAndGlyp
hs"); |
| 34 |
| 35 // Switch to 'spacing'. |
| 36 textContentElement.lengthAdjust.baseVal = SVGTextContentElement.LENGTHADJUST_S
PACING; |
| 37 assert_equals(textContentElement.lengthAdjust.baseVal, SVGTextContentElement.L
ENGTHADJUST_SPACING); |
| 38 assert_equals(textContentElement.getAttribute('lengthAdjust'), "spacing"); |
| 39 }); |
| 40 </script> |
OLD | NEW |