tor-browser

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

browser_inspector_pane-toggle-layout-invariant.js (1055B)


      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 documents with suppressed whitespace nodes are unaffected by the
      7 // activation of the inspector panel.
      8 
      9 const TEST_URL = URL_ROOT + "doc_inspector_pane-toggle-layout-invariant.html";
     10 
     11 async function getInvariantRect() {
     12  return SpecialPowers.spawn(gBrowser.selectedBrowser, [], async function () {
     13    const invariant = content.document.getElementById("invariant");
     14    return invariant.getBoundingClientRect();
     15  });
     16 }
     17 
     18 add_task(async function () {
     19  await addTab(TEST_URL);
     20 
     21  // Get the initial position of the "invariant" element. We'll later check it
     22  // again and we'll expect to get the same value.
     23  const beforeRect = await getInvariantRect();
     24 
     25  // Open the inspector.
     26  await openInspector();
     27 
     28  const afterRect = await getInvariantRect();
     29 
     30  is(afterRect.x, beforeRect.x, "invariant x should be same as initial value.");
     31  is(afterRect.y, beforeRect.y, "invariant y should be same as initial value.");
     32 });