OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script> | 3 <script> |
4 function log(msg) | 4 function log(msg) |
5 { | 5 { |
6 var res = document.getElementById('res'); | 6 var res = document.getElementById('res'); |
7 res.innerHTML = res.innerHTML + msg + "<br>"; | 7 res.innerHTML = res.innerHTML + msg + "<br>"; |
8 } | 8 } |
9 function test() | 9 function test() |
10 { | 10 { |
11 var slider = document.getElementById('slider'); | 11 var slider = document.getElementById('slider'); |
12 if (window.testRunner) { | 12 if (window.testRunner) { |
13 testRunner.dumpAsText(); | 13 testRunner.dumpAsText(); |
14 // slider drag | 14 // slider drag |
15 eventSender.mouseMoveTo(slider.offsetLeft + 7, slider.offset
Top + 7); | 15 eventSender.mouseMoveTo(slider.offsetLeft + 7, slider.offset
Top + 7); |
16 eventSender.mouseDown(); | 16 eventSender.mouseDown(); |
17 eventSender.mouseMoveTo(slider.offsetLeft + 50, slider.offse
tTop + 50); | 17 eventSender.mouseMoveTo(slider.offsetLeft + 50, slider.offse
tTop + 50); |
18 eventSender.mouseUp(); | 18 eventSender.mouseUp(); |
19 // single click | 19 // single click |
20 eventSender.mouseMoveTo(slider.offsetLeft + 7, slider.offset
Top + 7); | 20 eventSender.mouseMoveTo(slider.offsetLeft + 7, slider.offset
Top + 7); |
21 eventSender.mouseDown(); | 21 eventSender.mouseDown(); |
22 eventSender.mouseUp(); | 22 eventSender.mouseUp(); |
23 // single click again, should send no onchange event | 23 // single click again, should send no onchange event |
24 eventSender.mouseMoveTo(slider.offsetLeft + 7, slider.offset
Top + 7); | 24 eventSender.mouseMoveTo(slider.offsetLeft + 7, slider.offset
Top + 7); |
25 eventSender.mouseDown(); | 25 eventSender.mouseDown(); |
26 eventSender.mouseUp(); | 26 eventSender.mouseUp(); |
| 27 // On touch events, check if change event is dispatched at t
ouch end |
| 28 var x = slider.offsetLeft; |
| 29 var y = slider.offsetTop + slider.clientHeight / 2; |
| 30 var w = slider.clientWidth; |
| 31 |
| 32 eventSender.clearTouchPoints(); |
| 33 eventSender.addTouchPoint(x + w / 2, y); |
| 34 eventSender.touchStart(); |
| 35 eventSender.touchMove(); |
| 36 eventSender.releaseTouchPoint(0); |
| 37 eventSender.touchEnd(); |
27 } | 38 } |
28 } | 39 } |
29 </script> | 40 </script> |
30 </head> | 41 </head> |
31 <body onload="test()"> | 42 <body onload="test()"> |
32 This tests that slider controls get the onchange event and that it is se
nt after the DOMInput event.<br> | 43 This tests that slider controls get the onchange event and that it is se
nt after the DOMInput event.<br> |
33 <input type="range" id="slider" onchange="log('change')" oninput="log('i
nput')" value=0> | 44 <input type="range" id="slider" onchange="log('change')" oninput="log('i
nput')" value=0 width=200px height=300px> |
34 <div id="res"></div> | 45 <div id="res"></div> |
35 </body> | 46 </body> |
36 </html> | 47 </html> |
OLD | NEW |