Bug 1816824 - Test Tools menu item states. r=mkmelin

Differential Revision: https://phabricator.services.mozilla.com/D171788

--HG--
extra : amend_source : 7639e7cb877fff11da251c1861cd55b865b79f01
This commit is contained in:
Geoff Lankow 2023-03-07 19:14:21 +11:00
Родитель 7426de0ddf
Коммит 7d2f30a158
2 изменённых файлов: 111 добавлений и 0 удалений

Просмотреть файл

@ -40,6 +40,8 @@ skip-if = os == 'mac'
[browser_spacesToolbarCustomize.js]
[browser_selectionWidgetController.js]
[browser_threadTreeQuirks.js]
[browser_toolsMenu.js]
skip-if = os == 'mac'
[browser_treeListbox.js]
[browser_treeView.js]
[browser_viewMenu.js]

Просмотреть файл

@ -0,0 +1,109 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, you can obtain one at http://mozilla.org/MPL/2.0/. */
const { MessageGenerator } = ChromeUtils.import(
"resource://testing-common/mailnews/MessageGenerator.jsm"
);
/** @type MenuData */
const toolsMenuData = {
tasksMenuMail: { hidden: true },
addressBook: {},
menu_openSavedFilesWnd: {},
addonsManager: {},
activityManager: {},
imAccountsStatus: { disabled: true },
imStatusAvailable: {},
imStatusUnavailable: {},
imStatusOffline: {},
imStatusShowAccounts: {},
joinChatMenuItem: { disabled: true },
filtersCmd: {},
applyFilters: { disabled: ["mail3PaneTab", "contentTab"] },
applyFiltersToSelection: { disabled: ["mail3PaneTab", "contentTab"] },
runJunkControls: { disabled: true },
deleteJunk: { disabled: true },
menu_import: {},
menu_export: {},
manageKeysOpenPGP: {},
devtoolsMenu: {},
devtoolsToolbox: {},
addonDebugging: {},
javascriptConsole: {},
sanitizeHistory: {},
};
if (AppConstants.platform == "win") {
toolsMenuData.menu_preferences = {};
toolsMenuData.menu_accountmgr = {};
}
let helper = new MenuTestHelper("tasksMenu", toolsMenuData);
let tabmail = document.getElementById("tabmail");
let rootFolder, testFolder, testMessages;
add_setup(async function() {
document.getElementById("toolbar-menubar").removeAttribute("autohide");
let generator = new MessageGenerator();
MailServices.accounts.createLocalMailAccount();
let account = MailServices.accounts.accounts[0];
account.addIdentity(MailServices.accounts.createIdentity());
rootFolder = account.incomingServer.rootFolder;
rootFolder.createSubfolder("tools menu", null);
testFolder = rootFolder
.getChildNamed("tools menu")
.QueryInterface(Ci.nsIMsgLocalMailFolder);
testFolder.addMessageBatch(
generator.makeMessages({ count: 5 }).map(message => message.toMboxString())
);
testMessages = [...testFolder.messages];
window.OpenMessageInNewTab(testMessages[0], { background: true });
await BrowserTestUtils.waitForEvent(
tabmail.tabInfo[1].chromeBrowser,
"MsgLoaded"
);
window.openTab("contentTab", {
url: "https://example.com/",
background: true,
});
registerCleanupFunction(() => {
tabmail.closeOtherTabs(0);
MailServices.accounts.removeAccount(account, false);
});
});
add_task(async function test3PaneTab() {
tabmail.currentAbout3Pane.displayFolder(rootFolder);
await helper.testAllItems("mail3PaneTab");
tabmail.currentAbout3Pane.displayFolder(testFolder);
await helper.testItems({
applyFilters: {},
runJunkControls: {},
deleteJunk: {},
});
tabmail.currentAbout3Pane.threadTree.selectedIndex = 1;
await helper.testItems({
applyFilters: {},
applyFiltersToSelection: {},
runJunkControls: {},
deleteJunk: {},
});
});
add_task(async function testMessageTab() {
tabmail.switchToTab(1);
await helper.testAllItems("mailMessageTab");
});
add_task(async function testContentTab() {
tabmail.switchToTab(2);
await helper.testAllItems("contentTab");
});