Add qunit test and fix the rspec method

This commit is contained in:
Vinoth Kannan 2018-10-12 03:32:38 +05:30
parent f54052d796
commit f38caf30fb
2 changed files with 26 additions and 1 deletions

View File

@ -7,7 +7,7 @@ describe PrettyText do
[date=2018-05-08 time=22:00 format=LLL timezones="Europe/Paris|America/Los_Angeles"] [date=2018-05-08 time=22:00 format=LLL timezones="Europe/Paris|America/Los_Angeles"]
MD MD
cooked_mail = <<~HTML cooked_mail = <<~HTML
<p><span class="discourse-local-date" data-date="2018-05-08" data-time="22:00" data-format="LLL" data-timezones="Europe/Paris|America/Los_Angeles" data-email-preview="May 9, 2018 12:00 AM (Europe: Paris)">May 9, 2018 12:00 AM (Europe: Paris)</span></p> <p><span class="discourse-local-date" data-date="2018-05-08" data-format="LLL" data-timezones="Europe/Paris|America/Los_Angeles" data-time="22:00" data-email-preview="May 9, 2018 12:00 AM (Europe: Paris)">May 9, 2018 12:00 AM (Europe: Paris)</span></p>
HTML HTML
expect(PrettyText.format_for_email(cooked)).to match_html(cooked_mail) expect(PrettyText.format_for_email(cooked)).to match_html(cooked_mail)

View File

@ -0,0 +1,25 @@
import { acceptance } from "helpers/qunit-helpers";
import { clearPopupMenuOptionsCallback } from "discourse/controllers/composer";
acceptance("Local Dates", {
loggedIn: true,
settings: { discourse_local_dates_enabled: true },
beforeEach() {
clearPopupMenuOptionsCallback();
}
});
test("local dates bbcode", async assert => {
await visit("/");
await click("#create-topic");
await fillIn(
".d-editor-input",
'[date=2017-10-23 time=01:30:00 format="LL" timezone="Asia/Calcutta" timezones="Europe/Paris|America/Los_Angeles"]'
);
assert.ok(
exists(".d-editor-preview .discourse-local-date.past.cooked-date"),
"it should contain the cooked date output"
);
});