OLD | NEW |
1 var inputEventCounter = 0; | 1 var inputEventCounter = 0; |
2 var changeEventCounter = 0; | 2 var changeEventCounter = 0; |
3 var testInput; | 3 var testInput; |
4 | 4 |
5 function testSpinButtonChangeAndInputEvents(inputType, initialValue, expectedVal
ue, maximumValue) | 5 function testSpinButtonChangeAndInputEvents(inputType, initialValue, expectedVal
ue, maximumValue) |
6 { | 6 { |
7 description('Test for event dispatching by spin buttons in a type=' + inputT
ype + ' input.'); | 7 description('Test for event dispatching by spin buttons in a type=' + inputT
ype + ' input.'); |
8 if (!window.eventSender) { | 8 if (!window.eventSender) { |
9 debug('No eventSender'); | 9 debug('No eventSender'); |
10 return; | 10 return; |
(...skipping 16 matching lines...) Expand all Loading... |
27 eventSender.mouseMoveTo(0, 0); | 27 eventSender.mouseMoveTo(0, 0); |
28 shouldEvaluateTo('changeEventCounter', 0); | 28 shouldEvaluateTo('changeEventCounter', 0); |
29 shouldEvaluateTo('inputEventCounter', 0); | 29 shouldEvaluateTo('inputEventCounter', 0); |
30 testInput.focus(); | 30 testInput.focus(); |
31 | 31 |
32 debug('Click the upper button'); | 32 debug('Click the upper button'); |
33 // Move the cursor on the upper button. | 33 // Move the cursor on the upper button. |
34 var spinButton = getElementByPseudoId(internals.oldestShadowRoot(testInput),
"-webkit-inner-spin-button"); | 34 var spinButton = getElementByPseudoId(internals.oldestShadowRoot(testInput),
"-webkit-inner-spin-button"); |
35 eventSender.mouseMoveTo(testInput.offsetLeft + spinButton.offsetLeft, testIn
put.offsetTop + testInput.offsetHeight / 4); | 35 eventSender.mouseMoveTo(testInput.offsetLeft + spinButton.offsetLeft, testIn
put.offsetTop + testInput.offsetHeight / 4); |
36 eventSender.mouseDown(); | 36 eventSender.mouseDown(); |
| 37 debug('Triggers only input event'); |
| 38 shouldBeEqualToString('testInput.value', expectedValue); |
| 39 shouldEvaluateTo('changeEventCounter', 0); |
| 40 shouldEvaluateTo('inputEventCounter', 1); |
| 41 debug('Triggers only change event'); |
37 eventSender.mouseUp(); | 42 eventSender.mouseUp(); |
38 shouldBeEqualToString('testInput.value', expectedValue); | |
39 shouldEvaluateTo('changeEventCounter', 1); | 43 shouldEvaluateTo('changeEventCounter', 1); |
40 shouldEvaluateTo('inputEventCounter', 1); | 44 shouldEvaluateTo('inputEventCounter', 1); |
41 | 45 |
42 if (testInput.hasAttribute("max")) { | 46 if (testInput.hasAttribute("max")) { |
43 debug('Click again, but the value is not changed.'); | 47 debug('Click again, but the value is not changed.'); |
44 eventSender.mouseDown(); | 48 eventSender.mouseDown(); |
45 eventSender.mouseUp(); | 49 eventSender.mouseUp(); |
46 shouldBeEqualToString('testInput.value', expectedValue); | 50 shouldBeEqualToString('testInput.value', expectedValue); |
47 shouldEvaluateTo('changeEventCounter', 1); | 51 shouldEvaluateTo('changeEventCounter', 1); |
48 shouldEvaluateTo('inputEventCounter', 1); | 52 shouldEvaluateTo('inputEventCounter', 1); |
49 } | 53 } |
50 | 54 |
51 debug('Focus on another field'); | 55 debug('Focus on another field'); |
52 anotherInput.focus(); | 56 anotherInput.focus(); |
53 shouldEvaluateTo('changeEventCounter', 1); | 57 shouldEvaluateTo('changeEventCounter', 1); |
54 shouldEvaluateTo('inputEventCounter', 1); | 58 shouldEvaluateTo('inputEventCounter', 1); |
55 | 59 |
56 parent.innerHTML = ''; | 60 parent.innerHTML = ''; |
57 } | 61 } |
OLD | NEW |