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

Side by Side Diff: LayoutTests/fast/dom/HTMLProgressElement/script-tests/set-progress-properties.js

Issue 262753004: Replace all remaining IDL finitude type checks with [TypeChecking=Unrestricted] (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 6 years, 7 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('Test setting valid and invalid properties of HTMLProgressElement.') ; 1 description('Test setting valid and invalid properties of HTMLProgressElement.') ;
2 2
3 var p = document.createElement('progress'); 3 var p = document.createElement('progress');
4 4
5 debug("Test values before properties were set"); 5 debug("Test values before properties were set");
6 shouldBe("p.value", "0"); 6 shouldBe("p.value", "0");
7 shouldBe("p.max", "1"); 7 shouldBe("p.max", "1");
8 shouldBe("p.position", "-1"); 8 shouldBe("p.position", "-1");
9 9
10 debug("Set valid values"); 10 debug("Set valid values");
11 p.value = 7e1; 11 p.value = 7e1;
12 p.max = "1e2"; 12 p.max = "1e2";
13 shouldBe("p.value", "70"); 13 shouldBe("p.value", "70");
14 shouldBe("p.max", "100"); 14 shouldBe("p.max", "100");
15 shouldBe("p.position", "0.7"); 15 shouldBe("p.position", "0.7");
16 16
17 debug("Set value bigger than max"); 17 debug("Set value bigger than max");
18 p.value = 200; 18 p.value = 200;
19 p.max = 100.0; 19 p.max = 100.0;
20 shouldBe("p.value", "100"); 20 shouldBe("p.value", "100");
21 shouldBe("p.max", "100"); 21 shouldBe("p.max", "100");
22 shouldBe("p.position", "1"); 22 shouldBe("p.position", "1");
23 23
24 debug("Set value less than zero"); 24 debug("Set value less than zero");
25 p.value = -42; 25 p.value = -42;
26 shouldBe('p.value', '0'); 26 shouldBe('p.value', '0');
27 shouldBe('p.position', '0'); 27 shouldBe('p.position', '0');
28 28
29 debug("Set invalid value, should throw"); 29 debug("Set invalid value, should throw");
30 shouldThrow('p.value = "200A";', '"TypeError: Failed to set the \'value\' proper ty on \'HTMLProgressElement\': The value provided is not a number."'); 30 shouldThrow('p.value = "200A";');
31 31
32 debug("Set invalid max, should throw"); 32 debug("Set invalid max, should throw");
33 shouldThrow('p.max = "max";', '"TypeError: Failed to set the \'max\' property on \'HTMLProgressElement\': The value provided is not a number."'); 33 shouldThrow('p.max = "max";');
34 34
35 debug("Set max to Infinity, should throw"); 35 debug("Set max to Infinity, should throw");
36 shouldThrow('p.max = Infinity;', '"TypeError: Failed to set the \'max\' property on \'HTMLProgressElement\': The value provided is infinite."'); 36 shouldThrow('p.max = Infinity;');
37 37
38 debug("Set value to NaN, should throw"); 38 debug("Set value to NaN, should throw");
39 shouldThrow('p.value = NaN;', '"TypeError: Failed to set the \'value\' property on \'HTMLProgressElement\': The value provided is not a number."'); 39 shouldThrow('p.value = NaN;');
40 40
41 debug("Set value to null and max to 0"); 41 debug("Set value to null and max to 0");
42 p.value = null; 42 p.value = null;
43 p.max = 0; 43 p.max = 0;
44 shouldBe("p.value", "0"); 44 shouldBe("p.value", "0");
45 shouldBe("p.max", "1"); 45 shouldBe("p.max", "1");
46 shouldBe("p.position", "0"); 46 shouldBe("p.position", "0");
47 47
48 debug("Set attributes to valid numbers"); 48 debug("Set attributes to valid numbers");
49 p.setAttribute("value", 5); 49 p.setAttribute("value", 5);
(...skipping 10 matching lines...) Expand all
60 shouldBe("p.max", "1"); 60 shouldBe("p.max", "1");
61 shouldBe("p.getAttribute('value')", "'ABC'"); 61 shouldBe("p.getAttribute('value')", "'ABC'");
62 shouldBe("p.getAttribute('max')", "'#'"); 62 shouldBe("p.getAttribute('max')", "'#'");
63 63
64 debug("Set value and max to numbers with leading spaces"); 64 debug("Set value and max to numbers with leading spaces");
65 p.setAttribute("value", " 5"); 65 p.setAttribute("value", " 5");
66 p.setAttribute("max", " 10"); 66 p.setAttribute("max", " 10");
67 shouldBe("p.value", "0"); 67 shouldBe("p.value", "0");
68 shouldBe("p.max", "1"); 68 shouldBe("p.max", "1");
69 shouldBe("p.position", "0"); 69 shouldBe("p.position", "0");
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698