mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 16:51:22 +08:00
UX: remove "at" word from relative dates in local dates
Previously we would render "Today at 2:42 PM" Now we render "Today 2:42 PM" This also introduces new strings so it can be properly translated Finally it introduces tests so we can make sure this keeps working
This commit is contained in:
@ -6,9 +6,36 @@ acceptance("Local Dates", {
|
||||
settings: { discourse_local_dates_enabled: true },
|
||||
beforeEach() {
|
||||
clearPopupMenuOptionsCallback();
|
||||
},
|
||||
afterEach() {
|
||||
sinon.restore();
|
||||
}
|
||||
});
|
||||
|
||||
test("at removal", assert => {
|
||||
let now = moment("2018-06-20").valueOf();
|
||||
let timezone = moment.tz.guess();
|
||||
|
||||
sinon.useFakeTimers(now);
|
||||
|
||||
let html = `<span data-timezones="${timezone}" data-timezone="${timezone}" class="discourse-local-date past cooked-date" data-date="DATE" data-format="L LTS" data-time="14:42:26"></span>`;
|
||||
|
||||
let yesterday = $(html.replace("DATE", "2018-06-19"));
|
||||
yesterday.applyLocalDates();
|
||||
|
||||
assert.equal(yesterday.text(), "Yesterday 2:42 PM");
|
||||
|
||||
let today = $(html.replace("DATE", "2018-06-20"));
|
||||
today.applyLocalDates();
|
||||
|
||||
assert.equal(today.text(), "Today 2:42 PM");
|
||||
|
||||
let tomorrow = $(html.replace("DATE", "2018-06-21"));
|
||||
tomorrow.applyLocalDates();
|
||||
|
||||
assert.equal(tomorrow.text(), "Tomorrow 2:42 PM");
|
||||
});
|
||||
|
||||
test("local dates bbcode", async assert => {
|
||||
await visit("/");
|
||||
await click("#create-topic");
|
||||
|
Reference in New Issue
Block a user