tor-browser

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

browser_rules_content_02.js (2068B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 // Test the rule-view content when the inspector gets opened via the page
      7 // ctx-menu "inspect element"
      8 
      9 const CONTENT = `
     10  <body style="color:red;">
     11    <div style="color:blue;">
     12      <p style="color:green;">
     13        <span style="color:yellow;">test element</span>
     14      </p>
     15    </div>
     16  </body>
     17 `;
     18 
     19 add_task(async function () {
     20  await addTab("data:text/html;charset=utf-8," + CONTENT);
     21 
     22  // const commands = await CommandsFactory.forTab(tab);
     23  // // Initialize the TargetCommands which require some async stuff to be done
     24  // // before being fully ready. This will define the `targetCommand.targetFront` attribute.
     25  // await commands.targetCommand.startListening();
     26  const inspector = await clickOnInspectMenuItem("span");
     27 
     28  const { view } = inspector.getPanel("ruleview");
     29  checkRuleViewContent(view, [
     30    {
     31      selector: "element",
     32      selectorEditable: false,
     33      declarations: [
     34        {
     35          name: "color",
     36          value: "yellow",
     37        },
     38      ],
     39    },
     40    {
     41      header: STYLE_INSPECTOR_L10N.getFormatStr("rule.inheritedFrom", "p"),
     42    },
     43    {
     44      selector: "element",
     45      selectorEditable: false,
     46      inherited: true,
     47      declarations: [
     48        {
     49          name: "color",
     50          value: "green",
     51          overridden: true,
     52        },
     53      ],
     54    },
     55    {
     56      header: STYLE_INSPECTOR_L10N.getFormatStr("rule.inheritedFrom", "div"),
     57    },
     58    {
     59      selector: "element",
     60      selectorEditable: false,
     61      inherited: true,
     62      declarations: [
     63        {
     64          name: "color",
     65          value: "blue",
     66          overridden: true,
     67        },
     68      ],
     69    },
     70    {
     71      header: STYLE_INSPECTOR_L10N.getFormatStr("rule.inheritedFrom", "body"),
     72    },
     73    {
     74      selector: "element",
     75      selectorEditable: false,
     76      inherited: true,
     77      declarations: [
     78        {
     79          name: "color",
     80          value: "red",
     81          overridden: true,
     82        },
     83      ],
     84    },
     85  ]);
     86 });