tor-browser

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

browser_sidebar_button_reset.js (1696B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 * https://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 registerCleanupFunction(async () => {
      7  await SpecialPowers.popPrefEnv();
      8  CustomizableUI.reset();
      9 });
     10 
     11 add_task(
     12  async function reset_defaults_should_include_sidebar_button_in_revamp() {
     13    ok(
     14      !CustomizableUI.getPlacementOfWidget("sidebar-button"),
     15      "Sidebar button is not in the nav bar initially"
     16    );
     17    CustomizableUI.addWidgetToArea("sidebar-button", "nav-bar");
     18    is(
     19      CustomizableUI.getPlacementOfWidget("sidebar-button").area,
     20      CustomizableUI.AREA_NAVBAR,
     21      "Sidebar button is in the nav bar"
     22    );
     23    CustomizableUI.removeWidgetFromArea("sidebar-button");
     24    ok(
     25      !CustomizableUI.getPlacementOfWidget("sidebar-button"),
     26      "Sidebar button has been removed from the nav bar"
     27    );
     28    CustomizableUI.reset();
     29    ok(
     30      !CustomizableUI.getPlacementOfWidget("sidebar-button"),
     31      "Sidebar button has not been restored to the nav bar"
     32    );
     33 
     34    await SpecialPowers.pushPrefEnv({
     35      set: [["sidebar.revamp", true]],
     36    });
     37    is(
     38      CustomizableUI.getPlacementOfWidget("sidebar-button").area,
     39      CustomizableUI.AREA_NAVBAR,
     40      "Sidebar button is in the nav bar when revamp pref is flipped"
     41    );
     42    CustomizableUI.removeWidgetFromArea("sidebar-button");
     43    ok(
     44      !CustomizableUI.getPlacementOfWidget("sidebar-button"),
     45      "Sidebar button has been removed from the nav bar"
     46    );
     47    CustomizableUI.reset();
     48    is(
     49      CustomizableUI.getPlacementOfWidget("sidebar-button").area,
     50      CustomizableUI.AREA_NAVBAR,
     51      "Sidebar button has been restored to the nav bar"
     52    );
     53  }
     54 );