forked from mirrors/gecko-dev
There were options already being passed to BrowserTestUtils.removeTab, with only a single property being observed, "dontRemove". This caused BrowserTestUtils.removeTab to return a Promise once a tab is removed, but didn't actually remove the tab (as the calling test would be responsible for that themselves). This patch removes that option, and adds a method to BrowserTestUtils called tabRemoved to use for that case instead. The options being passed to removeTab are now forwarded along directly to tabbrowser's removeTab method. MozReview-Commit-ID: JzfZuoZmlJ0 --HG-- extra : rebase_source : 71afc1f82ecd979b101a9f1a1ef1766185eefd75
20 lines
802 B
JavaScript
20 lines
802 B
JavaScript
add_task(function*() {
|
|
is(gBrowser.tabs.length, 1, "one tab is open");
|
|
|
|
gBrowser.selectedBrowser.focus();
|
|
isnot(document.activeElement, gURLBar.inputField, "location bar is not focused");
|
|
|
|
var tab = gBrowser.selectedTab;
|
|
gPrefService.setBoolPref("browser.tabs.closeWindowWithLastTab", false);
|
|
|
|
let tabClosedPromise = BrowserTestUtils.tabRemoved(tab);
|
|
EventUtils.synthesizeKey("w", { accelKey: true });
|
|
yield tabClosedPromise;
|
|
|
|
is(tab.parentNode, null, "ctrl+w removes the tab");
|
|
is(gBrowser.tabs.length, 1, "a new tab has been opened");
|
|
is(document.activeElement, gURLBar.inputField, "location bar is focused for the new tab");
|
|
|
|
if (gPrefService.prefHasUserValue("browser.tabs.closeWindowWithLastTab"))
|
|
gPrefService.clearUserPref("browser.tabs.closeWindowWithLastTab");
|
|
});
|