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

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

Issue 2416163002: 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-SVGFEMorphologyElement.html
diff --git a/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGFEMorphologyElement.html b/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGFEMorphologyElement.html
index f28e08288804faff2a0997ecbf1b8efa8787e266..ef04d22f30cec9cfa726e4e627a62712cea40599 100644
--- a/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGFEMorphologyElement.html
+++ b/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration-SVGFEMorphologyElement.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-SVGFEMorphologyElement.js"></script>
-</body>
-</html>
+<!DOCTYPE HTML>
+<title>Use of SVGAnimatedEnumeration within SVGFEMorphologyElement</title>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script>
+test(function() {
+ // This test checks the use of SVGAnimatedEnumeration within SVGFEMorphologyElement.
+
+ var feMorphologyElement = document.createElementNS("http://www.w3.org/2000/svg", "feMorphology");
+ feMorphologyElement.setAttribute("operator", "erode");
+
+ // Check initial 'operator' value.
+ assert_true(feMorphologyElement.operator instanceof SVGAnimatedEnumeration);
+ assert_equals(typeof(feMorphologyElement.operator.baseVal), "number");
+ assert_equals(feMorphologyElement.operator.baseVal, SVGFEMorphologyElement.SVG_MORPHOLOGY_OPERATOR_ERODE);
+
+ // Switch to 'dilate'.
+ feMorphologyElement.operator.baseVal = SVGFEMorphologyElement.SVG_MORPHOLOGY_OPERATOR_DILATE;
+ assert_equals(feMorphologyElement.operator.baseVal, SVGFEMorphologyElement.SVG_MORPHOLOGY_OPERATOR_DILATE);
+ assert_equals(feMorphologyElement.getAttribute('operator'), "dilate");
+
+ // Try setting invalid values.
+ assert_throws(new TypeError(), function() { feMorphologyElement.operator.baseVal = 4; });
+ assert_equals(feMorphologyElement.operator.baseVal, SVGFEMorphologyElement.SVG_MORPHOLOGY_OPERATOR_DILATE);
+ assert_equals(feMorphologyElement.getAttribute('operator'), "dilate");
+
+ assert_throws(new TypeError(), function() { feMorphologyElement.operator.baseVal = -1; });
+ assert_equals(feMorphologyElement.operator.baseVal, SVGFEMorphologyElement.SVG_MORPHOLOGY_OPERATOR_DILATE);
+ assert_equals(feMorphologyElement.getAttribute('operator'), "dilate");
+
+ assert_throws(new TypeError(), function() { feMorphologyElement.operator.baseVal = 0; });
+ assert_equals(feMorphologyElement.operator.baseVal, SVGFEMorphologyElement.SVG_MORPHOLOGY_OPERATOR_DILATE);
+ assert_equals(feMorphologyElement.getAttribute('operator'), "dilate");
+
+ // Switch to 'erode'.
+ feMorphologyElement.operator.baseVal = SVGFEMorphologyElement.SVG_MORPHOLOGY_OPERATOR_ERODE;
+ assert_equals(feMorphologyElement.operator.baseVal, SVGFEMorphologyElement.SVG_MORPHOLOGY_OPERATOR_ERODE);
+ assert_equals(feMorphologyElement.getAttribute('operator'), "erode");
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698