tor-browser

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

browser_tabbar_big_widgets.js (1067B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 * http://creativecommons.org/publicdomain/zero/1.0/
      3 */
      4 
      5 const kButtonId = "test-tabbar-size-with-large-buttons";
      6 
      7 function test() {
      8  registerCleanupFunction(cleanup);
      9  let titlebar = document.getElementById("TabsToolbar");
     10  let originalHeight = titlebar.getBoundingClientRect().height;
     11  let button = document.createXULElement("toolbarbutton");
     12  button.id = kButtonId;
     13  button.setAttribute("style", "min-height: 100px");
     14  gNavToolbox.palette.appendChild(button);
     15  CustomizableUI.addWidgetToArea(kButtonId, CustomizableUI.AREA_TABSTRIP);
     16  let currentHeight = titlebar.getBoundingClientRect().height;
     17  Assert.greater(currentHeight, originalHeight, "Titlebar should have grown");
     18  CustomizableUI.removeWidgetFromArea(kButtonId);
     19  currentHeight = titlebar.getBoundingClientRect().height;
     20  is(
     21    currentHeight,
     22    originalHeight,
     23    "Titlebar should have gone back to its original size."
     24  );
     25 }
     26 
     27 function cleanup() {
     28  let btn = document.getElementById(kButtonId);
     29  if (btn) {
     30    btn.remove();
     31  }
     32 }