Bug 1939180 - Add test to ensure expanded sidebar remains expanded after exiting DOMFullscreen r=sidebar-reviewers,sfoster
Differential Revision: https://phabricator.services.mozilla.com/D233273
This commit is contained in:
@@ -18,30 +18,36 @@ registerCleanupFunction(async () => {
|
||||
add_task(async function test_dom_fullscreen() {
|
||||
// ensure the sidebar becomes hidden in dom fullscreen
|
||||
const url = "https://example.com/";
|
||||
const sidebarLauncher = win.document.getElementById("sidebar-main");
|
||||
const { SidebarController, gBrowser } = win;
|
||||
const { sidebarMain } = SidebarController;
|
||||
await SidebarController.promiseInitialized;
|
||||
|
||||
ok(
|
||||
BrowserTestUtils.isVisible(sidebarLauncher),
|
||||
"Sidebar launcher is initially visible"
|
||||
BrowserTestUtils.isVisible(sidebarMain),
|
||||
"Sidebar main is initially visible"
|
||||
);
|
||||
|
||||
await BrowserTestUtils.withNewTab(
|
||||
{ gBrowser: win.gBrowser, url },
|
||||
async browser => {
|
||||
// the newly opened tab should have focus
|
||||
await DOMFullscreenTestUtils.changeFullscreen(browser, true);
|
||||
|
||||
is(win.document.fullscreenElement, browser, "Entered DOM fullscreen");
|
||||
ok(
|
||||
BrowserTestUtils.isHidden(sidebarLauncher),
|
||||
"Sidebar launcher is hidden in DOMFullscreen"
|
||||
);
|
||||
|
||||
await DOMFullscreenTestUtils.changeFullscreen(browser, false);
|
||||
ok(
|
||||
BrowserTestUtils.isVisible(sidebarLauncher),
|
||||
"Sidebar launcher becomes visible when we exit DOMFullscreen"
|
||||
);
|
||||
}
|
||||
sidebarMain.expanded = true;
|
||||
await TestUtils.waitForCondition(
|
||||
() => sidebarMain.expanded,
|
||||
"Sidebar main is expanded"
|
||||
);
|
||||
|
||||
await BrowserTestUtils.withNewTab({ gBrowser, url }, async browser => {
|
||||
// the newly opened tab should have focus
|
||||
await DOMFullscreenTestUtils.changeFullscreen(browser, true);
|
||||
|
||||
is(win.document.fullscreenElement, browser, "Entered DOM fullscreen");
|
||||
ok(
|
||||
BrowserTestUtils.isHidden(sidebarMain),
|
||||
"Sidebar main is hidden in DOMFullscreen"
|
||||
);
|
||||
|
||||
await DOMFullscreenTestUtils.changeFullscreen(browser, false);
|
||||
ok(
|
||||
BrowserTestUtils.isVisible(sidebarMain),
|
||||
"Sidebar main becomes visible when we exit DOMFullscreen"
|
||||
);
|
||||
ok(sidebarMain.expanded, "Sidebar main is still expanded");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user