UX: Warn users if the post that's currently edited has changed. (#6498)

This commit is contained in:
Bianca Nenciu
2018-10-17 16:35:32 +03:00
committed by Régis Hanol
parent 065bf0762c
commit f60b10d090
6 changed files with 55 additions and 6 deletions
@@ -0,0 +1,25 @@
import { acceptance } from "helpers/qunit-helpers";
acceptance("Composer - Edit conflict", {
loggedIn: true,
pretend(server, helper) {
server.put("/posts/398", () => {
return helper.response(409, { errors: ["edit conflict"] });
});
}
});
QUnit.test("Edit a post that causes an edit conflict", async assert => {
await visit("/t/internationalization-localization/280");
await click(".topic-post:eq(0) button.show-more-actions");
await click(".topic-post:eq(0) button.edit");
await click("#reply-control button.create");
assert.equal(
find("#reply-control button.create")
.text()
.trim(),
I18n.t("composer.overwrite_edit"),
"it shows the overwrite button"
);
});