OLD | NEW |
1 description('Test setting valid and invalid properties of HTMLMeterElement.'); | 1 description('Test setting valid and invalid properties of HTMLMeterElement.'); |
2 | 2 |
3 var m = document.createElement('meter'); | 3 var m = document.createElement('meter'); |
4 | 4 |
5 debug("Test values before properties were set"); | 5 debug("Test values before properties were set"); |
6 shouldBe("m.min", "0"); | 6 shouldBe("m.min", "0"); |
7 shouldBe("m.value", "0"); | 7 shouldBe("m.value", "0"); |
8 shouldBe("m.max", "1"); | 8 shouldBe("m.max", "1"); |
9 shouldBe("m.low", "0"); | 9 shouldBe("m.low", "0"); |
10 shouldBe("m.high", "1"); | 10 shouldBe("m.high", "1"); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 m.high = 15e2; | 70 m.high = 15e2; |
71 m.optimum = 12.5; | 71 m.optimum = 12.5; |
72 shouldBe("m.min", "0.0"); | 72 shouldBe("m.min", "0.0"); |
73 shouldBe("m.value", "200.0"); | 73 shouldBe("m.value", "200.0"); |
74 shouldBe("m.max", "200.0"); | 74 shouldBe("m.max", "200.0"); |
75 shouldBe("m.low", "0.0"); | 75 shouldBe("m.low", "0.0"); |
76 shouldBe("m.high", "200.0"); | 76 shouldBe("m.high", "200.0"); |
77 shouldBe("m.optimum", "12.5"); | 77 shouldBe("m.optimum", "12.5"); |
78 | 78 |
79 debug("Set value to invalid value"); | 79 debug("Set value to invalid value"); |
80 shouldThrow('m.value = "value";', '"NotSupportedError: Failed to set the \'value
\' property on \'HTMLMeterElement\': The value provided is not a number."'); | 80 shouldThrow('m.value = "value";', '"TypeError: Failed to set the \'value\' prope
rty on \'HTMLMeterElement\': The value provided is not a number."'); |
81 | 81 |
82 debug("Set min to NaN"); | 82 debug("Set min to NaN"); |
83 shouldThrow('m.min = NaN;', '"NotSupportedError: Failed to set the \'min\' prope
rty on \'HTMLMeterElement\': The value provided is not a number."'); | 83 shouldThrow('m.min = NaN;', '"TypeError: Failed to set the \'min\' property on \
'HTMLMeterElement\': The value provided is not a number."'); |
84 | 84 |
85 debug("Set max to Infinity"); | 85 debug("Set max to Infinity"); |
86 shouldThrow('m.max = Infinity;', '"NotSupportedError: Failed to set the \'max\'
property on \'HTMLMeterElement\': The value provided is infinite."'); | 86 shouldThrow('m.max = Infinity;', '"TypeError: Failed to set the \'max\' property
on \'HTMLMeterElement\': The value provided is infinite."'); |
87 | 87 |
88 debug("Set low to invalid value"); | 88 debug("Set low to invalid value"); |
89 shouldThrow('m.low = "low";', '"NotSupportedError: Failed to set the \'low\' pro
perty on \'HTMLMeterElement\': The value provided is not a number."'); | 89 shouldThrow('m.low = "low";', '"TypeError: Failed to set the \'low\' property on
\'HTMLMeterElement\': The value provided is not a number."'); |
90 | 90 |
91 debug("Set high to NaN"); | 91 debug("Set high to NaN"); |
92 shouldThrow('m.high = NaN;', '"NotSupportedError: Failed to set the \'high\' pro
perty on \'HTMLMeterElement\': The value provided is not a number."'); | 92 shouldThrow('m.high = NaN;', '"TypeError: Failed to set the \'high\' property on
\'HTMLMeterElement\': The value provided is not a number."'); |
93 | 93 |
94 debug("Set optimum to Infinity"); | 94 debug("Set optimum to Infinity"); |
95 shouldThrow('m.optimum = Infinity;', '"NotSupportedError: Failed to set the \'op
timum\' property on \'HTMLMeterElement\': The value provided is infinite."'); | 95 shouldThrow('m.optimum = Infinity;', '"TypeError: Failed to set the \'optimum\'
property on \'HTMLMeterElement\': The value provided is infinite."'); |
96 | 96 |
97 debug("Set attributes to valid numbers"); | 97 debug("Set attributes to valid numbers"); |
98 m.setAttribute("min", 0); | 98 m.setAttribute("min", 0); |
99 m.setAttribute("value", 5); | 99 m.setAttribute("value", 5); |
100 m.setAttribute("max", 10); | 100 m.setAttribute("max", 10); |
101 shouldBe("m.value", "5"); | 101 shouldBe("m.value", "5"); |
102 shouldBe("m.max", "10"); | 102 shouldBe("m.max", "10"); |
103 shouldBe("parseInt(m.getAttribute('value'))", "5"); | 103 shouldBe("parseInt(m.getAttribute('value'))", "5"); |
104 shouldBe("parseInt(m.getAttribute('max'))", "10"); | 104 shouldBe("parseInt(m.getAttribute('max'))", "10"); |
105 | 105 |
(...skipping 12 matching lines...) Expand all Loading... |
118 m.setAttribute("low", " 5"); | 118 m.setAttribute("low", " 5"); |
119 m.setAttribute("high", " 5"); | 119 m.setAttribute("high", " 5"); |
120 m.setAttribute("optimum", " 5"); | 120 m.setAttribute("optimum", " 5"); |
121 shouldBe("m.value", "0"); | 121 shouldBe("m.value", "0"); |
122 shouldBe("m.min", "0"); | 122 shouldBe("m.min", "0"); |
123 shouldBe("m.max", "1"); | 123 shouldBe("m.max", "1"); |
124 shouldBe("m.low", "0"); | 124 shouldBe("m.low", "0"); |
125 shouldBe("m.high", "1"); | 125 shouldBe("m.high", "1"); |
126 shouldBe("m.optimum", "0.5"); | 126 shouldBe("m.optimum", "0.5"); |
127 | 127 |
OLD | NEW |