FIX: use full screen login for new-topic route (#7467)
DEV: add javascript tests for new-topic and new-message routes DEV: fix an existing test that was being skipped
This commit is contained in:
@@ -18,9 +18,7 @@ QUnit.test("does not display uncategorized if not allowed", async assert => {
|
||||
assert.ok(categoryChooser.rowByIndex(0).name() !== "uncategorized");
|
||||
});
|
||||
|
||||
// TODO: fix the test to work with new code to land on category page
|
||||
// (https://github.com/discourse/discourse/commit/7d9c97d66141d35d00258fe544211d9fd7f79a76)
|
||||
QUnit.skip("prefill category when category_id is set", async assert => {
|
||||
QUnit.test("prefill category when category_id is set", async assert => {
|
||||
await visit("/new-topic?category_id=1");
|
||||
|
||||
assert.equal(
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
import { acceptance, logIn } from "helpers/qunit-helpers";
|
||||
|
||||
acceptance("New Message");
|
||||
|
||||
QUnit.test("accessing new-message route when logged out", async assert => {
|
||||
await visit(
|
||||
"/new-message?username=eviltrout&title=message%20title&body=message%20body"
|
||||
);
|
||||
|
||||
assert.ok(exists(".modal.login-modal"), "it shows the login modal");
|
||||
});
|
||||
|
||||
QUnit.test("accessing new-message route when logged in", async assert => {
|
||||
logIn();
|
||||
Discourse.reset();
|
||||
|
||||
await visit(
|
||||
"/new-message?username=eviltrout&title=message%20title&body=message%20body"
|
||||
);
|
||||
|
||||
assert.ok(exists(".composer-fields"), "it opens composer");
|
||||
assert.equal(
|
||||
find("#reply-title")
|
||||
.val()
|
||||
.trim(),
|
||||
"message title",
|
||||
"it pre-fills message title"
|
||||
);
|
||||
assert.equal(
|
||||
find(".d-editor-input")
|
||||
.val()
|
||||
.trim(),
|
||||
"message body",
|
||||
"it pre-fills message body"
|
||||
);
|
||||
assert.equal(
|
||||
find(".users-input .item:eq(0)")
|
||||
.text()
|
||||
.trim(),
|
||||
"eviltrout",
|
||||
"it selects correct username"
|
||||
);
|
||||
});
|
||||
@@ -0,0 +1,39 @@
|
||||
import { acceptance, logIn } from "helpers/qunit-helpers";
|
||||
|
||||
acceptance("New Topic");
|
||||
|
||||
QUnit.test("accessing new-topic route when logged out", async assert => {
|
||||
await visit("/new-topic?title=topic%20title&body=topic%20body");
|
||||
|
||||
assert.ok(exists(".modal.login-modal"), "it shows the login modal");
|
||||
});
|
||||
|
||||
QUnit.test("accessing new-topic route when logged in", async assert => {
|
||||
logIn();
|
||||
Discourse.reset();
|
||||
|
||||
await visit("/new-topic?title=topic%20title&body=topic%20body&category=bug");
|
||||
|
||||
assert.ok(exists(".composer-fields"), "it opens composer");
|
||||
assert.equal(
|
||||
find("#reply-title")
|
||||
.val()
|
||||
.trim(),
|
||||
"topic title",
|
||||
"it pre-fills topic title"
|
||||
);
|
||||
assert.equal(
|
||||
find(".d-editor-input")
|
||||
.val()
|
||||
.trim(),
|
||||
"topic body",
|
||||
"it pre-fills topic body"
|
||||
);
|
||||
assert.equal(
|
||||
selectKit(".category-chooser")
|
||||
.header()
|
||||
.value(),
|
||||
1,
|
||||
"it selects desired category"
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user