tor-browser

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

browser_changes_declaration_remove.js (1192B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 // Test that removing a CSS declaration from a rule in the Rule view is tracked.
      7 
      8 const TEST_URI = `
      9  <style type='text/css'>
     10    div {
     11      color: red;
     12    }
     13  </style>
     14  <div></div>
     15 `;
     16 
     17 add_task(async function () {
     18  await addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
     19  const { inspector, view: ruleView } = await openRuleView();
     20  const { document: doc, store } = selectChangesView(inspector);
     21 
     22  await selectNode("div", inspector);
     23  const prop = getTextProperty(ruleView, 1, { color: "red" });
     24 
     25  const onTrackChange = waitForDispatch(store, "TRACK_CHANGE");
     26  info("Remove the first declaration");
     27  await removeProperty(ruleView, prop);
     28  info("Wait for change to be tracked");
     29  await onTrackChange;
     30 
     31  const removeDecl = getRemovedDeclarations(doc);
     32  is(removeDecl.length, 1, "One declaration was tracked as removed");
     33  is(
     34    removeDecl[0].property,
     35    "color",
     36    "Correct declaration name was tracked as removed"
     37  );
     38  is(
     39    removeDecl[0].value,
     40    "red",
     41    "Correct declaration value was tracked as removed"
     42  );
     43 });