From 6bf0a5cb5034a7e684dcc3500e841785237ce2dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:32:43 +0200 Subject: Adding upstream version 1:115.7.0. Signed-off-by: Daniel Baumann --- .../about/browser_aboutHome_search_searchbar.js | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 browser/base/content/test/about/browser_aboutHome_search_searchbar.js (limited to 'browser/base/content/test/about/browser_aboutHome_search_searchbar.js') diff --git a/browser/base/content/test/about/browser_aboutHome_search_searchbar.js b/browser/base/content/test/about/browser_aboutHome_search_searchbar.js new file mode 100644 index 0000000000..7b08d2ae34 --- /dev/null +++ b/browser/base/content/test/about/browser_aboutHome_search_searchbar.js @@ -0,0 +1,44 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + */ + +const { CustomizableUITestUtils } = ChromeUtils.importESModule( + "resource://testing-common/CustomizableUITestUtils.sys.mjs" +); +let gCUITestUtils = new CustomizableUITestUtils(window); + +ignoreAllUncaughtExceptions(); + +add_task(async function test_setup() { + await gCUITestUtils.addSearchBar(); + registerCleanupFunction(() => { + gCUITestUtils.removeSearchBar(); + }); +}); + +add_task(async function () { + info("Cmd+k should focus the search box in the toolbar when it's present"); + + await BrowserTestUtils.withNewTab( + { gBrowser, url: "about:home" }, + async function (browser) { + await BrowserTestUtils.synthesizeMouseAtCenter("#brandLogo", {}, browser); + + let doc = window.document; + let searchInput = BrowserSearch.searchBar.textbox; + isnot( + searchInput, + doc.activeElement, + "Search bar should not be the active element." + ); + + EventUtils.synthesizeKey("k", { accelKey: true }); + await TestUtils.waitForCondition(() => doc.activeElement === searchInput); + is( + searchInput, + doc.activeElement, + "Search bar should be the active element." + ); + } + ); +}); -- cgit v1.2.3