tenfourfox/toolkit/modules/tests/mochitest/test_spatial_navigation.html
Cameron Kaiser c9b2922b70 hello FPR
2017-04-19 00:56:45 -07:00

77 lines
2.4 KiB
HTML

<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=698437
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 698437</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
/** Test for Bug 698437 **/
SimpleTest.waitForExplicitFinish();
function Test() {
if (!SpecialPowers.getBoolPref("snav.enabled")) {
todo(false, "Enable spatial navigiation on this platform.");
SimpleTest.finish();
return;
}
var center = document.getElementById("center");
var right = document.getElementById("right");
var left = document.getElementById("left");
var top = document.getElementById("top");
var bottom = document.getElementById("bottom");
console.log(top);
console.log(bottom);
console.log(center);
console.log(left);
console.log(right);
center.focus();
is(center.id, document.activeElement.id, "How did we call focus on center and it did" +
" not become the active element?");
synthesizeKey("VK_UP", { });
is(document.activeElement.id, top.id,
"Spatial navigation up key is not handled correctly.");
center.focus();
synthesizeKey("VK_DOWN", { });
is(document.activeElement.id, bottom.id,
"Spatial navigation down key is not handled correctly.");
center.focus();
synthesizeKey("VK_RIGHT", { });
is(document.activeElement.id, right.id,
"Spatial navigation right key is not handled correctly.");
center.focus();
synthesizeKey("VK_LEFT", { });
is(document.activeElement.id, left.id,
"Spatial navigation left key is not handled correctly.");
SimpleTest.finish();
}
</script>
</head>
<body onload="Test();">
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=698437">Mozilla Bug 698437</a>
<p id="display"></p>
<div id="content">
<button id="lefttop">1</button><button id="top">2</button><button id="righttop">3</button><br>
<button id="left">4</button><button id="center">5</button><button id="right">6</button><br>
<button id="leftbottom">7</button><button id="bottom">8</button><button id="rightbottom">9</button><br>
</div>
<pre id="test">
</pre>
</body>
</html>