FIX: makes whisper state more resilient (#6889)

This commit also moves some logic from model to controller.
This commit is contained in:
Joffrey JAFFEUX
2019-01-16 15:23:06 +01:00
committed by GitHub
parent b46b6e72d1
commit 1ac4dc5b73
4 changed files with 78 additions and 30 deletions

View File

@ -407,6 +407,44 @@ QUnit.test("Composer can toggle whispers", async assert => {
);
});
QUnit.test("Switching composer whisper state", async assert => {
const menu = selectKit(".toolbar-popup-menu-options");
await visit("/t/this-is-a-test-topic/9");
await click(".topic-post:eq(0) button.reply");
await menu.expand();
await menu.selectRowByValue("toggleWhisper");
await fillIn(".d-editor-input", "this is the content of my reply");
await click("#reply-control button.create");
assert.ok(find(".topic-post:last").hasClass("whisper"));
await click("#topic-footer-buttons .btn.create");
assert.ok(
find(".composer-fields .whisper .d-icon-eye-slash").length === 0,
"doesn’t set topic reply as whisper"
);
await click(".topic-post:last button.reply");
assert.ok(find(".topic-post:last").hasClass("whisper"));
assert.ok(
find(".composer-fields .whisper .d-icon-eye-slash").length === 1,
"sets post reply as a whisper"
);
await click(".topic-post:nth-last-child(2) button.reply");
assert.notOk(find(".topic-post:nth-last-child(2)").hasClass("whisper"));
assert.ok(
find(".composer-fields .whisper .d-icon-eye-slash").length === 0,
"doesn’t set post reply as a whisper"
);
});
QUnit.test(
"Composer can toggle layouts (open, fullscreen and draft)",
async assert => {