FEATURE: Add toggle topic visibility button in popup menu.

This commit is contained in:
Guo Xiang Tan
2016-07-27 17:50:13 +08:00
parent 16a383ea1e
commit 36ddb1787e
7 changed files with 107 additions and 11 deletions

View File

@ -1,6 +1,11 @@
import { acceptance } from "helpers/qunit-helpers";
acceptance("Composer", { loggedIn: true });
acceptance("Composer", {
loggedIn: true,
settings: {
enable_whispers: true
}
});
test("Tests the Composer controls", () => {
visit("/");
@ -254,6 +259,52 @@ test("Composer can toggle between edit and reply", () => {
});
});
test("Composer can toggle between reply and createTopic", () => {
visit("/t/this-is-a-test-topic/9");
click('.topic-post:eq(0) button.reply');
click('button.options');
click('.popup-menu .fa-eye-slash');
andThen(() => {
ok(
find('.composer-fields .whisper').text().indexOf(I18n.t("composer.whisper")) > 0,
'it sets the post type to whisper'
);
});
visit("/");
andThen(() => {
ok(exists('#create-topic'), 'the create topic button is visible');
});
click('#create-topic');
andThen(() => {
ok(
find('.composer-fields .whisper').text().indexOf(I18n.t("composer.whisper")) === -1,
"it should reset the state of the composer's model"
);
});
click('button.options');
click('.popup-menu .fa-eye-slash');
andThen(() => {
ok(
find('.composer-fields .whisper').text().indexOf(I18n.t("composer.unlist")) > 0,
'it sets the topic to unlisted'
);
});
visit("/t/this-is-a-test-topic/9");
click('.topic-post:eq(0) button.reply');
andThen(() => {
ok(
find('.composer-fields .whisper').text().indexOf(I18n.t("composer.unlist")) === -1,
"it should reset the state of the composer's model"
);
});
});
test("Composer with dirty reply can toggle to edit", () => {
visit("/t/this-is-a-test-topic/9");