tor-browser

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

browser_computed_media-queries.js (1098B)


      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 titles in the
      7 // property view.
      8 
      9 const TEST_URI = URL_ROOT + "doc_media_queries.html";
     10 
     11 var {
     12  PropertyView,
     13 } = require("resource://devtools/client/inspector/computed/computed.js");
     14 
     15 add_task(async function () {
     16  await addTab(TEST_URI);
     17  const { inspector, view } = await openComputedView();
     18  await selectNode("div", inspector);
     19  await checkPropertyView(view);
     20 });
     21 
     22 function checkPropertyView(view) {
     23  const propertyView = new PropertyView(view, "width");
     24  propertyView.createListItemElement();
     25  propertyView.matchedExpanded = true;
     26 
     27  return propertyView.refreshMatchedSelectors().then(() => {
     28    const numMatchedSelectors = propertyView.matchedSelectors.length;
     29 
     30    is(
     31      numMatchedSelectors,
     32      2,
     33      "Property view has the correct number of matched selectors for div"
     34    );
     35 
     36    is(
     37      propertyView.hasMatchedSelectors,
     38      true,
     39      "hasMatchedSelectors returns true"
     40    );
     41  });
     42 }