Tests: Add a test for mouse clicks on range inputs with step specified

This commit is contained in:
Zaggy1024 2026-06-03 18:21:29 -05:00 committed by Gregory Bertilson
parent 716ab93c1a
commit 5d9b0cee0a
2 changed files with 30 additions and 0 deletions

View file

@ -0,0 +1,5 @@
click at x=10: value=0
click at x=25: value=0
click at x=33: value=0
click at x=50: value=1
click at x=75: value=1

View file

@ -0,0 +1,25 @@
<!DOCTYPE html>
<script src="include.js"></script>
<style>
input {
position: absolute;
left: 0;
top: 0;
width: 100px;
margin: 0;
padding: 0;
border: 0;
}
</style>
<input type="range" min="0" max="1" step="0.1">
<script>
test(() => {
const input = document.querySelector("input");
const rect = input.getBoundingClientRect();
const y = rect.top + rect.height / 2;
for (const offset of [10, 25, 33, 50, 75]) {
internals.click(rect.left + offset, y);
println(`click at x=${offset}: value=${input.value}`);
}
});
</script>