Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Errors
- This test failed 1 times in the preceding 30 days. quicksearch this test
- Manifest: accessible/tests/mochitest/hyperlink/a11y.toml
<?xml version="1.0"?>
type="text/css"?>
title="test for nsIAccessibleHyperLink interface on XUL:label elements">
<script type="application/javascript"
src="../common.js" />
<script type="application/javascript"
src="../role.js" />
<script type="application/javascript"
src="../states.js" />
<script type="application/javascript"
src="../events.js" />
<script type="application/javascript"
src="hyperlink.js" />
<script type="application/javascript">
<![CDATA[
function testThis(aID, aAcc, aRole, aAnchorCount, aAnchorName, aURI,
aStartIndex, aEndIndex, aValid)
{
testRole(aID, aRole);
is(aAcc.anchorCount, aAnchorCount, "Wrong number of anchors for ID "
+ aID + "!");
is(aAcc.getAnchor(0).name, aAnchorName, "Wrong name for ID " + aID + "!");
is(aAcc.getURI(0).spec, aURI, "URI wrong for ID " + aID + "!");
is(aAcc.startIndex, aStartIndex, "Wrong startIndex value for ID " + aID
+ "!");
is(aAcc.endIndex, aEndIndex, "Wrong endIndex value for ID " + aID + "!");
is(aAcc.valid, aValid, "Wrong valid state for ID " + aID + "!");
}
var gQueue = null;
function doTest()
{
var linkedLabelAcc = getAccessible("linkedLabel",
[nsIAccessibleHyperLink]);
testThis("linkedLabel", linkedLabelAcc, ROLE_LINK, 1,
// eslint-disable-next-line @microsoft/sdl/no-insecure-url
true);
testStates(linkedLabelAcc, STATE_LINKED, 0);
var labelWithValueAcc = getAccessible("linkLabelWithValue",
[nsIAccessibleHyperLink]);
testThis("linkLabelWithValue", labelWithValueAcc, ROLE_LINK, 1,
// eslint-disable-next-line @microsoft/sdl/no-insecure-url
false, true);
testStates(labelWithValueAcc, STATE_LINKED, 0);
var normalLabelAcc = getAccessible("normalLabel");
testRole(normalLabelAcc, ROLE_LABEL);
is(normalLabelAcc.name, "This label should not be a link",
"Wrong name for normal label!");
testStates(normalLabelAcc, 0, 0, (STATE_FOCUSABLE | STATE_LINKED));
//////////////////////////////////////////////////////////////////////////
// Test focus
gQueue = new eventQueue();
gQueue.push(new focusLink("linkedLabel", true));
gQueue.push(new focusLink("linkLabelWithValue", true));
gQueue.invoke(); // Will call SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
]]>
</script>
<a target="_blank"
title="Implement Mochitests for the nsIAccessibleHyperLink interface on XUL:label elements">
</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
Mozilla Foundation home</label>
<label id="linkLabelWithValue" value="Mozilla Foundation" is="text-link"
<label id="normalLabel" value="This label should not be a link" />
</window>