diff --git a/browser/base/content/browser.css b/browser/base/content/browser.css index 1db5e7cc7668..930c069ec3df 100644 --- a/browser/base/content/browser.css +++ b/browser/base/content/browser.css @@ -670,6 +670,7 @@ toolbar:not(#TabsToolbar) > #personal-bookmarks { #urlbar[actiontype="switchtab"][actionoverride] > #urlbar-input-container > #urlbar-label-box, #urlbar:not([actiontype="switchtab"], [actiontype="extension"], [searchmode]) > #urlbar-input-container > #urlbar-label-box, #urlbar:not([actiontype="switchtab"]) > #urlbar-input-container > #urlbar-label-box > #urlbar-label-switchtab, +#urlbar[searchmode] > #urlbar-input-container > #urlbar-label-box > #urlbar-label-switchtab, #urlbar:not([actiontype="extension"]) > #urlbar-input-container > #urlbar-label-box > #urlbar-label-extension, #urlbar[searchmode][breakout-extend] > #urlbar-input-container > #urlbar-label-box, #urlbar:not([searchmode]) > #urlbar-input-container > #urlbar-label-box > #urlbar-label-search-mode, diff --git a/browser/components/urlbar/tests/browser/browser.ini b/browser/components/urlbar/tests/browser/browser.ini index 1109b8b61d1c..be85fe5c0db6 100644 --- a/browser/components/urlbar/tests/browser/browser.ini +++ b/browser/components/urlbar/tests/browser/browser.ini @@ -237,6 +237,7 @@ skip-if = asan # Bug 1701321 [browser_switchTab_closesUrlbarPopup.js] [browser_switchTab_decodeuri.js] [browser_switchTab_override.js] +[browser_switchToTab_chiclet.js] [browser_switchToTab_closes_newtab.js] [browser_switchToTab_fullUrl_repeatedKeydown.js] [browser_switchToTabHavingURI_aOpenParams.js] diff --git a/browser/components/urlbar/tests/browser/browser_switchToTab_chiclet.js b/browser/components/urlbar/tests/browser/browser_switchToTab_chiclet.js new file mode 100644 index 000000000000..a6a9f68b96c3 --- /dev/null +++ b/browser/components/urlbar/tests/browser/browser_switchToTab_chiclet.js @@ -0,0 +1,92 @@ +/* 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/. */ + +/** + * Test for chiclet upon switching tab mode. + */ + +"use strict"; + +const TEST_URL = `${TEST_BASE_URL}dummy_page.html`; + +add_task(async function test_with_oneoff_button() { + info("Loading test page into first tab"); + await BrowserTestUtils.loadURI(gBrowser, TEST_URL); + + info("Opening a new tab"); + const tab = await BrowserTestUtils.openNewForegroundTab(gBrowser); + + info("Wait for autocomplete"); + await UrlbarTestUtils.promiseAutocompleteResultPopup({ + window, + value: "", + }); + + info("Enter Tabs mode"); + await UrlbarTestUtils.enterSearchMode(window, { + source: UrlbarUtils.RESULT_SOURCE.TABS, + }); + + info("Select first popup entry"); + await UrlbarTestUtils.promiseAutocompleteResultPopup({ + window, + value: "dummy", + }); + EventUtils.synthesizeKey("KEY_ArrowDown"); + const result = await UrlbarTestUtils.getDetailsOfResultAt( + window, + UrlbarTestUtils.getSelectedRowIndex(window) + ); + Assert.equal(result.type, UrlbarUtils.RESULT_TYPE.TAB_SWITCH); + + info("Enter escape key"); + EventUtils.synthesizeKey("KEY_Escape"); + + info("Check label visibility"); + const searchModeLabel = document.getElementById("urlbar-label-search-mode"); + const switchTabLabel = document.getElementById("urlbar-label-switchtab"); + Assert.ok(BrowserTestUtils.is_visible(searchModeLabel)); + Assert.ok(BrowserTestUtils.is_hidden(switchTabLabel)); + + await PlacesUtils.history.clear(); + gBrowser.removeTab(tab); +}); + +add_task(async function test_with_keytype() { + info("Loading test page into first tab"); + await BrowserTestUtils.loadURI(gBrowser, TEST_URL); + + info("Opening a new tab"); + const tab = await BrowserTestUtils.openNewForegroundTab(gBrowser); + + info("Enter Tabs mode with keytype"); + await UrlbarTestUtils.promiseAutocompleteResultPopup({ + window, + value: "%", + }); + + info("Select second popup entry"); + await UrlbarTestUtils.promiseAutocompleteResultPopup({ + window, + value: "dummy", + }); + EventUtils.synthesizeKey("KEY_ArrowDown"); + const result = await UrlbarTestUtils.getDetailsOfResultAt( + window, + UrlbarTestUtils.getSelectedRowIndex(window) + ); + Assert.equal(result.type, UrlbarUtils.RESULT_TYPE.TAB_SWITCH); + + info("Enter escape key"); + EventUtils.synthesizeKey("KEY_Escape"); + + info("Check label visibility"); + const searchModeLabel = document.getElementById("urlbar-label-search-mode"); + const switchTabLabel = document.getElementById("urlbar-label-switchtab"); + Assert.ok(BrowserTestUtils.is_hidden(searchModeLabel)); + Assert.ok(BrowserTestUtils.is_visible(switchTabLabel)); + + await PlacesUtils.history.clear(); + gBrowser.removeTab(tab); +});