FIX: Dismiss modal when "Keep Editing" is used (#21117)
Co-authored-by: Jarek Radosz <jradosz@gmail.com>
This commit is contained in:
parent
d3f3914ade
commit
b869d35f94
|
@ -1468,8 +1468,6 @@ export default class ComposerController extends Controller {
|
||||||
this.appEvents.trigger("composer:cancelled");
|
this.appEvents.trigger("composer:cancelled");
|
||||||
return resolve();
|
return resolve();
|
||||||
},
|
},
|
||||||
// needed to resume saving drafts if composer stays open
|
|
||||||
onDismissModal: () => resolve(),
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// it is possible there is some sort of crazy draft with no body ... just give up on it
|
// it is possible there is some sort of crazy draft with no body ... just give up on it
|
||||||
|
|
|
@ -13,8 +13,7 @@ export default Controller.extend(ModalFunctionality, {
|
||||||
this.send("closeModal");
|
this.send("closeModal");
|
||||||
},
|
},
|
||||||
|
|
||||||
async dismissModal() {
|
dismissModal() {
|
||||||
await this.onDismissModal();
|
|
||||||
this.send("closeModal");
|
this.send("closeModal");
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -370,6 +370,26 @@ acceptance("Composer", function (needs) {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("Can Keep Editing when replying on a different topic", async function (assert) {
|
||||||
|
await visit("/t/internationalization-localization/280");
|
||||||
|
|
||||||
|
await click("#topic-footer-buttons .create");
|
||||||
|
await fillIn(".d-editor-input", "this is the content of my reply");
|
||||||
|
|
||||||
|
await visit("/t/this-is-a-test-topic/9");
|
||||||
|
await click("#topic-footer-buttons .create");
|
||||||
|
assert.ok(visible(".discard-draft-modal.modal"));
|
||||||
|
|
||||||
|
await click(".modal-footer button.keep-editing");
|
||||||
|
assert.ok(invisible(".discard-draft-modal.modal"));
|
||||||
|
|
||||||
|
assert.strictEqual(
|
||||||
|
query(".d-editor-input").value,
|
||||||
|
"this is the content of my reply",
|
||||||
|
"composer does not switch when using Keep Editing button"
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
test("Posting on a different topic", async function (assert) {
|
test("Posting on a different topic", async function (assert) {
|
||||||
await visit("/t/internationalization-localization/280");
|
await visit("/t/internationalization-localization/280");
|
||||||
await click("#topic-footer-buttons .btn.create");
|
await click("#topic-footer-buttons .btn.create");
|
||||||
|
|
Loading…
Reference in New Issue