tor-browser

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

browser_currentset_post_reset.js (1079B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 * http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 function checkSpacers() {
      7  let navbarWidgets = CustomizableUI.getWidgetIdsInArea("nav-bar");
      8  let currentSetWidgets = CustomizableUI.getTestOnlyInternalProp(
      9    "CustomizableUIInternal"
     10  )._getCurrentWidgetsInContainer(document.getElementById("nav-bar"));
     11  navbarWidgets = navbarWidgets.filter(w => CustomizableUI.isSpecialWidget(w));
     12  currentSetWidgets = currentSetWidgets.filter(w =>
     13    CustomizableUI.isSpecialWidget(w)
     14  );
     15  Assert.deepEqual(
     16    navbarWidgets,
     17    currentSetWidgets,
     18    "Should have the same 'special' widgets in currentset and placements"
     19  );
     20 }
     21 
     22 /**
     23 * Check that after a reset, CUI's internal bookkeeping correctly deals with flexible spacers.
     24 */
     25 add_task(async function () {
     26  await startCustomizing();
     27  checkSpacers();
     28 
     29  CustomizableUI.addWidgetToArea(
     30    "spring",
     31    "nav-bar",
     32    4 /* Insert before the last extant spacer */
     33  );
     34  await gCustomizeMode.reset();
     35  checkSpacers();
     36  await endCustomizing();
     37 });