OLD | NEW |
---|---|
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
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 <p id="description"></p> | 7 <p id="description"></p> |
8 <div id="console"></div> | 8 <div id="console"></div> |
9 <script> | 9 <script> |
10 description('Check stepUp() and stepDown() bahevior for range type.'); | 10 description('Check stepUp() and stepDown() behavior for range type.'); |
11 | 11 |
12 var input; | 12 var input; |
13 | 13 |
14 function createRangeElement() { | 14 function createRangeElement() { |
15 input = document.createElement('input'); | 15 input = document.createElement('input'); |
16 input.type = 'range'; | 16 input.type = 'range'; |
17 } | 17 } |
18 | 18 |
19 function setInputAttributes(min, max, step, value) { | 19 function setInputAttributes(min, max, step, value) { |
20 input.min = min; | 20 input.min = min; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
101 shouldBeEqualToString('stepUpExplicitBounds(null, null, "0", "1")', '2'); | 101 shouldBeEqualToString('stepUpExplicitBounds(null, null, "0", "1")', '2'); |
102 shouldBeEqualToString('stepUpExplicitBounds(null, null, "-1", "2")', '3'); | 102 shouldBeEqualToString('stepUpExplicitBounds(null, null, "-1", "2")', '3'); |
103 shouldBeEqualToString('stepDownExplicitBounds(null, null, "foo", "1")', '0'); | 103 shouldBeEqualToString('stepDownExplicitBounds(null, null, "foo", "1")', '0'); |
104 shouldBeEqualToString('stepDownExplicitBounds(null, null, "0", "2")', '1'); | 104 shouldBeEqualToString('stepDownExplicitBounds(null, null, "0", "2")', '1'); |
105 shouldBeEqualToString('stepDownExplicitBounds(null, null, "-1", "3")', '2'); | 105 shouldBeEqualToString('stepDownExplicitBounds(null, null, "-1", "3")', '2'); |
106 debug('Step bases'); | 106 debug('Step bases'); |
107 shouldBeEqualToString('createInputWithContentAttributes(0, 100, "20", "50"); inp ut.value', '60'); | 107 shouldBeEqualToString('createInputWithContentAttributes(0, 100, "20", "50"); inp ut.value', '60'); |
108 shouldBeEqualToString('createInputWithContentAttributes(null, null, "50", "25"); input.value', '25'); | 108 shouldBeEqualToString('createInputWithContentAttributes(null, null, "50", "25"); input.value', '25'); |
109 shouldBeEqualToString('createInputWithContentAttributes(null, null, "50", "25"); input.stepUp(1); input.value', '75'); | 109 shouldBeEqualToString('createInputWithContentAttributes(null, null, "50", "25"); input.stepUp(1); input.value', '75'); |
110 shouldBeEqualToString('createInputWithContentAttributes(null, null, "50", "25"); input.stepUp(1); input.stepDown(1); input.value', '25'); | 110 shouldBeEqualToString('createInputWithContentAttributes(null, null, "50", "25"); input.stepUp(1); input.stepDown(1); input.value', '25'); |
111 // FIXME: these shouldn't throw according to the spec; commented-out version giv e its expected outcomes. | 111 // FIXME: these shouldn't throw according to the spec; commented-out version giv e its expected outcomes. |
keishi
2014/02/05 02:26:36
Do we need to keep this?
sof
2014/02/05 07:48:54
Sorry, an oversight to leave this behind. Removed
| |
112 shouldThrow('createInputWithContentAttributes(null, null, "50", "25"); input.ste pUp(2); input.stepDown(2);'); | 112 //shouldThrow('createInputWithContentAttributes(null, null, "50", "25"); input.s tepUp(2); input.stepDown(2);'); |
113 shouldThrow('createInputWithContentAttributes(null, null, "7", "22"); input.step Up(40);'); | 113 //shouldThrow('createInputWithContentAttributes(null, null, "7", "22"); input.st epUp(40);'); |
114 //shouldBeEqualToString('createInputWithContentAttributes(null, null, "50", "25" ); input.stepUp(2); input.stepDown(2); input.value', '25'); | 114 shouldBeEqualToString('createInputWithContentAttributes(null, null, "50", "25"); input.stepUp(2); input.stepDown(2); input.value', '25'); |
115 //shouldBeEqualToString('createInputWithContentAttributes(null, null, "7", "22") ; input.stepUp(40); input.value', '99'); | 115 shouldBeEqualToString('createInputWithContentAttributes(null, null, "7", "22"); input.stepUp(40); input.value', '99'); |
116 | 116 |
117 // Reset 'input' for follow-on tests. | 117 // Reset 'input' for follow-on tests. |
118 createRangeElement(); | 118 createRangeElement(); |
119 debug('Step=any'); | 119 debug('Step=any'); |
120 shouldThrow('stepUpExplicitBounds(null, null, "any", "1")'); | 120 shouldThrow('stepUpExplicitBounds(null, null, "any", "1")'); |
121 shouldThrow('stepDownExplicitBounds(null, null, "any", "1")'); | 121 shouldThrow('stepDownExplicitBounds(null, null, "any", "1")'); |
122 debug('Overflow/underflow'); | 122 debug('Overflow/underflow'); |
123 shouldBeEqualToString('stepUpExplicitBounds(null, "100", "1", "99")', '100'); | 123 shouldBeEqualToString('stepUpExplicitBounds(null, "100", "1", "99")', '100'); |
124 shouldThrow('stepUpExplicitBounds(null, "100", "1", "100")'); | 124 shouldBeEqualToString('stepUpExplicitBounds(null, "100", "1", "100")', '100'); |
125 shouldBeEqualToString('input.value', '100'); | 125 shouldBeEqualToString('stepUpExplicitBounds(null, "100", "1", "99", "2")', '100' ); |
126 shouldThrow('stepUpExplicitBounds(null, "100", "1", "99", "2")'); | |
127 shouldBeEqualToString('input.value', '99'); | |
128 shouldBeEqualToString('stepDownExplicitBounds("0", null, "1", "1")', '0'); | 126 shouldBeEqualToString('stepDownExplicitBounds("0", null, "1", "1")', '0'); |
129 shouldThrow('stepDownExplicitBounds("0", null, "1", "0")'); | 127 shouldBeEqualToString('stepDownExplicitBounds("0", null, "1", "0")', '0'); |
130 shouldBeEqualToString('input.value', '0'); | 128 shouldBeEqualToString('stepDownExplicitBounds("0", null, "1", "1", "2")', '0'); |
131 shouldThrow('stepDownExplicitBounds("0", null, "1", "1", "2")'); | 129 shouldBeEqualToString('stepDownExplicitBounds(null, null, "3.40282346e+38", "1", "2")', '0'); |
132 shouldBeEqualToString('input.value', '1'); | |
133 shouldThrow('stepDownExplicitBounds(null, null, "3.40282346e+38", "1", "2")'); | |
134 shouldBeEqualToString('stepUpExplicitBounds(-100, 0, 1, -1)', '0'); | 130 shouldBeEqualToString('stepUpExplicitBounds(-100, 0, 1, -1)', '0'); |
135 shouldThrow('stepUpExplicitBounds(null, 0, 1, 0)'); | 131 shouldBeEqualToString('stepUpExplicitBounds(null, 0, 1, 0)', '0'); |
136 shouldThrow('stepUpExplicitBounds(-100, 0, 1, -1, 2)'); | 132 shouldBeEqualToString('stepUpExplicitBounds(-100, 0, 1, -1, 2)', '0'); |
137 shouldBeEqualToString('input.value', '-1'); | 133 shouldBeEqualToString('stepUpExplicitBounds(null, null, "3.40282346e+38", "1", " 2")', '0'); |
138 shouldThrow('stepUpExplicitBounds(null, null, "3.40282346e+38", "1", "2")'); | |
139 debug('stepDown()/stepUp() for stepMismatch values'); | 134 debug('stepDown()/stepUp() for stepMismatch values'); |
140 shouldBeEqualToString('stepUpExplicitBounds(null, null, 2, 1)', '4'); | 135 shouldBeEqualToString('stepUpExplicitBounds(null, null, 2, 1)', '4'); |
141 shouldBeEqualToString('input.stepDown(); input.value', '2'); | 136 shouldBeEqualToString('input.stepDown(); input.value', '2'); |
142 shouldBeEqualToString('stepUpExplicitBounds(0, null, 10, 9, 9)', '100'); | 137 shouldBeEqualToString('stepUpExplicitBounds(0, null, 10, 9, 9)', '100'); |
143 shouldBeEqualToString('stepDownExplicitBounds(0, null, 10, 19)', '10'); | 138 shouldBeEqualToString('stepDownExplicitBounds(0, null, 10, 19)', '10'); |
144 debug('value + step is <= max, but rounded result would be > max.'); | 139 debug('value + step is <= max, but rounded result would be > max.'); |
145 shouldThrow('stepUpExplicitBounds(null, 99, 10, 89)'); | 140 shouldBeEqualToString('stepUpExplicitBounds(null, 99, 10, 89)', '90'); |
141 shouldBeEqualToString('stepUpExplicitBounds(null, 99, 10, 89, 21)', '90'); | |
142 shouldBeEqualToString('stepUpExplicitBounds(null, 99, 10, 77, 2)', '90'); | |
146 debug('Huge value and small step'); | 143 debug('Huge value and small step'); |
147 shouldBeEqualToString('stepUpExplicitBounds(0, 1e38, 1, 1e38, 999999)', '1e+38') ; | 144 shouldBeEqualToString('stepUpExplicitBounds(0, 1e38, 1, 1e38, 999999)', '1e+38') ; |
148 shouldBeEqualToString('stepDownExplicitBounds(0, 1e38, 1, 1e38, 999999)', '1e+38 '); | 145 shouldBeEqualToString('stepDownExplicitBounds(0, 1e38, 1, 1e38, 999999)', '1e+38 '); |
149 debug('Fractional numbers'); | 146 debug('Fractional numbers'); |
150 shouldBeEqualToString('stepUpExplicitBounds(null, null, 0.33333333333333333, 0, 3)', '1'); | 147 shouldBeEqualToString('stepUpExplicitBounds(null, null, 0.33333333333333333, 0, 3)', '1'); |
151 shouldBeEqualToString('stepUpExplicitBounds(null, null, 0.1, 1)', '1.1'); | 148 shouldBeEqualToString('stepUpExplicitBounds(null, null, 0.1, 1)', '1.1'); |
152 shouldBeEqualToString('stepUpExplicitBounds(null, null, 0.1, 1, 8)', '1.8'); | 149 shouldBeEqualToString('stepUpExplicitBounds(null, null, 0.1, 1, 8)', '1.8'); |
153 shouldBeEqualToString('stepUpExplicitBounds(null, null, 0.1, 1, 10)', '2'); | 150 shouldBeEqualToString('stepUpExplicitBounds(null, null, 0.1, 1, 10)', '2'); |
154 shouldBeEqualToString('input.stepUp(); input.stepUp(); input.stepUp(); input.ste pUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.ste pUp(); input.stepUp(); input.value', '3'); | 151 shouldBeEqualToString('input.stepUp(); input.stepUp(); input.stepUp(); input.ste pUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.ste pUp(); input.stepUp(); input.value', '3'); |
155 shouldBeEqualToString('stepUpExplicitBounds(0, 1, 0.003921568627450980, 0, 255)' , '1'); | 152 shouldBeEqualToString('stepUpExplicitBounds(0, 1, 0.003921568627450980, 0, 255)' , '1'); |
156 shouldBeEqualToString('for (var i = 0; i < 255; i++) { input.stepDown(); }; inpu t.value', '0'); | 153 shouldBeEqualToString('for (var i = 0; i < 255; i++) { input.stepDown(); }; inpu t.value', '0'); |
157 shouldBeEqualToString('stepDownExplicitBounds(null, null, 0.1, 1, 8)', '0.2'); | 154 shouldBeEqualToString('stepDownExplicitBounds(null, null, 0.1, 1, 8)', '0.2'); |
158 shouldBeEqualToString('stepDownExplicitBounds(null, null, 0.1, 1)', '0.9'); | 155 shouldBeEqualToString('stepDownExplicitBounds(null, null, 0.1, 1)', '0.9'); |
159 </script> | 156 </script> |
160 </body> | 157 </body> |
161 </html> | 158 </html> |
OLD | NEW |