OLD | NEW |
---|---|
(Empty) | |
1 <html> | |
2 <head> | |
3 <script src="../../../resources/js-test.js"></script> | |
4 </head> | |
5 <body> | |
6 <input type="range" id="slider" oninput="log(event)" onchange="log(event)" min= 0 max=100 value=50> | |
7 <script> | |
8 description('Test that for each keyboard event both input and change event a re dispatched'); | |
tkent
2014/03/04 22:24:28
nit: You don't need to indent the whole content of
| |
9 var changeEventCounter = 0; | |
10 var lastChangeEventCounter = changeEventCounter; | |
11 var inputEventCounter = 0; | |
12 var lastInputEventCounter = inputEventCounter; | |
13 | |
14 function log(event) { | |
15 if (event.type == 'input') | |
16 inputEventCounter++; | |
17 if (event.type == 'change') | |
18 changeEventCounter++; | |
19 } | |
20 | |
21 function testInput() { | |
22 var slider = document.getElementById('slider'); | |
23 if (window.testRunner) { | |
24 // slider drag | |
25 slider.focus(); | |
26 debug('Move left'); | |
27 eventSender.keyDown('leftArrow'); | |
28 shouldBeGreaterThanOrEqual('inputEventCounter' , 'lastInputEventCoun ter + 1'); | |
29 shouldBeGreaterThanOrEqual('changeEventCounter', 'lastChangeEventCou nter + 1'); | |
30 debug('Move right'); | |
31 lastInputEventCounter = inputEventCounter; | |
32 lastChangeEventCounter = changeEventCounter; | |
33 eventSender.keyDown('rightArrow'); | |
34 shouldBeGreaterThanOrEqual('inputEventCounter' , 'lastInputEventCoun ter + 1'); | |
35 shouldBeGreaterThanOrEqual('changeEventCounter', 'lastChangeEventCou nter + 1'); | |
36 } | |
37 } | |
38 testInput(); | |
39 </script> | |
40 </body> | |
41 </html> | |
OLD | NEW |