4 <script src=
"../../../resources/js-test.js"></script>
8 description('Test for a capturing bug of spin buttons in a type=numnber input.');
10 var parent
= document
.createElement('div');
11 document
.body
.appendChild(parent
);
12 parent
.innerHTML
= '<input type=number id=number value=0 min=0 max=100><input type=number id=another value=1 min=0 max=100>';
13 var numberInput
= document
.getElementById('number');
14 var anotherInput
= document
.getElementById('another');
16 if (window
.eventSender
) {
17 // Reset mouse position
18 eventSender
.mouseMoveTo(0, 0);
20 // Move the cursor on the upper button of the first input field.
21 eventSender
.mouseMoveTo(numberInput
.offsetLeft
+ numberInput
.offsetWidth
- 10, numberInput
.offsetTop
+ numberInput
.offsetHeight
/ 4);
23 // Move the cursor on the upper button of another input field, and click.
24 // There was a bug that a capturing flag of the first input field was not
25 // clear and this click didn't work.
26 eventSender
.mouseMoveTo(anotherInput
.offsetLeft
+ anotherInput
.offsetWidth
- 10, anotherInput
.offsetTop
+ anotherInput
.offsetHeight
/ 4);
27 eventSender
.mouseMoveTo(anotherInput
.offsetLeft
+ anotherInput
.offsetWidth
- 10, anotherInput
.offsetTop
+ anotherInput
.offsetHeight
/ 4 - 1);
28 eventSender
.mouseDown();
29 eventSender
.mouseUp();
30 shouldBe('anotherInput.value', '"2"');
32 parent
.innerHTML
= '';
34 document
.getElementById('console').innerHTML
= '<p>No eventSender. <p>Manual test instruction: Click the upper button of the first input field, then click the upper button of the second input field. Confirm that the second input field value is changed.';