Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(364)

Unified Diff: third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGTextContentElement.html

Issue 2447633002: Convert LayoutTests/svg/dom/SVGAnimatedEnumeration*.html js-tests.js to testharness.js based tests. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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>

Powered by Google App Engine
This is Rietveld 408576698