|
19 | 19 | * predict exactly what value the input should take on for events at
|
20 | 20 | * certain coordinates.)
|
21 | 21 | */
|
22 |
| - input { margin: 0 ! important; width: 200px ! important; } |
| 22 | + input { margin: 0 !important; width: 200px !important; padding-inline: 100px; } |
23 | 23 | </style>
|
24 | 24 | </head>
|
25 | 25 | <body>
|
26 | 26 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=846380">Mozilla Bug 846380</a>
|
27 | 27 | <p id="display"></p>
|
28 | 28 | <div id="content">
|
29 |
| - <input id="range" type="range"> |
| 29 | + <input id="range" type="range"><br> |
| 30 | + <input id="range-appearance-none" type="range" style="appearance: none"> |
30 | 31 | </div>
|
31 | 32 | <pre id="test">
|
32 | 33 | <script type="application/javascript">
|
|
40 | 41 | * This test checks how the value of <input type=range> changes in response to
|
41 | 42 | * various mouse and touch events.
|
42 | 43 | **/
|
| 44 | +SimpleTest.expectAssertions(0, 2); // bug 1917867 |
43 | 45 | SimpleTest.waitForExplicitFinish();
|
44 | 46 | SimpleTest.waitForFocus(function() {
|
45 |
| - test(synthesizeMouse, "click", "mousedown", "mousemove", "mouseup"); |
46 |
| - test(synthesizeTouch, "tap", "touchstart", "touchmove", "touchend"); |
| 47 | + for (let element of document.querySelectorAll("input[type=range]")) { |
| 48 | + test(element, synthesizeMouse, "click", "mousedown", "mousemove", "mouseup"); |
| 49 | + test(element, synthesizeTouch, "tap", "touchstart", "touchmove", "touchend"); |
| 50 | + } |
47 | 51 | SimpleTest.finish();
|
48 | 52 | });
|
49 | 53 |
|
|
62 | 66 | document.body.clientWidth;
|
63 | 67 | }
|
64 | 68 |
|
65 |
| -function test(synthesizeFunc, clickOrTap, startName, moveName, endName) { |
66 |
| - var elem = document.getElementById("range"); |
| 69 | +function test(elem, synthesizeFunc, clickOrTap, startName, moveName, endName) { |
| 70 | + info(`Testing ${elem.id}`); |
| 71 | + |
67 | 72 | elem.focus();
|
68 | 73 | flush();
|
69 | 74 |
|
|
74 | 79 | var paddingLeft = parseFloat(window.getComputedStyle(elem).paddingLeft);
|
75 | 80 | var paddingTop = parseFloat(window.getComputedStyle(elem).paddingTop);
|
76 | 81 |
|
| 82 | + // If themed then we use our border-box size. |
| 83 | + if (elem.style.appearance != "none") { |
| 84 | + width += borderLeft * 2 + paddingLeft * 2; |
| 85 | + borderLeft = 0; |
| 86 | + paddingLeft = 0; |
| 87 | + } |
| 88 | + |
77 | 89 | // Extrema for mouse/touch events:
|
78 | 90 | var midY = height / 2 + borderTop + paddingTop;
|
79 | 91 | var minX = borderLeft + paddingLeft;
|
|
206 | 218 | synthesizeKey("KEY_Home");
|
207 | 219 | // The KEY_Home tests are disabled until I can figure out why they fail on Android -jwatt
|
208 | 220 | //is(elem.value, MINIMUM_OF_RANGE, "Test KEY_Home during a drag sets the value to the minimum of the range");
|
209 |
| - synthesizeFunc(elem, midX+100, midY, { type: moveName }); |
| 221 | + synthesizeFunc(elem, maxX+100, midY, { type: moveName }); |
210 | 222 | is(elem.value, MAXIMUM_OF_RANGE, "Test " + moveName + " outside range after key press that occurred during a drag changes the value");
|
211 | 223 | synthesizeFunc(elem, midX, midY, { type: moveName });
|
212 | 224 | is(elem.value, MIDDLE_OF_RANGE, "Test " + moveName + " in middle of range");
|
|
0 commit comments