2008-09-18 00:25:09 -07:00
|
|
|
<html>
|
|
|
|
|
|
|
|
<head>
|
|
|
|
<title>nsIAccessible selects tests</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>
|
|
|
|
<script type="application/javascript"
|
2010-09-01 15:09:56 -07:00
|
|
|
src="common.js"></script>
|
2009-03-07 03:23:25 -08:00
|
|
|
<script type="application/javascript"
|
2010-09-01 15:09:56 -07:00
|
|
|
src="role.js"></script>
|
2010-10-20 08:04:18 -07:00
|
|
|
<script type="application/javascript"
|
|
|
|
src="states.js"></script>
|
2008-09-18 00:25:09 -07:00
|
|
|
<script type="application/javascript"
|
2010-09-01 15:09:56 -07:00
|
|
|
src="nsIAccessible_selects.js"></script>
|
2008-09-18 00:25:09 -07:00
|
|
|
|
|
|
|
<script type="application/javascript">
|
|
|
|
function doTest()
|
|
|
|
{
|
|
|
|
// Label and combo, separate tags
|
|
|
|
var names = [
|
|
|
|
"Foo:", // combobox
|
|
|
|
"Foo:", // combobox list
|
|
|
|
"item 1", // first item
|
|
|
|
"item 2" // second item
|
|
|
|
];
|
|
|
|
var roles = [
|
|
|
|
ROLE_COMBOBOX, // root
|
|
|
|
ROLE_COMBOBOX_LIST, // list accessible
|
|
|
|
ROLE_COMBOBOX_OPTION, // first option
|
|
|
|
ROLE_COMBOBOX_OPTION // second option
|
|
|
|
];
|
|
|
|
var states = [
|
|
|
|
(STATE_FOCUSABLE | STATE_HASPOPUP | STATE_COLLAPSED), // combobox
|
|
|
|
(0), // combobox_list
|
|
|
|
(STATE_SELECTABLE | STATE_SELECTED | STATE_FOCUSABLE | STATE_FOCUSED),
|
|
|
|
(STATE_SELECTABLE | STATE_FOCUSABLE) // second item, not focused
|
|
|
|
];
|
|
|
|
var undesiredStates = [
|
|
|
|
(STATE_FOCUSED), // combobox
|
|
|
|
(STATE_FOCUSED), // combobox_list
|
|
|
|
(0), // first item
|
|
|
|
(STATE_SELECTED | STATE_FOCUSED) // second, not currently focused, item
|
|
|
|
];
|
|
|
|
testSelect("combo1", names, roles, states, undesiredStates);
|
|
|
|
|
|
|
|
// Select nested within label element.
|
|
|
|
names = [
|
2008-11-26 20:06:11 -08:00
|
|
|
"Search in: Newsticker", // label
|
2008-09-18 00:25:09 -07:00
|
|
|
"Search in:", // text leaf
|
2009-02-18 23:06:14 -08:00
|
|
|
"Search in:", // combobox
|
|
|
|
"Search in: Newsticker", // combobox_list
|
2008-09-18 00:25:09 -07:00
|
|
|
"Newsticker", // option 1
|
|
|
|
"Entire site" // Option 2
|
|
|
|
];
|
|
|
|
roles = [
|
|
|
|
ROLE_LABEL, // root
|
|
|
|
ROLE_TEXT_LEAF, // inner text
|
|
|
|
ROLE_COMBOBOX, // combobox accessible
|
|
|
|
ROLE_COMBOBOX_LIST, // list accessible
|
|
|
|
ROLE_COMBOBOX_OPTION, // first option
|
|
|
|
ROLE_COMBOBOX_OPTION // second option
|
|
|
|
];
|
|
|
|
states = [
|
|
|
|
(0), // label
|
|
|
|
(0), // text leaf
|
|
|
|
(STATE_FOCUSABLE | STATE_HASPOPUP | STATE_COLLAPSED), // combobox
|
|
|
|
(0), // combobox_list
|
|
|
|
(STATE_SELECTABLE | STATE_SELECTED | STATE_FOCUSABLE | STATE_FOCUSED),
|
|
|
|
(STATE_SELECTABLE | STATE_FOCUSABLE) // second item, not focused
|
|
|
|
];
|
|
|
|
undesiredStates = [
|
|
|
|
(0), // label
|
|
|
|
(0), // text leaf
|
|
|
|
(STATE_FOCUSED), // combobox
|
|
|
|
(STATE_FOCUSED), // combobox_list
|
|
|
|
(0), // first item
|
|
|
|
(STATE_SELECTED | STATE_FOCUSED) // second, not currently focused, item
|
|
|
|
];
|
|
|
|
testSelect("combo2", names, roles, states, undesiredStates);
|
|
|
|
|
|
|
|
// select @size with label as separate tags.
|
|
|
|
names = [
|
|
|
|
"Component:", // list
|
|
|
|
"Build", // item 1
|
|
|
|
"Disability Access APIs", // item 2
|
|
|
|
"General", // item 3
|
|
|
|
"UI" // item 4
|
|
|
|
];
|
|
|
|
roles = [
|
2009-02-10 01:55:21 -08:00
|
|
|
ROLE_LISTBOX, // root
|
2008-09-18 00:25:09 -07:00
|
|
|
ROLE_OPTION, // item 1
|
|
|
|
ROLE_OPTION, // item 2
|
|
|
|
ROLE_OPTION, // item 4
|
|
|
|
ROLE_OPTION // item 4
|
|
|
|
];
|
|
|
|
states = [
|
|
|
|
(STATE_FOCUSABLE), // list
|
|
|
|
(STATE_SELECTABLE | STATE_FOCUSABLE | STATE_FOCUSED),
|
|
|
|
(STATE_SELECTABLE | STATE_FOCUSABLE), // second item, not focused
|
|
|
|
(STATE_SELECTABLE | STATE_FOCUSABLE), // third item, not focused
|
|
|
|
(STATE_SELECTABLE | STATE_FOCUSABLE) // fourth item, not focused
|
|
|
|
];
|
|
|
|
undesiredStates = [
|
|
|
|
(STATE_FOCUSED), // listbox
|
|
|
|
(STATE_SELECTED), // first item
|
|
|
|
(STATE_SELECTED | STATE_FOCUSED), // second, not currently focused, item
|
|
|
|
(STATE_SELECTED | STATE_FOCUSED), // third, not currently focused, item
|
|
|
|
(STATE_SELECTED | STATE_FOCUSED) // fourth, not currently focused, item
|
|
|
|
];
|
|
|
|
testSelect("list1", names, roles, states, undesiredStates);
|
|
|
|
|
|
|
|
// Select @size nested within label element.
|
|
|
|
names = [
|
2008-11-26 20:06:11 -08:00
|
|
|
"Version:", // label
|
2008-09-18 00:25:09 -07:00
|
|
|
"Version:", // text leaf
|
2008-11-26 20:06:11 -08:00
|
|
|
"Version:", // list
|
2008-09-18 00:25:09 -07:00
|
|
|
"2.0", // option 1
|
|
|
|
"3.0", // Option 2
|
|
|
|
"3.1", // Option 3
|
|
|
|
"trunk" // Option 4
|
|
|
|
];
|
|
|
|
roles = [
|
|
|
|
ROLE_LABEL, // root
|
|
|
|
ROLE_TEXT_LEAF, // inner text
|
2009-02-10 01:55:21 -08:00
|
|
|
ROLE_LISTBOX, // listbox accessible
|
2008-09-18 00:25:09 -07:00
|
|
|
ROLE_OPTION, // first option
|
|
|
|
ROLE_OPTION, // second option
|
|
|
|
ROLE_OPTION, // third option
|
|
|
|
ROLE_OPTION // fourth option
|
|
|
|
];
|
|
|
|
states = [
|
|
|
|
(0), // label
|
|
|
|
(0), // text leaf
|
|
|
|
(STATE_FOCUSABLE), // listbox
|
|
|
|
(STATE_SELECTABLE | STATE_FOCUSABLE | STATE_FOCUSED), // Option 1
|
|
|
|
(STATE_SELECTABLE | STATE_FOCUSABLE), // second item, not focused
|
|
|
|
(STATE_SELECTABLE | STATE_FOCUSABLE), // third item, not focused
|
|
|
|
(STATE_SELECTABLE | STATE_FOCUSABLE) // fourth item, not focused
|
|
|
|
];
|
|
|
|
undesiredStates = [
|
|
|
|
(0), // label
|
|
|
|
(0), // text leaf
|
|
|
|
(STATE_FOCUSED | STATE_HASPOPUP | STATE_COLLAPSED), // listbox
|
|
|
|
(STATE_SELECTED), // first item
|
|
|
|
(STATE_SELECTED | STATE_FOCUSED), // second, not currently focused, item
|
|
|
|
(STATE_SELECTED | STATE_FOCUSED), // third, not currently focused, item
|
|
|
|
(STATE_SELECTED | STATE_FOCUSED) // fourth, not currently focused, item
|
|
|
|
];
|
|
|
|
testSelect("list2", names, roles, states, undesiredStates);
|
|
|
|
|
|
|
|
SimpleTest.finish();
|
|
|
|
}
|
|
|
|
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
2009-09-23 07:21:47 -07:00
|
|
|
addA11yLoadEvent(doTest);
|
2008-09-18 00:25:09 -07:00
|
|
|
</script>
|
|
|
|
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
|
|
|
<a target="_blank"
|
|
|
|
href="https://bugzilla.mozilla.org/show_bug.cgi?id=443889"
|
|
|
|
title="mochitest for selects and lists">
|
|
|
|
Mozilla Bug 443889
|
|
|
|
</a>
|
|
|
|
<p id="display"></p>
|
|
|
|
<div id="content" style="display: none"></div>
|
|
|
|
<pre id="test">
|
|
|
|
</pre>
|
|
|
|
|
|
|
|
<form action="post.php" method="post">
|
|
|
|
<!-- Label and select separate tags -->
|
|
|
|
<label for="combo1">Foo:</label>
|
|
|
|
<select id="combo1" name="combo1">
|
|
|
|
<option>item 1</option>
|
|
|
|
<option>item 2</option>
|
|
|
|
</select><br />
|
|
|
|
|
|
|
|
<!-- Select embedded in label -->
|
|
|
|
<label id="combo2">Search in:<select name="search">
|
|
|
|
<option>Newsticker</option>
|
|
|
|
<option>Entire site</option>
|
|
|
|
</select></label><br />
|
|
|
|
|
|
|
|
<!-- Label and select @size -->
|
|
|
|
<label for="list1">Component:</label>
|
|
|
|
<select id="list1" name="component" size="3">
|
|
|
|
<option>Build</option>
|
|
|
|
<option>Disability Access APIs</option>
|
|
|
|
<option>General</option>
|
|
|
|
<option>UI</option>
|
|
|
|
</select><br />
|
|
|
|
|
|
|
|
<!-- Select @size nested within label -->
|
|
|
|
<label id="list2">Version:<select name="version" size="3">
|
|
|
|
<option>2.0</option>
|
|
|
|
<option>3.0</option>
|
|
|
|
<option>3.1</option>
|
|
|
|
<option>trunk</option>
|
|
|
|
</select></label><br />
|
|
|
|
</form>
|
|
|
|
</body>
|
|
|
|
</html>
|