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/webconsole/test/browser/browser_webconsole_sidebar_scroll.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 'devtools/client/webconsole/test/browser/browser_webconsole_sidebar_scroll.js')
-rw-r--r-- | devtools/client/webconsole/test/browser/browser_webconsole_sidebar_scroll.js | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/devtools/client/webconsole/test/browser/browser_webconsole_sidebar_scroll.js b/devtools/client/webconsole/test/browser/browser_webconsole_sidebar_scroll.js new file mode 100644 index 0000000000..29fd3d491b --- /dev/null +++ b/devtools/client/webconsole/test/browser/browser_webconsole_sidebar_scroll.js @@ -0,0 +1,55 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +// Test that the sidebar can be scrolled. + +"use strict"; + +const TEST_URI = `data:text/html;charset=utf8,<!DOCTYPE html>Test sidebar scroll`; + +add_task(async function () { + // Should be removed when sidebar work is complete + await pushPref("devtools.webconsole.sidebarToggle", true); + const isMacOS = Services.appinfo.OS === "Darwin"; + + const hud = await openNewTabAndConsole(TEST_URI); + + const onMessage = waitForMessageByType(hud, "Document", ".console-api"); + SpecialPowers.spawn(gBrowser.selectedBrowser, [], function () { + content.wrappedJSObject.console.log(content.wrappedJSObject.document); + }); + + const { node } = await onMessage; + const object = node.querySelector(".object-inspector .node"); + + info("Ctrl+click on an object to put it in the sidebar"); + const onSidebarShown = waitFor(() => + hud.ui.document.querySelector(".sidebar") + ); + AccessibilityUtils.setEnv({ + // Component that renders a node handles keyboard interactions on the + // container level. + focusableRule: false, + interactiveRule: false, + labelRule: false, + }); + EventUtils.sendMouseEvent( + { + type: "click", + [isMacOS ? "metaKey" : "ctrlKey"]: true, + }, + object, + hud.ui.window + ); + AccessibilityUtils.resetEnv(); + await onSidebarShown; + const sidebarContents = hud.ui.document.querySelector(".sidebar-contents"); + + // Let's wait until the object is fully expanded. + await waitFor(() => sidebarContents.querySelectorAll(".node").length > 1); + Assert.greater( + sidebarContents.scrollHeight, + sidebarContents.clientHeight, + "Sidebar overflows" + ); +}); |