diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /devtools/client/inspector/grids/test/browser_grids_grid-outline-selected-grid.js | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | devtools/client/inspector/grids/test/browser_grids_grid-outline-selected-grid.js | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/devtools/client/inspector/grids/test/browser_grids_grid-outline-selected-grid.js b/devtools/client/inspector/grids/test/browser_grids_grid-outline-selected-grid.js new file mode 100644 index 0000000000..ada2a635e4 --- /dev/null +++ b/devtools/client/inspector/grids/test/browser_grids_grid-outline-selected-grid.js @@ -0,0 +1,51 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// Tests that the grid outline is shown when a grid container is selected. + +const TEST_URI = ` + <style type='text/css'> + #grid { + display: grid; + } + </style> + <div id="grid"> + <div id="cella">Cell A</div> + <div id="cellb">Cell B</div> + <div id="cellc">Cell C</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; + + const gridList = doc.getElementById("grid-list"); + const checkbox = gridList.children[0].querySelector("input"); + + info("Checking the initial state of the Grid Inspector."); + ok( + !doc.getElementById("grid-outline-container"), + "There should be no grid outline shown." + ); + + info("Toggling ON the CSS grid highlighter from the layout panel."); + const onHighlighterShown = highlighters.once("grid-highlighter-shown"); + const onCheckboxChange = waitUntilState( + store, + state => state.grids.length == 1 && state.grids[0].highlighted + ); + const onGridOutlineRendered = waitForDOM(doc, "#grid-cell-group rect", 3); + checkbox.click(); + await onHighlighterShown; + await onCheckboxChange; + const elements = await onGridOutlineRendered; + + info("Checking the grid outline is shown."); + is(elements.length, 3, "Grid outline is shown."); +}); |