fix failing spec

This commit is contained in:
Joffrey JAFFEUX 2018-05-22 10:50:54 +02:00 committed by GitHub
parent 48c4f192e9
commit a0c5b48558
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 44 additions and 49 deletions

View File

@ -40,9 +40,9 @@ QUnit.test('replying to post - reply_as_private_message', assert => {
QUnit.test('replying to post - reply_to_topic', async assert => {
const composerActions = selectKit('.composer-actions');
await visit('/t/internationalization-localization/280');
await click('article#post_3 button.reply');
await fillIn('.d-editor-input', 'test replying to topic when initially replied to post');
visit('/t/internationalization-localization/280');
click('article#post_3 button.reply');
fillIn('.d-editor-input', 'test replying to topic when initially replied to post');
await composerActions.expandAwait();
await composerActions.selectRowByValueAwait('reply_to_topic');
@ -107,62 +107,57 @@ QUnit.test('shared draft', assert => {
});
});
QUnit.skip('interactions', assert => {
QUnit.test('interactions', async assert => {
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');
await visit('/t/internationalization-localization/280');
await click('article#post_3 button.reply');
await fillIn('.d-editor-input', quote);
andThen(() => {
assert.equal(find('.action-title').text().trim(), "Internationalization / localization");
assert.equal(find('.d-editor-input').val(), quote);
});
await composerActions.expandAwait();
await composerActions.selectRowByValueAwait('reply_to_topic');
composerActions.expand();
assert.equal(find('.action-title').text().trim(), "Internationalization / localization");
assert.equal(find('.d-editor-input').val(), quote);
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);
});
await composerActions.expandAwait();
composerActions.selectRowByValue('reply_to_post').expand();
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);
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);
});
await composerActions.selectRowByValueAwait('reply_to_post');
await composerActions.expandAwait();
composerActions.selectRowByValue('reply_as_new_topic').expand();
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);
andThen(() => {
assert.equal(find('.action-title').text().trim(), I18n.t("topic.create_long"));
assert.ok(find('.d-editor-input').val().includes(quote));
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');
assert.equal(composerActions.rowByIndex(3).value(), 'shared_draft');
});
await composerActions.selectRowByValueAwait('reply_as_new_topic');
await composerActions.expandAwait();
composerActions.selectRowByValue('reply_as_private_message').expand();
assert.equal(find('.action-title').text().trim(), I18n.t("topic.create_long"));
assert.ok(find('.d-editor-input').val().includes(quote));
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');
assert.equal(composerActions.rowByIndex(3).value(), 'shared_draft');
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);
});
await composerActions.selectRowByValueAwait('reply_as_private_message');
await composerActions.expandAwait();
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);
});