tor-browser

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

browser_938995_indefaultstate_nonremovable.js (1354B)


      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 const kWidgetId = "test-non-removable-widget";
      8 
      9 // Adding non-removable items to a toolbar or the panel shouldn't change inDefaultState
     10 add_task(async function () {
     11  ok(CustomizableUI.inDefaultState, "Should start in default state");
     12 
     13  let button = createDummyXULButton(
     14    kWidgetId,
     15    "Test non-removable inDefaultState handling"
     16  );
     17  CustomizableUI.addWidgetToArea(kWidgetId, CustomizableUI.AREA_NAVBAR);
     18  button.setAttribute("removable", "false");
     19  ok(
     20    CustomizableUI.inDefaultState,
     21    "Should still be in default state after navbar addition"
     22  );
     23  button.remove();
     24 
     25  button = createDummyXULButton(
     26    kWidgetId,
     27    "Test non-removable inDefaultState handling"
     28  );
     29  CustomizableUI.addWidgetToArea(
     30    kWidgetId,
     31    CustomizableUI.AREA_FIXED_OVERFLOW_PANEL
     32  );
     33  button.setAttribute("removable", "false");
     34  ok(
     35    CustomizableUI.inDefaultState,
     36    "Should still be in default state after panel addition"
     37  );
     38  button.remove();
     39  ok(
     40    CustomizableUI.inDefaultState,
     41    "Should be in default state after destroying both widgets"
     42  );
     43  // reset now that button is gone.
     44  CustomizableUI.reset();
     45 });