| 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 <script> | 7 <script> |
| 8 description('Test for spinbutton behavior for out-of-range values.'); | 8 description('Test for spinbutton behavior for out-of-range values.'); |
| 9 | 9 |
| 10 var parent = document.createElement('div'); | 10 var parent = document.createElement('div'); |
| 11 document.body.appendChild(parent); | 11 document.body.appendChild(parent); |
| 12 parent.innerHTML = '<input type=number id=lower value=-10 min=0 max=100>' | 12 parent.innerHTML = '<input type=number id=lower value=-10 min=0 max=100>' |
| 13 + '<input type=number id=higher value=200 min=0 max=100>'; | 13 + '<input type=number id=higher value=200 min=0 max=100>'; |
| 14 var lower = document.getElementById('lower'); | 14 var lower = document.getElementById('lower'); |
| 15 var higher = document.getElementById('higher'); | 15 var higher = document.getElementById('higher'); |
| 16 | 16 |
| 17 function sendKeyEvent(element, key) | 17 function sendKeyEvent(element, key) |
| 18 { | 18 { |
| 19 element.focus(); | 19 element.focus(); |
| 20 eventSender.keyDown(key); | 20 eventSender.keyDown(key); |
| 21 } | 21 } |
| 22 | 22 |
| 23 debug('Pressing the down arrow key on an input field of which value is lower tha
n the minimum:'); | 23 debug('Pressing the down arrow key on an input field of which value is lower tha
n the minimum:'); |
| 24 sendKeyEvent(lower, 'downArrow'); | 24 sendKeyEvent(lower, 'ArrowDown'); |
| 25 var unchanged = "-10"; | 25 var unchanged = "-10"; |
| 26 shouldBe('lower.value', 'unchanged'); | 26 shouldBe('lower.value', 'unchanged'); |
| 27 | 27 |
| 28 debug('Pressing the up arrow key on the input:'); | 28 debug('Pressing the up arrow key on the input:'); |
| 29 sendKeyEvent(lower, 'upArrow'); | 29 sendKeyEvent(lower, 'ArrowUp'); |
| 30 shouldBe('lower.value', 'lower.min'); | 30 shouldBe('lower.value', 'lower.min'); |
| 31 | 31 |
| 32 debug('Pressing the up arrow key on an input field of which value is higher than
the maximum:'); | 32 debug('Pressing the up arrow key on an input field of which value is higher than
the maximum:'); |
| 33 sendKeyEvent(higher, 'upArrow'); | 33 sendKeyEvent(higher, 'ArrowUp'); |
| 34 unchanged = "200"; | 34 unchanged = "200"; |
| 35 shouldBe('higher.value', 'unchanged'); | 35 shouldBe('higher.value', 'unchanged'); |
| 36 | 36 |
| 37 debug('Pressing the down arrow key on the input:'); | 37 debug('Pressing the down arrow key on the input:'); |
| 38 sendKeyEvent(higher, 'downArrow'); | 38 sendKeyEvent(higher, 'ArrowDown'); |
| 39 shouldBe('higher.value', 'higher.max'); | 39 shouldBe('higher.value', 'higher.max'); |
| 40 | 40 |
| 41 parent.innerHTML = ''; | 41 parent.innerHTML = ''; |
| 42 </script> | 42 </script> |
| 43 </body> | 43 </body> |
| 44 </html> | 44 </html> |
| OLD | NEW |