<input type="range"> changing to disabled while active breaks all pointer events
[WebKit-https.git] / LayoutTests / fast / forms / range / disabled-while-dragging.html
1 <!doctype html>
2 <html>
3 <body>
4 <script src="../../../resources/js-test-pre.js"></script>
5 <script>
6 description("Tests that click events still work after a range is disabled while dragging.");
7 jsTestIsAsync = true;
8
9 const input = (that) => {
10     if (Math.abs(that.value - 50) === 50)
11         that.disabled = true;
12 };
13
14 let buttonClicked = false;
15
16 function buttonClick()
17 {
18     buttonClicked = true;
19 }
20
21 onload = function() {
22     range = document.querySelector("input");
23
24     shouldBeFalse("range.disabled");
25
26     debug("Drag range slider.");
27     var centerY = range.offsetTop + range.offsetHeight / 2;
28     var centerX = range.offsetLeft + range.offsetWidth / 2;
29     var rightEdgeX = range.offsetLeft + range.offsetWidth - 1;
30
31     eventSender.mouseMoveTo(centerX, centerY);
32     eventSender.mouseDown();
33     eventSender.mouseMoveTo(rightEdgeX, centerY);
34     eventSender.mouseUp();
35
36     setTimeout(function() {
37         shouldBeTrue("range.disabled");
38
39         debug("Click button");
40         button = document.querySelector("button");
41         var centerY = button.offsetTop + button.offsetHeight / 2;
42         var centerX = button.offsetLeft + button.offsetWidth / 2;
43         eventSender.mouseMoveTo(centerX, centerY);
44         eventSender.mouseDown();
45         eventSender.mouseUp();
46
47         setTimeout(function() {
48             shouldBeTrue("buttonClicked");
49             finishJSTest();
50         }, 0);
51     }, 0);
52 }
53 </script>
54
55 <input type="range" oninput="input(this)">
56 <button onclick="buttonClick()">Click</button>
57 <script src="../../../resources/js-test-post.js"></script>
58 </body>
59 </html>