Index: third_party/WebKit/LayoutTests/svg/dom/SVGNumber.html |
diff --git a/third_party/WebKit/LayoutTests/svg/dom/SVGNumber.html b/third_party/WebKit/LayoutTests/svg/dom/SVGNumber.html |
index 1b141b80d8e5631cf3e93626d6e35c5d88f086b3..66460fed571a0a106eea515dca4c865e605fbf8c 100644 |
--- a/third_party/WebKit/LayoutTests/svg/dom/SVGNumber.html |
+++ b/third_party/WebKit/LayoutTests/svg/dom/SVGNumber.html |
@@ -1,11 +1,44 @@ |
-<!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/SVGNumber.js"></script> |
-</body> |
-</html> |
+<!DOCTYPE HTML> |
+<title>SVGNumber interface</title> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
+<script> |
+test(function() { |
+ // This test checks the SVGNumber API. |
+ |
+ var svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg"); |
+ var num = svgElement.createSVGNumber(); |
+ |
+ // Check initial number value. |
+ assert_equals(num.value, 0); |
+ |
+ // Check assigning number. |
+ num.value = 100; |
+ assert_equals(num.value, 100); |
+ num.value = -100; |
+ assert_equals(num.value, -100); |
+ num.value = 12345678; |
+ assert_equals(num.value, 12345678); |
+ num.value = -num.value; |
+ assert_equals(num.value, -12345678); |
+ |
+ // Check that numbers are static, caching value in a local variable and modifying it, should have no effect. |
+ var numRef = num.value; |
+ numRef = 1000; |
+ assert_equals(numRef, 1000); |
+ assert_equals(num.value, -12345678); |
+ |
+ // Check assigning invalid number, number should be 0 afterwards. |
+ num.value = 0; |
+ assert_equals(num.value, 0); |
+ assert_throws(new TypeError(), function() { num.value = num; }); |
+ assert_throws(new TypeError(), function() { num.value = 'aString'; }); |
+ assert_throws(new TypeError(), function() { num.value = svgElement; }); |
+ assert_throws(new TypeError(), function() { num.value = NaN; }); |
+ assert_throws(new TypeError(), function() { num.value = Infinity; }); |
+ assert_equals(num.value, 0); |
+ num.value = null; |
+ // Check that the number is now null. |
+ assert_equals(num.value, 0); |
+}); |
+</script> |