blob: a2f293c44d91d3ada8f8450090b2790c23bd1712 (
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Tests that grid outline does not show when cells are too small to be drawn and that
// "Cannot show outline for this grid." message is displayed.
const TEST_URI = `
<style type='text/css'>
#grid {
display: grid;
grid-template-columns: repeat(51, 20px);
grid-template-rows: repeat(51, 20px);
}
</style>
<div id="grid">
<div id="cellA">cell A</div>
<div id="cellB">cell B</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, store } = inspector;
await selectNode("#grid", inspector);
const outline = doc.getElementById("grid-outline-container");
const gridList = doc.getElementById("grid-list");
const checkbox = gridList.children[0].querySelector("input");
info("Toggling ON the CSS grid highlighter from the layout panel.");
const onHighlighterShown = highlighters.once("grid-highlighter-shown");
const onGridOutlineRendered = waitForDOM(doc, ".grid-outline-text", 1);
const onCheckboxChange = waitUntilState(
store,
state => state.grids.length == 1 && state.grids[0].highlighted
);
checkbox.click();
await onHighlighterShown;
await onCheckboxChange;
const elements = await onGridOutlineRendered;
const cannotShowGridOutline = elements[0];
info(
"Checking the grid outline is not rendered and an appropriate message is shown."
);
ok(!outline, "Outline component is not shown.");
ok(
cannotShowGridOutline,
"The message 'Cannot show outline for this grid' is displayed."
);
});
|