2009-10-22 20:29:36 -07:00
|
|
|
<html>
|
|
|
|
|
|
|
|
<head>
|
2010-02-03 07:00:25 -08:00
|
|
|
<title>HTML link states testing</title>
|
2009-10-22 20:29:36 -07:00
|
|
|
|
|
|
|
<link rel="stylesheet" type="text/css"
|
|
|
|
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
|
|
|
|
|
|
|
<script type="application/javascript"
|
|
|
|
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
2012-05-17 02:37:37 -07:00
|
|
|
<script type="application/javascript"
|
|
|
|
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
|
2009-10-22 20:29:36 -07:00
|
|
|
|
|
|
|
<script type="application/javascript"
|
2010-09-01 15:09:56 -07:00
|
|
|
src="../common.js"></script>
|
2009-10-22 20:29:36 -07:00
|
|
|
<script type="application/javascript"
|
2010-09-01 15:09:56 -07:00
|
|
|
src="../role.js"></script>
|
2009-10-22 20:29:36 -07:00
|
|
|
<script type="application/javascript"
|
2010-09-01 15:09:56 -07:00
|
|
|
src="../states.js"></script>
|
2012-05-17 02:37:37 -07:00
|
|
|
<script type="application/javascript"
|
|
|
|
src="../events.js"></script>
|
2009-10-22 20:29:36 -07:00
|
|
|
|
|
|
|
<script type="application/javascript">
|
2012-11-27 22:54:21 -08:00
|
|
|
//gA11yEventDumpToConsole = true; // debug stuff
|
2012-09-21 21:03:01 -07:00
|
|
|
|
2012-11-14 01:45:46 -08:00
|
|
|
var gLinkWindow = null;
|
2012-11-09 09:37:27 -08:00
|
|
|
function closeDocChecker()
|
|
|
|
{
|
|
|
|
this.__proto__ = new asyncInvokerChecker(EVENT_DOCUMENT_LOAD_COMPLETE);
|
|
|
|
|
|
|
|
this.check = function closeDocChecker_check(aEvent)
|
|
|
|
{
|
2012-11-14 01:45:46 -08:00
|
|
|
gLinkWindow = aEvent.accessible.rootDocument.window;
|
2012-11-09 09:37:27 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
this.match = function closeDocChecker_match(aEvent)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function clickLink(aID)
|
|
|
|
{
|
|
|
|
this.eventSeq = [
|
|
|
|
new stateChangeChecker(STATE_TRAVERSED, false, true, "link_traversed"),
|
|
|
|
new closeDocChecker()
|
|
|
|
];
|
|
|
|
|
|
|
|
this.invoke = function clickLink_invoke()
|
|
|
|
{
|
|
|
|
synthesizeMouse(getNode("link_traversed"), 1, 1, { shiftKey: true });
|
|
|
|
}
|
|
|
|
|
|
|
|
this.getID = function clickLink_getID()
|
|
|
|
{
|
|
|
|
return "link + '" + aID + "' clicked.";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var gQueue = null;
|
2009-10-22 20:29:36 -07:00
|
|
|
function doTest()
|
|
|
|
{
|
2012-05-17 02:37:37 -07:00
|
|
|
// a@href and its text node
|
|
|
|
testStates("link_href", STATE_LINKED);
|
|
|
|
testStates(getAccessible("link_href").firstChild, STATE_LINKED);
|
|
|
|
|
|
|
|
// a@onclick
|
|
|
|
testStates("link_click", STATE_LINKED);
|
|
|
|
|
|
|
|
// a@onmousedown
|
|
|
|
testStates("link_mousedown", STATE_LINKED);
|
|
|
|
|
|
|
|
// a@onmouseup
|
|
|
|
testStates("link_mouseup", STATE_LINKED);
|
|
|
|
|
|
|
|
// a@role="link"
|
|
|
|
testStates("link_arialink", STATE_LINKED);
|
|
|
|
|
|
|
|
// a@role="button"
|
|
|
|
testStates("link_ariabutton", 0, 0, STATE_LINKED);
|
2010-02-03 07:00:25 -08:00
|
|
|
|
2012-05-17 02:37:37 -07:00
|
|
|
// a (no @href, no click event listener)
|
|
|
|
testStates("link_notlink", 0, 0, STATE_LINKED);
|
|
|
|
|
2012-11-09 09:37:27 -08:00
|
|
|
// a: no traversed state
|
2012-05-17 02:37:37 -07:00
|
|
|
testStates("link_traversed", 0, 0, STATE_TRAVERSED);
|
2012-09-24 04:07:35 -07:00
|
|
|
|
2012-11-09 09:37:27 -08:00
|
|
|
// a: traversed state
|
|
|
|
gQueue = new eventQueue();
|
|
|
|
gQueue.push(new clickLink("link_traversed"));
|
2012-11-27 22:54:21 -08:00
|
|
|
gQueue.onFinish = function() { gLinkWindow.close(); }
|
2012-11-09 09:37:27 -08:00
|
|
|
gQueue.invoke(); // will call SimpleTest.finsih();
|
2009-10-22 20:29:36 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
addA11yLoadEvent(doTest);
|
|
|
|
</script>
|
2010-02-03 07:00:25 -08:00
|
|
|
|
2009-10-22 20:29:36 -07:00
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
|
|
|
<a target="_blank"
|
2010-02-03 07:00:25 -08:00
|
|
|
href="https://bugzilla.mozilla.org/show_bug.cgi?id=423409"
|
|
|
|
title="Expose click action if mouseup and mousedown are registered">
|
|
|
|
Mozilla Bug 423409
|
2009-10-22 20:29:36 -07:00
|
|
|
</a>
|
2012-05-17 02:37:37 -07:00
|
|
|
<a target="_blank"
|
|
|
|
href="https://bugzilla.mozilla.org/show_bug.cgi?id=754830"
|
|
|
|
title="Calculate link states separately">
|
|
|
|
Mozilla Bug 754830
|
|
|
|
</a>
|
2012-11-09 09:37:27 -08:00
|
|
|
<a target="_blank"
|
|
|
|
href="https://bugzilla.mozilla.org/show_bug.cgi?id=757774"
|
|
|
|
title="Fire state change event when link is traversed">
|
|
|
|
Mozilla Bug 757774
|
|
|
|
</a>
|
2009-10-22 20:29:36 -07:00
|
|
|
<p id="display"></p>
|
|
|
|
<div id="content" style="display: none"></div>
|
|
|
|
<pre id="test">
|
|
|
|
</pre>
|
|
|
|
|
2012-05-17 02:37:37 -07:00
|
|
|
<a id="link_href" href="http://mozilla.org">link</a>
|
|
|
|
<a id="link_click" onclick="">link</a>
|
|
|
|
<a id="link_mousedown" onmousedown="">link</a>
|
|
|
|
<a id="link_mouseup" onmouseup="">link</a>
|
|
|
|
<a id="link_arialink" role="link">aria link</a>
|
|
|
|
<a id="link_ariabutton" role="button">aria button</a>
|
|
|
|
<a id="link_notlink">not link</a>
|
|
|
|
|
|
|
|
<a id="link_traversed" href="http://www.example.com" target="_top">example.com</a>
|
2010-02-03 07:00:25 -08:00
|
|
|
|
2009-10-22 20:29:36 -07:00
|
|
|
</body>
|
|
|
|
</html>
|