summaryrefslogtreecommitdiffstats
path: root/devtools/client/inspector/grids/test/browser_grids_grid-list-no-grids.js
blob: ce9cbc786652891b78ad7afacf554d58b298617e (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
33
34
35
36
37
/* Any copyright is dedicated to the Public Domain.
 http://creativecommons.org/publicdomain/zero/1.0/ */

"use strict";

// Tests that no grid list items and a "no grids available" message is displayed when
// there are no grid containers on the page.

const TEST_URI = `
  <style type='text/css'>
  </style>
  <div id="grid">
    <div id="cell1">cell1</div>
    <div id="cell2">cell2</div>
  </div>
`;

add_task(async function () {
  await addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
  const { inspector, gridInspector } = await openLayoutView();
  const { document: doc } = gridInspector;
  const { highlighters } = inspector;

  await selectNode("#grid", inspector);
  const noGridList = doc.querySelector(
    "#layout-grid-section .devtools-sidepanel-no-result"
  );
  const gridList = doc.getElementById("grid-list");

  info("Checking the initial state of the Grid Inspector.");
  ok(noGridList, "The message no grid containers is displayed.");
  ok(!gridList, "No grid containers are listed.");
  ok(
    !highlighters.gridHighlighters.size,
    "No CSS grid highlighter exists in the highlighters overlay."
  );
});