Bug 1882993 - Force field row of other headers to be displayed after adding a value via compose API. r=aleca
When adding values to standard headers (like reply-to) via the compose API, the row of their header field is automatically shown. This is currently not the case for non-standard headers, which have been added to the UI via the `mail.compose.other.header` preference. This patch forces also non-standard headers to be shown, and adds a test. Differential Revision: https://phabricator.services.mozilla.com/D204157 --HG-- extra : amend_source : b9eedfa327fe8ff6e54b57a0f52300afceb2e2d6
This commit is contained in:
Родитель
ed3e476922
Коммит
e1abb7d564
|
@ -675,6 +675,7 @@ async function setComposeDetails(composeWindow, details, extension) {
|
|||
)) {
|
||||
const recipientType = row.dataset.recipienttype.trim().toLowerCase();
|
||||
if (customHeaders.has(recipientType)) {
|
||||
row.classList.remove("hidden");
|
||||
row.querySelector(".address-row-input").value =
|
||||
customHeaders.get(recipientType);
|
||||
}
|
||||
|
|
|
@ -656,6 +656,11 @@ add_task(async function testCustomHeaders() {
|
|||
let customHeaders = [{ name: "X-TEST1", value: "some header" }];
|
||||
const tab = await browser.compose.beginNew(null, { customHeaders });
|
||||
|
||||
// The initial window should not have the X-Expediteur row visible.
|
||||
await window.sendMessage("Check X-Expediteur header display", {
|
||||
isHidden: true,
|
||||
});
|
||||
|
||||
// Add a header which does not start with X- and should not be touched by
|
||||
// the API.
|
||||
await window.sendMessage("addTestHeader");
|
||||
|
@ -687,6 +692,11 @@ add_task(async function testCustomHeaders() {
|
|||
];
|
||||
await checkCustomHeaders(tab, expectedHeaders);
|
||||
|
||||
// The X-Expediteur row should now be visible.
|
||||
await window.sendMessage("Check X-Expediteur header display", {
|
||||
isHidden: false,
|
||||
});
|
||||
|
||||
// Update existing header and remove some of the others. Test support for
|
||||
// empty headers.
|
||||
customHeaders = [
|
||||
|
@ -764,6 +774,19 @@ add_task(async function testCustomHeaders() {
|
|||
extension.sendMessage(value);
|
||||
});
|
||||
|
||||
extension.onMessage("Check X-Expediteur header display", expected => {
|
||||
const composeWindow = Services.wm.getMostRecentWindow("msgcompose");
|
||||
const row = composeWindow.document.querySelector(
|
||||
".address-row-raw[data-recipienttype=X-Expediteur]"
|
||||
);
|
||||
Assert.equal(
|
||||
BrowserTestUtils.isHidden(row),
|
||||
expected.isHidden,
|
||||
"The display of the X-Expediteur header row should be correct"
|
||||
);
|
||||
extension.sendMessage();
|
||||
});
|
||||
|
||||
await extension.startup();
|
||||
await extension.awaitFinish("finished");
|
||||
await extension.unload();
|
||||
|
|
Загрузка…
Ссылка в новой задаче