Bug 1498332 - Fix the tests after the prefs rearrange. r=darktrojan

This commit is contained in:
Richard Marti 2019-07-16 07:46:59 +02:00
Родитель 3a09173546
Коммит 72d9e11385
16 изменённых файлов: 251 добавлений и 315 удалений

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

@ -92,8 +92,8 @@ function testDefaultAlarms() {
function handlePrefTab(tab) { function handlePrefTab(tab) {
let { replaceText } = helpersForController(controller); let { replaceText } = helpersForController(controller);
// Click on the alarms tab. // Scroll to the reminder groupbox
content_tab_e(tab, "calPreferencesTabAlarms").click(); content_tab_e(tab, "defaultsnoozelength").scrollIntoView();
// Turn on alarms for events and tasks. // Turn on alarms for events and tasks.
menulistSelect(content_tab_eid(tab, "eventdefalarm"), "1", controller); menulistSelect(content_tab_eid(tab, "eventdefalarm"), "1", controller);

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

@ -127,7 +127,11 @@ function selectPrefPane(prefWindow, paneID, scrollPaneTo, otherArgs) {
* @param subdialogID ID of button to activate, opening a subdialog * @param subdialogID ID of button to activate, opening a subdialog
*/ */
function showTab(pane, scrollPaneTo, subdialogID) { function showTab(pane, scrollPaneTo, subdialogID) {
document.getElementById(scrollPaneTo).scrollIntoView(); let scrollTarget = document.getElementById(scrollPaneTo);
if (scrollTarget.closest("groupbox")) {
scrollTarget = scrollTarget.closest("groupbox");
}
scrollTarget.scrollIntoView();
if (subdialogID) { if (subdialogID) {
setTimeout(function() { setTimeout(function() {
document.getElementById(subdialogID).click(); document.getElementById(subdialogID).click();

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

@ -11,14 +11,10 @@ prefs =
mailnews.start_page.url=about:blank mailnews.start_page.url=about:blank
subsuite = thunderbird subsuite = thunderbird
[browser_advanced.js]
[browser_applications.js]
[browser_chat.js] [browser_chat.js]
[browser_cloudfile.js] [browser_cloudfile.js]
support-files = files/icon.svg files/management.html support-files = files/icon.svg files/management.html
[browser_compose.js] [browser_compose.js]
[browser_display.js]
[browser_general.js] [browser_general.js]
[browser_openPreferences.js] [browser_openPreferences.js]
[browser_privacy.js] [browser_privacy.js]
[browser_security.js]

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

@ -1,87 +0,0 @@
/* 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/. */
add_task(async () => {
let tests = [{
checkboxID: "useAutoScroll",
pref: "general.autoScroll",
}, {
checkboxID: "useSmoothScrolling",
pref: "general.smoothScroll",
}, {
checkboxID: "alwaysCheckDefault",
pref: "mail.shell.checkDefaultClient",
}, {
checkboxID: "enableGloda",
pref: "mailnews.database.global.indexer.enabled",
}, {
checkboxID: "allowHWAccel",
pref: "layers.acceleration.disabled",
prefValues: [true, false],
}];
// We don't want to wake up the platform search for this test.
// if (AppConstants.platform == "macosx") {
// tests.push({
// checkboxID: "searchIntegration",
// pref: "mail.spotlight.enable",
// });
// } else if (AppConstants.platform == "win") {
// tests.push({
// checkboxID: "searchIntegration",
// pref: "mail.winsearch.enable",
// });
// }
await testCheckboxes("paneAdvanced", "advancedGeneralTab", ...tests);
// Telemetry pref is locked.
// await testCheckboxes("paneAdvanced", "dataChoicesTab", {
// checkboxID: "submitTelemetryBox",
// pref: "toolkit.telemetry.enabled",
// });
await testCheckboxes("paneAdvanced", "networkingTab", {
checkboxID: "allowSmartSize",
pref: "browser.cache.disk.smart_size.enabled",
prefValues: [true, false],
enabledElements: ["#cacheSize"],
}, {
checkboxID: "offlineCompactFolder",
pref: "mail.prompt_purge_threshhold",
enabledElements: ["#offlineCompactFolderMin"],
});
await testCheckboxes("paneAdvanced", "certificateTab", {
checkboxID: "enableOCSP",
pref: "security.OCSP.enabled",
prefValues: [0, 1],
});
});
add_task(async () => {
await testRadioButtons("paneAdvanced", "advancedGeneralTab", {
pref: "intl.regional_prefs.use_os_locales",
states: [{
id: "appLocale",
prefValue: false,
}, {
id: "rsLocale",
prefValue: true,
}],
});
// Here we'd test the update choices, but I don't want to go near that.
await testRadioButtons("paneAdvanced", "certificateTab", {
pref: "security.default_personal_cert",
states: [{
id: "certSelectionAuto",
prefValue: "Select Automatically",
}, {
id: "certSelectionAsk",
prefValue: "Ask Every Time",
}],
});
});

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

@ -1,25 +0,0 @@
/* 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/. */
add_task(async () => {
await testCheckboxes("paneApplications", "attachmentsOutTab", {
checkboxID: "enableThreshold",
pref: "mail.compose.big_attachments.notify",
enabledElements: ["#cloudFileThreshold"],
});
});
add_task(async () => {
await testRadioButtons("paneApplications", "attachmentsInTab", {
pref: "browser.download.useDownloadDir",
states: [{
id: "saveTo",
prefValue: true,
enabledElements: ["#downloadFolder", "#chooseFolder"],
}, {
id: "alwaysAsk",
prefValue: false,
}],
});
});

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

@ -3,7 +3,7 @@
* file, you can obtain one at http://mozilla.org/MPL/2.0/. */ * file, you can obtain one at http://mozilla.org/MPL/2.0/. */
add_task(async () => { add_task(async () => {
await testCheckboxes("paneChat", "chatGeneralTab", { await testCheckboxes("paneChat", "chatPaneCategory", {
checkboxID: "reportIdle", checkboxID: "reportIdle",
pref: "messenger.status.reportIdle", pref: "messenger.status.reportIdle",
enabledElements: ["#autoAway", "#timeBeforeAway"], enabledElements: ["#autoAway", "#timeBeforeAway"],
@ -23,14 +23,14 @@ add_task(async () => {
}); });
Services.prefs.setBoolPref("messenger.status.reportIdle", true); Services.prefs.setBoolPref("messenger.status.reportIdle", true);
await testCheckboxes("paneChat", "chatGeneralTab", { await testCheckboxes("paneChat", "chatPaneCategory", {
checkboxID: "autoAway", checkboxID: "autoAway",
pref: "messenger.status.awayWhenIdle", pref: "messenger.status.awayWhenIdle",
enabledElements: ["#defaultIdleAwayMessage"], enabledElements: ["#defaultIdleAwayMessage"],
}); });
Services.prefs.setBoolPref("mail.chat.play_sound", true); Services.prefs.setBoolPref("mail.chat.play_sound", true);
await testRadioButtons("paneChat", "chatGeneralTab", { await testRadioButtons("paneChat", "chatPaneCategory", {
pref: "mail.chat.play_sound.type", pref: "mail.chat.play_sound.type",
states: [{ states: [{
id: "chatSoundSystemSound", id: "chatSoundSystemSound",

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

@ -31,7 +31,7 @@ add_task(async () => {
// Load the preferences tab. // Load the preferences tab.
let { prefsDocument, prefsWindow } = await openNewPrefsTab("paneApplications", "attachmentsOutTab"); let { prefsDocument, prefsWindow } = await openNewPrefsTab("paneCompose", "compositionAttachmentsCategory");
// Check everything is as it should be. // Check everything is as it should be.
@ -282,13 +282,15 @@ add_task(async () => {
// Load the preferences tab. // Load the preferences tab.
let { prefsDocument, prefsWindow } = await openNewPrefsTab("paneApplications", "attachmentsOutTab"); let { prefsDocument, prefsWindow } = await openNewPrefsTab("paneCompose", "compositionAttachmentsCategory");
let accountList = prefsDocument.getElementById("cloudFileView"); let accountList = prefsDocument.getElementById("cloudFileView");
is(accountList.itemCount, 0); is(accountList.itemCount, 0);
let buttonList = prefsDocument.getElementById("addCloudFileAccountButtons"); let buttonList = prefsDocument.getElementById("addCloudFileAccountButtons");
ok(!buttonList.hidden); ok(!buttonList.hidden);
is(buttonList.childElementCount, 2);
is(buttonList.children[0].getAttribute("value"), "Mochitest");
let menuButton = prefsDocument.getElementById("addCloudFileAccount"); let menuButton = prefsDocument.getElementById("addCloudFileAccount");
ok(menuButton.hidden); ok(menuButton.hidden);

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

@ -3,7 +3,7 @@
* file, you can obtain one at http://mozilla.org/MPL/2.0/. */ * file, you can obtain one at http://mozilla.org/MPL/2.0/. */
add_task(async () => { add_task(async () => {
await testCheckboxes("paneCompose", "generalTab", { await testCheckboxes("paneCompose", "compositionMainCategory", {
checkboxID: "addExtension", checkboxID: "addExtension",
pref: "mail.forward_add_extension", pref: "mail.forward_add_extension",
}, { }, {
@ -14,10 +14,14 @@ add_task(async () => {
checkboxID: "mailWarnOnSendAccelKey", checkboxID: "mailWarnOnSendAccelKey",
pref: "mail.warn_on_send_accel_key", pref: "mail.warn_on_send_accel_key",
}, { }, {
checkboxID: "attachment_reminder_label", checkboxID: "spellCheckBeforeSend",
pref: "mail.compose.attachment_reminder", pref: "mail.SpellCheckBeforeSend",
enabledElements: ["#attachment_reminder_button"],
}, { }, {
checkboxID: "inlineSpellCheck",
pref: "mail.spellcheck.inline",
});
await testCheckboxes("paneCompose", "FontSelect", {
checkboxID: "useReaderDefaults", checkboxID: "useReaderDefaults",
pref: "msgcompose.default_colors", pref: "msgcompose.default_colors",
enabledInverted: true, enabledInverted: true,
@ -32,7 +36,7 @@ add_task(async () => {
pref: "mail.compose.default_to_paragraph", pref: "mail.compose.default_to_paragraph",
}); });
await testCheckboxes("paneCompose", "addressingTab", { await testCheckboxes("paneCompose", "compositionAddressingCategory", {
checkboxID: "addressingAutocomplete", checkboxID: "addressingAutocomplete",
pref: "mail.enable_autocomplete", pref: "mail.enable_autocomplete",
}, { }, {
@ -44,12 +48,16 @@ add_task(async () => {
pref: "mail.collect_email_address_outgoing", pref: "mail.collect_email_address_outgoing",
enabledElements: ["#localDirectoriesList"], enabledElements: ["#localDirectoriesList"],
}); });
});
await testCheckboxes("paneCompose", "spellingTab", { add_task(async () => {
checkboxID: "spellCheckBeforeSend", await testCheckboxes("paneCompose", "compositionAttachmentsCategory", {
pref: "mail.SpellCheckBeforeSend", checkboxID: "attachment_reminder_label",
pref: "mail.compose.attachment_reminder",
enabledElements: ["#attachment_reminder_button"],
}, { }, {
checkboxID: "inlineSpellCheck", checkboxID: "enableThreshold",
pref: "mail.spellcheck.inline", pref: "mail.compose.big_attachments.notify",
enabledElements: ["#cloudFileThreshold"],
}); });
}); });

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

@ -1,52 +0,0 @@
/* 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/. */
add_task(async () => {
Services.prefs.setIntPref("mail.displayname.version", 1);
await testCheckboxes("paneDisplay", "formattingTab", {
checkboxID: "displayGlyph",
pref: "mail.display_glyph",
});
await testCheckboxes("paneDisplay", "displayTab", {
checkboxID: "automaticallyMarkAsRead",
pref: "mailnews.mark_message_read.auto",
enabledElements: ["#markAsReadAutoPreferences radio"],
}, {
checkboxID: "closeMsgOnMoveOrDelete",
pref: "mail.close_message_window.on_delete",
}, {
checkboxID: "showCondensedAddresses",
pref: "mail.showCondensedAddresses",
});
});
add_task(async () => {
Services.prefs.setBoolPref("mailnews.mark_message_read.auto", true);
await testRadioButtons("paneDisplay", "displayTab", {
pref: "mailnews.mark_message_read.delay",
states: [{
id: "mark_read_immediately",
prefValue: false,
}, {
id: "markAsReadAfterDelay",
prefValue: true,
enabledElements: ["#markAsReadDelay"],
}],
}, {
pref: "mail.openMessageBehavior",
states: [{
id: "newTab",
prefValue: 2,
}, {
id: "newWindow",
prefValue: 0,
}, {
id: "existingWindow",
prefValue: 1,
}],
});
});

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

@ -3,26 +3,49 @@
* file, you can obtain one at http://mozilla.org/MPL/2.0/. */ * file, you can obtain one at http://mozilla.org/MPL/2.0/. */
add_task(async () => { add_task(async () => {
let tests = [{ await testCheckboxes("paneGeneral", "generalCategory", {
checkboxID: "mailnewsStartPageEnabled", checkboxID: "mailnewsStartPageEnabled",
pref: "mailnews.start_page.enabled", pref: "mailnews.start_page.enabled",
enabledElements: ["#mailnewsStartPageUrl", "#mailnewsStartPageUrl + button"], enabledElements: ["#mailnewsStartPageUrl", "#mailnewsStartPageUrl + button"],
}]; }, {
checkboxID: "alwaysCheckDefault",
pref: "mail.shell.checkDefaultClient",
});
});
add_task(async () => {
await testCheckboxes("paneGeneral", "scrollingGroup", {
checkboxID: "useAutoScroll",
pref: "general.autoScroll",
}, {
checkboxID: "useSmoothScrolling",
pref: "general.smoothScroll",
});
});
add_task(async () => {
await testCheckboxes("paneGeneral", "enableGloda", {
checkboxID: "enableGloda",
pref: "mailnews.database.global.indexer.enabled",
}, {
checkboxID: "allowHWAccel",
pref: "layers.acceleration.disabled",
prefValues: [true, false],
});
});
add_task(async () => {
if (AppConstants.platform != "macosx") { if (AppConstants.platform != "macosx") {
tests.push({ await testCheckboxes("paneGeneral", "incomingMailCategory", {
checkboxID: "newMailNotification", checkboxID: "newMailNotification",
pref: "mail.biff.play_sound", pref: "mail.biff.play_sound",
enabledElements: ["#soundType radio"], enabledElements: ["#soundType radio"],
}); }, {
tests.push({
checkboxID: "newMailNotificationAlert", checkboxID: "newMailNotificationAlert",
pref: "mail.biff.show_alert", pref: "mail.biff.show_alert",
enabledElements: ["#customizeMailAlert"], enabledElements: ["#customizeMailAlert"],
}); });
} }
await testCheckboxes("paneGeneral", undefined, ...tests);
}); });
add_task(async () => { add_task(async () => {
@ -32,7 +55,7 @@ add_task(async () => {
Services.prefs.setBoolPref("mail.biff.play_sound", true); Services.prefs.setBoolPref("mail.biff.play_sound", true);
await testRadioButtons("paneGeneral", undefined, { await testRadioButtons("paneGeneral", "incomingMailCategory", {
pref: "mail.biff.play_sound.type", pref: "mail.biff.play_sound.type",
states: [{ states: [{
id: "system", id: "system",
@ -44,3 +67,105 @@ add_task(async () => {
}], }],
}); });
}); });
add_task(async () => {
Services.prefs.setIntPref("mail.displayname.version", 1);
await testCheckboxes("paneGeneral", "fontsGroup", {
checkboxID: "displayGlyph",
pref: "mail.display_glyph",
});
await testCheckboxes("paneGeneral", "readingAndDisplayCategory", {
checkboxID: "automaticallyMarkAsRead",
pref: "mailnews.mark_message_read.auto",
enabledElements: ["#markAsReadAutoPreferences radio"],
}, {
checkboxID: "closeMsgOnMoveOrDelete",
pref: "mail.close_message_window.on_delete",
}, {
checkboxID: "showCondensedAddresses",
pref: "mail.showCondensedAddresses",
});
});
add_task(async () => {
Services.prefs.setBoolPref("mailnews.mark_message_read.auto", true);
await testRadioButtons("paneGeneral", "mark_read_immediately", {
pref: "mailnews.mark_message_read.delay",
states: [{
id: "mark_read_immediately",
prefValue: false,
}, {
id: "markAsReadAfterDelay",
prefValue: true,
enabledElements: ["#markAsReadDelay"],
}],
}, {
pref: "mail.openMessageBehavior",
states: [{
id: "newTab",
prefValue: 2,
}, {
id: "newWindow",
prefValue: 0,
}, {
id: "existingWindow",
prefValue: 1,
}],
});
});
add_task(async () => {
// We don't want to wake up the platform search for this test.
// if (AppConstants.platform == "macosx") {
// tests.push({
// checkboxID: "searchIntegration",
// pref: "mail.spotlight.enable",
// });
// } else if (AppConstants.platform == "win") {
// tests.push({
// checkboxID: "searchIntegration",
// pref: "mail.winsearch.enable",
// });
// }
await testCheckboxes("paneGeneral", "allowSmartSize", {
checkboxID: "allowSmartSize",
pref: "browser.cache.disk.smart_size.enabled",
prefValues: [true, false],
enabledElements: ["#cacheSize"],
}, {
checkboxID: "offlineCompactFolder",
pref: "mail.prompt_purge_threshhold",
enabledElements: ["#offlineCompactFolderMin"],
});
});
add_task(async () => {
await testRadioButtons("paneGeneral", "formatLocale", {
pref: "intl.regional_prefs.use_os_locales",
states: [{
id: "appLocale",
prefValue: false,
}, {
id: "rsLocale",
prefValue: true,
}],
});
});
add_task(async () => {
await testRadioButtons("paneGeneral", "filesAttachmentCategory", {
pref: "browser.download.useDownloadDir",
states: [{
id: "saveTo",
prefValue: true,
enabledElements: ["#downloadFolder", "#chooseFolder"],
}, {
id: "alwaysAsk",
prefValue: false,
}],
});
});

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

@ -26,42 +26,8 @@ add_task(async () => {
await closePrefsTab(); await closePrefsTab();
// … even with a value in the XULStore. // … even with a value in the XULStore.
await openNewPrefsTab("paneAdvanced"); await openNewPrefsTab("paneCompose");
is(getStoredLastSelected(), "paneAdvanced"); is(getStoredLastSelected(), "paneCompose");
await closePrefsTab();
});
add_task(async () => {
// Check that openPreferencesTab with no second argument opens the right tab on a tabbed pane.
Services.xulStore.removeDocument("about:preferences");
Services.prefs.clearUserPref("mail.preferences.display.selectedTabIndex");
await openNewPrefsTab("paneDisplay");
is(getStoredLastSelected(), "paneDisplay");
is(Services.prefs.getIntPref("mail.preferences.display.selectedTabIndex", -1), 0);
await closePrefsTab();
});
add_task(async () => {
// Check that openPreferencesTab with a second argument opens the right tab on a tabbed pane…
Services.xulStore.removeDocument("about:preferences");
Services.prefs.clearUserPref("mail.preferences.display.selectedTabIndex");
let prefsDocument;
({ prefsDocument } = await openNewPrefsTab("paneDisplay", "tagTab"));
is(getStoredLastSelected(), "paneDisplay");
prefsDocument.getElementById("displayPrefs").selectedTab.id = "tagTab";
is(Services.prefs.getIntPref("mail.preferences.display.selectedTabIndex", -1), 1);
await closePrefsTab();
// … even with a value in the prefs.
({ prefsDocument } = await openNewPrefsTab("paneDisplay", "displayTab"));
is(getStoredLastSelected(), "paneDisplay");
prefsDocument.getElementById("displayPrefs").selectedTab.id = "displayTab";
is(Services.prefs.getIntPref("mail.preferences.display.selectedTabIndex", -1), 2);
await closePrefsTab(); await closePrefsTab();
}); });

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

@ -3,7 +3,7 @@
* file, you can obtain one at http://mozilla.org/MPL/2.0/. */ * file, you can obtain one at http://mozilla.org/MPL/2.0/. */
add_task(async () => { add_task(async () => {
await testCheckboxes("panePrivacy", undefined, { await testCheckboxes("panePrivacy", "privacyCategory", {
checkboxID: "acceptRemoteContent", checkboxID: "acceptRemoteContent",
pref: "mailnews.message_display.disable_remote_image", pref: "mailnews.message_display.disable_remote_image",
prefValues: [true, false], prefValues: [true, false],
@ -20,3 +20,71 @@ add_task(async () => {
pref: "privacy.donottrackheader.enabled", pref: "privacy.donottrackheader.enabled",
}); });
}); });
add_task(async () => {
await testCheckboxes("panePrivacy", "privacyJunkCategory", {
checkboxID: "manualMark",
pref: "mail.spam.manualMark",
enabledElements: ["#manualMarkMode radio"],
}, {
checkboxID: "markAsReadOnSpam",
pref: "mail.spam.markAsReadOnSpam",
}, {
checkboxID: "enableJunkLogging",
pref: "mail.spam.logging.enabled",
enabledElements: ["#openJunkLogButton"],
});
await testCheckboxes("panePrivacy", "privacySecurityCategory", {
checkboxID: "enablePhishingDetector",
pref: "mail.phishing.detection.enabled",
});
await testCheckboxes("panePrivacy", "enableAntiVirusQuaruntine", {
checkboxID: "enableAntiVirusQuaruntine",
pref: "mailnews.downloadToTempFile",
});
});
add_task(async () => {
Services.prefs.setBoolPref("mail.spam.manualMark", true);
await testRadioButtons("panePrivacy", "privacyJunkCategory", {
pref: "mail.spam.manualMarkMode",
states: [{
id: "manualMarkMode0",
prefValue: 0,
}, {
id: "manualMarkMode1",
prefValue: 1,
}],
});
});
add_task(async () => {
// Telemetry pref is locked.
// await testCheckboxes("paneAdvanced", undefined, {
// checkboxID: "submitTelemetryBox",
// pref: "toolkit.telemetry.enabled",
// });
await testCheckboxes("panePrivacy", "enableOCSP", {
checkboxID: "enableOCSP",
pref: "security.OCSP.enabled",
prefValues: [0, 1],
});
});
// Here we'd test the update choices, but I don't want to go near that.
add_task(async () => {
await testRadioButtons("panePrivacy", "enableOCSP", {
pref: "security.default_personal_cert",
states: [{
id: "certSelectionAuto",
prefValue: "Select Automatically",
}, {
id: "certSelectionAsk",
prefValue: "Ask Every Time",
}],
});
});

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

@ -4,7 +4,7 @@
/* import-globals-from ../../../../base/content/utilityOverlay.js */ /* import-globals-from ../../../../base/content/utilityOverlay.js */
async function openNewPrefsTab(paneID, tabID, otherArgs) { async function openNewPrefsTab(paneID, scrollPaneTo, otherArgs) {
let tabmail = document.getElementById("tabmail"); let tabmail = document.getElementById("tabmail");
let prefsTabMode = tabmail.tabModes.preferencesTab; let prefsTabMode = tabmail.tabModes.preferencesTab;
@ -17,7 +17,7 @@ async function openNewPrefsTab(paneID, tabID, otherArgs) {
resolve(subject); resolve(subject);
} }
}, "chrome-document-loaded"); }, "chrome-document-loaded");
openPreferencesTab(paneID, tabID, otherArgs); openPreferencesTab(paneID, scrollPaneTo, otherArgs);
}); });
ok(prefsDocument.URL == "about:preferences", "Prefs tab is open"); ok(prefsDocument.URL == "about:preferences", "Prefs tab is open");
@ -30,15 +30,12 @@ async function openNewPrefsTab(paneID, tabID, otherArgs) {
}); });
} }
await new Promise(resolve => setTimeout(resolve)); await new Promise(resolve => prefsWindow.setTimeout(resolve));
is(prefsWindow.getCurrentPaneID(), paneID, `Selected pane is ${paneID}`); is(prefsWindow.getCurrentPaneID(), paneID, `Selected pane is ${paneID}`);
if (tabID) {
is(prefsDocument.querySelector(`#${paneID} tab[selected]`).id, tabID, `Selected tab is ${tabID}`);
}
} else { } else {
// If we don't wait here for other scripts to run, they // If we don't wait here for other scripts to run, they
// could be in a bad state if our test closes the tab. // could be in a bad state if our test closes the tab.
await new Promise(resolve => setTimeout(resolve)); await new Promise(resolve => prefsWindow.setTimeout(resolve));
} }
registerCleanupOnce(); registerCleanupOnce();
@ -46,7 +43,7 @@ async function openNewPrefsTab(paneID, tabID, otherArgs) {
return { prefsDocument, prefsWindow }; return { prefsDocument, prefsWindow };
} }
async function openExistingPrefsTab(paneID, tabID, otherArgs) { async function openExistingPrefsTab(paneID, scrollPaneTo, otherArgs) {
let tabmail = document.getElementById("tabmail"); let tabmail = document.getElementById("tabmail");
let prefsTabMode = tabmail.tabModes.preferencesTab; let prefsTabMode = tabmail.tabModes.preferencesTab;
@ -58,17 +55,14 @@ async function openExistingPrefsTab(paneID, tabID, otherArgs) {
if (paneID && prefsWindow.getCurrentPaneID() != paneID) { if (paneID && prefsWindow.getCurrentPaneID() != paneID) {
await new Promise(resolve => { await new Promise(resolve => {
prefsDocument.addEventListener("paneSelected", resolve, { once: true }); prefsDocument.addEventListener("paneSelected", resolve, { once: true });
openPreferencesTab(paneID, tabID, otherArgs); openPreferencesTab(paneID, scrollPaneTo, otherArgs);
}); });
} else { } else {
openPreferencesTab(paneID, tabID, otherArgs); openPreferencesTab(paneID, scrollPaneTo, otherArgs);
} }
await new Promise(resolve => setTimeout(resolve)); await new Promise(resolve => prefsWindow.setTimeout(resolve));
is(prefsWindow.getCurrentPaneID(), paneID, `Selected pane is ${paneID}`); is(prefsWindow.getCurrentPaneID(), paneID, `Selected pane is ${paneID}`);
if (tabID) {
is(prefsDocument.querySelector(`#${paneID} tab[selected]`).id, tabID, `Selected tab is ${tabID}`);
}
registerCleanupOnce(); registerCleanupOnce();
@ -105,7 +99,7 @@ async function closePrefsTab() {
* enabledElements - an array of CSS selectors (optional) * enabledElements - an array of CSS selectors (optional)
* enabledInverted - if the elements should be disabled when the checkbox is checked (optional) * enabledInverted - if the elements should be disabled when the checkbox is checked (optional)
*/ */
async function testCheckboxes(paneID, tabID, ...tests) { async function testCheckboxes(paneID, scrollPaneTo, ...tests) {
for (let initiallyChecked of [true, false]) { for (let initiallyChecked of [true, false]) {
info(`Opening ${paneID} with prefs set to ${initiallyChecked}`); info(`Opening ${paneID} with prefs set to ${initiallyChecked}`);
@ -121,7 +115,7 @@ async function testCheckboxes(paneID, tabID, ...tests) {
} }
} }
let { prefsDocument, prefsWindow } = await openNewPrefsTab(paneID, tabID); let { prefsDocument, prefsWindow } = await openNewPrefsTab(paneID, scrollPaneTo);
let testUIState = function(test, checked) { let testUIState = function(test, checked) {
let wantedValue = checked; let wantedValue = checked;
@ -181,7 +175,7 @@ async function testCheckboxes(paneID, tabID, ...tests) {
* enabledElements - an array of CSS selectors to elements that should be enabled when this * enabledElements - an array of CSS selectors to elements that should be enabled when this
* radio button is selected (optional) * radio button is selected (optional)
*/ */
async function testRadioButtons(paneID, tabID, ...tests) { async function testRadioButtons(paneID, scrollPaneTo, ...tests) {
for (let { pref, states } of tests) { for (let { pref, states } of tests) {
for (let initialState of states) { for (let initialState of states) {
info(`Opening ${paneID} with ${pref} set to ${initialState.prefValue}`); info(`Opening ${paneID} with ${pref} set to ${initialState.prefValue}`);
@ -194,7 +188,7 @@ async function testRadioButtons(paneID, tabID, ...tests) {
Services.prefs.setCharPref(pref, initialState.prefValue); Services.prefs.setCharPref(pref, initialState.prefValue);
} }
let { prefsDocument, prefsWindow } = await openNewPrefsTab(paneID, tabID); let { prefsDocument, prefsWindow } = await openNewPrefsTab(paneID, scrollPaneTo);
let testUIState = function(currentState) { let testUIState = function(currentState) {
info(`Testing with ${pref} set to ${currentState.prefValue}`); info(`Testing with ${pref} set to ${currentState.prefValue}`);

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

@ -75,9 +75,7 @@ function destroy_account(aKey) {
* case-insensitive) * case-insensitive)
*/ */
function test_load_accounts_and_properly_order() { function test_load_accounts_and_properly_order() {
let prefTab = open_pref_tab("paneApplications"); let prefTab = open_pref_tab("paneCompose");
let tabbox = content_tab_e(prefTab, "attachmentPrefs");
tabbox.selectedIndex = 1;
let richList = content_tab_e(prefTab, "cloudFileView"); let richList = content_tab_e(prefTab, "cloudFileView");
assert_equals(4, richList.itemCount, assert_equals(4, richList.itemCount,
@ -108,9 +106,7 @@ test_external_link.__force_skip__ = true;
function test_external_link() { function test_external_link() {
gMockExtProtSvcReg.register(); gMockExtProtSvcReg.register();
let prefTab = open_pref_tab("paneApplications"); let prefTab = open_pref_tab("paneCompose");
let tabbox = content_tab_e(prefTab, "attachmentPrefs");
tabbox.selectedIndex = 1;
content_tab_e(prefTab, "cloudFileView").selectedIndex = 0; content_tab_e(prefTab, "cloudFileView").selectedIndex = 0;
let iframe = content_tab_e(prefTab, "cloudFileSettingsWrapper").firstElementChild; let iframe = content_tab_e(prefTab, "cloudFileSettingsWrapper").firstElementChild;

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

@ -1,59 +0,0 @@
/* 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/. */
/**
* Tests the manager for attachment storage services
*/
"use strict";
/* import-globals-from ../shared-modules/test-content-tab-helpers.js */
/* import-globals-from ../shared-modules/test-folder-display-helpers.js */
/* import-globals-from ../shared-modules/test-pref-window-helpers.js */
var MODULE_NAME = "test-attachments-pane";
var RELATIVE_ROOT = "../shared-modules";
var MODULE_REQUIRES = ["folder-display-helpers", "pref-window-helpers", "content-tab-helpers"];
function setupModule(module) {
for (let lib of MODULE_REQUIRES) {
collector.getModule(lib).installInto(module);
}
}
/**
* Test that if we come back to the Attachment pane, then
* we'll automatically be viewing the same tab we were viewing
* last time.
*/
function test_persist_tabs() {
let prefTab = open_pref_tab("paneApplications");
let tabbox = content_tab_e(prefTab, "attachmentPrefs");
// We should default to be viewing the "Outgoing" tab, which is the
// second tab, with index 1.
assert_equals(1, tabbox.selectedIndex,
"The second tab should have been selected");
// Switch to the first tab.
tabbox.selectedIndex = 0;
close_pref_tab(prefTab);
prefTab = open_pref_tab("paneApplications");
tabbox = content_tab_e(prefTab, "attachmentPrefs");
// We should default to be viewing the first tab now.
assert_equals(0, tabbox.selectedIndex,
"The first tab selection should have been persisted");
// Switch back to the second tab.
tabbox.selectedIndex = 1;
close_pref_tab(prefTab);
prefTab = open_pref_tab("paneApplications");
tabbox = content_tab_e(prefTab, "attachmentPrefs");
// We should default to be viewing the second tab.
assert_equals(1, tabbox.selectedIndex,
"The second tab selection should have been persisted");
close_pref_tab(prefTab);
}

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

@ -92,7 +92,7 @@ function assert_fonts_equal(aDescription, aExpected, aActual, aPrefix = false) {
*/ */
function _verify_fonts_displayed(aDefaults, aSerif, aSansSerif, aMonospace) { function _verify_fonts_displayed(aDefaults, aSerif, aSansSerif, aMonospace) {
// Bring up the preferences window. // Bring up the preferences window.
let prefTab = open_pref_tab("paneDisplay"); let prefTab = open_pref_tab("paneGeneral");
let isSansDefault = (Services.prefs.getCharPref("font.default." + kLanguage) == let isSansDefault = (Services.prefs.getCharPref("font.default." + kLanguage) ==
"sans-serif"); "sans-serif");