mirror of
https://github.com/discourse/discourse.git
synced 2024-11-30 20:54:00 -06:00
DEV: Rework two composer actions tests (#18008)
This commit is contained in:
parent
d35ffe8361
commit
870ff48470
@ -422,28 +422,28 @@ acceptance("Composer Actions With New Topic Draft", function (needs) {
|
|||||||
needs.hooks.afterEach(() => toggleCheckDraftPopup(false));
|
needs.hooks.afterEach(() => toggleCheckDraftPopup(false));
|
||||||
|
|
||||||
test("shared draft", async function (assert) {
|
test("shared draft", async function (assert) {
|
||||||
|
updateCurrentUser({ has_topic_draft: true });
|
||||||
stubDraftResponse();
|
stubDraftResponse();
|
||||||
toggleCheckDraftPopup(true);
|
toggleCheckDraftPopup(true);
|
||||||
|
|
||||||
const composerActions = selectKit(".composer-actions");
|
|
||||||
const tags = selectKit(".mini-tag-chooser");
|
|
||||||
|
|
||||||
await visit("/");
|
await visit("/");
|
||||||
await click("#create-topic");
|
await click("button.open-draft");
|
||||||
|
|
||||||
await fillIn(
|
await fillIn(
|
||||||
"#reply-title",
|
"#reply-title",
|
||||||
"This is the new text for the title using 'quotes'"
|
"This is the new text for the title using 'quotes'"
|
||||||
);
|
);
|
||||||
|
|
||||||
await fillIn(".d-editor-input", "This is the new text for the post");
|
await fillIn(".d-editor-input", "This is the new text for the post");
|
||||||
|
|
||||||
|
const tags = selectKit(".mini-tag-chooser");
|
||||||
await tags.expand();
|
await tags.expand();
|
||||||
await tags.selectRowByValue("monkey");
|
await tags.selectRowByValue("monkey");
|
||||||
|
|
||||||
|
const composerActions = selectKit(".composer-actions");
|
||||||
await composerActions.expand();
|
await composerActions.expand();
|
||||||
await composerActions.selectRowByValue("shared_draft");
|
await composerActions.selectRowByValue("shared_draft");
|
||||||
|
|
||||||
assert.strictEqual(tags.header().value(), "monkey", "tags are not reset");
|
assert.strictEqual(tags.header().value(), "monkey", "tags are not reset");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
query("#reply-title").value,
|
query("#reply-title").value,
|
||||||
"This is the new text for the title using 'quotes'"
|
"This is the new text for the title using 'quotes'"
|
||||||
@ -458,23 +458,29 @@ acceptance("Composer Actions With New Topic Draft", function (needs) {
|
|||||||
1,
|
1,
|
||||||
"shared draft icon is visible"
|
"shared draft icon is visible"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.strictEqual(count("#reply-control.composing-shared-draft"), 1);
|
|
||||||
await click(".modal-footer .btn.btn-default");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test("reply_as_new_topic with new_topic draft", async function (assert) {
|
test("reply_as_new_topic with new_topic draft", async function (assert) {
|
||||||
await visit("/t/internationalization-localization/280");
|
await visit("/t/internationalization-localization/280");
|
||||||
await click(".create.reply");
|
await click(".create.reply");
|
||||||
|
|
||||||
|
stubDraftResponse();
|
||||||
|
|
||||||
const composerActions = selectKit(".composer-actions");
|
const composerActions = selectKit(".composer-actions");
|
||||||
await composerActions.expand();
|
await composerActions.expand();
|
||||||
stubDraftResponse();
|
|
||||||
await composerActions.selectRowByValue("reply_as_new_topic");
|
await composerActions.selectRowByValue("reply_as_new_topic");
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
query(".bootbox .modal-body").innerText,
|
query(".bootbox .modal-body").innerText,
|
||||||
I18n.t("composer.composer_actions.reply_as_new_topic.confirm")
|
I18n.t("composer.composer_actions.reply_as_new_topic.confirm")
|
||||||
);
|
);
|
||||||
await click(".modal-footer .btn.btn-default");
|
await click(".modal-footer .btn.btn-primary");
|
||||||
|
|
||||||
|
assert.ok(
|
||||||
|
query(".d-editor-input").value.startsWith(
|
||||||
|
"Continuing the discussion from"
|
||||||
|
)
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user