Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / onchange-range-slider.html
blob248c0366bc9774b9944b242b282cb089a23010ea
1 <!DOCTYPE html>
2 <html>
3 <head>
4 </head>
5 <body>
6 <p>This test verifies that updating the slider for an input element with type=range fires a change event.</p>
8 <!-- See bug 84674 -->
9 <input id="slider" type="range" min="0" max="3" value="0"></input>
10 <pre id="console"></pre>
11 <script src="../../resources/js-test.js"></script>
12 <script>
13 var receivedChangeEvent = false;
14 var slider;
16 function onChange(e)
18 testPassed('Change event fired.');
19 receivedChangeEvent = true;
20 shouldBeEqualToString("slider.value", "0");
23 window.onload = function()
25 if (!window.testRunner)
26 return;
28 slider = document.getElementById("slider");
29 slider.addEventListener("change", onChange);
31 // Programmatically changing an input value should not fire a change event.
32 slider.value = 1;
34 // Changing back to original value should fire a change event.
35 var x = slider.offsetLeft + 1;
36 var y = slider.offsetTop + slider.clientHeight / 2;
38 eventSender.mouseMoveTo(x, y);
39 eventSender.mouseDown();
40 eventSender.mouseUp();
42 if (!receivedChangeEvent)
43 testFailed('Change event not fired.');
45 </script>
46 </body>
47 </html>