Index: third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGTextContentElement.html |
diff --git a/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGTextContentElement.html b/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGTextContentElement.html |
index ea06c2b7ddb1902aaea50b9fbcadd79509e252d1..82f80ed6a3aeb49dbef252ea029d2629d36cb1b1 100644 |
--- a/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGTextContentElement.html |
+++ b/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGTextContentElement.html |
@@ -1,11 +1,40 @@ |
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
-<html> |
-<head> |
-<script src="../../resources/js-test.js"></script> |
-</head> |
-<body> |
-<p id="description"></p> |
-<div id="console"></div> |
-<script src="script-tests/SVGAnimatedEnumeration-SVGTextContentElement.js"></script> |
-</body> |
-</html> |
+<!DOCTYPE HTML> |
+<title>Use of SVGAnimatedEnumeration within SVGTextContentElement</title> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
+<script> |
+test(function() { |
+ // This test checks the use of SVGAnimatedEnumeration within SVGTextContentElement. |
+ |
+ var textContentElement = document.createElementNS("http://www.w3.org/2000/svg", "text"); |
+ textContentElement.setAttribute("lengthAdjust", "spacing"); |
+ |
+ // Check initial 'lengthAdjust' value. |
+ assert_true(textContentElement.lengthAdjust instanceof SVGAnimatedEnumeration); |
+ assert_equals(typeof(textContentElement.lengthAdjust.baseVal), "number"); |
+ assert_equals(textContentElement.lengthAdjust.baseVal, SVGTextContentElement.LENGTHADJUST_SPACING); |
+ |
+ // Switch to 'spacingAndGlyphs'. |
+ textContentElement.lengthAdjust.baseVal = SVGTextContentElement.LENGTHADJUST_SPACINGANDGLYPHS; |
+ assert_equals(textContentElement.lengthAdjust.baseVal, SVGTextContentElement.LENGTHADJUST_SPACINGANDGLYPHS); |
+ assert_equals(textContentElement.getAttribute('lengthAdjust'), "spacingAndGlyphs"); |
+ |
+ // Try setting invalid values. |
+ assert_throws(new TypeError(), function() { textContentElement.lengthAdjust.baseVal = 3; }); |
+ assert_equals(textContentElement.lengthAdjust.baseVal, SVGTextContentElement.LENGTHADJUST_SPACINGANDGLYPHS); |
+ assert_equals(textContentElement.getAttribute('lengthAdjust'), "spacingAndGlyphs"); |
+ |
+ assert_throws(new TypeError(), function() { textContentElement.lengthAdjust.baseVal = -1; }); |
+ assert_equals(textContentElement.lengthAdjust.baseVal, SVGTextContentElement.LENGTHADJUST_SPACINGANDGLYPHS); |
+ assert_equals(textContentElement.getAttribute('lengthAdjust'), "spacingAndGlyphs"); |
+ |
+ assert_throws(new TypeError(), function() { textContentElement.lengthAdjust.baseVal = 0; }); |
+ assert_equals(textContentElement.lengthAdjust.baseVal, SVGTextContentElement.LENGTHADJUST_SPACINGANDGLYPHS); |
+ assert_equals(textContentElement.getAttribute('lengthAdjust'), "spacingAndGlyphs"); |
+ |
+ // Switch to 'spacing'. |
+ textContentElement.lengthAdjust.baseVal = SVGTextContentElement.LENGTHADJUST_SPACING; |
+ assert_equals(textContentElement.lengthAdjust.baseVal, SVGTextContentElement.LENGTHADJUST_SPACING); |
+ assert_equals(textContentElement.getAttribute('lengthAdjust'), "spacing"); |
+}); |
+</script> |