gecko/accessible/tests/mochitest/test_aria_roles.html

146 lines
5.2 KiB
HTML

<!DOCTYPE html>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=481114
https://bugzilla.mozilla.org/show_bug.cgi?id=469688
https://bugzilla.mozilla.org/show_bug.cgi?id=529289
-->
<head>
<title>Test weak ARIA roles</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"
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">
function doTest()
{
// Note:
// The phrase "weak foo" here means that there is no good foo-to-platform
// role mapping. Similarly "strong foo" means there is a good foo-to-
// platform role mapping.
// weak roles that are forms of "live regions"
testRole("log_table", ROLE_TABLE);
testRole("marquee_h1", ROLE_HEADING);
testRole("timer_div", ROLE_SECTION);
// strong landmark
testRole("application", ROLE_APPLICATION);
// weak landmarks
var weak_landmarks = ["banner", "complementary", "contentinfo",
"main", "navigation", "search"];
for (l in weak_landmarks)
testRole(weak_landmarks[l], ROLE_SECTION);
for (l in weak_landmarks) {
var id = weak_landmarks[l] + "_table";
testRole(id, ROLE_TABLE);
var accessibleTable = getAccessible(id, [nsIAccessibleTable], null,
DONOTFAIL_IF_NO_INTERFACE);
ok(accessibleTable ? true : false,
"landmarked table should have nsIAccessibleTable");
if (accessibleTable)
is(accessibleTable.getCellAt(0,0).firstChild.name, "hi", "no cell");
}
// test gEmptyRoleMap
testRole("cell", ROLE_NOTHING);
// abstract roles
var abstract_roles = ["composite", "landmark", "structure", "widget",
"window", "input", "range", "select", "section",
"sectionhead"];
for (a in abstract_roles)
testRole(abstract_roles[a], ROLE_SECTION);
// aria scrollbar
testRole("scrollbar", ROLE_SCROLLBAR);
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=481114">Mozilla Bug 481114</a>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=469688">Mozilla Bug 469688</a>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=529289">Mozilla Bug 529289</a>
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<!-- "live" roles -->
<table role="log" id="log_table">
<tr><td>Table based log</td></tr>
</table>
<h1 role="marquee" id="marquee_h1">marquee</h1>
<div role="timer" id="timer_div">timer</div>
<!-- landmarks -->
<div role="application" id="application">application</div>
<div role="banner" id="banner">banner</div>
<div role="complementary" id="complementary">complementary</div>
<div role="contentinfo" id="contentinfo">contentinfo</div>
<div role="main" id="main">main</div>
<div role="navigation" id="navigation">navigation</div>
<div role="search" id="search">search</div>
<!-- landmarks are tables -->
<table role="application" id="application_table">application table
<tr><td>hi<td></tr></table>
<table role="banner" id="banner_table">banner table
<tr><td>hi<td></tr></table>
<table role="complementary" id="complementary_table">complementary table
<tr><td>hi<td></tr></table>
<table role="contentinfo" id="contentinfo_table">contentinfo table
<tr><td>hi<td></tr></table>
<table role="main" id="main_table">main table
<tr><td>hi<td></tr></table>
<table role="navigation" id="navigation_table">navigation table
<tr><td>hi<td></tr></table>
<table role="search" id="search_table">search table
<tr><td>hi<td></tr></table>
<!-- test gEmptyRoleMap -->
<table role="label">
<tr>
<td id="cell">cell</td>
</tr>
</table>
<!-- user agents must not map abstract roles to platform API -->
<!-- test abstract base type roles -->
<div role="composite" id="composite">composite</div>
<div role="landmark" id="landmark">landmark</div>
<div role="roletype" id="roletype">roletype</div>
<div role="structure" id="structure">structure</div>
<div role="widget" id="widget">widget</div>
<div role="window" id="window">window</div>
<!-- test abstract input roles -->
<div role="input" id="input">input</div>
<div role="range" id="range">range</div>
<div role="select" id="select">select</div>
<!-- test abstract structure roles -->
<div role="section" id="section">section</div>
<div role="sectionhead" id="sectionhead">sectionhead</div>
<!-- aria scrollbar -->
<div role="scrollbar" id="scrollbar">scrollbar</div>
</body>
</html>