tor-browser

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

browser_963639_customizing_attribute_non_customizable_toolbar.js (1332B)


      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 kToolbar = "test-toolbar-963639-non-customizable-customizing-attribute";
      8 
      9 add_task(async function () {
     10  info(
     11    "Test for Bug 963639 - CustomizeMode _onToolbarVisibilityChange sets @customizing on non-customizable toolbars"
     12  );
     13 
     14  let toolbar = document.createXULElement("toolbar");
     15  toolbar.id = kToolbar;
     16  gNavToolbox.appendChild(toolbar);
     17 
     18  let testToolbar = document.getElementById(kToolbar);
     19  ok(testToolbar, "Toolbar was created.");
     20  is(
     21    gNavToolbox.getElementsByAttribute("id", kToolbar).length,
     22    1,
     23    "Toolbar was added to the navigator toolbox"
     24  );
     25 
     26  toolbar.setAttribute(
     27    "toolbarname",
     28    "NonCustomizableToolbarCustomizingAttribute"
     29  );
     30  toolbar.setAttribute("collapsed", "true");
     31 
     32  await startCustomizing();
     33  window.setToolbarVisibility(toolbar, "true");
     34  ok(
     35    !toolbar.hasAttribute("customizing"),
     36    "Toolbar doesn't have the customizing attribute"
     37  );
     38 
     39  await endCustomizing();
     40  gNavToolbox.removeChild(toolbar);
     41 
     42  is(
     43    gNavToolbox.getElementsByAttribute("id", kToolbar).length,
     44    0,
     45    "Toolbar was removed from the navigator toolbox"
     46  );
     47 });