Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / forms / number / number-keyoperation.html
blob5e75705bf2eff3509eaaca417e930f08a347cb4a
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../../resources/js-test.js"></script>
5 </head>
6 <body>
7 <script>
8 description('Test for keyboard operations for &lt;input type=number>');
9 var parent = document.createElement('div');
10 document.body.appendChild(parent);
11 parent.innerHTML = '<input type=number id=number>';
13 var input = document.getElementById('number');
14 input.focus();
15 debug('Inserting "ab123cd":');
16 document.execCommand('InsertText', false, 'ab123cd');
17 shouldBeEqualToString('input.value', '123');
19 debug('Press the up arrow key:');
20 input.valueAsNumber = 123;
21 eventSender.keyDown('upArrow');
22 shouldBe('input.value', '"124"');
24 debug('Press the down arrow key:');
25 eventSender.keyDown('downArrow');
26 shouldBe('input.value', '"123"');
28 debug('Press the down and alt arrow key, should not decrement value:');
29 eventSender.keyDown('downArrow', ['altKey']);
30 shouldBeEqualToString('input.value', '123');
32 debug('Disable input element:');
33 input.disabled = true;
34 eventSender.keyDown('upArrow');
35 shouldBe('input.value', '"123"');
36 input.removeAttribute('disabled');
38 debug('Read-only input element:');
39 input.readOnly = true;
40 eventSender.keyDown('upArrow');
41 shouldBe('input.value', '"123"');
42 </script>
43 </body>
44 </html>