mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
lint: Add JS indentation eslint rules for node_tests.
The only difference between this as the main project's lint rules is that we dont have the OuterIIFE setting.
This commit is contained in:
@@ -1,5 +1,12 @@
|
||||
{
|
||||
"rules": {
|
||||
"indent": 0
|
||||
"indent": ["error", 4, {
|
||||
"ArrayExpression": "first",
|
||||
"ObjectExpression": "first",
|
||||
"SwitchCase": 0,
|
||||
"CallExpression": {"arguments": "first"},
|
||||
"FunctionExpression": {"parameters": "first"},
|
||||
"FunctionDeclaration": {"parameters": "first"}
|
||||
}]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -307,7 +307,8 @@ reset_setup();
|
||||
compose_fade.set_focused_recipient("private");
|
||||
|
||||
const users = activity.build_user_sidebar();
|
||||
assert.deepEqual(users, [{
|
||||
assert.deepEqual(users, [
|
||||
{
|
||||
name: 'Fred Flintstone',
|
||||
href: '#narrow/pm-with/2-fred',
|
||||
user_id: fred.user_id,
|
||||
@@ -879,5 +880,4 @@ reset_setup();
|
||||
return true;
|
||||
};
|
||||
activity.initialize();
|
||||
|
||||
}());
|
||||
|
||||
@@ -18,30 +18,62 @@ global.people.add({
|
||||
global.people.initialize_current_user(42);
|
||||
|
||||
|
||||
const regular_message = { sender_email: 'another@zulip.com', content: '<p>a message</p>'};
|
||||
const own_message = { sender_email: 'tester@zulip.com', content: '<p>hey this message alertone</p>',
|
||||
alerted: true };
|
||||
const other_message = { sender_email: 'another@zulip.com', content: '<p>another alertone message</p>',
|
||||
alerted: true };
|
||||
const caps_message = { sender_email: 'another@zulip.com', content: '<p>another ALERTtwo message</p>',
|
||||
alerted: true };
|
||||
const alertwordboundary_message = { sender_email: 'another@zulip.com',
|
||||
content: '<p>another alertthreemessage</p>', alerted: false };
|
||||
const multialert_message = { sender_email: 'another@zulip.com', content:
|
||||
'<p>another alertthreemessage alertone and then alerttwo</p>',
|
||||
alerted: true };
|
||||
const unsafe_word_message = { sender_email: 'another@zulip.com', content: '<p>gotta al*rt.*s all</p>',
|
||||
alerted: true };
|
||||
const alert_in_url_message = { sender_email: 'another@zulip.com', content: '<p>http://www.google.com/alertone/me</p>',
|
||||
alerted: true };
|
||||
const question_word_message = { sender_email: 'another@zulip.com', content: '<p>still alertone? me</p>',
|
||||
alerted: true };
|
||||
const regular_message = {
|
||||
sender_email: 'another@zulip.com',
|
||||
content: '<p>a message</p>',
|
||||
};
|
||||
const own_message = {
|
||||
sender_email: 'tester@zulip.com',
|
||||
content: '<p>hey this message alertone</p>',
|
||||
alerted: true,
|
||||
};
|
||||
const other_message = {
|
||||
sender_email: 'another@zulip.com',
|
||||
content: '<p>another alertone message</p>',
|
||||
alerted: true,
|
||||
};
|
||||
const caps_message = {
|
||||
sender_email: 'another@zulip.com',
|
||||
content: '<p>another ALERTtwo message</p>',
|
||||
alerted: true,
|
||||
};
|
||||
const alertwordboundary_message = {
|
||||
sender_email: 'another@zulip.com',
|
||||
content: '<p>another alertthreemessage</p>',
|
||||
alerted: false,
|
||||
};
|
||||
const multialert_message = {
|
||||
sender_email: 'another@zulip.com',
|
||||
content: '<p>another alertthreemessage alertone and then alerttwo</p>',
|
||||
alerted: true,
|
||||
};
|
||||
const unsafe_word_message = {
|
||||
sender_email: 'another@zulip.com',
|
||||
content: '<p>gotta al*rt.*s all</p>',
|
||||
alerted: true,
|
||||
};
|
||||
const alert_in_url_message = {
|
||||
sender_email: 'another@zulip.com',
|
||||
content: '<p>http://www.google.com/alertone/me</p>',
|
||||
alerted: true,
|
||||
};
|
||||
const question_word_message = {
|
||||
sender_email: 'another@zulip.com',
|
||||
content: '<p>still alertone? me</p>',
|
||||
alerted: true,
|
||||
};
|
||||
|
||||
const alert_domain_message = { sender_email: 'another@zulip.com', content: '<p>now with link <a href="http://www.alerttwo.us/foo/bar" target="_blank" title="http://www.alerttwo.us/foo/bar">www.alerttwo.us/foo/bar</a></p>',
|
||||
alerted: true };
|
||||
const alert_domain_message = {
|
||||
sender_email: 'another@zulip.com',
|
||||
content: '<p>now with link <a href="http://www.alerttwo.us/foo/bar" target="_blank" title="http://www.alerttwo.us/foo/bar">www.alerttwo.us/foo/bar</a></p>',
|
||||
alerted: true,
|
||||
};
|
||||
// This test ensure we are not mucking up rendered HTML content.
|
||||
const message_with_emoji = { sender_email: 'another@zulip.com', content: '<p>I <img alt=":heart:" class="emoji" src="/static/generated/emoji/images/emoji/unicode/2764.png" title="heart"> emoji!</p>',
|
||||
alerted: true };
|
||||
const message_with_emoji = {
|
||||
sender_email: 'another@zulip.com',
|
||||
content: '<p>I <img alt=":heart:" class="emoji" src="/static/generated/emoji/images/emoji/unicode/2764.png" title="heart"> emoji!</p>',
|
||||
alerted: true,
|
||||
};
|
||||
|
||||
(function test_notifications() {
|
||||
assert(!alert_words.notifies(regular_message));
|
||||
|
||||
@@ -280,7 +280,8 @@ function test_with_mock_ajax(test_params) {
|
||||
};
|
||||
|
||||
blueslip.set_test_data('warn',
|
||||
'The length of pending_requests is over 50. Most likely they are not being correctly removed.');
|
||||
'The length of pending_requests is over 50. ' +
|
||||
'Most likely they are not being correctly removed.');
|
||||
_.times(50, function () {
|
||||
channel.post({});
|
||||
});
|
||||
|
||||
@@ -369,8 +369,10 @@ user_pill.get_user_ids = function () {
|
||||
assert.deepEqual(actual_value, expected_value);
|
||||
|
||||
// options.highlighter()
|
||||
options.query = 'De'; // Beginning of "Denmark", one of the streams
|
||||
|
||||
// Beginning of "Denmark", one of the streams
|
||||
// provided in stream_list through .source().
|
||||
options.query = 'De';
|
||||
actual_value = options.highlighter('Denmark');
|
||||
expected_value = '<strong>Denmark</strong>';
|
||||
assert.equal(actual_value, expected_value);
|
||||
@@ -751,8 +753,8 @@ user_pill.get_user_ids = function () {
|
||||
pm_recipient_blur_called = true;
|
||||
};
|
||||
|
||||
page_params.enter_sends = false; // We manually specify it the first
|
||||
// time because the click_func
|
||||
page_params.enter_sends = false;
|
||||
// We manually specify it the first time because the click_func
|
||||
// doesn't exist yet.
|
||||
$("#stream").select(noop);
|
||||
$("#subject").select(noop);
|
||||
|
||||
@@ -147,7 +147,6 @@ markdown.initialize();
|
||||
var bugdown_data = global.read_fixture_data('markdown_test_cases.json');
|
||||
|
||||
(function test_bugdown_detection() {
|
||||
|
||||
var no_markup = [
|
||||
"This is a plaintext message",
|
||||
"This is a plaintext: message",
|
||||
|
||||
@@ -246,7 +246,8 @@ var with_overrides = global.with_overrides; // make lint happy
|
||||
|
||||
|
||||
list = new MessageList(table, filter);
|
||||
list.append([{id:10}, {id:20}, {id:30}, {id:20.02}, {id:20.03}, {id:40},
|
||||
list.append([
|
||||
{id:10}, {id:20}, {id:30}, {id:20.02}, {id:20.03}, {id:40},
|
||||
{id:50}, {id: 50.01}, {id: 50.02}, {id:60}]);
|
||||
list._local_only= {20.02: {id:20.02}, 20.03: {id:20.03},
|
||||
50.01: {id: 50.01}, 50.02: {id: 50.02}};
|
||||
|
||||
@@ -616,7 +616,8 @@ initialize();
|
||||
// Test shim where we can still retrieve user info using the
|
||||
// old email.
|
||||
blueslip.set_test_data('warn',
|
||||
'Obsolete email passed to get_by_email: FOO@example.com new email = bar@example.com');
|
||||
'Obsolete email passed to get_by_email: ' +
|
||||
'FOO@example.com new email = bar@example.com');
|
||||
person = people.get_by_email(old_email);
|
||||
assert.equal(person.user_id, user_id);
|
||||
assert.equal(blueslip.get_test_logs('warn').length, 1);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
set_global("page_params", {
|
||||
realm_uri: "https://chat.example.com",
|
||||
realm_embedded_bots: [{name: "converter", config: {}},
|
||||
realm_embedded_bots: [
|
||||
{name: "converter", config: {}},
|
||||
{name:"giphy", config: {key: "12345678"}},
|
||||
{name:"foobot", config: {bar: "baz", qux: "quux"}},
|
||||
],
|
||||
|
||||
@@ -473,7 +473,8 @@ function test_parse_time_limit() {
|
||||
global.page_params.realm_message_content_edit_limit_seconds =
|
||||
settings_org.parse_time_limit(elem);
|
||||
assert.equal(expected_value,
|
||||
settings_org.get_realm_time_limits_in_minutes('realm_message_content_edit_limit_seconds'));
|
||||
settings_org.get_realm_time_limits_in_minutes(
|
||||
'realm_message_content_edit_limit_seconds'));
|
||||
};
|
||||
|
||||
test_function('0.01', '0');
|
||||
|
||||
@@ -143,7 +143,8 @@ function render(template_name, args) {
|
||||
|
||||
// When the logged in user is admin
|
||||
_.each(streams, function (stream) {
|
||||
var args = {stream: {name: stream, invite_only: false},
|
||||
var args = {
|
||||
stream: {name: stream, invite_only: false},
|
||||
can_modify: true,
|
||||
};
|
||||
html += render('admin_default_streams_list', args);
|
||||
@@ -155,7 +156,8 @@ function render(template_name, args) {
|
||||
// When the logged in user is not admin
|
||||
html = '<table>';
|
||||
_.each(streams, function (stream) {
|
||||
var args = {stream: {name: stream, invite_only: false},
|
||||
var args = {
|
||||
stream: {name: stream, invite_only: false},
|
||||
can_modify: false,
|
||||
};
|
||||
html += render('admin_default_streams_list', args);
|
||||
|
||||
Reference in New Issue
Block a user