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:
Sam
2018-10-31 11:55:31 +11:00
parent d6f89a85ef
commit df62b48d51
3 changed files with 52 additions and 1 deletions

View File

@ -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");