tor-browser

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

browser_956602_remove_special_widget.js (1258B)


      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 // Adding a separator and then dragging it out of the navbar shouldn't throw
      8 add_task(async function () {
      9  try {
     10    let navbar = document.getElementById("nav-bar");
     11    let separatorSelector =
     12      "toolbarseparator[id^=customizableui-special-separator]";
     13    ok(
     14      !navbar.querySelector(separatorSelector),
     15      "Shouldn't be a separator in the navbar"
     16    );
     17    CustomizableUI.addWidgetToArea("separator", "nav-bar");
     18    await startCustomizing();
     19    let separator = navbar.querySelector(separatorSelector);
     20    ok(separator, "There should be a separator in the navbar now.");
     21    let palette = document.getElementById("customization-palette");
     22    simulateItemDrag(separator, palette);
     23    ok(
     24      !palette.querySelector(separatorSelector),
     25      "No separator in the palette."
     26    );
     27  } catch (ex) {
     28    console.error(ex);
     29    ok(false, "Shouldn't throw an exception moving an item to the navbar.");
     30  } finally {
     31    await endCustomizing();
     32  }
     33 });
     34 
     35 add_task(async function asyncCleanup() {
     36  resetCustomization();
     37 });