diff --git a/app/assets/javascripts/discourse/tests/acceptance/composer-actions-test.js b/app/assets/javascripts/discourse/tests/acceptance/composer-actions-test.js index 9141eeac3f8..a2002935f0a 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/composer-actions-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/composer-actions-test.js @@ -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" + ) + ); }); });