mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 22:43:33 +08:00
DEV: fixes eslint/prettier on github actions (#10601)
This commit is contained in:
@ -13,22 +13,22 @@ function buildDateHelper(params = {}) {
|
||||
hour: params.hour || 10,
|
||||
minute: params.minute || 5,
|
||||
timezone: params.timezone,
|
||||
localTimezone: PARIS
|
||||
localTimezone: PARIS,
|
||||
});
|
||||
}
|
||||
|
||||
QUnit.test("#format", assert => {
|
||||
QUnit.test("#format", (assert) => {
|
||||
let date = buildDateHelper({
|
||||
day: 15,
|
||||
month: 2,
|
||||
hour: 15,
|
||||
minute: 36,
|
||||
timezone: PARIS
|
||||
timezone: PARIS,
|
||||
});
|
||||
assert.equal(date.format(), "2020-03-15T15:36:00.000+01:00");
|
||||
});
|
||||
|
||||
QUnit.test("#repetitionsBetweenDates", assert => {
|
||||
QUnit.test("#repetitionsBetweenDates", (assert) => {
|
||||
let date;
|
||||
|
||||
date = buildDateHelper({
|
||||
@ -36,7 +36,7 @@ QUnit.test("#repetitionsBetweenDates", assert => {
|
||||
month: 1,
|
||||
hour: 15,
|
||||
minute: 36,
|
||||
timezone: PARIS
|
||||
timezone: PARIS,
|
||||
});
|
||||
assert.equal(
|
||||
date.repetitionsBetweenDates(
|
||||
@ -52,7 +52,7 @@ QUnit.test("#repetitionsBetweenDates", assert => {
|
||||
month: 1,
|
||||
hour: 15,
|
||||
minute: 36,
|
||||
timezone: PARIS
|
||||
timezone: PARIS,
|
||||
});
|
||||
assert.equal(
|
||||
date.repetitionsBetweenDates(
|
||||
@ -68,7 +68,7 @@ QUnit.test("#repetitionsBetweenDates", assert => {
|
||||
month: 1,
|
||||
hour: 15,
|
||||
minute: 36,
|
||||
timezone: PARIS
|
||||
timezone: PARIS,
|
||||
});
|
||||
assert.equal(
|
||||
date.repetitionsBetweenDates(
|
||||
@ -84,7 +84,7 @@ QUnit.test("#repetitionsBetweenDates", assert => {
|
||||
month: 1,
|
||||
hour: 15,
|
||||
minute: 36,
|
||||
timezone: PARIS
|
||||
timezone: PARIS,
|
||||
});
|
||||
assert.equal(
|
||||
date.repetitionsBetweenDates(
|
||||
@ -96,7 +96,7 @@ QUnit.test("#repetitionsBetweenDates", assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("#add", assert => {
|
||||
QUnit.test("#add", (assert) => {
|
||||
let date;
|
||||
let futureLocalDate;
|
||||
|
||||
@ -105,7 +105,7 @@ QUnit.test("#add", assert => {
|
||||
month: 2,
|
||||
hour: 15,
|
||||
minute: 36,
|
||||
timezone: PARIS
|
||||
timezone: PARIS,
|
||||
});
|
||||
|
||||
assert.notOk(date.isDST());
|
||||
@ -122,7 +122,7 @@ QUnit.test("#add", assert => {
|
||||
month: 3,
|
||||
hour: 15,
|
||||
minute: 36,
|
||||
timezone: PARIS
|
||||
timezone: PARIS,
|
||||
});
|
||||
assert.ok(date.isDST());
|
||||
futureLocalDate = date.add(1, "year");
|
||||
@ -138,7 +138,7 @@ QUnit.test("#add", assert => {
|
||||
month: 2,
|
||||
hour: 15,
|
||||
minute: 36,
|
||||
timezone: PARIS
|
||||
timezone: PARIS,
|
||||
});
|
||||
assert.notOk(date.isDST());
|
||||
futureLocalDate = date.add(1, "week");
|
||||
@ -154,7 +154,7 @@ QUnit.test("#add", assert => {
|
||||
month: 3,
|
||||
hour: 15,
|
||||
minute: 36,
|
||||
timezone: PARIS
|
||||
timezone: PARIS,
|
||||
});
|
||||
|
||||
assert.ok(date.isDST());
|
||||
|
@ -30,7 +30,7 @@ function freezeTime({ date, timezone }, cb) {
|
||||
sandbox.restore();
|
||||
}
|
||||
|
||||
QUnit.assert.buildsCorrectDate = function(options, expected, message) {
|
||||
QUnit.assert.buildsCorrectDate = function (options, expected, message) {
|
||||
const localTimezone = options.localTimezone || PARIS;
|
||||
delete options.localTimezone;
|
||||
|
||||
@ -38,7 +38,7 @@ QUnit.assert.buildsCorrectDate = function(options, expected, message) {
|
||||
Object.assign(
|
||||
{},
|
||||
{
|
||||
date: "2020-03-22"
|
||||
date: "2020-03-22",
|
||||
},
|
||||
options
|
||||
),
|
||||
@ -62,7 +62,7 @@ QUnit.assert.buildsCorrectDate = function(options, expected, message) {
|
||||
}
|
||||
};
|
||||
|
||||
QUnit.test("date", assert => {
|
||||
QUnit.test("date", (assert) => {
|
||||
freezeTime({ date: "2020-03-11" }, () => {
|
||||
assert.buildsCorrectDate(
|
||||
{ date: "2020-03-22", timezone: PARIS },
|
||||
@ -72,7 +72,7 @@ QUnit.test("date", assert => {
|
||||
});
|
||||
});
|
||||
|
||||
QUnit.test("date and time", assert => {
|
||||
QUnit.test("date and time", (assert) => {
|
||||
assert.buildsCorrectDate(
|
||||
{ date: "2020-04-11", time: "11:00" },
|
||||
{ formated: "April 11, 2020 1:00 PM" },
|
||||
@ -86,7 +86,7 @@ QUnit.test("date and time", assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("option[format]", assert => {
|
||||
QUnit.test("option[format]", (assert) => {
|
||||
freezeTime({ date: "2020-03-11" }, () => {
|
||||
assert.buildsCorrectDate(
|
||||
{ format: "YYYY" },
|
||||
@ -96,7 +96,7 @@ QUnit.test("option[format]", assert => {
|
||||
});
|
||||
});
|
||||
|
||||
QUnit.test("option[displayedTimezone]", assert => {
|
||||
QUnit.test("option[displayedTimezone]", (assert) => {
|
||||
freezeTime({}, () => {
|
||||
assert.buildsCorrectDate(
|
||||
{ displayedTimezone: SYDNEY },
|
||||
@ -130,7 +130,7 @@ QUnit.test("option[displayedTimezone]", assert => {
|
||||
});
|
||||
});
|
||||
|
||||
QUnit.test("option[timezone]", assert => {
|
||||
QUnit.test("option[timezone]", (assert) => {
|
||||
freezeTime({}, () => {
|
||||
assert.buildsCorrectDate(
|
||||
{ timezone: SYDNEY, displayedTimezone: PARIS },
|
||||
@ -140,7 +140,7 @@ QUnit.test("option[timezone]", assert => {
|
||||
});
|
||||
});
|
||||
|
||||
QUnit.test("option[recurring]", assert => {
|
||||
QUnit.test("option[recurring]", (assert) => {
|
||||
freezeTime({ date: "2020-04-06 06:00", timezone: LAGOS }, () => {
|
||||
assert.buildsCorrectDate(
|
||||
{
|
||||
@ -148,10 +148,10 @@ QUnit.test("option[recurring]", assert => {
|
||||
time: "11:00",
|
||||
timezone: PARIS,
|
||||
displayedTimezone: LAGOS,
|
||||
recurring: "1.weeks"
|
||||
recurring: "1.weeks",
|
||||
},
|
||||
{
|
||||
formated: "April 6, 2020 10:00 AM (Lagos)"
|
||||
formated: "April 6, 2020 10:00 AM (Lagos)",
|
||||
},
|
||||
"it correctly formats a recurring date starting from a !isDST timezone to a isDST timezone date when displayed to a user using a timezone with no DST"
|
||||
);
|
||||
@ -165,10 +165,10 @@ QUnit.test("option[recurring]", assert => {
|
||||
timezone: UTC,
|
||||
recurring: "1.weeks",
|
||||
calendar: false,
|
||||
displayedTimezone: SYDNEY
|
||||
displayedTimezone: SYDNEY,
|
||||
},
|
||||
{
|
||||
formated: "April 6, 2020 12:00 PM (Sydney)"
|
||||
formated: "April 6, 2020 12:00 PM (Sydney)",
|
||||
},
|
||||
"it correctly formats a recurring date spanning over weeks"
|
||||
);
|
||||
@ -180,10 +180,10 @@ QUnit.test("option[recurring]", assert => {
|
||||
date: "2019-11-25",
|
||||
time: "11:00",
|
||||
recurring: "1.weeks",
|
||||
timezone: PARIS
|
||||
timezone: PARIS,
|
||||
},
|
||||
{
|
||||
formated: "April 13, 2020 11:00 AM"
|
||||
formated: "April 13, 2020 11:00 AM",
|
||||
},
|
||||
"it correctly adds from a !isDST date to a isDST date"
|
||||
);
|
||||
@ -195,10 +195,10 @@ QUnit.test("option[recurring]", assert => {
|
||||
date: "2020-03-30",
|
||||
time: "11:00",
|
||||
recurring: "1.weeks",
|
||||
timezone: PARIS
|
||||
timezone: PARIS,
|
||||
},
|
||||
{
|
||||
formated: "Today 11:00 AM"
|
||||
formated: "Today 11:00 AM",
|
||||
},
|
||||
"it works to the minute"
|
||||
);
|
||||
@ -210,22 +210,22 @@ QUnit.test("option[recurring]", assert => {
|
||||
date: "2020-03-30",
|
||||
time: "11:00",
|
||||
recurring: "1.weeks",
|
||||
timezone: PARIS
|
||||
timezone: PARIS,
|
||||
},
|
||||
{
|
||||
formated: "April 13, 2020 11:00 AM"
|
||||
formated: "April 13, 2020 11:00 AM",
|
||||
},
|
||||
"it works to the minute"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
QUnit.test("option[countown]", assert => {
|
||||
QUnit.test("option[countown]", (assert) => {
|
||||
freezeTime({ date: "2020-03-21 23:59" }, () => {
|
||||
assert.buildsCorrectDate(
|
||||
{
|
||||
countdown: true,
|
||||
timezone: PARIS
|
||||
timezone: PARIS,
|
||||
},
|
||||
{ formated: "a minute" },
|
||||
"it shows the time remaining"
|
||||
@ -236,19 +236,19 @@ QUnit.test("option[countown]", assert => {
|
||||
assert.buildsCorrectDate(
|
||||
{
|
||||
countdown: true,
|
||||
timezone: PARIS
|
||||
timezone: PARIS,
|
||||
},
|
||||
{
|
||||
formated: I18n.t(
|
||||
"discourse_local_dates.relative_dates.countdown.passed"
|
||||
)
|
||||
),
|
||||
},
|
||||
"it shows the date has passed"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
QUnit.test("option[calendar]", assert => {
|
||||
QUnit.test("option[calendar]", (assert) => {
|
||||
freezeTime({ date: "2020-03-23 23:00" }, () => {
|
||||
assert.buildsCorrectDate(
|
||||
{ date: "2020-03-22", time: "23:59", timezone: PARIS },
|
||||
@ -313,7 +313,7 @@ QUnit.test("option[calendar]", assert => {
|
||||
{
|
||||
date: "2020-05-13",
|
||||
time: "18:00",
|
||||
localTimezone: LOS_ANGELES
|
||||
localTimezone: LOS_ANGELES,
|
||||
},
|
||||
{ formated: "Tomorrow 11:00 AM" },
|
||||
"it correctly displays a different local timezone"
|
||||
@ -321,7 +321,7 @@ QUnit.test("option[calendar]", assert => {
|
||||
});
|
||||
});
|
||||
|
||||
QUnit.test("previews", assert => {
|
||||
QUnit.test("previews", (assert) => {
|
||||
freezeTime({ date: "2020-03-22" }, () => {
|
||||
assert.buildsCorrectDate(
|
||||
{ timezone: PARIS },
|
||||
@ -331,9 +331,9 @@ QUnit.test("previews", assert => {
|
||||
current: true,
|
||||
formated:
|
||||
"Sunday, March 22, 2020 12:00 AM → Monday, March 23, 2020 12:00 AM",
|
||||
timezone: "Paris"
|
||||
}
|
||||
]
|
||||
timezone: "Paris",
|
||||
},
|
||||
],
|
||||
}
|
||||
);
|
||||
});
|
||||
@ -347,14 +347,14 @@ QUnit.test("previews", assert => {
|
||||
current: true,
|
||||
formated:
|
||||
"Sunday, March 22, 2020 12:00 AM → Monday, March 23, 2020 12:00 AM",
|
||||
timezone: "Paris"
|
||||
timezone: "Paris",
|
||||
},
|
||||
{
|
||||
formated:
|
||||
"Sunday, March 22, 2020 10:00 AM → Monday, March 23, 2020 10:00 AM",
|
||||
timezone: "Sydney"
|
||||
}
|
||||
]
|
||||
timezone: "Sydney",
|
||||
},
|
||||
],
|
||||
}
|
||||
);
|
||||
});
|
||||
@ -368,9 +368,9 @@ QUnit.test("previews", assert => {
|
||||
current: true,
|
||||
formated:
|
||||
"Sunday, March 22, 2020 12:00 AM → Monday, March 23, 2020 12:00 AM",
|
||||
timezone: "Paris"
|
||||
}
|
||||
]
|
||||
timezone: "Paris",
|
||||
},
|
||||
],
|
||||
}
|
||||
);
|
||||
});
|
||||
@ -384,9 +384,9 @@ QUnit.test("previews", assert => {
|
||||
current: true,
|
||||
formated:
|
||||
"Sunday, March 22, 2020 12:00 AM → Monday, March 23, 2020 12:00 AM",
|
||||
timezone: "Paris"
|
||||
}
|
||||
]
|
||||
timezone: "Paris",
|
||||
},
|
||||
],
|
||||
}
|
||||
);
|
||||
});
|
||||
@ -400,9 +400,9 @@ QUnit.test("previews", assert => {
|
||||
current: true,
|
||||
formated:
|
||||
"Sunday, March 22, 2020 12:00 AM → Monday, March 23, 2020 12:00 AM",
|
||||
timezone: "Paris"
|
||||
}
|
||||
]
|
||||
timezone: "Paris",
|
||||
},
|
||||
],
|
||||
}
|
||||
);
|
||||
});
|
||||
@ -415,9 +415,9 @@ QUnit.test("previews", assert => {
|
||||
{
|
||||
current: true,
|
||||
formated: "March 22, 2020 11:34 AM",
|
||||
timezone: "Paris"
|
||||
}
|
||||
]
|
||||
timezone: "Paris",
|
||||
},
|
||||
],
|
||||
}
|
||||
);
|
||||
});
|
||||
@ -427,7 +427,7 @@ QUnit.test("previews", assert => {
|
||||
{
|
||||
timezone: PARIS,
|
||||
date: "2020-04-07",
|
||||
timezones: [LONDON, LAGOS, SYDNEY]
|
||||
timezones: [LONDON, LAGOS, SYDNEY],
|
||||
},
|
||||
{
|
||||
previews: [
|
||||
@ -435,24 +435,24 @@ QUnit.test("previews", assert => {
|
||||
current: true,
|
||||
formated:
|
||||
"Tuesday, April 7, 2020 12:00 AM → Wednesday, April 8, 2020 12:00 AM",
|
||||
timezone: "Paris"
|
||||
timezone: "Paris",
|
||||
},
|
||||
{
|
||||
formated:
|
||||
"Monday, April 6, 2020 11:00 PM → Tuesday, April 7, 2020 11:00 PM",
|
||||
timezone: "London"
|
||||
timezone: "London",
|
||||
},
|
||||
{
|
||||
formated:
|
||||
"Monday, April 6, 2020 11:00 PM → Tuesday, April 7, 2020 11:00 PM",
|
||||
timezone: "Lagos"
|
||||
timezone: "Lagos",
|
||||
},
|
||||
{
|
||||
formated:
|
||||
"Tuesday, April 7, 2020 8:00 AM → Wednesday, April 8, 2020 8:00 AM",
|
||||
timezone: "Sydney"
|
||||
}
|
||||
]
|
||||
timezone: "Sydney",
|
||||
},
|
||||
],
|
||||
}
|
||||
);
|
||||
});
|
||||
@ -463,28 +463,28 @@ QUnit.test("previews", assert => {
|
||||
timezone: PARIS,
|
||||
date: "2020-04-07",
|
||||
time: "14:54",
|
||||
timezones: [LONDON, LAGOS, SYDNEY]
|
||||
timezones: [LONDON, LAGOS, SYDNEY],
|
||||
},
|
||||
{
|
||||
previews: [
|
||||
{
|
||||
current: true,
|
||||
formated: "April 7, 2020 2:54 PM",
|
||||
timezone: "Paris"
|
||||
timezone: "Paris",
|
||||
},
|
||||
{
|
||||
formated: "April 7, 2020 1:54 PM",
|
||||
timezone: "London"
|
||||
timezone: "London",
|
||||
},
|
||||
{
|
||||
formated: "April 7, 2020 1:54 PM",
|
||||
timezone: "Lagos"
|
||||
timezone: "Lagos",
|
||||
},
|
||||
{
|
||||
formated: "April 7, 2020 10:54 PM",
|
||||
timezone: "Sydney"
|
||||
}
|
||||
]
|
||||
timezone: "Sydney",
|
||||
},
|
||||
],
|
||||
}
|
||||
);
|
||||
});
|
||||
@ -494,20 +494,20 @@ QUnit.test("previews", assert => {
|
||||
{
|
||||
date: "2020-05-13",
|
||||
time: "18:00",
|
||||
localTimezone: LOS_ANGELES
|
||||
localTimezone: LOS_ANGELES,
|
||||
},
|
||||
{
|
||||
previews: [
|
||||
{
|
||||
current: true,
|
||||
formated: "May 13, 2020 11:00 AM",
|
||||
timezone: "Los Angeles"
|
||||
timezone: "Los Angeles",
|
||||
},
|
||||
{
|
||||
formated: "May 13, 2020 6:00 PM",
|
||||
timezone: "UTC"
|
||||
}
|
||||
]
|
||||
timezone: "UTC",
|
||||
},
|
||||
],
|
||||
}
|
||||
);
|
||||
});
|
||||
|
Reference in New Issue
Block a user