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

Side by Side Diff: third_party/WebKit/LayoutTests/svg/dom/SVGNumber.html

Issue 2741153003: Convert LayoutTests/svg/dom/*.html js-tests.js to testharness.js based tests. (Closed)
Patch Set: Align with review comments Created 3 years, 9 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
OLDNEW
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> 1 <!DOCTYPE HTML>
2 <html> 2 <title>SVGNumber interface</title>
3 <head> 3 <script src="../../resources/testharness.js"></script>
4 <script src="../../resources/js-test.js"></script> 4 <script src="../../resources/testharnessreport.js"></script>
5 </head> 5 <script>
6 <body> 6 test(function() {
7 <p id="description"></p> 7 // This test checks the SVGNumber API.
8 <div id="console"></div> 8
9 <script src="script-tests/SVGNumber.js"></script> 9 var svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg") ;
10 </body> 10 var num = svgElement.createSVGNumber();
11 </html> 11
12 // Check initial number value.
13 assert_equals(num.value, 0);
14
15 // Check assigning number.
16 num.value = 100;
17 assert_equals(num.value, 100);
18 num.value = -100;
19 assert_equals(num.value, -100);
20 num.value = 12345678;
21 assert_equals(num.value, 12345678);
22 num.value = -num.value;
23 assert_equals(num.value, -12345678);
24
25 // Check that numbers are static, caching value in a local variable and modify ing it, should have no effect.
26 var numRef = num.value;
27 numRef = 1000;
28 assert_equals(numRef, 1000);
29 assert_equals(num.value, -12345678);
30
31 // Check assigning invalid number, number should be 0 afterwards.
32 num.value = 0;
33 assert_equals(num.value, 0);
34 assert_throws(new TypeError(), function() { num.value = num; });
35 assert_throws(new TypeError(), function() { num.value = 'aString'; });
36 assert_throws(new TypeError(), function() { num.value = svgElement; });
37 assert_throws(new TypeError(), function() { num.value = NaN; });
38 assert_throws(new TypeError(), function() { num.value = Infinity; });
39 assert_equals(num.value, 0);
40 num.value = null;
41 // Check that the number is now null.
42 assert_equals(num.value, 0);
43 });
44 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698