blob: ba5f339dceafca45af8b64e055ef9df7dcf04b1a [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../resources/js-test.js"></script>
<script src="../resources/accessibility-helper.js"></script>
<title>Range Alter by Percent</title>
</head>
<body>
<!-- Range type input elements are altered by five percent if they have no step specified. -->
<!-- Implicit step size of five when decrement/increment is called. -->
<input id="largeRange" max="100" min="0" type="range" value="50">
<!-- Implicit step size of one when decrement/increment is called (because five percent would give us less than one). -->
<input id="smallRange" max="10" min="0" type="range" value="5">
<script>
description("This tests that decrement and increment alter a range type input element by five percent or one (whichever is larger) when no step is specified.");
var smallRange, largeRange;
if (window.accessibilityController) {
window.jsTestIsAsync = true;
setTimeout(async function() {
largeRange = accessibilityController.accessibleElementById("largeRange");
shouldBe("largeRange.intValue", "50");
largeRange.increment();
await expectAsyncExpression("largeRange.intValue", 55);
largeRange.increment();
await expectAsyncExpression("largeRange.intValue", 60);
largeRange.decrement();
await expectAsyncExpression("largeRange.intValue", 55);
largeRange.decrement();
await expectAsyncExpression("largeRange.intValue", 50);
smallRange = accessibilityController.accessibleElementById("smallRange");
shouldBe("smallRange.intValue", "5");
smallRange.increment();
await expectAsyncExpression("smallRange.intValue", 6);
smallRange.increment();
await expectAsyncExpression("smallRange.intValue", 7);
smallRange.decrement();
await expectAsyncExpression("smallRange.intValue", 6);
smallRange.decrement();
await expectAsyncExpression("smallRange.intValue", 5);
finishJSTest();
}, 0);
}
</script>
</body>
</html>