Files
firefox/devtools/client/webconsole/test/browser/browser_webconsole_sidebar_scroll.js
T
Kris Maglione 8c0d38f33d Bug 1596918: Part 3a - Scripted rewrite of most ContentTask.spawn calls to SpecialPowers.spawn calls. r=mccr8,remote-protocol-reviewers,ato
This is generally pretty straightforward, and rewrites nearly all calls. It
skips the ones that it can detect using frame script globals like
`sendAsyncMessage`, though.

Differential Revision: https://phabricator.services.mozilla.com/D53740
2019-12-13 20:36:16 +00:00

47 lines
1.4 KiB
JavaScript

/* 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,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 = waitForMessage(hud, "Document");
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")
);
EventUtils.sendMouseEvent(
{
type: "click",
[isMacOS ? "metaKey" : "ctrlKey"]: true,
},
object,
hud.ui.window
);
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);
ok(
sidebarContents.scrollHeight > sidebarContents.clientHeight,
"Sidebar overflows"
);
});