js: Fix indentation issues in casper tests.

Our casper tests now pass eslint cleanly.
This commit is contained in:
Tim Abbott 2018-05-06 16:42:17 -07:00
parent 063d11b139
commit 716a4a967d
8 changed files with 34 additions and 33 deletions

View File

@ -17,8 +17,8 @@ casper.then(function () {
});
// Make sure confirmation email is send
this.waitWhileVisible('form[action^="/new/"]', function () {
var regex = new RegExp('^http://[^/]+/accounts/send_confirm/' + email);
this.test.assertUrlMatch(regex, 'Confirmation mail send');
var regex = new RegExp('^http://[^/]+/accounts/send_confirm/' + email);
this.test.assertUrlMatch(regex, 'Confirmation mail send');
});
});

View File

@ -19,14 +19,14 @@ casper.then(function () {
msg.headings.forEach(function (heading) {
casper.test.assertMatch(common.normalize_spaces(heading),
/(^You and )|( )/,
'Heading is well-formed');
/(^You and )|( )/,
'Heading is well-formed');
});
msg.bodies.forEach(function (body) {
casper.test.assertMatch(body,
/^(<p>(.|\n)*<\/p>)?$/,
'Body is well-formed');
/^(<p>(.|\n)*<\/p>)?$/,
'Body is well-formed');
});
casper.test.info('Sending messages');

View File

@ -351,14 +351,14 @@ casper.then(function () {
casper.waitForSelector('#stream_filters [data-stream-name="Scotland"].highlighted_stream', function () {
casper.test.info('Suggestion highlighting - after arrow key navigation');
casper.test.assertDoesntExist(
'#stream_filters [data-stream-name="Denmark"].highlighted_stream',
'Stream Denmark is not highlighted');
'#stream_filters [data-stream-name="Denmark"].highlighted_stream',
'Stream Denmark is not highlighted');
casper.test.assertExist(
'#stream_filters [data-stream-name="Scotland"].highlighted_stream',
'Stream Scotland is highlighted');
'#stream_filters [data-stream-name="Scotland"].highlighted_stream',
'Stream Scotland is highlighted');
casper.test.assertDoesntExist(
'#stream_filters [data-stream-name="Verona"].highlighted_stream',
'Stream Verona is not highlighted');
'#stream_filters [data-stream-name="Verona"].highlighted_stream',
'Stream Verona is not highlighted');
});
// We search for the beginning of "Scotland", not case sensitive
@ -490,9 +490,9 @@ casper.then(function () {
casper.waitForSelector('#user_presences li.highlighted_user [data-name="King Hamlet"]', function () {
casper.test.info('Suggestion highlighting - after arrow key navigation');
casper.test.assertDoesntExist('#user_presences li.highlighted_user [data-name="Cordelia Lear"]',
'User Cordelia Lear not is selected');
'User Cordelia Lear not is selected');
casper.test.assertExist('#user_presences li.highlighted_user [data-name="King Hamlet"]',
'User King Hamlet is selected');
'User King Hamlet is selected');
});
common.then_log_out();

View File

@ -160,8 +160,8 @@ casper.then(function () {
casper.then(function () {
casper.fill('form#add_new_subscription', {stream_name: 'was'});
casper.evaluate(function () {
$('#add_new_subscription input[type="text"]').expectOne()
.trigger($.Event('input'));
$('#add_new_subscription input[type="text"]').expectOne()
.trigger($.Event('input'));
});
});
casper.waitForSelectorTextChange('form#add_new_subscription', function () {

View File

@ -166,15 +166,15 @@ casper.then(function () {
var form_sel = '.edit_bot_form[data-email="' + bot_email + '"]';
casper.test.info('Testing edit bot form values');
// casper.test.assertEqual(
// common.get_form_field_value(form_sel + ' [name=bot_name]'),
// 'Bot 1');
// casper.test.assertEqual(
// common.get_form_field_value(form_sel + ' [name=bot_default_sending_stream]'),
// 'Denmark');
// casper.test.assertEqual(
// common.get_form_field_value(form_sel + ' [name=bot_default_events_register_stream]'),
// 'Rome');
// casper.test.assertEqual(
// common.get_form_field_value(form_sel + ' [name=bot_name]'),
// 'Bot 1');
// casper.test.assertEqual(
// common.get_form_field_value(form_sel + ' [name=bot_default_sending_stream]'),
// 'Denmark');
// casper.test.assertEqual(
// common.get_form_field_value(form_sel + ' [name=bot_default_events_register_stream]'),
// 'Rome');
casper.test.assertEqual(
common.get_form_field_value(form_sel + ' [name=bot_name]'),
'Bot 1');

View File

@ -19,9 +19,9 @@ casper.then(function () {
});
common.then_send_message('stream', {
stream: 'Verona',
subject: 'stars',
content: 'test star',
stream: 'Verona',
subject: 'stars',
content: 'test star',
});
casper.then(function () {

View File

@ -287,9 +287,9 @@ function get_suggestions(str) {
casper.then(function () {
casper.evaluate(function (str) {
$('.create_default_stream')
.focus()
.val(str)
.trigger($.Event('keyup', { which: 0 }));
.focus()
.val(str)
.trigger($.Event('keyup', { which: 0 }));
}, str);
});
}
@ -350,7 +350,7 @@ casper.then(function () {
// Hack: Rather than submitting the form, we just fill the
// form and then trigger a click event by clicking the button.
casper.fill('form.admin-realm-form', {
realm_icon_file_input: 'static/images/logo/zulip-icon-128x128.png',
realm_icon_file_input: 'static/images/logo/zulip-icon-128x128.png',
}, false);
casper.click("#realm_icon_upload_button");
casper.waitWhileVisible("#upload_icon_spinner .loading_indicator_spinner", function () {

View File

@ -47,7 +47,8 @@ casper.then(function () {
casper.then(function () {
common.expected_messages('zhome', ['Verona > Test mention all'],
["<p><span class=\"user-mention user-mention-me\" data-user-id=\"*\">@all</span></p>"]);
["<p><span class=\"user-mention user-mention-me\" " +
"data-user-id=\"*\">@all</span></p>"]);
});