blob: 2f37a7f8c6be71671c8603512e92431824adee17 [file] [log] [blame]
<script src="../resources/js-test.js"></script>
<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>
<p id="description"></p>
<div id="console"></div>
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')");
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++) {