Bug 1346797 - Fix calendar eslint issues - Fix quotes issues. r=MakeMyDay
MozReview-Commit-ID: IPyczNQYJW5
--- a/calendar/base/content/widgets/minimonth.xml
+++ b/calendar/base/content/widgets/minimonth.xml
@@ -756,20 +756,20 @@
let useOSFormat;
tempDate.setDate(tempDate.getDate() - (tempDate.getDay() - this.weekStart));
for (i = 0; i < 7; i++) {
// if available, use UILocale days, else operating system format
try {
dayList[i] = cal.calGetString("dateFormat",
"day." + (tempDate.getDay() + 1) + ".short");
} catch (e) {
- dayList[i] = tempDate.toLocaleDateString(undefined, { weekday: 'short' });
+ dayList[i] = tempDate.toLocaleDateString(undefined, { weekday: "short" });
useOSFormat = true;
}
- longDayList[i] = tempDate.toLocaleDateString(undefined, { weekday: 'long' });
+ longDayList[i] = tempDate.toLocaleDateString(undefined, { weekday: "long" });
tempDate.setDate(tempDate.getDate() + 1);
}
if (useOSFormat) {
// To keep datepicker popup compact, shrink localized weekday
// abbreviations down to 1 or 2 chars so each column of week can
// be as narrow as 2 digits.
//
@@ -1263,17 +1263,17 @@
<body><![CDATA[
this.mFocused.focus();
]]></body>
</method>
<method name="onDayActivate">
<parameter name="aEvent"/>
<body><![CDATA[
- if (aEvent.originalTarget.className == 'minimonth-day') {
+ if (aEvent.originalTarget.className == "minimonth-day") {
// the associated date might change when setting this.value if month changes
let date = aEvent.originalTarget.date;
if (!this.mIsReadOnly) {
this.value = date;
this.fireEvent("select");
}
this.setFocusedDate(date, true);
@@ -1284,17 +1284,17 @@
</method>
<method name="onDayMovement">
<parameter name="aEvent"/>
<parameter name="aYears"/>
<parameter name="aMonths"/>
<parameter name="aDays"/>
<body><![CDATA[
- if (aEvent.originalTarget.className == 'minimonth-day') {
+ if (aEvent.originalTarget.className == "minimonth-day") {
this.moveByOffset(aYears, aMonths, aDays);
aEvent.stopPropagation();
aEvent.preventDefault();
}
]]></body>
</method>
</implementation>
@@ -1343,25 +1343,25 @@
<handler event="keypress" keycode="VK_PAGE_DOWN"
action="this.onDayMovement(event, 0, 1, 0);" phase="target"/>
<handler event="keypress" keycode="VK_PAGE_UP" modifiers="shift"
action="this.onDayMovement(event, -1, 0, 0);" phase="target"/>
<handler event="keypress" keycode="VK_PAGE_DOWN" modifiers="shift"
action="this.onDayMovement(event, 1, 0, 0);" phase="target"/>
<handler event="keypress" keycode="VK_ESCAPE"
phase="target"><![CDATA[
- if (event.originalTarget.className == 'minimonth-day') {
+ if (event.originalTarget.className == "minimonth-day") {
this.focusDate(this.mValue || this.mExtraDate);
event.stopPropagation();
event.preventDefault();
}
]]></handler>
<handler event="keypress" keycode="VK_HOME"
phase="target"><![CDATA[
- if (event.originalTarget.className == 'minimonth-day') {
+ if (event.originalTarget.className == "minimonth-day") {
let today = new Date();
this.update(today);
this.focusDate(today);
event.stopPropagation();
event.preventDefault();
}
]]></handler>
--- a/calendar/base/src/calDateTimeFormatter.js
+++ b/calendar/base/src/calDateTimeFormatter.js
@@ -33,17 +33,17 @@ calDateTimeFormatter.prototype = {
return this._inTimezone(aDate, { dateStyle: "short" });
},
formatDateLong: function(aDate) {
return this._inTimezone(aDate, { dateStyle: "full" });
},
formatDateWithoutYear: function(aDate) {
- let dtOptions = { month: 'short', day: 'numeric' };
+ let dtOptions = { month: "short", day: "numeric" };
return this._inTimezone(aDate, dtOptions);
},
formatTime: function(aDate) {
if (aDate.isDate) {
return this.mDateStringBundle.GetStringFromName("AllDay");
}
--- a/calendar/test/unit/test_datetimeformatter.js
+++ b/calendar/test/unit/test_datetimeformatter.js
@@ -38,17 +38,17 @@ add_task(function* formatDate_test() {
let tzs = cal.getTimezoneService();
let i = 0;
for (let test of data) {
i++;
Preferences.set("calendar.date.format", test.input.dateformat);
- let zone = (test.input.timezone == 'floating') ? cal.floating() : tzs.getTimezone(test.input.timezone);
+ let zone = (test.input.timezone == "floating") ? cal.floating() : tzs.getTimezone(test.input.timezone);
let date = cal.createDateTime(test.input.datetime).getInTimezone(zone);
let dtFormatter = Components.classes["@mozilla.org/calendar/datetime-formatter;1"]
.getService(Components.interfaces.calIDateTimeFormatter);
let formatted = dtFormatter.formatDate(date);
ok(
test.expected.includes(formatted),
"(test #" + i + ": result '" + formatted + "', expected '" + test.expected + "')"
@@ -117,17 +117,17 @@ add_task(function* formatDateShort_test(
Preferences.set("calendar.date.format", 0);
let tzs = cal.getTimezoneService();
let i = 0;
for (let test of data) {
i++;
- let zone = (test.input.timezone == 'floating') ? cal.floating() : tzs.getTimezone(test.input.timezone);
+ let zone = (test.input.timezone == "floating") ? cal.floating() : tzs.getTimezone(test.input.timezone);
let date = cal.createDateTime(test.input.datetime).getInTimezone(zone);
let dtFormatter = Components.classes["@mozilla.org/calendar/datetime-formatter;1"]
.getService(Components.interfaces.calIDateTimeFormatter);
let formatted = dtFormatter.formatDateShort(date);
ok(
test.expected.includes(formatted),
@@ -197,17 +197,17 @@ add_task(function* formatDateLong_test()
Preferences.set("calendar.date.format", 1);
let tzs = cal.getTimezoneService();
let i = 0;
for (let test of data) {
i++;
- let zone = (test.input.timezone == 'floating') ? cal.floating() : tzs.getTimezone(test.input.timezone);
+ let zone = (test.input.timezone == "floating") ? cal.floating() : tzs.getTimezone(test.input.timezone);
let date = cal.createDateTime(test.input.datetime).getInTimezone(zone);
let dtFormatter = Components.classes["@mozilla.org/calendar/datetime-formatter;1"]
.getService(Components.interfaces.calIDateTimeFormatter);
let formatted = dtFormatter.formatDateLong(date);
ok(
test.expected.includes(formatted),
@@ -277,17 +277,17 @@ add_task(function* formatDateWithoutYear
Preferences.set("calendar.date.format", 1);
let tzs = cal.getTimezoneService();
let i = 0;
for (let test of data) {
i++;
- let zone = (test.input.timezone == 'floating') ? cal.floating() : tzs.getTimezone(test.input.timezone);
+ let zone = (test.input.timezone == "floating") ? cal.floating() : tzs.getTimezone(test.input.timezone);
let date = cal.createDateTime(test.input.datetime).getInTimezone(zone);
let dtFormatter = Components.classes["@mozilla.org/calendar/datetime-formatter;1"]
.getService(Components.interfaces.calIDateTimeFormatter);
equal(dtFormatter.formatDateWithoutYear(date), test.expected, "(test #" + i + ")");
}
// let's reset the preferences
@@ -332,17 +332,17 @@ add_task(function* formatTime_test() {
Preferences.set("calendar.timezone.local", "Pacific/Fakaofo");
let tzs = cal.getTimezoneService();
let i = 0;
for (let test of data) {
i++;
- let zone = (test.input.timezone == 'floating') ? cal.floating() : tzs.getTimezone(test.input.timezone);
+ let zone = (test.input.timezone == "floating") ? cal.floating() : tzs.getTimezone(test.input.timezone);
let date = cal.createDateTime(test.input.datetime).getInTimezone(zone);
let dtFormatter = Components.classes["@mozilla.org/calendar/datetime-formatter;1"]
.getService(Components.interfaces.calIDateTimeFormatter);
let formatted = dtFormatter.formatTime(date);
ok(
test.expected.includes(formatted),