summaryrefslogtreecommitdiffstats
path: root/accessible/tests/mochitest/actions/test_link.html
diff options
context:
space:
mode:
Diffstat (limited to 'accessible/tests/mochitest/actions/test_link.html')
-rw-r--r--accessible/tests/mochitest/actions/test_link.html147
1 files changed, 147 insertions, 0 deletions
diff --git a/accessible/tests/mochitest/actions/test_link.html b/accessible/tests/mochitest/actions/test_link.html
new file mode 100644
index 000000000..dc96951d1
--- /dev/null
+++ b/accessible/tests/mochitest/actions/test_link.html
@@ -0,0 +1,147 @@
+<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/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.firstChild;
+ var nextAcc = newDocTabPanelAcc;
+
+ while (nextAcc = nextAcc.nextSibling) {
+ // Find the last accessible for a browser with about:mozilla loaded.
+ if (nextAcc.firstChild.DOMNode.currentURI.spec == "about:mozilla") {
+ newDocTabPanelAcc = nextAcc;
+ }
+ }
+
+ return newDocTabPanelAcc.firstChild.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 ";
+ }
+ }
+
+ //gA11yEventDumpToConsole = true;
+ //enableLogging("tree,eventTree,verbose");
+
+ 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>
+</body>
+</html>