2008-12-03 01:04:02 -08:00
|
|
|
<?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"?>
|
|
|
|
<?xml-stylesheet href="chrome://browser/content/browser.css"
|
|
|
|
type="text/css"?>
|
|
|
|
|
|
|
|
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
|
|
|
title="nsIAccessible interface for xul:menulist test.">
|
|
|
|
|
|
|
|
<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 type="application/javascript"
|
|
|
|
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js" />
|
|
|
|
|
|
|
|
<script type="application/javascript"
|
2010-09-01 15:09:56 -07:00
|
|
|
src="common.js" />
|
2009-01-24 20:42:21 -08:00
|
|
|
<script type="application/javascript"
|
2010-09-01 15:09:56 -07:00
|
|
|
src="events.js" />
|
2008-12-03 01:04:02 -08:00
|
|
|
|
|
|
|
<script type="application/javascript">
|
|
|
|
<![CDATA[
|
2008-12-16 02:14:20 -08:00
|
|
|
function openHideCombobox(aComboboxNodeOrID, aIsOpen)
|
2008-12-03 01:04:02 -08:00
|
|
|
{
|
|
|
|
this.invoke = function invoke()
|
|
|
|
{
|
|
|
|
synthesizeMouse(this.DOMNode, 5, 5, {});
|
|
|
|
}
|
|
|
|
this.check = function check(aEvent)
|
|
|
|
{
|
|
|
|
aEvent.QueryInterface(nsIAccessibleStateChangeEvent);
|
|
|
|
|
2008-12-16 02:14:20 -08:00
|
|
|
var id = this.getID();
|
2008-12-03 01:04:02 -08:00
|
|
|
is(aEvent.state, nsIAccessibleStates.STATE_EXPANDED,
|
2008-12-16 02:14:20 -08:00
|
|
|
"Wrong state change event is handled in test '" + id + "'.");
|
2008-12-03 01:04:02 -08:00
|
|
|
is(aEvent.isEnabled(), this.mIsOpen,
|
2008-12-16 02:14:20 -08:00
|
|
|
"Wrong value of state expanded in test '" + id + "'.");
|
|
|
|
}
|
|
|
|
this.getID = function getID()
|
|
|
|
{
|
|
|
|
if (this.mIsOpen)
|
|
|
|
return this.DOMNodeOrID + " open combobox";
|
|
|
|
return this.DOMNodeOrID + " close combobox";
|
2008-12-03 01:04:02 -08:00
|
|
|
}
|
|
|
|
|
2008-12-16 02:14:20 -08:00
|
|
|
this.DOMNodeOrID = aComboboxNodeOrID;
|
|
|
|
this.DOMNode = getNode(aComboboxNodeOrID);
|
2008-12-03 01:04:02 -08:00
|
|
|
this.mIsOpen = aIsOpen;
|
|
|
|
}
|
|
|
|
|
|
|
|
var gQueue = null;
|
|
|
|
function doTest()
|
|
|
|
{
|
|
|
|
gQueue = new eventQueue(nsIAccessibleEvent.EVENT_STATE_CHANGE);
|
|
|
|
|
2008-12-16 02:14:20 -08:00
|
|
|
var ID = "menulist";
|
|
|
|
gQueue.push(new openHideCombobox(ID, true));
|
|
|
|
gQueue.push(new openHideCombobox(ID, false));
|
2008-12-03 01:04:02 -08:00
|
|
|
|
|
|
|
// XXX: searchbar doesn't fire state change events because accessible
|
|
|
|
// parent of combobox_list accessible is pushbutton accessible.
|
|
|
|
//var searchbar = document.getElementById("searchbar");
|
|
|
|
//gQueue.push(new openHideCombobox(searchbar, true));
|
|
|
|
//gQueue.push(new openHideCombobox(searchbar, false));
|
|
|
|
|
|
|
|
gQueue.invoke(); // Will call SimpleTest.finish();
|
|
|
|
}
|
|
|
|
|
|
|
|
// This is the hack needed for searchbar work outside of browser.
|
|
|
|
function getBrowser()
|
|
|
|
{
|
|
|
|
return {
|
|
|
|
mCurrentBrowser: { engines: new Array() }
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
2009-01-12 09:20:34 -08:00
|
|
|
addA11yLoadEvent(doTest);
|
2008-12-03 01:04:02 -08:00
|
|
|
]]>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<hbox style="overflow: auto;" flex="1">
|
|
|
|
<body xmlns="http://www.w3.org/1999/xhtml">
|
|
|
|
<a target="_blank"
|
|
|
|
href="https://bugzilla.mozilla.org/show_bug.cgi?id=467057"
|
|
|
|
title="xul menulist doesn't fire expand/collapse state change events">
|
|
|
|
Mozilla Bug 467057
|
|
|
|
</a>
|
|
|
|
<p id="display"></p>
|
|
|
|
<div id="content" style="display: none">
|
|
|
|
</div>
|
|
|
|
<pre id="test">
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
|
|
|
|
<vbox flex="1">
|
|
|
|
<menulist id="menulist">
|
|
|
|
<menupopup>
|
|
|
|
<menuitem label="item1"/>
|
|
|
|
<menuitem label="item2"/>
|
|
|
|
<menuitem label="item3"/>
|
|
|
|
</menupopup>
|
|
|
|
</menulist>
|
|
|
|
|
|
|
|
<searchbar id="searchbar"/>
|
|
|
|
</vbox>
|
|
|
|
</hbox>
|
|
|
|
|
|
|
|
</window>
|
|
|
|
|