2018-02-01 23:42:56 +08:00
|
|
|
import { acceptance } from 'helpers/qunit-helpers';
|
|
|
|
|
|
|
|
acceptance('Composer Actions', {
|
|
|
|
loggedIn: true,
|
|
|
|
settings: {
|
|
|
|
enable_whispers: true
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2018-04-23 14:42:25 +08:00
|
|
|
QUnit.test('replying to post', async assert => {
|
2018-02-01 23:42:56 +08:00
|
|
|
const composerActions = selectKit('.composer-actions');
|
|
|
|
|
|
|
|
visit('/t/internationalization-localization/280');
|
|
|
|
click('article#post_3 button.reply');
|
|
|
|
|
2018-04-23 14:42:25 +08:00
|
|
|
await composerActions.expandAwait();
|
|
|
|
|
|
|
|
assert.equal(composerActions.rowByIndex(0).value(), 'reply_as_new_topic');
|
|
|
|
assert.equal(composerActions.rowByIndex(1).value(), 'reply_as_private_message');
|
|
|
|
assert.equal(composerActions.rowByIndex(2).value(), 'reply_to_topic');
|
|
|
|
assert.equal(composerActions.rowByIndex(3).value(), 'toggle_whisper');
|
|
|
|
assert.equal(composerActions.rowByIndex(4).value(), undefined);
|
2018-02-01 23:42:56 +08:00
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
QUnit.test('replying to post - reply_as_private_message', assert => {
|
|
|
|
const composerActions = selectKit('.composer-actions');
|
|
|
|
|
|
|
|
visit('/t/internationalization-localization/280');
|
|
|
|
click('article#post_3 button.reply');
|
|
|
|
|
|
|
|
composerActions.expand().selectRowByValue('reply_as_private_message');
|
|
|
|
|
|
|
|
andThen(() => {
|
|
|
|
assert.equal(find('.users-input .item:eq(0)').text(), 'codinghorror');
|
|
|
|
assert.ok(find('.d-editor-input').val().indexOf('Continuing the discussion') >= 0);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
QUnit.test('replying to post - reply_to_topic', assert => {
|
|
|
|
const composerActions = selectKit('.composer-actions');
|
|
|
|
|
|
|
|
visit('/t/internationalization-localization/280');
|
|
|
|
click('article#post_3 button.reply');
|
2018-02-08 18:46:55 +08:00
|
|
|
fillIn('.d-editor-input', 'test replying to topic when initially replied to post');
|
2018-02-01 23:42:56 +08:00
|
|
|
composerActions.expand().selectRowByValue('reply_to_topic');
|
|
|
|
|
|
|
|
andThen(() => {
|
2018-02-08 18:46:55 +08:00
|
|
|
assert.equal(find('.action-title .topic-link').text().trim(), 'Internationalization / localization');
|
|
|
|
assert.equal(find('.action-title .topic-link').attr("href"), '/t/internationalization-localization/280');
|
|
|
|
assert.equal(find('.d-editor-input').val(), 'test replying to topic when initially replied to post');
|
2018-02-01 23:42:56 +08:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2018-02-02 06:07:37 +08:00
|
|
|
QUnit.test('replying to post - toggle_whisper', assert => {
|
2018-02-01 23:42:56 +08:00
|
|
|
const composerActions = selectKit('.composer-actions');
|
|
|
|
|
|
|
|
visit('/t/internationalization-localization/280');
|
|
|
|
click('article#post_3 button.reply');
|
2018-02-08 18:46:55 +08:00
|
|
|
fillIn('.d-editor-input', 'test replying as whisper to topic when initially not a whisper');
|
2018-02-02 06:07:37 +08:00
|
|
|
composerActions.expand().selectRowByValue('toggle_whisper');
|
2018-02-01 23:42:56 +08:00
|
|
|
|
|
|
|
andThen(() => {
|
2018-02-02 06:07:37 +08:00
|
|
|
assert.ok(
|
|
|
|
find('.composer-fields .whisper').text().indexOf(I18n.t("composer.whisper")) > 0
|
|
|
|
);
|
2018-02-01 23:42:56 +08:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
QUnit.test('replying to post - reply_as_new_topic', assert => {
|
|
|
|
const composerActions = selectKit('.composer-actions');
|
|
|
|
const categoryChooser = selectKit('.title-wrapper .category-chooser');
|
|
|
|
const categoryChooserReplyArea = selectKit('.reply-area .category-chooser');
|
2018-02-14 18:32:20 +08:00
|
|
|
const quote = 'test replying as new topic when initially replied to post';
|
2018-02-01 23:42:56 +08:00
|
|
|
|
|
|
|
visit('/t/internationalization-localization/280');
|
|
|
|
|
|
|
|
click('#topic-title .d-icon-pencil');
|
|
|
|
categoryChooser.expand().selectRowByValue(4);
|
|
|
|
click('#topic-title .submit-edit');
|
|
|
|
|
|
|
|
click('article#post_3 button.reply');
|
2018-02-14 18:32:20 +08:00
|
|
|
fillIn('.d-editor-input', quote);
|
2018-02-01 23:42:56 +08:00
|
|
|
composerActions.expand().selectRowByValue('reply_as_new_topic');
|
|
|
|
|
|
|
|
andThen(() => {
|
|
|
|
assert.equal(categoryChooserReplyArea.header().name(), 'faq');
|
2018-02-08 18:46:55 +08:00
|
|
|
assert.equal(find('.action-title').text().trim(), I18n.t("topic.create_long"));
|
2018-02-14 18:32:20 +08:00
|
|
|
assert.ok(find('.d-editor-input').val().includes(quote));
|
2018-02-08 18:46:55 +08:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2018-03-14 03:59:12 +08:00
|
|
|
QUnit.test('shared draft', assert => {
|
|
|
|
let composerActions = selectKit('.composer-actions');
|
|
|
|
|
|
|
|
visit("/");
|
|
|
|
click('#create-topic');
|
|
|
|
andThen(() => {
|
|
|
|
composerActions.expand().selectRowByValue('shared_draft');
|
|
|
|
});
|
|
|
|
andThen(() => {
|
|
|
|
assert.equal(
|
|
|
|
find('#reply-control .btn-primary.create .d-button-label').text(),
|
|
|
|
I18n.t('composer.create_shared_draft')
|
|
|
|
);
|
|
|
|
assert.ok(find('#reply-control.composing-shared-draft').length === 1);
|
|
|
|
});
|
|
|
|
});
|
2018-02-08 18:46:55 +08:00
|
|
|
|
2018-05-22 11:03:26 +08:00
|
|
|
QUnit.skip('interactions', assert => {
|
2018-02-08 18:46:55 +08:00
|
|
|
const composerActions = selectKit('.composer-actions');
|
|
|
|
const quote = 'Life is like riding a bicycle.';
|
|
|
|
|
|
|
|
visit('/t/internationalization-localization/280');
|
|
|
|
click('article#post_3 button.reply');
|
|
|
|
fillIn('.d-editor-input', quote);
|
|
|
|
composerActions.expand().selectRowByValue('reply_to_topic');
|
|
|
|
|
|
|
|
andThen(() => {
|
|
|
|
assert.equal(find('.action-title').text().trim(), "Internationalization / localization");
|
|
|
|
assert.equal(find('.d-editor-input').val(), quote);
|
|
|
|
});
|
|
|
|
|
|
|
|
composerActions.expand();
|
|
|
|
|
|
|
|
andThen(() => {
|
|
|
|
assert.equal(composerActions.rowByIndex(0).value(), 'reply_as_new_topic');
|
|
|
|
assert.equal(composerActions.rowByIndex(1).value(), 'reply_to_post');
|
|
|
|
assert.equal(composerActions.rowByIndex(2).value(), 'reply_as_private_message');
|
|
|
|
assert.equal(composerActions.rowByIndex(3).value(), 'toggle_whisper');
|
|
|
|
assert.equal(composerActions.rowByIndex(4).value(), undefined);
|
|
|
|
});
|
|
|
|
|
|
|
|
composerActions.selectRowByValue('reply_to_post').expand();
|
|
|
|
|
|
|
|
andThen(() => {
|
|
|
|
assert.ok(exists(find('.action-title img.avatar')));
|
|
|
|
assert.equal(find('.action-title .user-link').text().trim(), "codinghorror");
|
|
|
|
assert.equal(find('.d-editor-input').val(), quote);
|
|
|
|
assert.equal(composerActions.rowByIndex(0).value(), 'reply_as_new_topic');
|
|
|
|
assert.equal(composerActions.rowByIndex(1).value(), 'reply_as_private_message');
|
|
|
|
assert.equal(composerActions.rowByIndex(2).value(), 'reply_to_topic');
|
|
|
|
assert.equal(composerActions.rowByIndex(3).value(), 'toggle_whisper');
|
|
|
|
assert.equal(composerActions.rowByIndex(4).value(), undefined);
|
|
|
|
});
|
|
|
|
|
|
|
|
composerActions.selectRowByValue('reply_as_new_topic').expand();
|
|
|
|
|
|
|
|
andThen(() => {
|
|
|
|
assert.equal(find('.action-title').text().trim(), I18n.t("topic.create_long"));
|
2018-02-14 18:32:20 +08:00
|
|
|
assert.ok(find('.d-editor-input').val().includes(quote));
|
2018-02-08 18:46:55 +08:00
|
|
|
assert.equal(composerActions.rowByIndex(0).value(), 'reply_to_post');
|
|
|
|
assert.equal(composerActions.rowByIndex(1).value(), 'reply_as_private_message');
|
|
|
|
assert.equal(composerActions.rowByIndex(2).value(), 'reply_to_topic');
|
2018-03-14 03:59:12 +08:00
|
|
|
assert.equal(composerActions.rowByIndex(3).value(), 'shared_draft');
|
2018-02-08 18:46:55 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
composerActions.selectRowByValue('reply_as_private_message').expand();
|
|
|
|
|
|
|
|
andThen(() => {
|
|
|
|
assert.equal(find('.action-title').text().trim(), I18n.t("topic.private_message"));
|
|
|
|
assert.ok(find('.d-editor-input').val().indexOf("Continuing the discussion") === 0);
|
|
|
|
assert.equal(composerActions.rowByIndex(0).value(), 'reply_as_new_topic');
|
|
|
|
assert.equal(composerActions.rowByIndex(1).value(), 'reply_to_post');
|
|
|
|
assert.equal(composerActions.rowByIndex(2).value(), 'reply_to_topic');
|
|
|
|
assert.equal(composerActions.rowByIndex(3).value(), undefined);
|
2018-02-01 23:42:56 +08:00
|
|
|
});
|
|
|
|
});
|