fune/browser/components/customizableui/test/browser_exit_background_customize_mode.js
Jonathan Kingston 555f89c8d7 Bug 1485305 - browser/ tests Ensure loadURI always passes a triggeringPrincipal() r=Mossop
Differential Revision: https://phabricator.services.mozilla.com/D4552

--HG--
extra : source : 2cf17e4974823d09d0fdd1aef64e69e840b288a1
extra : intermediate-source : 4771e6948a78507aa95a56e5b324d87dc82e9009
2018-08-29 15:44:56 +01:00

36 lines
1.2 KiB
JavaScript

"use strict";
/**
* Tests that if customize mode is currently attached to a background
* tab, and that tab browses to a new location, that customize mode
* is detached from that tab.
*/
add_task(async function test_exit_background_customize_mode() {
let nonCustomizingTab = gBrowser.selectedTab;
Assert.equal(gBrowser.tabContainer.querySelector("tab[customizemode=true]"),
null,
"Should not have a tab marked as being the customize tab now.");
await startCustomizing();
is(gBrowser.tabs.length, 2, "Should have 2 tabs");
let custTab = gBrowser.selectedTab;
let finishedCustomizing = BrowserTestUtils.waitForEvent(gNavToolbox, "aftercustomization");
await BrowserTestUtils.switchTab(gBrowser, nonCustomizingTab);
await finishedCustomizing;
BrowserTestUtils.loadURI(custTab.linkedBrowser, "http://example.com");
await BrowserTestUtils.browserLoaded(custTab.linkedBrowser);
Assert.equal(gBrowser.tabContainer.querySelector("tab[customizemode=true]"),
null,
"Should not have a tab marked as being the customize tab now.");
await startCustomizing();
is(gBrowser.tabs.length, 3, "Should have 3 tabs now");
await endCustomizing();
BrowserTestUtils.removeTab(custTab);
});