gecko/accessible/tests/mochitest/selectable/test_aria.html

170 lines
4.9 KiB
HTML

<html>
<head>
<title>nsIAccessibleSelectable ARIA widgets testing</title>
<link rel="stylesheet" type="text/css"
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
</style>
<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"
src="chrome://mochikit/content/a11y/accessible/common.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/role.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/selectable.js"></script>
<script type="application/javascript">
function testSelectable(aID, aSelectableChildren)
{
var acc = getAccessible(aID, [nsIAccessibleSelectable]);
testSelectableSelection(acc, []);
acc.selectAllSelection();
testSelectableSelection(acc, aSelectableChildren);
acc.clearSelection();
testSelectableSelection(acc, []);
}
function doTest()
{
var id = "list1";
ok(isAccessible(id, [nsIAccessibleSelectable]),
"No selectable accessible for " + id);
id = "listbox1";
ok(isAccessible(id, [nsIAccessibleSelectable]),
"No selectable accessible for " + id);
id = "listbox2";
ok(isAccessible(id, [nsIAccessibleSelectable]),
"No selectable accessible for " + id);
id = "grid1";
ok(isAccessible(id, [nsIAccessibleSelectable]),
"No selectable accessible for " + id);
id = "tree1";
ok(isAccessible(id, [nsIAccessibleSelectable]),
"No selectable accessible for " + id);
id = "treegrid1";
ok(isAccessible(id, [nsIAccessibleSelectable]),
"No selectable accessible for " + id);
// Test selection methods for selectable children in subtree.
testSelectable("grid2",
["grid2_colhead1", "grid2_colhead2", "grid2_colhead3",
"grid2_rowhead", "grid2_cell1", "grid2_cell2"]);
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
</script>
</head>
<body>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=530014"
title="ARIA single selectable widget should implement nsIAccessibleSelectable">
Mozilla Bug 530014
</a><br>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=566551"
title="ARIA grid and accessible selectable methods shouldn't use GetNextSibling">
Mozilla Bug 566551
</a><br>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<div role="list" id="list1">
<div role="listitem">item1</div>
<div role="listitem">item2</div>
</div>
<div role="listbox" id="listbox1">
<div role="listitem">item1</div>
<div role="listitem">item2</div>
</div>
<div role="listbox" id="listbox2" aria-multiselectable="true">
<div role="listitem">item1</div>
<div role="listitem">item2</div>
</div>
<div role="grid" id="grid1">
<div role="row">
<span role="gridcell">cell</span>
<span role="gridcell">cell</span>
</div>
<div role="row">
<span role="gridcell">cell</span>
<span role="gridcell">cell</span>
</div>
</div>
<div role="tree" id="tree1">
<div role="treeitem">
item1
<div role="group">
<div role="treeitem">item1.1</div>
</div>
</div>
<div>item2</div>
</div>
<div role="treegrid" id="treegrid1">
<div role="row" aria-level="1">
<span role="gridcell">cell</span>
<span role="gridcell">cell</span>
</div>
<div role="row" aria-level="2">
<span role="gridcell">cell</span>
<span role="gridcell">cell</span>
</div>
<div role="row" aria-level="1">
<span role="gridcell">cell</span>
<span role="gridcell">cell</span>
</div>
</div>
<table tabindex="0" border="2" cellspacing="0" id="grid2" role="grid"
aria-multiselectable="true">
<thead>
<tr>
<th tabindex="-1" role="columnheader" id="grid2_colhead1"
style="width:6em">Entry #</th>
<th tabindex="-1" role="columnheader" id="grid2_colhead2"
style="width:10em">Date</th>
<th tabindex="-1" role="columnheader" id="grid2_colhead3"
style="width:20em">Expense</th>
</tr>
</thead>
<tbody>
<tr>
<td tabindex="-1" role="rowheader" id="grid2_rowhead"
aria-readonly="true">1</td>
<td tabindex="-1" role="gridcell" id="grid2_cell1"
aria-selected="false">03/14/05</td>
<td tabindex="-1" role="gridcell" id="grid2_cell2"
aria-selected="false">Conference Fee</td>
</tr>
</tobdy>
</table>
</body>
</html>