tor-browser

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

browser_computed_default_tab.js (1037B)


      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 computed view is initialized when the computed view is the default tab
      7 // for the inspector.
      8 
      9 const TEST_URI = `
     10  <style type="text/css">
     11    #matches {
     12      color: #F00;
     13    }
     14  </style>
     15  <span id="matches">Some styled text</span>
     16 `;
     17 
     18 add_task(async function () {
     19  await pushPref("devtools.inspector.activeSidebar", "computedview");
     20  await addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
     21  const { inspector, view } = await openComputedView();
     22  await selectNode("#matches", inspector);
     23  is(
     24    isPropertyVisible("color", view),
     25    true,
     26    "span #matches color property is visible"
     27  );
     28 });
     29 
     30 function isPropertyVisible(name, view) {
     31  info("Checking property visibility for " + name);
     32  const propertyViews = view.propertyViews;
     33  for (const propView of propertyViews) {
     34    if (propView.name == name) {
     35      return propView.visible;
     36    }
     37  }
     38  return false;
     39 }