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/rules/test/browser_rules_selector-highlighter-iframe-picker.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/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"); +}); |