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

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

Issue 2705293005: Convert LayoutTests/svg/dom/SVGAnimated*.html js-tests.js to testharness.js based tests. (Closed)
Patch Set: Align with review comments Created 3 years, 10 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/SVGAnimatedRect.html
diff --git a/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedRect.html b/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedRect.html
index 9c030dc25511be85bc9b53ec4138b70ee0a1e158..8a9376afc14fc97c9146f8f3fa74e0a4c1ff2e1d 100644
--- a/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedRect.html
+++ b/third_party/WebKit/LayoutTests/svg/dom/SVGAnimatedRect.html
@@ -1,11 +1,33 @@
-<!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/SVGAnimatedRect.js"></script>
-</body>
-</html>
+<!DOCTYPE HTML>
+<title>SVGAnimatedRect interface - utilizing the viewBox property of SVGSVGElement</title>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script>
+test(function() {
+ // This test checks the SVGAnimatedRect API - utilizing the viewBox property of SVGSVGElement.
+
+ var svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg");
+
+ // Check initial viewBox value.
+ assert_true(svgElement.viewBox instanceof SVGAnimatedRect);
+ assert_true(svgElement.viewBox.baseVal instanceof SVGRect);
+ assert_equals(svgElement.viewBox.baseVal.x, 0);
+
+ // Check that rects are dynamic, caching value in a local variable and modifying it, should take effect.
+ var numRef = svgElement.viewBox.baseVal;
+ numRef.x = 100;
+ assert_equals(numRef.x, 100);
+ assert_equals(svgElement.viewBox.baseVal.x, 100);
+
+ // Check that assigning to baseVal has no effect, as no setter is defined.
+ svgElement.viewBox.baseVal = -1;
+ assert_equals(svgElement.viewBox.baseVal.x, 100);
+ svgElement.viewBox.baseVal = 'aString';
+ assert_equals(svgElement.viewBox.baseVal.x, 100);
+ svgElement.viewBox.baseVal = svgElement;
+ assert_equals(svgElement.viewBox.baseVal.x, 100);
+
+ // Check that the viewBox baseVal type has not been changed.
+ assert_true(svgElement.viewBox.baseVal instanceof SVGRect);
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698