gecko/accessible/tests/mochitest/actions/test_link.html

143 lines
3.5 KiB
HTML

<html>
<head>
<title>nsIAccessible actions testing on HTML links (HTML:a)</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="../common.js"></script>
<script type="application/javascript"
src="../events.js"></script>
<script type="application/javascript"
src="../actions.js"></script>
<script type="application/javascript">
function getAnchorTargetDocumentAcc()
{
var thisTabDocAcc = getTabDocAccessible();
var thisDocTabPanelAcc = thisTabDocAcc.parent.parent;
var tabPanelsAcc = thisDocTabPanelAcc.parent;
var newDocTabPanelAcc = tabPanelsAcc.lastChild.firstChild;
return newDocTabPanelAcc.firstChild;
}
function linkChecker(aID)
{
this.type = EVENT_DOCUMENT_LOAD_COMPLETE;
this.__defineGetter__("target", getAnchorTargetDocumentAcc);
this.check = function linkChecker_check()
{
var anchorTargetWindow =
getAccessible(getAnchorTargetDocumentAcc(), [nsIAccessibleDocument]).
window;
anchorTargetWindow.close();
}
this.getID = function linkChecker_getID()
{
return "link '" + aID + "' states check ";
}
}
//gA11yEventDumpID = "eventdump"; // debug stuff
gA11yEventDumpToConsole = true;
function doTest()
{
var actionsArray = [
{
ID: "link1",
actionName: "jump",
events: CLICK_EVENTS,
eventSeq: [
new linkChecker("link1")
]
},
{
ID: "img1",
targetID: "link1",
actionName: "jump",
events: CLICK_EVENTS,
eventSeq: [
new linkChecker("link1")
]
},
{
ID: "link2",
actionName: "click",
events: CLICK_EVENTS
},
{
ID: "img2",
targetID: "link2",
actionName: "jump",
events: CLICK_EVENTS
},
{
ID: "link3",
actionName: "click",
events: CLICK_EVENTS
},
{
ID: "img3",
targetID: "link3",
actionName: "jump",
events: CLICK_EVENTS
},
{
ID: "link4",
actionName: "click",
events: CLICK_EVENTS
},
{
ID: "img4",
targetID: "link4",
actionName: "jump",
events: CLICK_EVENTS
}
];
testActions(actionsArray);
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
</script>
</head>
<body>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=423409"
title="Expose click action if mouseup and mousedown are registered">
Mozilla Bug 423409
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<a href="about:mozilla" id="link1" target="_blank">
<img src="../moz.png" id="img1">
</a>
<a id="link2" onmousedown="">
<img src="../moz.png" id="img2">
</a>
<a id="link3" onclick="">
<img src="../moz.png" id="img3">
</a>
<a id="link4" onmouseup="">
<img src="../moz.png" id="img4">
</a>
<div id="eventdump"></div>
</body>
</html>