<!DOCTYPE HTML>
<html>
<head>
<script src="../resources/js-test.js"></script>
</head>
<body>
<input id="range1" type="range" min="0" max="100" value="50">
<input id="range2" type="range" min="0" max="10" value="5">
<input id="range3" type="range" min="0" max="50" value="10" step="5">
<script>
var jsTestIsAsync = true;
description("Check whether changing slider's value without step attribute works properly");
if (window.accessibilityController) {
// Checking whether step is greater than one
var range1 = accessibilityController.accessibleElementById("range1");
var eventsTriggered = 0;
document.getElementById("range1").addEventListener("keyup", (event) => {
eventsTriggered++;
});
shouldBe("range1.intValue", "50");
range1.increment();
shouldBe("range1.intValue", "51");
range1.increment();
shouldBe("range1.intValue", "52");
range1.decrement();
shouldBe("range1.intValue", "51");
range1.increment();
shouldBe("range1.intValue", "52");
var range2 = accessibilityController.accessibleElementById("range2");
document.getElementById("range2").addEventListener("keyup", (event) => {
eventsTriggered++;
});
shouldBe("range2.intValue", "5");
range2.increment();
shouldBe("range2.intValue", "6");
range2.increment();
shouldBe("range2.intValue", "7");
range2.decrement();
shouldBe("range2.intValue", "6");
range2.increment();
shouldBe("range2.intValue", "7");
var range3 = accessibilityController.accessibleElementById("range3");
document.getElementById("range3").addEventListener("keyup", (event) => {
eventsTriggered++;
});
shouldBe("range3.intValue", "10");
range3.increment();
shouldBe("range3.intValue", "15");
range3.increment();
shouldBe("range3.intValue", "20");
range3.decrement();
shouldBe("range3.intValue", "15");
range3.increment();
shouldBe("range3.intValue", "20");
// Make sure all synthesized keydown/up events have already passed, so the
// test doesn't leak.
shouldBecomeEqual("eventsTriggered", "12", finishJSTest, 1000);
}
</script>
</body>
</html>