blob: 0db05b73ef968be29b9ea6aebe5d7d7275c20cae [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../resources/js-test.js"></script>
</head>
<body>
<div id="container">
<div role="group" id="group" tabindex="0">group</div>
<div role="button" id="button" tabindex="0">button</div>
<div role="tab" id="tab" tabindex="0">tab button</div>
<div role="radio" id="radio" tabindex="0">radio</div>
<div role="checkbox" id="checkbox" tabindex="0">checkbox</div>
<div role="menuitem" id="menuitem" tabindex="0">menu item</div>
<div role="menuitemcheckbox" id="menuitemcheckbox" tabindex="0">menu item checkbox</div>
<div role="menuitemradio" id="menuitemradio" tabindex="0">menu item radio</div>
<div role="listitem" id="listitem" tabindex="0">list item</div>
</div>
<p id="description"></p>
<div id="console"></div>
<script>
document.getElementById("container").onmousedown = handlePress;
var pressCount = 0;
var eventSrcElement;
function handlePress(e) {
eventSrcElement = e.srcElement;
// First press was on the group element. That is not a control type and it should
// have caused the container to be the target element instead of the group element.
if (pressCount == 0)
shouldBeTrue("eventSrcElement == document.getElementById('container')");
else if (pressCount == 1)
shouldBeTrue("eventSrcElement == document.getElementById('button')");
else if (pressCount == 2)
shouldBeTrue("eventSrcElement == document.getElementById('tab')");
else if (pressCount == 3)
shouldBeTrue("eventSrcElement == document.getElementById('radio')");
else if (pressCount == 4)
shouldBeTrue("eventSrcElement == document.getElementById('checkbox')");
else if (pressCount == 5)
shouldBeTrue("eventSrcElement == document.getElementById('menuitem')");
else if (pressCount == 6)
shouldBeTrue("eventSrcElement == document.getElementById('menuitemcheckbox')");
else if (pressCount == 7)
shouldBeTrue("eventSrcElement == document.getElementById('menuitemradio')");
else if (pressCount == 8)
shouldBeTrue("eventSrcElement == document.getElementById('listitem')");
pressCount++;
}
description("This tests that when certain control type elements are pressed, a valid event is sent that references the right element.");
if (window.accessibilityController) {
var items = new Array("group", "button", "tab", "radio", "checkbox", "menuitem", "menuitemcheckbox", "menuitemradio", "listitem");
for (var k = 0; k < items.length; k++) {
document.getElementById(items[k]).focus();
accessibilityController.focusedElement.press();
}
}
</script>
</body>
</html>