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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/dom/HTMLMeterElement/set-meter-properties.html

Issue 2667393002: Stop using script-tests in fast/dom/. (Closed)
Patch Set: . 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../../../resources/js-test.js"></script> 4 <script src="../../../resources/js-test.js"></script>
5 </head> 5 </head>
6 <body> 6 <body>
7 <script src="script-tests/set-meter-properties.js"></script> 7 <script>
8 description('Test setting valid and invalid properties of HTMLMeterElement.');
9
10 var m = document.createElement('meter');
11
12 debug("Test values before properties were set");
13 shouldBe("m.min", "0");
14 shouldBe("m.value", "0");
15 shouldBe("m.max", "1");
16 shouldBe("m.low", "0");
17 shouldBe("m.high", "1");
18 shouldBe("m.optimum", "0.5");
19
20 debug("Set valid values");
21 m.min = "-10";
22 m.value = 7e1;
23 m.max = "1e2";
24 m.low = "10.1";
25 m.high = "99.5";
26 m.optimum = "70";
27 shouldBe("m.min", "-10");
28 shouldBe("m.value", "70");
29 shouldBe("m.max", "100");
30 shouldBe("m.low", "10.1");
31 shouldBe("m.high", "99.5");
32 shouldBe("m.optimum", "70");
33
34 debug("Set attributes to improper values - 1");
35 m.min = -10;
36 m.value = 200;
37 m.max = 100.0;
38 m.low = 200;
39 m.high = -50;
40 m.optimum = null;
41 shouldBe("m.min", "-10");
42 shouldBe("m.value", "100");
43 shouldBe("m.max", "100");
44 shouldBe("m.low", "100");
45 shouldBe("m.high", "100");
46 shouldBe("m.optimum", "0");
47
48 debug("Set attributes to improper values - 2");
49 m.min = 200.0;
50 m.value = -200.0;
51 m.max = 0;
52 m.low = null;
53 shouldBe("m.min", "200.0");
54 shouldBe("m.value", "200.0");
55 shouldBe("m.max", "200.0");
56 shouldBe("m.low", "200.0");
57
58 debug("Set attributes to improper values - 3");
59 m.min = 100.0;
60 m.value = 200.0;
61 m.max = 50;
62 m.low = 10;
63 m.high = 15e1;
64 m.optimum = 12.5;
65 shouldBe("m.min", "100.0");
66 shouldBe("m.value", "100.0");
67 shouldBe("m.max", "100.0");
68 shouldBe("m.low", "100.0");
69 shouldBe("m.high", "100.0");
70 shouldBe("m.optimum", "100.0");
71
72 debug("Set attributes to improper values - 4");
73 m.min = 0.0;
74 m.value = 250.0;
75 m.max = 200;
76 m.low = -10;
77 m.high = 15e2;
78 m.optimum = 12.5;
79 shouldBe("m.min", "0.0");
80 shouldBe("m.value", "200.0");
81 shouldBe("m.max", "200.0");
82 shouldBe("m.low", "0.0");
83 shouldBe("m.high", "200.0");
84 shouldBe("m.optimum", "12.5");
85
86 debug("Set value to invalid value");
87 shouldThrow('m.value = "value";');
88
89 debug("Set min to NaN");
90 shouldThrow('m.min = NaN;');
91
92 debug("Set max to Infinity");
93 shouldThrow('m.max = Infinity;');
94
95 debug("Set low to invalid value");
96 shouldThrow('m.low = "low";');
97
98 debug("Set high to NaN");
99 shouldThrow('m.high = NaN;');
100
101 debug("Set optimum to Infinity");
102 shouldThrow('m.optimum = Infinity;');
103
104 debug("Set attributes to valid numbers");
105 m.setAttribute("min", 0);
106 m.setAttribute("value", 5);
107 m.setAttribute("max", 10);
108 shouldBe("m.value", "5");
109 shouldBe("m.max", "10");
110 shouldBe("parseInt(m.getAttribute('value'))", "5");
111 shouldBe("parseInt(m.getAttribute('max'))", "10");
112
113 debug("Set attributes to invalid values");
114 m.setAttribute("value", "ABC");
115 m.setAttribute("max", "#");
116 shouldBe("m.value", "0");
117 shouldBe("m.max", "1");
118 shouldBe("m.getAttribute('value')", "'ABC'");
119 shouldBe("m.getAttribute('max')", "'#'");
120
121 debug("Set attributes to numbers with leading spaces");
122 m.setAttribute("value", " 5");
123 m.setAttribute("min", " 5");
124 m.setAttribute("max", " 5");
125 m.setAttribute("low", " 5");
126 m.setAttribute("high", " 5");
127 m.setAttribute("optimum", " 5");
128 shouldBe("m.value", "0");
129 shouldBe("m.min", "0");
130 shouldBe("m.max", "1");
131 shouldBe("m.low", "0");
132 shouldBe("m.high", "1");
133 shouldBe("m.optimum", "0.5");
134
135 </script>
8 </body> 136 </body>
9 </html> 137 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698