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

Side by Side Diff: LayoutTests/svg/dom/script-tests/SVGNumber.js

Issue 930053002: Apply TypeChecking=Unrestricted to SVG{Number,Length,Transform,Angle} (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 description("This test checks the SVGNumber API"); 1 description("This test checks the SVGNumber API");
2 2
3 var svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg"); 3 var svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg");
4 var num = svgElement.createSVGNumber(); 4 var num = svgElement.createSVGNumber();
5 5
6 debug(""); 6 debug("");
7 debug("Check initial number value"); 7 debug("Check initial number value");
8 shouldBe("num.value", "0"); 8 shouldBe("num.value", "0");
9 9
10 debug(""); 10 debug("");
11 debug("Check assigning number"); 11 debug("Check assigning number");
12 shouldBe("num.value = 100", "100"); 12 shouldBe("num.value = 100", "100");
13 shouldBe("num.value = -100", "-100"); 13 shouldBe("num.value = -100", "-100");
14 shouldBe("num.value = 12345678", "12345678"); 14 shouldBe("num.value = 12345678", "12345678");
15 shouldBe("num.value = -num.value", "-12345678"); 15 shouldBe("num.value = -num.value", "-12345678");
16 16
17 debug(""); 17 debug("");
18 debug("Check that numbers are static, caching value in a local variable and modi fying it, should have no effect"); 18 debug("Check that numbers are static, caching value in a local variable and modi fying it, should have no effect");
19 var numRef = num.value; 19 var numRef = num.value;
20 numRef = 1000; 20 numRef = 1000;
21 shouldBe("numRef", "1000"); 21 shouldBe("numRef", "1000");
22 shouldBe("num.value", "-12345678"); 22 shouldBe("num.value", "-12345678");
23 23
24 debug(""); 24 debug("");
25 debug("Check assigning invalid number, number should be 0 afterwards"); 25 debug("Check assigning invalid number, number should be 0 afterwards");
26 shouldBe("num.value = num", "num"); 26 shouldBe("num.value = 0", "0");
27 shouldBe("num.value = 'aString'", "'aString'"); 27 shouldThrow("num.value = num");
28 shouldBe("num.value = svgElement", "svgElement"); 28 shouldThrow("num.value = 'aString'");
29 shouldBe("num.value", "NaN"); 29 shouldThrow("num.value = svgElement");
30 shouldThrow("num.value = NaN");
31 shouldThrow("num.value = Infinity");
32 shouldBe("num.value", "0");
30 shouldBeNull("num.value = null"); 33 shouldBeNull("num.value = null");
31 34
32 debug(""); 35 debug("");
33 debug("Check that the number is now null"); 36 debug("Check that the number is now null");
34 shouldBe("num.value", "0"); 37 shouldBe("num.value", "0");
35 38
36 successfullyParsed = true; 39 successfullyParsed = true;
OLDNEW
« no previous file with comments | « LayoutTests/svg/dom/script-tests/SVGLength.js ('k') | LayoutTests/svg/dom/script-tests/SVGTransform.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698