Bug 1683865 - Backed out changeset 3a15062552f2 for test failures in at least calendar/test/unit/test_alarmutils.js

--HG--
extra : amend_source : 72e7edf1f8c69c5113ee187fea377455bc52854e
This commit is contained in:
Magnus Melin 2021-04-15 12:58:32 +03:00
Родитель 68f4859f6c
Коммит 1a9ee810f3
9 изменённых файлов: 15 добавлений и 75 удалений

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

@ -304,10 +304,10 @@
let alarms = item.getAlarms();
if (alarms.length && Services.prefs.getBoolPref("calendar.alarms.indicator.show", true)) {
let iconsBox = this.querySelector(".alarm-icons-box");
cal.alarms.addReminderImages(iconsBox, alarms);
// Set suppressed status on the icons box.
iconsBox.toggleAttribute("suppressed", item.calendar.getProperty("suppressAlarms"));
cal.alarms.addReminderImages(iconsBox, alarms);
}
// Item classification / privacy.

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

@ -226,28 +226,12 @@ function setupListItem(aListItem, aReminder, aItem) {
listitem.setAttribute("aria-labelledby", ariaLabel);
listitem.setAttribute("value", aReminder.action);
let image = listitem.querySelector("img");
let image = listitem.querySelector("image");
if (!image) {
image = document.createElement("img");
image = document.createXULElement("image");
image.setAttribute("class", "reminder-icon");
listitem.appendChild(image);
}
switch (aReminder.action) {
case "DISPLAY":
image.setAttribute("src", "chrome://calendar/skin/shared/icons/alarm.svg");
// Sets alt.
document.l10n.setAttributes(image, "calendar-event-reminder-icon-display");
break;
case "EMAIL":
image.setAttribute("src", "chrome://calendar/skin/shared/icons/email.svg");
// Sets alt.
document.l10n.setAttributes(image, "calendar-event-reminder-icon-email");
break;
default:
image.removeAttribute("src");
image.setAttribute("alt", "");
break;
}
image.setAttribute("value", aReminder.action);
let label = listitem.querySelector("label");

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

@ -26,8 +26,6 @@
<dialog>
<html:link rel="localization" href="calendar/calendar-event-dialog-reminder.ftl"/>
<!-- Javascript includes -->
<script src="chrome://calendar/content/calendar-event-dialog-reminder.js"/>
<script src="chrome://calendar/content/calendar-ui-utils.js"/>
@ -116,16 +114,16 @@
</hbox>
<menulist id="reminder-actions-menulist"
oncommand="updateReminder(event)"
class="reminder-list-icon">
class="reminder-icon">
<!-- Make sure the id is formatted "reminder-action-<VALUE>", for accessibility -->
<!-- TODO provider specific -->
<menupopup id="reminder-actions-menupopup">
<menuitem id="reminder-action-DISPLAY"
class="reminder-list-icon menuitem-iconic"
class="reminder-icon menuitem-iconic"
value="DISPLAY"
label="&reminder.action.alert.label;"/>
<menuitem id="reminder-action-EMAIL"
class="reminder-list-icon menuitem-iconic"
class="reminder-icon menuitem-iconic"
value="EMAIL"
label="&reminder.action.email.label;"/>
</menupopup>

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

@ -139,35 +139,9 @@ var calalarms = {
*/
addReminderImages(aElement, aReminders) {
function setupActionImage(node, reminder) {
let document = aElement.ownerDocument;
let image = node || document.createElement("img");
let image = node || aElement.ownerDocument.createXULElement("image");
image.setAttribute("class", "reminder-icon");
image.setAttribute("value", reminder.action);
switch (reminder.action) {
case "DISPLAY":
if (aElement.hasAttribute("suppressed")) {
image.setAttribute("src", "chrome://calendar/skin/shared/icons/alarm-no.svg");
// Sets alt.
document.l10n.setAttributes(
image,
"calendar-editable-item-reminder-icon-suppressed-alarm"
);
break;
}
image.setAttribute("src", "chrome://calendar/skin/shared/icons/alarm.svg");
// Sets alt.
document.l10n.setAttributes(image, "calendar-editable-item-reminder-icon-alarm");
break;
case "EMAIL":
image.setAttribute("src", "chrome://calendar/skin/shared/icons/email.svg");
// Sets alt.
document.l10n.setAttributes(image, "calendar-editable-item-reminder-icon-email");
break;
default:
image.removeAttribute("src");
image.setAttribute("alt", "");
break;
}
return image;
}

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

@ -10,11 +10,15 @@
fill: currentColor;
}
.reminder-list-icon[value="DISPLAY"] {
.reminder-icon[value="DISPLAY"] {
list-style-image: url(chrome://calendar/skin/shared/icons/alarm.svg);
}
.reminder-list-icon[value="EMAIL"] {
.alarm-icons-box[suppressed] > .reminder-icon[value="DISPLAY"] {
list-style-image: url(chrome://calendar/skin/shared/icons/alarm-no.svg);
}
.reminder-icon[value="EMAIL"] {
list-style-image: url(chrome://calendar/skin/shared/icons/email.svg);
}

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

@ -36,8 +36,6 @@
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml">
<html:link rel="localization" href="calendar/calendar-editable-item.ftl"/>
<!-- JavaScript includes -->
<script src="chrome://lightning/content/lightning-item-iframe.js"/>
<script src="chrome://calendar/content/calendar-dialog-utils.js"/>

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

@ -22,12 +22,3 @@ calendar-editable-item-multiday-event-icon-continue =
calendar-editable-item-multiday-event-icon-end =
.alt = Multiple-day event ends
calendar-editable-item-reminder-icon-alarm =
.alt = A reminder alert is scheduled
calendar-editable-item-reminder-icon-suppressed-alarm =
.alt = A reminder alert is scheduled but currently suppressed
calendar-editable-item-reminder-icon-email =
.alt = A reminder e-mail is scheduled

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

@ -1,9 +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/.
calendar-event-reminder-icon-display =
.alt = Show an Alert
calendar-event-reminder-icon-email =
.alt = Send an E-mail

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

@ -212,7 +212,7 @@ add_task(async function test_addReminderImages() {
equal(box.children.length, actions.length);
for (let i = 0, len = box.children.length; i < len; i++) {
let actionvalue = box.children[i].getAttribute("value");
equal(box.children[i].localName, "img", msg + " (is image)");
equal(box.children[i].localName, "image", msg + " (is image)");
ok(actionset.has(actionvalue), msg + " (has action)");
equal(box.children[i].getAttribute("class"), "reminder-icon", msg + " (has class)");
actionset.delete(actionvalue);