tor-browser

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

browser_customizemode_contextmenu_menubuttonstate.js (2035B)


      1 "use strict";
      2 
      3 add_task(async function () {
      4  ok(
      5    !PanelUI.menuButton.hasAttribute("open"),
      6    "Menu button should not be 'pressed' outside customize mode"
      7  );
      8  ok(
      9    !PanelUI.menuButton.hasAttribute("disabled"),
     10    "Menu button should not be disabled outside of customize mode"
     11  );
     12  await startCustomizing();
     13 
     14  ok(
     15    !PanelUI.menuButton.hasAttribute("open"),
     16    "Menu button should still not be 'pressed' when in customize mode"
     17  );
     18  ok(
     19    PanelUI.menuButton.hasAttribute("disabled"),
     20    "Menu button should be disabled in customize mode"
     21  );
     22 
     23  let contextMenu = document.getElementById(
     24    "customizationPaletteItemContextMenu"
     25  );
     26  let shownPromise = popupShown(contextMenu);
     27  let newWindowButton = document.getElementById("wrapper-new-window-button");
     28  EventUtils.synthesizeMouse(newWindowButton, 2, 2, {
     29    type: "contextmenu",
     30    button: 2,
     31  });
     32  await shownPromise;
     33  ok(
     34    !PanelUI.menuButton.hasAttribute("open"),
     35    "Menu button should still not be 'pressed' when in customize mode after opening a context menu"
     36  );
     37  ok(
     38    PanelUI.menuButton.hasAttribute("disabled"),
     39    "Menu button should still be disabled in customize mode"
     40  );
     41  ok(
     42    PanelUI.menuButton.hasAttribute("disabled"),
     43    "Menu button should still be disabled in customize mode after opening context menu"
     44  );
     45 
     46  let hiddenContextPromise = popupHidden(contextMenu);
     47  contextMenu.hidePopup();
     48  await hiddenContextPromise;
     49  ok(
     50    !PanelUI.menuButton.hasAttribute("open"),
     51    "Menu button should still not be 'pressed' when in customize mode after hiding a context menu"
     52  );
     53  ok(
     54    PanelUI.menuButton.hasAttribute("disabled"),
     55    "Menu button should still be disabled in customize mode after hiding context menu"
     56  );
     57  await endCustomizing();
     58 
     59  ok(
     60    !PanelUI.menuButton.hasAttribute("open"),
     61    "Menu button should not be 'pressed' after ending customize mode"
     62  );
     63  ok(
     64    !PanelUI.menuButton.hasAttribute("disabled"),
     65    "Menu button should not be disabled after ending customize mode"
     66  );
     67 });