summaryrefslogtreecommitdiffstats
path: root/devtools/client/inspector/test/browser_inspector_pane-toggle-layout-invariant.js
blob: 641423b720fd9c97a639dcfa24c5b4489af08548 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/* Any copyright is dedicated to the Public Domain.
 http://creativecommons.org/publicdomain/zero/1.0/ */

"use strict";

// Test that documents with suppressed whitespace nodes are unaffected by the
// activation of the inspector panel.

const TEST_URL = URL_ROOT + "doc_inspector_pane-toggle-layout-invariant.html";

async function getInvariantRect() {
  return SpecialPowers.spawn(gBrowser.selectedBrowser, [], async function() {
    const invariant = content.document.getElementById("invariant");
    return invariant.getBoundingClientRect();
  });
}

add_task(async function() {
  await addTab(TEST_URL);

  // Get the initial position of the "invariant" element. We'll later check it
  // again and we'll expect to get the same value.
  const beforeRect = await getInvariantRect();

  // Open the inspector.
  await openInspector();

  const afterRect = await getInvariantRect();

  is(afterRect.x, beforeRect.x, "invariant x should be same as initial value.");
  is(afterRect.y, beforeRect.y, "invariant y should be same as initial value.");
});