1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 // There should be one tab when we start the test
7 let [origTab] = gBrowser.visibleTabs;
8 is(gBrowser.visibleTabs.length, 1, "there is one visible tab");
9 let testTab = gBrowser.addTab();
10 is(gBrowser.visibleTabs.length, 2, "there are now two visible tabs");
12 // Check the context menu with two tabs
13 updateTabContextMenu(origTab);
14 is(document.getElementById("context_closeTab").disabled, false, "Close Tab is enabled");
15 is(document.getElementById("context_reloadAllTabs").disabled, false, "Reload All Tabs is enabled");
17 // Hide the original tab.
18 gBrowser.selectedTab = testTab;
19 gBrowser.showOnlyTheseTabs([testTab]);
20 is(gBrowser.visibleTabs.length, 1, "now there is only one visible tab");
22 // Check the context menu with one tab.
23 updateTabContextMenu(testTab);
24 is(document.getElementById("context_closeTab").disabled, false, "Close Tab is enabled when more than one tab exists");
25 is(document.getElementById("context_reloadAllTabs").disabled, true, "Reload All Tabs is disabled");
27 // Add a tab that will get pinned
28 // So now there's one pinned tab, one visible unpinned tab, and one hidden tab
29 let pinned = gBrowser.addTab();
30 gBrowser.pinTab(pinned);
31 is(gBrowser.visibleTabs.length, 2, "now there are two visible tabs");
33 // Check the context menu on the unpinned visible tab
34 updateTabContextMenu(testTab);
35 is(document.getElementById("context_closeOtherTabs").disabled, true, "Close Other Tabs is disabled");
38 let allTabs = [tab for each (tab in gBrowser.tabs)];
39 gBrowser.showOnlyTheseTabs(allTabs);
41 // Check the context menu now
42 updateTabContextMenu(testTab);
43 is(document.getElementById("context_closeOtherTabs").disabled, false, "Close Other Tabs is enabled");
45 gBrowser.removeTab(testTab);
46 gBrowser.removeTab(pinned);