DEV: Rework two composer actions tests (#18008)

This commit is contained in:
Jarek Radosz 2022-08-21 09:19:39 +02:00 committed by GitHub
parent d35ffe8361
commit 870ff48470
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -422,28 +422,28 @@ acceptance("Composer Actions With New Topic Draft", function (needs) {
needs.hooks.afterEach(() => toggleCheckDraftPopup(false));
test("shared draft", async function (assert) {
updateCurrentUser({ has_topic_draft: true });
stubDraftResponse();
toggleCheckDraftPopup(true);
const composerActions = selectKit(".composer-actions");
const tags = selectKit(".mini-tag-chooser");
await visit("/");
await click("#create-topic");
await click("button.open-draft");
await fillIn(
"#reply-title",
"This is the new text for the title using 'quotes'"
);
await fillIn(".d-editor-input", "This is the new text for the post");
const tags = selectKit(".mini-tag-chooser");
await tags.expand();
await tags.selectRowByValue("monkey");
const composerActions = selectKit(".composer-actions");
await composerActions.expand();
await composerActions.selectRowByValue("shared_draft");
assert.strictEqual(tags.header().value(), "monkey", "tags are not reset");
assert.strictEqual(
query("#reply-title").value,
"This is the new text for the title using 'quotes'"
@ -458,23 +458,29 @@ acceptance("Composer Actions With New Topic Draft", function (needs) {
1,
"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) {
await visit("/t/internationalization-localization/280");
await click(".create.reply");
stubDraftResponse();
const composerActions = selectKit(".composer-actions");
await composerActions.expand();
stubDraftResponse();
await composerActions.selectRowByValue("reply_as_new_topic");
assert.strictEqual(
query(".bootbox .modal-body").innerText,
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"
)
);
});
});