4 <script src=
"../../../resources/js-test.js"></script>
8 description('Test for keyboard operations for <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');
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"');