summaryrefslogtreecommitdiffstats
path: root/accessible/tests/mochitest/hyperlink/hyperlink.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /accessible/tests/mochitest/hyperlink/hyperlink.js
parentInitial commit. (diff)
downloadfirefox-upstream.tar.xz
firefox-upstream.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'accessible/tests/mochitest/hyperlink/hyperlink.js')
-rw-r--r--accessible/tests/mochitest/hyperlink/hyperlink.js46
1 files changed, 46 insertions, 0 deletions
diff --git a/accessible/tests/mochitest/hyperlink/hyperlink.js b/accessible/tests/mochitest/hyperlink/hyperlink.js
new file mode 100644
index 0000000000..93caa9090c
--- /dev/null
+++ b/accessible/tests/mochitest/hyperlink/hyperlink.js
@@ -0,0 +1,46 @@
+/* import-globals-from ../common.js */
+/* import-globals-from ../events.js */
+/* import-globals-from ../states.js */
+
+/**
+ * Focus hyperlink invoker.
+ *
+ * @param aID [in] hyperlink identifier
+ * @param aSelectedAfter [in] specifies if hyperlink is selected/focused after
+ * the focus
+ */
+function focusLink(aID, aSelectedAfter) {
+ this.node = getNode(aID);
+ this.accessible = getAccessible(this.node);
+
+ this.eventSeq = [];
+ this.unexpectedEventSeq = [];
+
+ var checker = new invokerChecker(EVENT_FOCUS, this.accessible);
+ if (aSelectedAfter) {
+ this.eventSeq.push(checker);
+ } else {
+ this.unexpectedEventSeq.push(checker);
+ }
+
+ this.invoke = function focusLink_invoke() {
+ var expectedStates = aSelectedAfter ? STATE_FOCUSABLE : 0;
+ var unexpectedStates =
+ (!aSelectedAfter ? STATE_FOCUSABLE : 0) | STATE_FOCUSED;
+ testStates(aID, expectedStates, 0, unexpectedStates, 0);
+
+ this.node.focus();
+ };
+
+ this.finalCheck = function focusLink_finalCheck() {
+ var expectedStates = aSelectedAfter ? STATE_FOCUSABLE | STATE_FOCUSED : 0;
+ var unexpectedStates = !aSelectedAfter
+ ? STATE_FOCUSABLE | STATE_FOCUSED
+ : 0;
+ testStates(aID, expectedStates, 0, unexpectedStates, 0);
+ };
+
+ this.getID = function focusLink_getID() {
+ return "focus hyperlink " + prettyName(aID);
+ };
+}