Chromium Code Reviews

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

Issue 2713833002: Convert LayoutTests/svg/dom/SVGAnimated*.html js-tests.js to testharness.js based tests. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedLengthList.html
diff --git a/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedLengthList.html b/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedLengthList.html
index 82dce0ced3fdca98b2cbff796cfd2b780038d08b..15251f4e2e0c60b6d608386af9a206476b0cb83d 100644
--- a/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedLengthList.html
+++ b/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedLengthList.html
@@ -1,11 +1,34 @@
-<!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/SVGAnimatedLengthList.js"></script>
-</body>
-</html>
+<!DOCTYPE HTML>
+<title>SVGAnimatedLengthList interface - utilizing the dx property of SVGTextElement</title>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script>
+test(function() {
+ // This test checks the SVGAnimatedLengthList API - utilizing the dx property of SVGTextElement.
+
+ var textElement = document.createElementNS("http://www.w3.org/2000/svg", "text");
+ textElement.setAttribute("dx", "50");
+
+ // Check initial dx value.
+ assert_true(textElement.dx instanceof SVGAnimatedLengthList);
+ assert_true(textElement.dx.baseVal instanceof SVGLengthList);
+ assert_equals(textElement.dx.baseVal.getItem(0).value, 50);
+
+ // Check that length lists are dynamic, caching value in a local variable and modifying it, should take effect.
+ var numRef = textElement.dx.baseVal;
+ numRef.getItem(0).value = 100;
+ assert_equals(numRef.getItem(0).value, 100);
+ assert_equals(textElement.dx.baseVal.getItem(0).value, 100);
+
+ // Check that assigning to baseVal has no effect, as no setter is defined.
+ textElement.dx.baseVal = -1;
+ assert_equals(textElement.dx.baseVal.getItem(0).value, 100);
+ textElement.dx.baseVal = 'aString';
+ assert_equals(textElement.dx.baseVal.getItem(0).value, 100);
+ textElement.dx.baseVal = textElement;
+ assert_equals(textElement.dx.baseVal.getItem(0).value, 100);
+
+ // Check that the dx baseVal type has not been changed.
+ assert_true(textElement.dx.baseVal instanceof SVGLengthList);
+});
+</script>

Powered by Google App Engine