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

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

Issue 2389803004: 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.html
diff --git a/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration.html b/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration.html
index c2021cbcd5e546fa8a142b02fa0c1dc9571ca210..59c81779b80fd2a62334977e45999a99c1b95e12 100644
--- a/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration.html
+++ b/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedEnumeration.html
@@ -1,11 +1,41 @@
-<!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.js"></script>
-</body>
-</html>
+<!DOCTYPE HTML>
+<title>SVGAnimatedEnumeration interface - utilizing the clipPathUnits property of SVGClipPathElement</title>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script>
+test(function() {
+ // This test checks the SVGAnimatedEnumeration API - utilizing the clipPathUnits property of SVGClipPathElement.
+
+ var clipPathElement = document.createElementNS("http://www.w3.org/2000/svg", "clipPath");
+
+ // Check initial clipPathUnits value.
+ assert_equals(clipPathElement.clipPathUnits.toString(), "[object SVGAnimatedEnumeration]");
Srirama 2016/10/04 09:32:05 can we remove toString conversion and check direct
Shanmuga Pandi 2016/10/05 06:53:10 Done.
+ assert_equals(typeof(clipPathElement.clipPathUnits.baseVal), "number");
+ assert_equals(clipPathElement.clipPathUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE);
+
+ // Check that enumerations are static, caching value in a local variable and modifying it, should have no effect.
+ var enumRef = clipPathElement.clipPathUnits.baseVal;
+ enumRef = SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX;
+ assert_equals(enumRef, SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
+ assert_equals(clipPathElement.clipPathUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE);
+
+ // Check assigning various valid and invalid values.
+ assert_throws(new TypeError(), function() { clipPathElement.clipPathUnits.baseVal = 3; });
+ assert_equals(clipPathElement.clipPathUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE);
+ assert_throws(new TypeError(), function() { clipPathElement.clipPathUnits.baseVal = -1; });
+ assert_equals(clipPathElement.clipPathUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE);
+
+ // ECMA-262, 9.7, "ToUint16"
+ assert_equals(clipPathElement.clipPathUnits.baseVal = '1', SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE.toString());
Srirama 2016/10/04 09:32:05 may be split it into assignment and then check for
Shanmuga Pandi 2016/10/05 06:53:10 Done.
+ assert_equals(clipPathElement.clipPathUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE);
+
+ // ECMA-262, 9.7, "ToUint16"
+ assert_throws(new TypeError(), function() { clipPathElement.clipPathUnits.baseVal = 'aString'; });
+ assert_equals(clipPathElement.clipPathUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE);
+
+ clipPathElement.clipPathUnits.baseVal = 2;
+ assert_equals(clipPathElement.clipPathUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
+ assert_throws(new TypeError(), function() { clipPathElement.clipPathUnits.baseVal = clipPathElement; });
+ assert_equals(clipPathElement.clipPathUnits.baseVal, SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698