tor-browser

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

browser_rules_selector-highlighter_04.js (1103B)


      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 the selector highlighter is shown when clicking on a selector icon
      7 // for the 'element {}' rule
      8 
      9 const TEST_URI = `
     10 <p>Testing the selector highlighter for the 'element {}' rule</p>
     11 `;
     12 
     13 add_task(async function () {
     14  await addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
     15  const { inspector, view } = await openRuleView();
     16  let data;
     17 
     18  info("Checking that the right NodeFront reference and options are passed");
     19  await selectNode("p", inspector);
     20  data = await clickSelectorIcon(view, "element");
     21  is(
     22    data.nodeFront.tagName,
     23    "P",
     24    "The right NodeFront is passed to the highlighter (1)"
     25  );
     26  is(
     27    data.options.selector,
     28    "body > p:nth-child(1)",
     29    "The right selector option is passed to the highlighter (1)"
     30  );
     31  ok(data.isShown, "The toggle event says the highlighter is visible");
     32 
     33  data = await clickSelectorIcon(view, "element");
     34  ok(!data.isShown, "The toggle event says the highlighter is not visible");
     35 });