<!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>
<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. Even though that isn't a control
// type, that was the element pressed, and the page should be given an
// accurate target. The press will eventually bubble up to any ancestor
// listeners.
if (pressCount == 0)
shouldBeTrue("eventSrcElement == document.getElementById('group')");
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')");
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");
for (var k = 0; k < items.length; k++) {
document.getElementById(items[k]).focus();
accessibilityController.focusedElement.press();
}
}
</script>
</body>
</html>