diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /browser/components/customizableui/test/browser_987640_charEncoding.js | |
parent | Initial commit. (diff) | |
download | firefox-upstream.tar.xz firefox-upstream.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/components/customizableui/test/browser_987640_charEncoding.js')
-rw-r--r-- | browser/components/customizableui/test/browser_987640_charEncoding.js | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/browser/components/customizableui/test/browser_987640_charEncoding.js b/browser/components/customizableui/test/browser_987640_charEncoding.js new file mode 100644 index 0000000000..1d43299dff --- /dev/null +++ b/browser/components/customizableui/test/browser_987640_charEncoding.js @@ -0,0 +1,78 @@ +/* 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"; + +const TEST_PAGE = + "http://mochi.test:8888/browser/browser/components/customizableui/test/support/test_967000_charEncoding_page.html"; + +add_task(async function() { + info("Check Character Encoding panel functionality"); + + // add the Character Encoding button to the panel + CustomizableUI.addWidgetToArea( + "characterencoding-button", + CustomizableUI.AREA_FIXED_OVERFLOW_PANEL + ); + + await waitForOverflowButtonShown(); + + let newTab = await BrowserTestUtils.openNewForegroundTab( + gBrowser, + TEST_PAGE, + true, + true + ); + + await document.getElementById("nav-bar").overflowable.show(); + let charEncodingButton = document.getElementById("characterencoding-button"); + + ok( + !charEncodingButton.hasAttribute("disabled"), + "The encoding button should be enabled" + ); + + let browserStopPromise = BrowserTestUtils.browserStopped(gBrowser, TEST_PAGE); + charEncodingButton.click(); + await browserStopPromise; + is( + gBrowser.selectedBrowser.characterSet, + "UTF-8", + "The encoding should be changed to UTF-8" + ); + ok( + !gBrowser.selectedBrowser.mayEnableCharacterEncodingMenu, + "The encoding menu should be disabled" + ); + + is( + charEncodingButton.getAttribute("disabled"), + "true", + "We should disable the encoding button in toolbar" + ); + + CustomizableUI.removeWidgetFromArea("characterencoding-button"); + CustomizableUI.addWidgetToArea( + "characterencoding-button", + CustomizableUI.AREA_FIXED_OVERFLOW_PANEL + ); + await waitForOverflowButtonShown(); + await document.getElementById("nav-bar").overflowable.show(); + charEncodingButton = document.getElementById("characterencoding-button"); + + // check the encoding menu again + is( + charEncodingButton.getAttribute("disabled"), + "true", + "We should disable the encoding button in overflow menu" + ); + + BrowserTestUtils.removeTab(newTab); +}); + +add_task(async function asyncCleanup() { + // reset the panel to the default state + await resetCustomization(); + ok(CustomizableUI.inDefaultState, "The UI is in default state again."); +}); |