tor-browser

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

browser_rules_selector-highlighter_05.js (1252B)


      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 correctly shown when clicking on a
      7 // inherited element
      8 
      9 const TEST_URI = `
     10 <div style="cursor:pointer">
     11  A
     12  <div style="cursor:pointer">
     13    B<a>Cursor</a>
     14  </div>
     15 </div>
     16 `;
     17 
     18 add_task(async function () {
     19  await addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
     20  const { inspector, view } = await openRuleView();
     21  let data;
     22 
     23  info("Checking that the right NodeFront reference and options are passed");
     24  await selectNode("a", inspector);
     25 
     26  data = await clickSelectorIcon(view, "element");
     27  is(
     28    data.options.selector,
     29    "body > div:nth-child(1) > div:nth-child(1) > a:nth-child(1)",
     30    "The right selector option is passed to the highlighter (1)"
     31  );
     32 
     33  data = await clickSelectorIcon(view, "element", 1);
     34  is(
     35    data.options.selector,
     36    "body > div:nth-child(1) > div:nth-child(1)",
     37    "The right selector option is passed to the highlighter (1)"
     38  );
     39 
     40  data = await clickSelectorIcon(view, "element", 2);
     41  is(
     42    data.options.selector,
     43    "body > div:nth-child(1)",
     44    "The right selector option is passed to the highlighter (1)"
     45  );
     46 });