<!DOCTYPE HTML>
<script src="../resources/gc.js"></script>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="../http/tests/resources/permissions-helper.js"></script>
<script src="resources/aom-helper.js"></script>
<!--
Accessibility Object Model
Explainer: https://github.com/WICG/aom/blob/gh-pages/explainer.md
Spec: https://wicg.github.io/aom/spec/
-->
<script>
test(function(t) {
assert_true(internals.runtimeFlags.accessibilityObjectModelEnabled);
}, "Make sure that Accessibility Object Model is enabled");
</script>
<input type=range min=1 max=5 value=3 id="decrement_target">
<script>
async_test(function(t) {
enableAccessibilityEventsPermission().then(function() {
var target = document.getElementById("decrement_target");
var axTarget = accessibilityController.accessibleElementById("decrement_target");
var gotAccessibleEvent = false;
target.accessibleNode.onaccessibledecrement = function() {
gotAccessibleEvent = true;
};
// Finish the test after the synthesized keyup event, which is triggered
// 100ms later, to prevent leaks.
target.addEventListener("keyup",
t.step_func_done((event) => {}), { once: true });
axTarget.decrement();
assert_true(gotAccessibleEvent);
assert_equals(target.value, "2");
});
}, "AccessibleNode.onaccessibledecrement");
</script>