diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /devtools/client/inspector/markup/test/browser_markup_grid_display_badge_01.js | |
parent | Initial commit. (diff) | |
download | thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | devtools/client/inspector/markup/test/browser_markup_grid_display_badge_01.js | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/devtools/client/inspector/markup/test/browser_markup_grid_display_badge_01.js b/devtools/client/inspector/markup/test/browser_markup_grid_display_badge_01.js new file mode 100644 index 0000000000..a68b972006 --- /dev/null +++ b/devtools/client/inspector/markup/test/browser_markup_grid_display_badge_01.js @@ -0,0 +1,91 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// Tests that the grid display badge toggles on the grid highlighter. + +const TEST_URI = ` + <style type="text/css"> + #grid { + display: grid; + } + </style> + <div id="grid"></div> +`; + +add_task(async function () { + await addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI)); + const { inspector } = await openLayoutView(); + const { highlighters, store } = inspector; + const HIGHLIGHTER_TYPE = inspector.highlighters.TYPES.GRID; + const { waitForHighlighterTypeShown, waitForHighlighterTypeHidden } = + getHighlighterTestHelpers(inspector); + + info("Check the grid display badge is shown and not active."); + await selectNode("#grid", inspector); + const gridContainer = await getContainerForSelector("#grid", inspector); + const gridDisplayBadge = gridContainer.elt.querySelector( + ".inspector-badge.interactive[data-display]" + ); + ok( + !gridDisplayBadge.classList.contains("active"), + "grid display badge is not active." + ); + ok( + gridDisplayBadge.classList.contains("interactive"), + "grid display badge is interactive." + ); + + info("Check the initial state of the grid highlighter."); + ok( + !highlighters.gridHighlighters.size, + "No CSS grid highlighter exists in the highlighters overlay." + ); + + info("Toggling ON the CSS grid highlighter from the grid display badge."); + const onHighlighterShown = waitForHighlighterTypeShown(HIGHLIGHTER_TYPE); + let onCheckboxChange = waitUntilState( + store, + state => state.grids.length === 1 && state.grids[0].highlighted + ); + gridDisplayBadge.click(); + await onHighlighterShown; + await onCheckboxChange; + + info( + "Check that the CSS grid highlighter is created and the display badge state." + ); + is( + highlighters.gridHighlighters.size, + 1, + "CSS grid highlighter is created in the highlighters overlay." + ); + ok( + gridDisplayBadge.classList.contains("active"), + "grid display badge is active." + ); + ok( + gridDisplayBadge.classList.contains("interactive"), + "grid display badge is interactive." + ); + + info("Toggling OFF the CSS grid highlighter from the grid display badge."); + const onHighlighterHidden = waitForHighlighterTypeHidden(HIGHLIGHTER_TYPE); + onCheckboxChange = waitUntilState( + store, + state => state.grids.length == 1 && !state.grids[0].highlighted + ); + gridDisplayBadge.click(); + await onHighlighterHidden; + await onCheckboxChange; + + ok( + !gridDisplayBadge.classList.contains("active"), + "grid display badge is not active." + ); + ok( + gridDisplayBadge.classList.contains("interactive"), + "grid display badge is interactive." + ); +}); |