tor-browser

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

test_action-toggle-inverted.js (942B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 // Test toggling the top level inversion state of the tree.
      7 
      8 const {
      9  censusDisplays,
     10 } = require("resource://devtools/client/memory/constants.js");
     11 const {
     12  setCensusDisplay,
     13 } = require("resource://devtools/client/memory/actions/census-display.js");
     14 
     15 add_task(async function () {
     16  const store = Store();
     17  const { getState, dispatch } = store;
     18 
     19  dispatch(setCensusDisplay(censusDisplays.allocationStack));
     20  equal(getState().censusDisplay.inverted, false, "not inverted initially");
     21 
     22  dispatch(setCensusDisplay(censusDisplays.invertedAllocationStack));
     23  equal(getState().censusDisplay.inverted, true, "now inverted after toggling");
     24 
     25  dispatch(setCensusDisplay(censusDisplays.allocationStack));
     26  equal(
     27    getState().censusDisplay.inverted,
     28    false,
     29    "not inverted again after toggling again"
     30  );
     31 });