Add missing checks after calls to the sameValue() JSValue comparator.
[WebKit-https.git] / LayoutTests / fast / events / onchange-range-slider.html
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>
7
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-pre.js"></script>
12 <script>
13 var receivedChangeEvent = false;
14 var slider;
15
16 function onChange(e)
17 {
18     testPassed('Change event fired.');
19     receivedChangeEvent = true;
20     shouldBeEqualToString("slider.value", "0");
21 }
22
23 window.onload = function()
24 {
25     if (!window.testRunner)
26         return;
27
28     slider = document.getElementById("slider");
29     slider.addEventListener("change", onChange);
30
31     // Programmatically changing an input value should not fire a change event.
32     slider.value = 1;
33
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;
37
38     eventSender.mouseMoveTo(x, y);
39     eventSender.mouseDown();
40     eventSender.mouseUp();
41
42     if (!receivedChangeEvent)
43         testFailed('Change event not fired.');
44 }
45 </script>
46 </body>
47 </html>