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/rules/test/browser_rules_selector-highlighter-iframe-picker.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/rules/test/browser_rules_selector-highlighter-iframe-picker.js | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/devtools/client/inspector/rules/test/browser_rules_selector-highlighter-iframe-picker.js b/devtools/client/inspector/rules/test/browser_rules_selector-highlighter-iframe-picker.js new file mode 100644 index 0000000000..51d4a9b371 --- /dev/null +++ b/devtools/client/inspector/rules/test/browser_rules_selector-highlighter-iframe-picker.js @@ -0,0 +1,60 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// Test that the selector highlighter is hidden when selecting frames in the iframe picker + +const TEST_URI = ` + <style type="text/css"> + body { + background: red; + } + </style> + <h1>Test the selector highlighter</h1> + <iframe src="data:text/html,<meta charset=utf8><style>h2 {background: yellow;}</style><h2>In iframe</h2>"> +`; + +add_task(async function () { + await addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI)); + const { inspector, toolbox, view } = await openRuleView(); + + info("Clicking on a selector icon"); + const { highlighter, isShown } = await clickSelectorIcon(view, "body"); + + ok(highlighter, "The selector highlighter instance was created"); + ok(isShown, "The selector highlighter was shown"); + is( + highlighter, + inspector.highlighters.getActiveHighlighter( + inspector.highlighters.TYPES.SELECTOR + ), + "The selector highlighter is the active highlighter" + ); + + // Open frame menu and wait till it's available on the screen. + const panel = toolbox.doc.getElementById("command-button-frames-panel"); + const btn = toolbox.doc.getElementById("command-button-frames"); + btn.click(); + ok(panel, "popup panel has created."); + await waitUntil(() => panel.classList.contains("tooltip-visible")); + + // Verify that the menu is populated. + const menuList = toolbox.doc.getElementById("toolbox-frame-menu"); + const frames = Array.from(menuList.querySelectorAll(".command")); + + // Wait for the inspector to be reloaded + // (instead of only new-root) in order to wait for full + // async update of the inspector. + const onNewRoot = inspector.once("reloaded"); + frames[1].click(); + await onNewRoot; + + await waitFor( + () => + !inspector.highlighters.getActiveHighlighter( + inspector.highlighters.TYPES.SELECTOR + ) + ); + ok(true, "The selector highlighter gets hidden after selecting a frame"); +}); |