diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
commit | d8bbc7858622b6d9c278469aab701ca0b609cddf (patch) | |
tree | eff41dc61d9f714852212739e6b3738b82a2af87 /accessible/tests/browser/windows/uia/browser_focus.js | |
parent | Releasing progress-linux version 125.0.3-1~progress7.99u1. (diff) | |
download | firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip |
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'accessible/tests/browser/windows/uia/browser_focus.js')
-rw-r--r-- | accessible/tests/browser/windows/uia/browser_focus.js | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/accessible/tests/browser/windows/uia/browser_focus.js b/accessible/tests/browser/windows/uia/browser_focus.js new file mode 100644 index 0000000000..f26c9e1d1b --- /dev/null +++ b/accessible/tests/browser/windows/uia/browser_focus.js @@ -0,0 +1,61 @@ +/* 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"; + +async function testIsFocusable(pyVar, isFocusable) { + const result = await runPython(`${pyVar}.CurrentIsKeyboardFocusable`); + if (isFocusable) { + ok(result, `${pyVar} is focusable`); + } else { + ok(!result, `${pyVar} isn't focusable`); + } +} + +async function testHasFocus(pyVar, hasFocus) { + const result = await runPython(`${pyVar}.CurrentHasKeyboardFocus`); + if (hasFocus) { + ok(result, `${pyVar} has focus`); + } else { + ok(!result, `${pyVar} doesn't have focus`); + } +} + +addUiaTask( + ` +<button id="button1">button1</button> +<p id="p">p</p> +<button id="button2">button2</button> + `, + async function (browser) { + await definePyVar("doc", `getDocUia()`); + await testIsFocusable("doc", true); + await testHasFocus("doc", true); + + await assignPyVarToUiaWithId("button1"); + await testIsFocusable("button1", true); + await testHasFocus("button1", false); + info("Focusing button1"); + await setUpWaitForUiaEvent("AutomationFocusChanged", "button1"); + await invokeFocus(browser, "button1"); + await waitForUiaEvent(); + ok(true, "Got AutomationFocusChanged event on button1"); + await testHasFocus("button1", true); + + await assignPyVarToUiaWithId("p"); + await testIsFocusable("p", false); + await testHasFocus("p", false); + + await assignPyVarToUiaWithId("button2"); + await testIsFocusable("button2", true); + await testHasFocus("button2", false); + info("Focusing button2"); + await setUpWaitForUiaEvent("AutomationFocusChanged", "button2"); + await invokeFocus(browser, "button2"); + await waitForUiaEvent(); + ok(true, "Got AutomationFocusChanged event on button2"); + await testHasFocus("button2", true); + await testHasFocus("button1", false); + } +); |