summaryrefslogtreecommitdiffstats
path: root/accessible/tests/mochitest/actions/test_link.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /accessible/tests/mochitest/actions/test_link.html
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'accessible/tests/mochitest/actions/test_link.html')
-rw-r--r--accessible/tests/mochitest/actions/test_link.html145
1 files changed, 145 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 0000000000..cf10f4bec0
--- /dev/null
+++ b/accessible/tests/mochitest/actions/test_link.html
@@ -0,0 +1,145 @@
+<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 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: "click ancestor",
+ events: CLICK_EVENTS,
+ allowBubbling: true,
+ eventSeq: [
+ new linkChecker("link1"),
+ ],
+ },
+ {
+ ID: "link2",
+ actionName: "click",
+ events: CLICK_EVENTS,
+ },
+ {
+ ID: "img2",
+ targetID: "link2",
+ actionName: "click ancestor",
+ events: CLICK_EVENTS,
+ allowBubbling: true,
+ },
+ {
+ ID: "link3",
+ actionName: "click",
+ events: CLICK_EVENTS,
+ },
+ {
+ ID: "img3",
+ targetID: "link3",
+ actionName: "click ancestor",
+ events: CLICK_EVENTS,
+ allowBubbling: true,
+ },
+ {
+ ID: "link4",
+ actionName: "click",
+ events: CLICK_EVENTS,
+ },
+ {
+ ID: "img4",
+ targetID: "link4",
+ actionName: "click ancestor",
+ events: CLICK_EVENTS,
+ allowBubbling: true,
+ },
+ ];
+ testActions(actionsArray);
+ }
+
+ SimpleTest.waitForExplicitFinish();
+ addA11yLoadEvent(doTest);
+ </script>
+</head>
+
+<body>
+
+ <a target="_blank" rel="opener"
+ 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" rel="opener">
+ <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>