From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- accessible/tests/mochitest/hyperlink/hyperlink.js | 46 +++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 accessible/tests/mochitest/hyperlink/hyperlink.js (limited to 'accessible/tests/mochitest/hyperlink/hyperlink.js') 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); + }; +} -- cgit v1.2.3