tor-browser

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

browser_toolbox_toolbar_minimum_width.js (1392B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 * http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 // Test that all of buttons of tool tab go to the overflowed menu when the devtool's
      7 // width is narrow.
      8 
      9 const SIDEBAR_WIDTH_PREF = "devtools.toolbox.sidebar.width";
     10 
     11 const { Toolbox } = require("resource://devtools/client/framework/toolbox.js");
     12 
     13 add_task(async function () {
     14  // 74px is Chevron(26px) + Meatball(24px) + Close(24px)
     15  // devtools-browser.css defined this minimum width by using min-width.
     16  Services.prefs.setIntPref(SIDEBAR_WIDTH_PREF, 74);
     17  registerCleanupFunction(function () {
     18    Services.prefs.clearUserPref(SIDEBAR_WIDTH_PREF);
     19  });
     20  const tab = await addTab("about:blank");
     21 
     22  info("Open devtools on the Inspector in a side dock");
     23  const toolbox = await openToolboxForTab(
     24    tab,
     25    "inspector",
     26    Toolbox.HostType.RIGHT
     27  );
     28  await waitUntil(() => toolbox.doc.querySelector(".tools-chevron-menu"));
     29 
     30  await openChevronMenu(toolbox);
     31 
     32  // Check that all of tools is overflowed.
     33  toolbox.panelDefinitions.forEach(({ id }) => {
     34    const menuItem = toolbox.doc.getElementById(
     35      "tools-chevron-menupopup-" + id
     36    );
     37    const tab = toolbox.doc.getElementById("toolbox-tab-" + id);
     38    ok(menuItem, id + " is in the overflowed menu");
     39    ok(!tab, id + " tab does not exist");
     40  });
     41 
     42  await closeChevronMenu(toolbox);
     43 });