tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

browser_947914_button_find.js (1239B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 "use strict";
      6 
      7 add_task(async function () {
      8  info("Check find button existence and functionality");
      9  // The TabContextMenu initializes its strings only on a focus or mouseover event.
     10  // Calls focus event on the TabContextMenu early in the test.
     11  gBrowser.selectedTab.focus();
     12  CustomizableUI.addWidgetToArea(
     13    "find-button",
     14    CustomizableUI.AREA_FIXED_OVERFLOW_PANEL
     15  );
     16  registerCleanupFunction(() => CustomizableUI.reset());
     17 
     18  await waitForOverflowButtonShown();
     19 
     20  await document.getElementById("nav-bar").overflowable.show();
     21  info("Menu panel was opened");
     22 
     23  let findButton = document.getElementById("find-button");
     24  ok(findButton, "Find button exists in Panel Menu");
     25 
     26  let findBarPromise = gBrowser.isFindBarInitialized()
     27    ? null
     28    : BrowserTestUtils.waitForEvent(gBrowser.selectedTab, "TabFindInitialized");
     29 
     30  findButton.click();
     31  await findBarPromise;
     32  ok(!gFindBar.hasAttribute("hidden"), "Findbar opened successfully");
     33 
     34  // close find bar
     35  gFindBar.close();
     36  info("Findbar was closed");
     37 });