gecko-dev/accessible/tests/mochitest/test_value.html

86 строки
2.4 KiB
HTML

<html>
<head>
<title>nsIAccessible value testing</title>
<link rel="stylesheet" type="text/css"
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<style type="text/css">
.offscreen {
position: absolute;
left: -5000px;
top: -5000px;
height: 100px;
width: 100px;
}
</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="common.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/chrome-harness.js"/>
<script type="application/javascript">
function doTest()
{
function testValue(aID, aValue)
{
var acc = getAccessible(aID);
if (!acc)
return;
is(acc.value, aValue, "Wrong value for " + aID + "!");
}
var rootDir = getRootDirectory(window.location.href);
var href = rootDir.path + "foo";
// roles that can't live as nsHTMLLinkAccessibles
testValue("aria_menuitem_link", "");
testValue("aria_button_link", "");
testValue("aria_checkbox_link", "");
testValue("aria_application_link", "");
// roles that can live as nsHTMLLinkAccessibles
testValue("aria_link_link", href);
testValue("aria_main_link", href);
testValue("aria_navigation_link", href);
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
</script>
</head>
<body>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=494807"
title="Do not expose a11y info specific to hyperlinks when role is overridden using ARIA">
Mozilla Bug 494807
</a><br />
<a id="aria_menuitem_link" role="menuitem" href="foo">menuitem</a>
<a id="aria_button_link" role="button" href="foo">button</a>
<a id="aria_checkbox_link" role="checkbox" href="foo">checkbox</a>
<!-- landmark links -->
<a id="aria_application_link" role="application" href="foo">app</a>
<a id="aria_main_link" role="main" href="foo">main</a>
<a id="aria_navigation_link" role="navigation" href="foo">nav</a>
<!-- strange edge case: please don't do this in the wild -->
<a id="aria_link_link" role="link" href="foo">link</a>
</body>
</html>