4 <script src=
"../../../resources/js-test.js"></script>
7 <input id=
"readonlyNumber" type=
"number" onmouseup=
"mouseupEventOnReadonlyNumber()" />
8 <input id=
"disabledNumber" type=
"number" onmouseup=
"mouseupEventOnDisabledNumber()" />
10 This tests if the value of a number input form does not continue
11 to increase/decrease in the following scenario.
<br/>
12 (
1) Click the spin button of the input form.
<br/>
13 (
2) Hook the 'mouseup' event and disable the input form.
<br/>
14 (
3) Enable the input form after some delay.
<br/>
15 To run this test manually, input any value in the input form
16 and then click the spin-down button.
17 At this point, click the spin-down button quickly and
18 do not move the cursor from the spin-down button after the click.
19 If the value decreases by just
1, this test passes.
21 <div id=
"console"></div>
27 window
.jsTestIsAsync
= true;
29 if (window
.testRunner
&& window
.eventSender
) {
30 testInputs
= [document
.getElementById("readonlyNumber"), document
.getElementById("disabledNumber")];
31 setTimeout(function() {
36 function nextInputTest() {
37 if (testInputs
.length
== 0) {
40 input
= testInputs
.shift();
42 testDelays
= [1, 10, 100];
44 debug("Test on a " + (input
.id
== "readonlyNumber" ? "readonly" : "disabled") + " number input form:");
49 function nextDelayTest() {
50 if (testDelays
.length
== 0) {
53 delay
= testDelays
.shift();
54 initializeInputAttributes(input
, 1234567);
55 debug("delay = " + delay
+ " ms");
56 clickSpinDownButton(input
);
57 setTimeout(function() {
58 shouldBeEqualToString('input.value', "1234566");
64 function mouseupEventOnReadonlyNumber() {
65 input
.readOnly
= true;
66 setTimeout(function() {
67 input
.readOnly
= false;
71 function mouseupEventOnDisabledNumber() {
72 input
.disabled
= true;
73 setTimeout(function() {
74 input
.disabled
= false;
78 function initializeInputAttributes(input
, value
) {
80 input
.disabled
= false;
81 input
.readOnly
= false;
84 function clickSpinDownButton(input
) {
85 var x
= input
.offsetLeft
+ input
.offsetWidth
- 6;
86 var y
= input
.offsetTop
+ input
.offsetHeight
- 6;
87 eventSender
.mouseMoveTo(x
, y
);
88 eventSender
.mouseDown();
89 eventSender
.mouseUp();