blob: 25818dc40b348aeab4397f67561a00c275d49fd9 [file] [edit]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test.js"></script>
<script src="../../resources/accessibility-helper.js"></script>
</head>
<body id="body">
<input type="range" min="0" max="100" value="25" step="25" id="range1"/>
<p id="description"></p>
<div id="console"></div>
<script>
description("This tests that increment and decrement actions are async.");
if (window.accessibilityController) {
window.jsTestIsAsync = true;
var obj = accessibilityController.accessibleElementById("range1");
shouldBe("obj.intValue", "25");
// sync version
obj.increment();
shouldBe("obj.intValue", "50");
obj.decrement();
shouldBe("obj.intValue", "25");
// async version
// The increment/decrement actions are now async so that they won't
// block the test run loop by changing the value.
obj.asyncIncrement();
shouldBe("obj.intValue", "25");
setTimeout(async function() {
// Wait for the async increment to be reflected before issuing the async
// decrement, so we can verify both async operations take effect.
debug(await expectAsync("obj.intValue", "50"));
obj.asyncDecrement();
debug(await expectAsync("obj.intValue", "25"));
finishJSTest();
}, 0);
}
</script>
</body>
</html>