blob: 6d72b3263d0a8e9848bc6325abf78eaac2cb5ed9 [file] [log] [blame]
<!DOCTYPE html>
<script src="../../../../../resources/testharness.js"></script>
<script src="../../../../../resources/testharnessreport.js"></script>
<script src="../../../../../fast/spatial-navigation/resources/snav-testharness.js"></script>
<style>
div {
width: 100px;
height: 100px;
margin: 5px;
border: 1px solid black;
}
</style>
<div id="first" tabindex="0">First</div>
<div id="second" tabindex="0">Second</div>
<div id="third" tabindex="0">Third</div>
<script>
if (accessibilityController) {
accessibilityController.reset();
}
var resultMap = [
["Down", "first"],
["Down", "second"],
["Down", "third"],
];
// This test checks that the "focusless spatial navigation" feature doesn't
// dispatch key events to the elements as it navigates over them.
let no_keyboard_events_test =
async_test("Focusless SpatNav Doesn't Dispatch KeyboardEvents");
for (let id of ['first', 'second', 'third']) {
let e = document.getElementById(id);
e.addEventListener('keydown', no_keyboard_events_test.unreached_func(
"Focusless SpatNav should not cause keydown on '" + id + "'"));
e.addEventListener('keyup', no_keyboard_events_test.unreached_func(
"Focusless SpatNav should not cause keyup on '" + id + "'"));
}
let postAssertsFunc = no_keyboard_events_test.step_func_done(() => {});
snav.assertFocusMoves(resultMap,
true /* enableSpatnav */,
postAssertsFunc,
true /* focuslessSpatNav */ );
</script>