gecko/accessible/tests/mochitest/tree/test_combobox.xul

196 lines
5.1 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 XUL menulist and textbox @autocomplete hierarchy tests">
<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/a11y/accessible/common.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/role.js" />
<script type="application/javascript">
<![CDATA[
////////////////////////////////////////////////////////////////////////////
// Test
function doTest()
{
//////////////////////////////////////////////////////////////////////////
// menulist
var accTree = {
role: ROLE_COMBOBOX,
children: [
{
role: ROLE_COMBOBOX_LIST,
children: [
{
role: ROLE_COMBOBOX_OPTION
},
{
role: ROLE_COMBOBOX_OPTION
}
]
}
]
};
testAccessibleTree("menulist", accTree);
//////////////////////////////////////////////////////////////////////////
// editable menulist
accTree = {
role: ROLE_COMBOBOX,
children: [
{
role: ROLE_ENTRY,
children: [
{
role: ROLE_TEXT_LEAF // HTML 5 placeholder attribute value
},
{
role: ROLE_TEXT_LEAF // Text node for the node's value
}
]
},
{
role: ROLE_COMBOBOX_LIST, // context menu
children: []
},
{
role: ROLE_PUSHBUTTON, // dropmarker
},
{
role: ROLE_COMBOBOX_LIST, // option list
children: [
{
role: ROLE_COMBOBOX_OPTION
},
{
role: ROLE_COMBOBOX_OPTION
}
]
}
]
};
// XXX Bug 551957
if (!MAC) {
testAccessibleTree("menulist2", accTree);
}
//////////////////////////////////////////////////////////////////////////
// textbox@type=autocomplete #1 (history)
accTree = {
role: ROLE_AUTOCOMPLETE,
children: [
{
role: ROLE_ENTRY,
children: [
{
role: ROLE_TEXT_LEAF
}
]
},
{
role: ROLE_COMBOBOX_LIST, // context menu popup
children: [ ]
}
]
};
testAccessibleTree("autocomplete", accTree);
//////////////////////////////////////////////////////////////////////////
// textbox@type=autocomplete #2 (child menupoup)
accTree = {
role: ROLE_AUTOCOMPLETE,
children: [
{
role: ROLE_COMBOBOX_LIST, // autocomplete menu popup
children: [
{
role: ROLE_COMBOBOX_OPTION
}
]
},
{
role: ROLE_ENTRY,
children: [
{
role: ROLE_TEXT_LEAF // HTML 5 placeholder attribute value
},
{
role: ROLE_TEXT_LEAF // Text node for the node's value
}
]
},
{
role: ROLE_COMBOBOX_LIST, // context menu popup
children: [ ]
}
]
};
testAccessibleTree("autocomplete2", accTree);
SimpleTest.finish()
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
]]>
</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=249292"
title="Ensure accessible children for toolbarbutton types 'menu' and 'menu-button'">
Mozilla Bug 249292
</a><br/>
<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="item"/>
<menuitem label="item"/>
</menupopup>
</menulist>
<menulist id="menulist2" editable="true">
<menupopup>
<menuitem label="item"/>
<menuitem label="item"/>
</menupopup>
</menulist>
<textbox id="autocomplete" type="autocomplete"
autocompletesearch="history"
value="http://mochi.test:8888/redirect-a11y.html"/>
<textbox id="autocomplete2" type="autocomplete">
<menupopup>
<menuitem label="item1"/>
</menupopup>
</textbox>
</vbox>
</hbox>
</window>