mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 03:51:07 +08:00
REFACTOR: All remaining acceptance tests converted to new format
Also contains fixes to leaky state in pretender.
This commit is contained in:
@ -1,50 +1,54 @@
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
acceptance("Local Dates - composer", {
|
||||
loggedIn: true,
|
||||
settings: { discourse_local_dates_enabled: true },
|
||||
});
|
||||
acceptance("Local Dates - composer", function (needs) {
|
||||
needs.user();
|
||||
needs.settings({ discourse_local_dates_enabled: true });
|
||||
|
||||
test("composer bbcode", async (assert) => {
|
||||
const getAttr = (attr) => {
|
||||
return find(".d-editor-preview .discourse-local-date.cooked-date").attr(
|
||||
`data-${attr}`
|
||||
test("composer bbcode", async (assert) => {
|
||||
const getAttr = (attr) => {
|
||||
return find(".d-editor-preview .discourse-local-date.cooked-date").attr(
|
||||
`data-${attr}`
|
||||
);
|
||||
};
|
||||
|
||||
await visit("/");
|
||||
await click("#create-topic");
|
||||
|
||||
await fillIn(
|
||||
".d-editor-input",
|
||||
'[date=2017-10-23 time=01:30:00 displayedTimezone="America/Chicago" format="LLLL" calendar="off" recurring="1.weeks" timezone="Asia/Calcutta" timezones="Europe/Paris|America/Los_Angeles"]'
|
||||
);
|
||||
};
|
||||
|
||||
await visit("/");
|
||||
await click("#create-topic");
|
||||
assert.equal(getAttr("date"), "2017-10-23", "it has the correct date");
|
||||
assert.equal(getAttr("time"), "01:30:00", "it has the correct time");
|
||||
assert.equal(
|
||||
getAttr("displayed-timezone"),
|
||||
"America/Chicago",
|
||||
"it has the correct displayed timezone"
|
||||
);
|
||||
assert.equal(getAttr("format"), "LLLL", "it has the correct format");
|
||||
assert.equal(
|
||||
getAttr("timezones"),
|
||||
"Europe/Paris|America/Los_Angeles",
|
||||
"it has the correct timezones"
|
||||
);
|
||||
assert.equal(
|
||||
getAttr("recurring"),
|
||||
"1.weeks",
|
||||
"it has the correct recurring"
|
||||
);
|
||||
assert.equal(
|
||||
getAttr("timezone"),
|
||||
"Asia/Calcutta",
|
||||
"it has the correct timezone"
|
||||
);
|
||||
|
||||
await fillIn(
|
||||
".d-editor-input",
|
||||
'[date=2017-10-23 time=01:30:00 displayedTimezone="America/Chicago" format="LLLL" calendar="off" recurring="1.weeks" timezone="Asia/Calcutta" timezones="Europe/Paris|America/Los_Angeles"]'
|
||||
);
|
||||
await fillIn(
|
||||
".d-editor-input",
|
||||
'[date=2017-10-24 format="LL" timezone="Asia/Calcutta" timezones="Europe/Paris|America/Los_Angeles"]'
|
||||
);
|
||||
|
||||
assert.equal(getAttr("date"), "2017-10-23", "it has the correct date");
|
||||
assert.equal(getAttr("time"), "01:30:00", "it has the correct time");
|
||||
assert.equal(
|
||||
getAttr("displayed-timezone"),
|
||||
"America/Chicago",
|
||||
"it has the correct displayed timezone"
|
||||
);
|
||||
assert.equal(getAttr("format"), "LLLL", "it has the correct format");
|
||||
assert.equal(
|
||||
getAttr("timezones"),
|
||||
"Europe/Paris|America/Los_Angeles",
|
||||
"it has the correct timezones"
|
||||
);
|
||||
assert.equal(getAttr("recurring"), "1.weeks", "it has the correct recurring");
|
||||
assert.equal(
|
||||
getAttr("timezone"),
|
||||
"Asia/Calcutta",
|
||||
"it has the correct timezone"
|
||||
);
|
||||
|
||||
await fillIn(
|
||||
".d-editor-input",
|
||||
'[date=2017-10-24 format="LL" timezone="Asia/Calcutta" timezones="Europe/Paris|America/Los_Angeles"]'
|
||||
);
|
||||
|
||||
assert.equal(getAttr("date"), "2017-10-24", "it has the correct date");
|
||||
assert.notOk(getAttr("time"), "it doesn’t have time");
|
||||
assert.equal(getAttr("date"), "2017-10-24", "it has the correct date");
|
||||
assert.notOk(getAttr("time"), "it doesn’t have time");
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user