tor-browser

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

browser_rules_media-queries.js (1152B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 // Tests that we correctly display appropriate media query information in the rule view.
      7 
      8 const TEST_URI = URL_ROOT + "doc_media_queries.html?constructed";
      9 
     10 add_task(async function () {
     11  await addTab(TEST_URI);
     12  const { inspector, view } = await openRuleView();
     13  await selectNode("div", inspector);
     14 
     15  const elementStyle = view._elementStyle;
     16 
     17  const inline = STYLE_INSPECTOR_L10N.getStr("rule.sourceInline");
     18  const constructed = STYLE_INSPECTOR_L10N.getStr("rule.sourceConstructed");
     19 
     20  is(elementStyle.rules.length, 4, "Should have 4 rules.");
     21  is(elementStyle.rules[0].title, inline, "check rule 0 title");
     22  is(
     23    elementStyle.rules[1].title,
     24    constructed + ":1",
     25    "check constructed sheet rule title"
     26  );
     27  is(elementStyle.rules[2].title, inline + ":9", "check rule 2 title");
     28  is(elementStyle.rules[3].title, inline + ":2", "check rule 3 title");
     29 
     30  is(
     31    getRuleViewAncestorRulesDataTextByIndex(view, 2),
     32    "@media screen and (min-width: 1px) {",
     33    "Media queries information are displayed"
     34  );
     35 });