2010-11-19 18:37:30 -08:00
|
|
|
<html>
|
|
|
|
|
|
|
|
<head>
|
|
|
|
<title>ARIA menu events testing</title>
|
|
|
|
|
|
|
|
<link rel="stylesheet" type="text/css"
|
|
|
|
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
|
|
|
|
|
|
|
<script type="application/javascript"
|
|
|
|
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
|
|
|
<script type="application/javascript"
|
|
|
|
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
2010-12-03 02:49:20 -08:00
|
|
|
<script type="application/javascript"
|
|
|
|
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
|
2010-11-19 18:37:30 -08:00
|
|
|
|
|
|
|
<script type="application/javascript"
|
|
|
|
src="../common.js"></script>
|
|
|
|
<script type="application/javascript"
|
|
|
|
src="../states.js"></script>
|
|
|
|
<script type="application/javascript"
|
|
|
|
src="../events.js"></script>
|
|
|
|
|
|
|
|
<script type="application/javascript">
|
2010-11-30 07:43:17 -08:00
|
|
|
const kViaDisplayStyle = 0;
|
|
|
|
const kViaVisibilityStyle = 1;
|
|
|
|
|
2010-12-03 02:49:20 -08:00
|
|
|
function focusMenu(aMenuBarID, aMenuID)
|
|
|
|
{
|
|
|
|
this.eventSeq = [
|
|
|
|
new invokerChecker(EVENT_MENU_START, getNode(aMenuBarID)),
|
|
|
|
new invokerChecker(EVENT_FOCUS, getNode(aMenuID)),
|
|
|
|
];
|
|
|
|
|
|
|
|
this.invoke = function focusMenu_invoke()
|
|
|
|
{
|
|
|
|
getNode(aMenuID).focus();
|
|
|
|
}
|
|
|
|
|
|
|
|
this.getID = function focusMenu_getID()
|
|
|
|
{
|
|
|
|
return "focus menu '" + aMenuID + "'";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function showMenu(aMenuID, aParentMenuID, aHow)
|
2010-11-19 18:37:30 -08:00
|
|
|
{
|
2010-11-30 07:43:17 -08:00
|
|
|
this.menuNode = getNode(aMenuID);
|
|
|
|
|
|
|
|
this.eventSeq = [
|
|
|
|
new invokerChecker(EVENT_SHOW, this.menuNode),
|
|
|
|
new invokerChecker(EVENT_MENUPOPUP_START, this.menuNode),
|
2010-12-03 02:49:20 -08:00
|
|
|
new invokerChecker(EVENT_REORDER, getNode(aParentMenuID))
|
2010-11-30 07:43:17 -08:00
|
|
|
];
|
2010-11-19 18:37:30 -08:00
|
|
|
|
|
|
|
this.invoke = function showMenu_invoke()
|
|
|
|
{
|
2010-11-30 07:43:17 -08:00
|
|
|
if (aHow == kViaDisplayStyle)
|
|
|
|
this.menuNode.style.display = "block";
|
2010-11-19 18:37:30 -08:00
|
|
|
else
|
2010-11-30 07:43:17 -08:00
|
|
|
this.menuNode.style.visibility = "visible";
|
2010-11-19 18:37:30 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
this.getID = function showMenu_getID()
|
|
|
|
{
|
2010-11-30 07:43:17 -08:00
|
|
|
return "Show ARIA menu " + aMenuID + " by " +
|
|
|
|
(aHow == kViaDisplayStyle ? "display" : "visibility") +
|
|
|
|
" style tricks";
|
2010-11-19 18:37:30 -08:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2010-12-03 02:49:20 -08:00
|
|
|
function closeMenu(aMenuID, aParentMenuID, aHow)
|
2010-11-30 07:43:17 -08:00
|
|
|
{
|
|
|
|
this.menuNode = getNode(aMenuID);
|
|
|
|
this.menu = null;
|
|
|
|
|
|
|
|
this.eventSeq = [
|
|
|
|
new invokerChecker(EVENT_MENUPOPUP_END, getMenu, this),
|
|
|
|
new invokerChecker(EVENT_HIDE, getMenu, this),
|
2010-12-03 02:49:20 -08:00
|
|
|
new invokerChecker(EVENT_REORDER, getNode(aParentMenuID))
|
2010-11-30 07:43:17 -08:00
|
|
|
];
|
|
|
|
|
|
|
|
this.invoke = function closeMenu_invoke()
|
|
|
|
{
|
|
|
|
// Store menu accessible reference while menu is still open.
|
|
|
|
this.menu = getAccessible(this.menuNode);
|
|
|
|
|
|
|
|
// Hide menu.
|
|
|
|
if (aHow == kViaDisplayStyle)
|
|
|
|
this.menuNode.style.display = "none";
|
|
|
|
else
|
|
|
|
this.menuNode.style.visibility = "hidden";
|
|
|
|
}
|
|
|
|
|
|
|
|
this.getID = function closeMenu_getID()
|
|
|
|
{
|
|
|
|
return "Close ARIA menu " + aMenuID + " by " +
|
|
|
|
(aHow == kViaDisplayStyle ? "display" : "visibility") +
|
|
|
|
" style tricks";
|
|
|
|
}
|
|
|
|
|
|
|
|
function getMenu(aThisObj)
|
|
|
|
{
|
|
|
|
return aThisObj.menu;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-12-03 02:49:20 -08:00
|
|
|
function focusInsideMenu(aMenuID, aMenuBarID)
|
|
|
|
{
|
|
|
|
this.eventSeq = [
|
|
|
|
new invokerChecker(EVENT_FOCUS, getNode(aMenuID))
|
|
|
|
];
|
|
|
|
|
|
|
|
this.unexpectedEventSeq = [
|
|
|
|
new invokerChecker(EVENT_MENU_END, getNode(aMenuBarID))
|
|
|
|
];
|
|
|
|
|
|
|
|
this.invoke = function focusInsideMenu_invoke()
|
|
|
|
{
|
|
|
|
getNode(aMenuID).focus();
|
|
|
|
}
|
|
|
|
|
|
|
|
this.getID = function focusInsideMenu_getID()
|
|
|
|
{
|
|
|
|
return "focus menu '" + aMenuID + "'";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function blurMenu(aMenuBarID)
|
|
|
|
{
|
|
|
|
var eventSeq = [
|
|
|
|
new invokerChecker(EVENT_MENU_END, getNode(aMenuBarID)),
|
|
|
|
new invokerChecker(EVENT_FOCUS, getNode("outsidemenu"))
|
|
|
|
];
|
|
|
|
|
|
|
|
this.__proto__ = new synthClick("outsidemenu", eventSeq);
|
|
|
|
|
|
|
|
this.getID = function blurMenu_getID()
|
|
|
|
{
|
|
|
|
return "blur menu";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-11-19 18:37:30 -08:00
|
|
|
////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Do tests
|
|
|
|
|
|
|
|
var gQueue = null;
|
|
|
|
|
|
|
|
//gA11yEventDumpID = "eventdump";
|
2010-12-03 02:49:20 -08:00
|
|
|
//gA11yEventDumpToConsole = true;
|
2010-11-19 18:37:30 -08:00
|
|
|
|
|
|
|
function doTests()
|
|
|
|
{
|
2010-11-30 07:43:17 -08:00
|
|
|
gQueue = new eventQueue();
|
2010-11-19 18:37:30 -08:00
|
|
|
|
2010-12-03 02:49:20 -08:00
|
|
|
gQueue.push(new focusMenu("menubar", "menu-file"));
|
|
|
|
gQueue.push(new showMenu("menupopup-file", "menu-file", kViaDisplayStyle));
|
|
|
|
gQueue.push(new closeMenu("menupopup-file", "menu-file", kViaDisplayStyle));
|
|
|
|
gQueue.push(new showMenu("menupopup-edit", "menu-edit", kViaVisibilityStyle));
|
|
|
|
gQueue.push(new closeMenu("menupopup-edit", "menu-edit", kViaVisibilityStyle));
|
|
|
|
gQueue.push(new focusInsideMenu("menu-edit", "menubar"));
|
|
|
|
gQueue.push(new blurMenu("menubar"));
|
2010-11-19 18:37:30 -08:00
|
|
|
|
|
|
|
gQueue.invoke(); // Will call SimpleTest.finish();
|
|
|
|
}
|
|
|
|
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
addA11yLoadEvent(doTests);
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
|
|
|
<a target="_blank"
|
|
|
|
href="https://bugzilla.mozilla.org/show_bug.cgi?id=606207"
|
|
|
|
title="Dojo dropdown buttons are broken">
|
|
|
|
Mozilla Bug 606207
|
|
|
|
</a>
|
2010-11-30 07:43:17 -08:00
|
|
|
<a target="_blank"
|
|
|
|
href="https://bugzilla.mozilla.org/show_bug.cgi?id=614829"
|
|
|
|
title="Menupopup end event isn't fired for ARIA menus">
|
|
|
|
Mozilla Bug 614829
|
|
|
|
</a>
|
2010-12-03 02:49:20 -08:00
|
|
|
<a target="_blank"
|
|
|
|
href="https://bugzilla.mozilla.org/show_bug.cgi?id=615189"
|
|
|
|
title="Clean up FireAccessibleFocusEvent">
|
|
|
|
Mozilla Bug 615189
|
|
|
|
</a>
|
2010-11-19 18:37:30 -08:00
|
|
|
|
|
|
|
<p id="display"></p>
|
|
|
|
<div id="content" style="display: none"></div>
|
|
|
|
<pre id="test">
|
|
|
|
</pre>
|
|
|
|
|
2010-12-03 02:49:20 -08:00
|
|
|
<div id="menubar" role="menubar">
|
|
|
|
<div id="menu-file" role="menuitem" tabindex="0">
|
|
|
|
File
|
|
|
|
<div id="menupopup-file" role="menu" style="display: none;">
|
|
|
|
<div id="menuitem-newtab" role="menuitem" tabindex="0">New Tab</div>
|
|
|
|
<div id="menuitem-newwindow" role="menuitem" tabindex="0">New Window</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="menu-edit" role="menuitem" tabindex="0">
|
|
|
|
Edit
|
|
|
|
<div id="menupopup-edit" role="menu" style="visibility: hidden;">
|
|
|
|
<div id="menuitem-undo" role="menuitem" tabindex="0">Undo</div>
|
|
|
|
<div id="menuitem-redo" role="menuitem" tabindex="0">Redo</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2010-11-19 18:37:30 -08:00
|
|
|
</div>
|
2010-12-03 02:49:20 -08:00
|
|
|
<div tabindex="0" id="outsidemenu">outsidemenu</div>
|
2010-11-19 18:37:30 -08:00
|
|
|
|
|
|
|
<div id="eventdump"></div>
|
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|