FEATURE: Allow admins to reply without topic bump
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { acceptance } from "helpers/qunit-helpers";
|
||||
import { acceptance, replaceCurrentUser } from "helpers/qunit-helpers";
|
||||
import { _clearSnapshots } from "select-kit/components/composer-actions";
|
||||
|
||||
acceptance("Composer Actions", {
|
||||
@@ -25,7 +25,8 @@ QUnit.test("replying to post", async assert => {
|
||||
);
|
||||
assert.equal(composerActions.rowByIndex(2).value(), "reply_to_topic");
|
||||
assert.equal(composerActions.rowByIndex(3).value(), "toggle_whisper");
|
||||
assert.equal(composerActions.rowByIndex(4).value(), undefined);
|
||||
assert.equal(composerActions.rowByIndex(4).value(), "toggle_topic_bump");
|
||||
assert.equal(composerActions.rowByIndex(5).value(), undefined);
|
||||
});
|
||||
|
||||
QUnit.test("replying to post - reply_as_private_message", async assert => {
|
||||
@@ -179,7 +180,8 @@ QUnit.test("interactions", async assert => {
|
||||
"reply_as_private_message"
|
||||
);
|
||||
assert.equal(composerActions.rowByIndex(3).value(), "toggle_whisper");
|
||||
assert.equal(composerActions.rows().length, 4);
|
||||
assert.equal(composerActions.rowByIndex(4).value(), "toggle_topic_bump");
|
||||
assert.equal(composerActions.rows().length, 5);
|
||||
|
||||
await composerActions.selectRowByValue("reply_to_post");
|
||||
await composerActions.expand();
|
||||
@@ -199,7 +201,8 @@ QUnit.test("interactions", async assert => {
|
||||
);
|
||||
assert.equal(composerActions.rowByIndex(2).value(), "reply_to_topic");
|
||||
assert.equal(composerActions.rowByIndex(3).value(), "toggle_whisper");
|
||||
assert.equal(composerActions.rows().length, 4);
|
||||
assert.equal(composerActions.rowByIndex(4).value(), "toggle_topic_bump");
|
||||
assert.equal(composerActions.rows().length, 5);
|
||||
|
||||
await composerActions.selectRowByValue("reply_as_new_topic");
|
||||
await composerActions.expand();
|
||||
@@ -243,3 +246,62 @@ QUnit.test("interactions", async assert => {
|
||||
assert.equal(composerActions.rowByIndex(2).value(), "reply_to_topic");
|
||||
assert.equal(composerActions.rows().length, 3);
|
||||
});
|
||||
|
||||
QUnit.test("replying to post - toggle_topic_bump", async assert => {
|
||||
const composerActions = selectKit(".composer-actions");
|
||||
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("article#post_3 button.reply");
|
||||
|
||||
assert.ok(
|
||||
find(".composer-fields .no-bump").length === 0,
|
||||
"no-bump text is not visible"
|
||||
);
|
||||
|
||||
await composerActions.expand();
|
||||
await composerActions.selectRowByValue("toggle_topic_bump");
|
||||
|
||||
assert.equal(
|
||||
find(".composer-fields .no-bump").text(),
|
||||
I18n.t("composer.no_topic_bump"),
|
||||
"no-bump text is visible"
|
||||
);
|
||||
|
||||
await composerActions.expand();
|
||||
await composerActions.selectRowByValue("toggle_topic_bump");
|
||||
|
||||
assert.ok(
|
||||
find(".composer-fields .no-bump").length === 0,
|
||||
"no-bump text is not visible"
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("replying to post as staff", async assert => {
|
||||
const composerActions = selectKit(".composer-actions");
|
||||
|
||||
replaceCurrentUser({ staff: true, admin: false });
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("article#post_3 button.reply");
|
||||
await composerActions.expand();
|
||||
|
||||
assert.equal(composerActions.rows().length, 5);
|
||||
assert.equal(composerActions.rowByIndex(4).value(), "toggle_topic_bump");
|
||||
});
|
||||
|
||||
QUnit.test("replying to post as regular user", async assert => {
|
||||
const composerActions = selectKit(".composer-actions");
|
||||
|
||||
replaceCurrentUser({ staff: false, admin: false });
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("article#post_3 button.reply");
|
||||
await composerActions.expand();
|
||||
|
||||
assert.equal(composerActions.rows().length, 3);
|
||||
Array.from(composerActions.rows()).forEach(row => {
|
||||
assert.notEqual(
|
||||
row.value,
|
||||
"toggle_topic_bump",
|
||||
"toggle button is not visible"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user