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";', '"Error: NotSupportedError: DOM Exception 9"')
; | 80 shouldThrow('m.value = "value";', '"NotSupportedError: The implementation did no
t support the requested type of object or operation."'); |
81 | 81 |
82 debug("Set min to NaN"); | 82 debug("Set min to NaN"); |
83 shouldThrow('m.min = NaN;', '"Error: NotSupportedError: DOM Exception 9"'); | 83 shouldThrow('m.min = NaN;', '"NotSupportedError: The implementation did not supp
ort the requested type of object or operation."'); |
84 | 84 |
85 debug("Set max to Infinity"); | 85 debug("Set max to Infinity"); |
86 shouldThrow('m.max = Infinity;', '"Error: NotSupportedError: DOM Exception 9"'); | 86 shouldThrow('m.max = Infinity;', '"NotSupportedError: The implementation did not
support the requested type of object or operation."'); |
87 | 87 |
88 debug("Set low to invalid value"); | 88 debug("Set low to invalid value"); |
89 shouldThrow('m.low = "low";', '"Error: NotSupportedError: DOM Exception 9"'); | 89 shouldThrow('m.low = "low";', '"NotSupportedError: The implementation did not su
pport the requested type of object or operation."'); |
90 | 90 |
91 debug("Set high to NaN"); | 91 debug("Set high to NaN"); |
92 shouldThrow('m.high = NaN;', '"Error: NotSupportedError: DOM Exception 9"'); | 92 shouldThrow('m.high = NaN;', '"NotSupportedError: The implementation did not sup
port the requested type of object or operation."'); |
93 | 93 |
94 debug("Set optimum to Infinity"); | 94 debug("Set optimum to Infinity"); |
95 shouldThrow('m.optimum = Infinity;', '"Error: NotSupportedError: DOM Exception 9
"'); | 95 shouldThrow('m.optimum = Infinity;', '"NotSupportedError: The implementation did
not support the requested type of object or operation."'); |
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 |