fune/browser/base/content/test/newtab/browser_newtab_fullscreen_focus.js
Mike Conley e4124cb8f6 Bug 1367621 - Regression test to ensure that the URL bar is focused when new tabs are opened in fullscreen mode. r=Felipe
MozReview-Commit-ID: 66Rl2U2Kdbl

--HG--
extra : rebase_source : 04c00eaa006db0b7369de3a9f3989e0e44d9145c
2017-05-26 12:21:25 -04:00

35 lines
978 B
JavaScript

"use strict";
function isFullscreenSizeMode() {
let sizemode = document.documentElement.getAttribute("sizemode");
return sizemode == "fullscreen";
}
/**
* Checks that the URL bar is correctly focused
* when a new tab is opened while in fullscreen
* mode.
*/
add_task(async function() {
gURLBar.blur();
Assert.ok(!window.fullScreen, "Should not start in fullscreen mode.");
BrowserFullScreen();
await BrowserTestUtils.waitForCondition(() => isFullscreenSizeMode());
registerCleanupFunction(async function() {
// Exit fullscreen if we're still in it.
if (window.fullScreen) {
BrowserFullScreen();
await BrowserTestUtils.waitForCondition(() => !isFullscreenSizeMode());
}
});
Assert.ok(window.fullScreen, "Should be in fullscreen mode now.");
let newTabOpened = BrowserTestUtils.waitForEvent(gBrowser, "TabSwitchDone");
BrowserOpenTab();
await newTabOpened;
Assert.ok(gURLBar.focused, "URL bar should be focused.");
});