2009-04-24 18:40:18 +04:00
|
|
|
<html>
|
|
|
|
|
|
|
|
<head>
|
|
|
|
<title>nsIAccessible::description 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"
|
|
|
|
src="chrome://mochikit/content/a11y/accessible/common.js"></script>
|
|
|
|
|
|
|
|
<script type="application/javascript">
|
|
|
|
function testDescr(aAccOrElmOrID, aDescr)
|
|
|
|
{
|
|
|
|
var acc = getAccessible(aAccOrElmOrID);
|
|
|
|
if (!acc)
|
|
|
|
return;
|
|
|
|
|
|
|
|
is(acc.description, aDescr,
|
|
|
|
"Wrong description for " + prettyName(aAccOrElmOrID));
|
|
|
|
}
|
|
|
|
|
|
|
|
function doTest()
|
|
|
|
{
|
|
|
|
// Description from aria-describedby attribute
|
|
|
|
testDescr("img1", "aria description");
|
|
|
|
|
|
|
|
// No description from @title attribute because it is used to generate
|
|
|
|
// name.
|
|
|
|
testDescr("img2", "");
|
|
|
|
|
|
|
|
// Description from @title attribute, name is generated from @alt
|
|
|
|
// attribute.
|
|
|
|
testDescr("img3", "description");
|
|
|
|
|
2009-11-07 09:37:51 +03:00
|
|
|
// Description from content of h2.
|
|
|
|
testDescr("p", "heading");
|
|
|
|
|
2009-04-24 18:40:18 +04:00
|
|
|
SimpleTest.finish();
|
|
|
|
}
|
|
|
|
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
2009-09-23 18:21:47 +04:00
|
|
|
addA11yLoadEvent(doTest);
|
2009-04-24 18:40:18 +04:00
|
|
|
</script>
|
|
|
|
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
|
|
|
<a target="_blank"
|
|
|
|
href="https://bugzilla.mozilla.org/show_bug.cgi?id=489944"
|
|
|
|
title="@title attribute no longer exposed on accDescription">
|
|
|
|
Mozilla Bug 489944
|
|
|
|
</a>
|
|
|
|
<p id="display"></p>
|
|
|
|
<div id="content" style="display: none"></div>
|
|
|
|
<pre id="test">
|
|
|
|
</pre>
|
|
|
|
|
|
|
|
<p id="description">aria description</p>
|
|
|
|
<img id="img1" aria-describedby="description" />
|
|
|
|
<img id="img2" title="title" />
|
|
|
|
<img id="img3" alt="name" title="description" />
|
|
|
|
|
2009-11-07 09:37:51 +03:00
|
|
|
<h2 id="heading">heading</h2>
|
|
|
|
<p id="p" aria-describedby="heading" role="button">click me</p>
|
2009-04-24 18:40:18 +04:00
|
|
|
</body>
|
|
|
|
</html>
|