gecko/accessible/tests/mochitest/events/test_focus.xul

102 lines
3.0 KiB
XML

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="Accessible focus event testing">
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js" />
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
<script type="application/javascript"
src="../common.js" />
<script type="application/javascript"
src="../events.js" />
<script type="application/javascript">
/**
* Click menu item invoker.
*/
function clickMenuItem(aNodeOrID, aFocusNodeOrID)
{
this.DOMNode = getNode(aFocusNodeOrID);
this.invoke = function clickMenuItem_invoke()
{
synthesizeMouse(getNode(aNodeOrID), 1, 1, {});
}
this.getID = function clickMenuItem_getID()
{
return prettyName(aNodeOrID) + " click menu item";
}
}
/**
* Do tests.
*/
//gA11yEventDumpID = "eventdump"; // debug stuff
var gQueue = null;
function doTests()
{
// Test focus events.
gQueue = new eventQueue(nsIAccessibleEvent.EVENT_FOCUS);
gQueue.push(new synthFocus("textbox"));
gQueue.push(new synthFocus("scale"));
gQueue.push(new synthFocusOnFrame("editabledoc"));
gQueue.push(new synthClick("menu"));
gQueue.push(new synthMouseMove("menuitem"));
gQueue.push(new clickMenuItem("menuitem",
getNode("editabledoc").contentDocument));
gQueue.invoke(); // Will call SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTests);
</script>
<hbox flex="1" style="overflow: auto;">
<body xmlns="http://www.w3.org/1999/xhtml">
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=492518"
title="xul:slider accessible of xul:scale is accessible illegally">
Mozilla Bug 492518
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=552368"
title=" fire focus event on document accessible whenever the root or body element is focused">
Mozilla Bug 552368
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
</body>
<vbox flex="1">
<textbox id="textbox" value="hello"/>
<scale id="scale" min="0" max="9" value="5"/>
<menubar>
<menu id="menu" label="menu">
<menupopup>
<menuitem id="menuitem" label="menuitem"/>
</menupopup>
</menu>
</menubar>
<iframe id="editabledoc" src="focus.html"/>
<vbox id="eventdump"/>
</vbox>
</hbox>
</window>