commit 84e52d1f8c42e516f57260615d2cf74055ef55bf
parent ee5ad51b568bb4eb4ad269dad0f8c0deb04c5da4
Author: Eitan Isaacson <eitan@monotonous.org>
Date: Fri, 17 Oct 2025 05:30:06 +0000
Bug 1994029 - P1: Introduce atk action test. r=Jamie
Differential Revision: https://phabricator.services.mozilla.com/D268468
Diffstat:
2 files changed, 32 insertions(+), 0 deletions(-)
diff --git a/accessible/tests/browser/atk/browser.toml b/accessible/tests/browser/atk/browser.toml
@@ -13,6 +13,8 @@ prefs = [
"security.allow_eval_with_system_principal=true"
]
+["browser_action.js"]
+
["browser_atspi_interfaces.js"]
["browser_groupPosition.js"]
diff --git a/accessible/tests/browser/atk/browser_action.js b/accessible/tests/browser/atk/browser_action.js
@@ -0,0 +1,30 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+"use strict";
+
+/**
+ * Test basic press action.
+ */
+addAccessibleTask(
+ `
+<button id="btn" onclick="this.textContent = 'Clicked'">Click me</button>
+ `,
+ async function testBasicPress() {
+ const actions = await runPython(`
+ global doc
+ doc = getDoc()
+ global btn
+ btn = findByDomId(doc, "btn").queryAction()
+ return str([[btn.getName(i), btn.getLocalizedName(i), btn.getDescription(i)] for i in range(btn.get_nActions())])
+ `);
+ is(actions, "[['press', '', 'Press']]", "btn has correct actions");
+
+ const nameChanged = waitForEvent(EVENT_NAME_CHANGE, "btn");
+ await runPython(`
+ btn.doAction(0)
+ `);
+ await nameChanged;
+ }
+);