js: Use inside variant of IIFE wrappers.

Prettier would do this anyway, but it’s separated out for a more
reviewable diff.  Generated by ESLint.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2020-07-16 13:35:58 -07:00
committed by Tim Abbott
parent 6924d501bc
commit a20c12366f
36 changed files with 118 additions and 118 deletions

View File

@@ -136,7 +136,7 @@
"strict": "off", "strict": "off",
"template-curly-spacing": "error", "template-curly-spacing": "error",
"valid-typeof": [ "error", { "requireStringLiterals": true } ], "valid-typeof": [ "error", { "requireStringLiterals": true } ],
"wrap-iife": "error", "wrap-iife": ["error", "inside"],
"yoda": "error" "yoda": "error"
}, },
"overrides": [ "overrides": [

View File

@@ -336,7 +336,7 @@ run_test("handlers", () => {
activity.user_cursor.go_to(alice.user_id); activity.user_cursor.go_to(alice.user_id);
filter_key_handlers.down_arrow(); filter_key_handlers.down_arrow();
filter_key_handlers.up_arrow(); filter_key_handlers.up_arrow();
}()); })();
(function test_click_filter() { (function test_click_filter() {
init(); init();
@@ -346,7 +346,7 @@ run_test("handlers", () => {
const handler = $(".user-list-filter").get_on_handler("focus"); const handler = $(".user-list-filter").get_on_handler("focus");
handler(e); handler(e);
}()); })();
(function test_click_header_filter() { (function test_click_header_filter() {
init(); init();
@@ -358,7 +358,7 @@ run_test("handlers", () => {
handler(e); handler(e);
// and click again // and click again
handler(e); handler(e);
}()); })();
(function test_enter_key() { (function test_enter_key() {
init(); init();
@@ -378,7 +378,7 @@ run_test("handlers", () => {
// get line coverage for cleared case // get line coverage for cleared case
activity.user_cursor.clear(); activity.user_cursor.clear();
filter_key_handlers.enter_key(); filter_key_handlers.enter_key();
}()); })();
(function test_click_handler() { (function test_click_handler() {
init(); init();
@@ -393,14 +393,14 @@ run_test("handlers", () => {
activity.narrow_for_user({li: alice_li}); activity.narrow_for_user({li: alice_li});
assert(narrowed); assert(narrowed);
}()); })();
(function test_blur_filter() { (function test_blur_filter() {
init(); init();
const e = {}; const e = {};
const handler = $(".user-list-filter").get_on_handler("blur"); const handler = $(".user-list-filter").get_on_handler("blur");
handler(e); handler(e);
}()); })();
}); });
presence.presence_info = new Map(); presence.presence_info = new Map();

View File

@@ -65,7 +65,7 @@ run_test("test_basics", () => {
assert.equal("http://bar.com", services[0].base_url); assert.equal("http://bar.com", services[0].base_url);
assert.equal(1, services[0].interface); assert.equal(1, services[0].interface);
assert.equal(undefined, bot.extra); assert.equal(undefined, bot.extra);
}()); })();
(function test_update() { (function test_update() {
bot_data.add(test_bot); bot_data.add(test_bot);
@@ -88,7 +88,7 @@ run_test("test_basics", () => {
bot = bot_data.get(43); bot = bot_data.get(43);
assert.equal(bot.owner_id, fred.user_id); assert.equal(bot.owner_id, fred.user_id);
}()); })();
(function test_embedded_bot_update() { (function test_embedded_bot_update() {
bot_data.add(test_embedded_bot); bot_data.add(test_embedded_bot);
@@ -97,7 +97,7 @@ run_test("test_basics", () => {
assert.equal("12345678", services[0].config_data.key); assert.equal("12345678", services[0].config_data.key);
bot_data.update(bot_id, {services: [{config_data: {key: "87654321"}}]}); bot_data.update(bot_id, {services: [{config_data: {key: "87654321"}}]});
assert.equal("87654321", services[0].config_data.key); assert.equal("87654321", services[0].config_data.key);
}()); })();
(function test_remove() { (function test_remove() {
let bot; let bot;
@@ -110,13 +110,13 @@ run_test("test_basics", () => {
bot_data.deactivate(43); bot_data.deactivate(43);
bot = bot_data.get(43); bot = bot_data.get(43);
assert.equal(bot.is_active, false); assert.equal(bot.is_active, false);
}()); })();
(function test_all_user_ids() { (function test_all_user_ids() {
const all_ids = bot_data.all_user_ids(); const all_ids = bot_data.all_user_ids();
all_ids.sort(); all_ids.sort();
assert.deepEqual(all_ids, [143, 314, 42, 43]); assert.deepEqual(all_ids, [143, 314, 42, 43]);
}()); })();
(function test_delete() { (function test_delete() {
let bot; let bot;
@@ -129,7 +129,7 @@ run_test("test_basics", () => {
bot_data.del(43); bot_data.del(43);
bot = bot_data.get(43); bot = bot_data.get(43);
assert.equal(bot, undefined); assert.equal(bot, undefined);
}()); })();
(function test_get_editable() { (function test_get_editable() {
@@ -139,7 +139,7 @@ run_test("test_basics", () => {
const editable_bots = bot_data.get_editable().map((bot) => bot.email); const editable_bots = bot_data.get_editable().map((bot) => bot.email);
assert.deepEqual(["bot1@zulip.com", "bot2@zulip.com"], editable_bots); assert.deepEqual(["bot1@zulip.com", "bot2@zulip.com"], editable_bots);
}()); })();
(function test_get_all_bots_for_current_user() { (function test_get_all_bots_for_current_user() {
const bots = bot_data.get_all_bots_for_current_user(); const bots = bot_data.get_all_bots_for_current_user();
@@ -147,5 +147,5 @@ run_test("test_basics", () => {
assert.equal(bots.length, 2); assert.equal(bots.length, 2);
assert.equal(bots[0].email, "bot1@zulip.com"); assert.equal(bots[0].email, "bot1@zulip.com");
assert.equal(bots[1].email, "bot2@zulip.com"); assert.equal(bots[1].email, "bot2@zulip.com");
}()); })();
}); });

View File

@@ -76,7 +76,7 @@ run_test("basics", () => {
}; };
return self; return self;
}()); })();
const switcher = (function () { const switcher = (function () {
const self = {}; const self = {};
@@ -106,7 +106,7 @@ run_test("basics", () => {
}; };
return self; return self;
}()); })();
set_global("$", (sel) => { set_global("$", (sel) => {
if (sel.stub) { if (sel.stub) {

View File

@@ -684,7 +684,7 @@ run_test("send_message", () => {
assert(!$("#compose-send-status").visible()); assert(!$("#compose-send-status").visible());
assert.equal($("#compose-send-button").prop("disabled"), false); assert.equal($("#compose-send-button").prop("disabled"), false);
assert(!$("#sending-indicator").visible()); assert(!$("#sending-indicator").visible());
}()); })();
// This is the additional setup which is common to both the tests below. // This is the additional setup which is common to both the tests below.
transmit.send_message = function (payload, success, error) { transmit.send_message = function (payload, success, error) {
@@ -713,7 +713,7 @@ run_test("send_message", () => {
}; };
assert.deepEqual(stub_state, state); assert.deepEqual(stub_state, state);
assert(echo_error_msg_checked); assert(echo_error_msg_checked);
}()); })();
(function test_error_codepath_local_id_undefined() { (function test_error_codepath_local_id_undefined() {
stub_state = initialize_state_stub_dict(); stub_state = initialize_state_stub_dict();
@@ -749,7 +749,7 @@ run_test("send_message", () => {
assert($("#compose-send-status").visible()); assert($("#compose-send-status").visible());
assert.equal($("#compose-send-button").prop("disabled"), false); assert.equal($("#compose-send-button").prop("disabled"), false);
assert(!$("#sending-indicator").visible()); assert(!$("#sending-indicator").visible());
}()); })();
}); });
set_global("document", "document-stub"); set_global("document", "document-stub");
@@ -806,7 +806,7 @@ run_test("finish", () => {
assert(!$("#compose-send-button").is_focused()); assert(!$("#compose-send-button").is_focused());
assert.equal($("#compose-send-button").prop("disabled"), false); assert.equal($("#compose-send-button").prop("disabled"), false);
assert.equal($("#compose-error-msg").html(), i18n.t("You have nothing to send!")); assert.equal($("#compose-error-msg").html(), i18n.t("You have nothing to send!"));
}()); })();
(function test_when_compose_validation_succeed() { (function test_when_compose_validation_succeed() {
$("#compose-textarea").hide(); $("#compose-textarea").hide();
@@ -835,7 +835,7 @@ run_test("finish", () => {
assert($("#markdown_preview").visible()); assert($("#markdown_preview").visible());
assert(send_message_called); assert(send_message_called);
assert(compose_finished_event_checked); assert(compose_finished_event_checked);
}()); })();
}); });
run_test("warn_if_private_stream_is_linked", () => { run_test("warn_if_private_stream_is_linked", () => {
@@ -875,7 +875,7 @@ run_test("warn_if_private_stream_is_linked", () => {
return "fake-compose_private_stream_alert-template"; return "fake-compose_private_stream_alert-template";
}); });
return function () { assert(called); }; return function () { assert(called); };
}()), })(),
(function () { (function () {
let called; let called;
@@ -884,7 +884,7 @@ run_test("warn_if_private_stream_is_linked", () => {
assert.equal(html, "fake-compose_private_stream_alert-template"); assert.equal(html, "fake-compose_private_stream_alert-template");
}; };
return function () { assert(called); }; return function () { assert(called); };
}()), })(),
]; ];
denmark = { denmark = {
@@ -988,7 +988,7 @@ run_test("initialize", () => {
compose.initialize(); compose.initialize();
assert(compose_actions_start_checked); assert(compose_actions_start_checked);
}()); })();
(function test_page_params_narrow_topic() { (function test_page_params_narrow_topic() {
page_params.narrow_topic = "testing"; page_params.narrow_topic = "testing";
@@ -1000,7 +1000,7 @@ run_test("initialize", () => {
compose.initialize(); compose.initialize();
assert(compose_actions_start_checked); assert(compose_actions_start_checked);
}()); })();
(function test_abort_xhr() { (function test_abort_xhr() {
$("#compose-send-button").attr("disabled", "disabled"); $("#compose-send-button").attr("disabled", "disabled");
@@ -1013,7 +1013,7 @@ run_test("initialize", () => {
assert.equal($("#compose-send-button").attr(), undefined); assert.equal($("#compose-send-button").attr(), undefined);
assert(uppy_cancel_all_called); assert(uppy_cancel_all_called);
}()); })();
}); });
run_test("update_fade", () => { run_test("update_fade", () => {
@@ -1150,7 +1150,7 @@ run_test("warn_if_mentioning_unsubscribed_user", () => {
return true; return true;
}; };
return function () { assert(called); }; return function () { assert(called); };
}()), })(),
(function () { (function () {
let called; let called;
@@ -1163,7 +1163,7 @@ run_test("warn_if_mentioning_unsubscribed_user", () => {
return "fake-compose-invite-user-template"; return "fake-compose-invite-user-template";
}); });
return function () { assert(called); }; return function () { assert(called); };
}()), })(),
(function () { (function () {
let called; let called;
@@ -1172,7 +1172,7 @@ run_test("warn_if_mentioning_unsubscribed_user", () => {
assert.equal(html, "fake-compose-invite-user-template"); assert.equal(html, "fake-compose-invite-user-template");
}; };
return function () { assert(called); }; return function () { assert(called); };
}()), })(),
]; ];
mentioned = { mentioned = {
@@ -1266,7 +1266,7 @@ run_test("on_events", () => {
assert(compose_finish_checked); assert(compose_finish_checked);
assert(!$("#compose-all-everyone").visible()); assert(!$("#compose-all-everyone").visible());
assert(!$("#compose-send-status").visible()); assert(!$("#compose-send-status").visible());
}()); })();
(function test_compose_invite_users_clicked() { (function test_compose_invite_users_clicked() {
const handler = $("#compose_invite_users") const handler = $("#compose_invite_users")
@@ -1323,7 +1323,7 @@ run_test("on_events", () => {
assert(!$("#compose_invite_users").visible()); assert(!$("#compose_invite_users").visible());
assert(invite_user_to_stream_called); assert(invite_user_to_stream_called);
assert(all_invite_children_called); assert(all_invite_children_called);
}()); })();
(function test_compose_invite_close_clicked() { (function test_compose_invite_close_clicked() {
const handler = $("#compose_invite_users") const handler = $("#compose_invite_users")
@@ -1347,7 +1347,7 @@ run_test("on_events", () => {
assert(helper.container_was_removed()); assert(helper.container_was_removed());
assert(all_invite_children_called); assert(all_invite_children_called);
assert(!$("#compose_invite_users").visible()); assert(!$("#compose_invite_users").visible());
}()); })();
(function test_compose_not_subscribed_clicked() { (function test_compose_not_subscribed_clicked() {
const handler = $("#compose-send-status") const handler = $("#compose-send-status")
@@ -1379,7 +1379,7 @@ run_test("on_events", () => {
handler(helper.event); handler(helper.event);
assert(!$("#compose-send-status").visible()); assert(!$("#compose-send-status").visible());
}()); })();
(function test_compose_not_subscribed_close_clicked() { (function test_compose_not_subscribed_close_clicked() {
const handler = $("#compose-send-status") const handler = $("#compose-send-status")
@@ -1396,7 +1396,7 @@ run_test("on_events", () => {
handler(helper.event); handler(helper.event);
assert(!$("#compose-send-status").visible()); assert(!$("#compose-send-status").visible());
}()); })();
(function test_attach_files_compose_clicked() { (function test_attach_files_compose_clicked() {
const handler = $("#compose") const handler = $("#compose")
@@ -1416,7 +1416,7 @@ run_test("on_events", () => {
handler(event); handler(event);
assert(compose_file_input_clicked); assert(compose_file_input_clicked);
}()); })();
(function test_video_link_compose_clicked() { (function test_video_link_compose_clicked() {
page_params.jitsi_server_url = "https://meet.jit.si"; page_params.jitsi_server_url = "https://meet.jit.si";
@@ -1489,7 +1489,7 @@ run_test("on_events", () => {
video_link_regex = /\[Click to join video call\]\(\/calls\/bigbluebutton\/join\?meeting_id=%22zulip-1%22&password=%22AAAAAAAAAA%22&checksum=%2232702220bff2a22a44aee72e96cfdb4c4091752e%22\)/; video_link_regex = /\[Click to join video call\]\(\/calls\/bigbluebutton\/join\?meeting_id=%22zulip-1%22&password=%22AAAAAAAAAA%22&checksum=%2232702220bff2a22a44aee72e96cfdb4c4091752e%22\)/;
assert(video_link_regex.test(syntax_to_insert)); assert(video_link_regex.test(syntax_to_insert));
}()); })();
(function test_markdown_preview_compose_clicked() { (function test_markdown_preview_compose_clicked() {
// Tests setup // Tests setup
@@ -1612,7 +1612,7 @@ run_test("on_events", () => {
assert_visibilities(); assert_visibilities();
assert.equal($("#preview_content").html(), assert.equal($("#preview_content").html(),
"Server: foobarfoobar"); "Server: foobarfoobar");
}()); })();
(function test_undo_markdown_preview_clicked() { (function test_undo_markdown_preview_clicked() {
const handler = $("#compose") const handler = $("#compose")
@@ -1633,7 +1633,7 @@ run_test("on_events", () => {
assert(!$("#undo_markdown_preview").visible()); assert(!$("#undo_markdown_preview").visible());
assert(!$("#preview_message_area").visible()); assert(!$("#preview_message_area").visible());
assert($("#markdown_preview").visible()); assert($("#markdown_preview").visible());
}()); })();
}); });

View File

@@ -45,7 +45,7 @@ compose_state.private_message_recipient = (function () {
recipient = arg; recipient = arg;
}; };
}()); })();
set_global("reload_state", { set_global("reload_state", {
is_in_progress: return_false, is_in_progress: return_false,

View File

@@ -102,7 +102,7 @@ run_test("pills", () => {
const item = handler(othello.email, pills.items()); const item = handler(othello.email, pills.items());
assert(get_by_email_called); assert(get_by_email_called);
assert.equal(item, undefined); assert.equal(item, undefined);
}()); })();
(function test_success_path() { (function test_success_path() {
get_by_email_called = false; get_by_email_called = false;
@@ -111,7 +111,7 @@ run_test("pills", () => {
assert.equal(typeof res, "object"); assert.equal(typeof res, "object");
assert.equal(res.user_id, iago.user_id); assert.equal(res.user_id, iago.user_id);
assert.equal(res.display_value, iago.full_name); assert.equal(res.display_value, iago.full_name);
}()); })();
} }
function input_pill_stub(opts) { function input_pill_stub(opts) {

View File

@@ -107,7 +107,7 @@ run_test("draft_model", () => {
ls.set("drafts", expected); ls.set("drafts", expected);
assert.deepEqual(draft_model.get(), expected); assert.deepEqual(draft_model.get(), expected);
}()); })();
localStorage.clear(); localStorage.clear();
(function test_get() { (function test_get() {
@@ -115,7 +115,7 @@ run_test("draft_model", () => {
assert.deepEqual(draft_model.getDraft("id1"), draft_1); assert.deepEqual(draft_model.getDraft("id1"), draft_1);
assert.equal(draft_model.getDraft("id2"), false); assert.equal(draft_model.getDraft("id2"), false);
}()); })();
localStorage.clear(); localStorage.clear();
(function test_addDraft() { (function test_addDraft() {
@@ -126,7 +126,7 @@ run_test("draft_model", () => {
assert.deepEqual(ls.get("drafts")[id], expected); assert.deepEqual(ls.get("drafts")[id], expected);
}); });
}()); })();
localStorage.clear(); localStorage.clear();
(function test_editDraft() { (function test_editDraft() {
@@ -138,7 +138,7 @@ run_test("draft_model", () => {
assert.deepEqual(ls.get("drafts").id1, expected); assert.deepEqual(ls.get("drafts").id1, expected);
}); });
}()); })();
localStorage.clear(); localStorage.clear();
(function test_deleteDraft() { (function test_deleteDraft() {
@@ -146,7 +146,7 @@ run_test("draft_model", () => {
draft_model.deleteDraft("id1"); draft_model.deleteDraft("id1");
assert.deepEqual(ls.get("drafts"), {}); assert.deepEqual(ls.get("drafts"), {});
}()); })();
}); });
run_test("snapshot_message", () => { run_test("snapshot_message", () => {

View File

@@ -531,7 +531,7 @@ run_test("unread_ops", () => {
message_list.all = {}; message_list.all = {};
message_list.all.show_message_as_read = noop; message_list.all.show_message_as_read = noop;
notifications.close_notification = noop; notifications.close_notification = noop;
}()); })();
// Set up a way to capture the options passed in to channel.post. // Set up a way to capture the options passed in to channel.post.
let channel_post_opts; let channel_post_opts;

View File

@@ -398,7 +398,7 @@ run_test("loading_newer", () => {
// since the last message event's data had been discarded. // since the last message event's data had been discarded.
// This fetch goes on until the newest message has been found. // This fetch goes on until the newest message has been found.
assert.equal(msg_list.data.fetch_status.can_load_newer_messages(), false); assert.equal(msg_list.data.fetch_status.can_load_newer_messages(), false);
}()); })();
(function test_home() { (function test_home() {
reset_lists(); reset_lists();
@@ -455,6 +455,6 @@ run_test("loading_newer", () => {
assert.equal(msg_list.data.fetch_status.can_load_newer_messages(), false); assert.equal(msg_list.data.fetch_status.can_load_newer_messages(), false);
}()); })();
}); });

View File

@@ -120,7 +120,7 @@ run_test("msg_edited_vars", () => {
assert_alongside_sender(result[0]); assert_alongside_sender(result[0]);
assert_left_col(result[1]); assert_left_col(result[1]);
assert_status_msg(result[2]); assert_status_msg(result[2]);
}()); })();
}); });
run_test("merge_message_groups", () => { run_test("merge_message_groups", () => {
@@ -204,7 +204,7 @@ run_test("merge_message_groups", () => {
assert.deepEqual(result.rerender_groups, []); assert.deepEqual(result.rerender_groups, []);
assert.deepEqual(result.append_messages, []); assert.deepEqual(result.append_messages, []);
assert.deepEqual(result.rerender_messages_next_same_sender, []); assert.deepEqual(result.rerender_messages_next_same_sender, []);
}()); })();
(function test_append_message_same_subject() { (function test_append_message_same_subject() {
@@ -229,7 +229,7 @@ run_test("merge_message_groups", () => {
assert.deepEqual(result.rerender_groups, []); assert.deepEqual(result.rerender_groups, []);
assert_message_list_equal(result.append_messages, [message2]); assert_message_list_equal(result.append_messages, [message2]);
assert_message_list_equal(result.rerender_messages_next_same_sender, [message1]); assert_message_list_equal(result.rerender_messages_next_same_sender, [message1]);
}()); })();
(function test_append_message_different_subject() { (function test_append_message_different_subject() {
@@ -255,7 +255,7 @@ run_test("merge_message_groups", () => {
assert.deepEqual(result.rerender_groups, []); assert.deepEqual(result.rerender_groups, []);
assert.deepEqual(result.append_messages, []); assert.deepEqual(result.append_messages, []);
assert.deepEqual(result.rerender_messages_next_same_sender, []); assert.deepEqual(result.rerender_messages_next_same_sender, []);
}()); })();
(function test_append_message_different_subject_and_days() { (function test_append_message_different_subject_and_days() {
@@ -284,7 +284,7 @@ run_test("merge_message_groups", () => {
assert.equal( assert.equal(
message_group2.group_date_divider_html, message_group2.group_date_divider_html,
"900000000 - 1000000"); "900000000 - 1000000");
}()); })();
(function test_append_message_different_day() { (function test_append_message_different_day() {
@@ -308,7 +308,7 @@ run_test("merge_message_groups", () => {
assert.deepEqual(result.append_messages, [message2]); assert.deepEqual(result.append_messages, [message2]);
assert.deepEqual(result.rerender_messages_next_same_sender, [message1]); assert.deepEqual(result.rerender_messages_next_same_sender, [message1]);
assert(list._message_groups[0].message_containers[1].want_date_divider); assert(list._message_groups[0].message_containers[1].want_date_divider);
}()); })();
(function test_append_message_historical() { (function test_append_message_historical() {
@@ -334,7 +334,7 @@ run_test("merge_message_groups", () => {
assert.deepEqual(result.rerender_groups, []); assert.deepEqual(result.rerender_groups, []);
assert.deepEqual(result.append_messages, []); assert.deepEqual(result.append_messages, []);
assert.deepEqual(result.rerender_messages_next_same_sender, []); assert.deepEqual(result.rerender_messages_next_same_sender, []);
}()); })();
(function test_append_message_same_subject_me_message() { (function test_append_message_same_subject_me_message() {
@@ -360,7 +360,7 @@ run_test("merge_message_groups", () => {
assert.deepEqual(result.rerender_groups, []); assert.deepEqual(result.rerender_groups, []);
assert_message_list_equal(result.append_messages, [message2]); assert_message_list_equal(result.append_messages, [message2]);
assert_message_list_equal(result.rerender_messages_next_same_sender, [message1]); assert_message_list_equal(result.rerender_messages_next_same_sender, [message1]);
}()); })();
(function test_prepend_message_same_subject() { (function test_prepend_message_same_subject() {
@@ -386,7 +386,7 @@ run_test("merge_message_groups", () => {
[build_message_group([message2, message1])]); [build_message_group([message2, message1])]);
assert.deepEqual(result.append_messages, []); assert.deepEqual(result.append_messages, []);
assert.deepEqual(result.rerender_messages_next_same_sender, []); assert.deepEqual(result.rerender_messages_next_same_sender, []);
}()); })();
(function test_prepend_message_different_subject() { (function test_prepend_message_different_subject() {
@@ -411,7 +411,7 @@ run_test("merge_message_groups", () => {
assert.deepEqual(result.rerender_groups, []); assert.deepEqual(result.rerender_groups, []);
assert.deepEqual(result.append_messages, []); assert.deepEqual(result.append_messages, []);
assert.deepEqual(result.rerender_messages_next_same_sender, []); assert.deepEqual(result.rerender_messages_next_same_sender, []);
}()); })();
(function test_prepend_message_different_subject_and_day() { (function test_prepend_message_different_subject_and_day() {
@@ -441,7 +441,7 @@ run_test("merge_message_groups", () => {
assert.deepEqual(result.rerender_groups, [message_group1]); assert.deepEqual(result.rerender_groups, [message_group1]);
assert.deepEqual(result.append_messages, []); assert.deepEqual(result.append_messages, []);
assert.deepEqual(result.rerender_messages_next_same_sender, []); assert.deepEqual(result.rerender_messages_next_same_sender, []);
}()); })();
(function test_prepend_message_different_day() { (function test_prepend_message_different_day() {
@@ -470,7 +470,7 @@ run_test("merge_message_groups", () => {
assert_message_groups_list_equal(result.rerender_groups, [message_group2]); assert_message_groups_list_equal(result.rerender_groups, [message_group2]);
assert.deepEqual(result.append_messages, []); assert.deepEqual(result.append_messages, []);
assert.deepEqual(result.rerender_messages_next_same_sender, []); assert.deepEqual(result.rerender_messages_next_same_sender, []);
}()); })();
(function test_prepend_message_historical() { (function test_prepend_message_historical() {
@@ -496,7 +496,7 @@ run_test("merge_message_groups", () => {
assert.deepEqual(result.rerender_groups, []); assert.deepEqual(result.rerender_groups, []);
assert.deepEqual(result.append_messages, []); assert.deepEqual(result.append_messages, []);
assert.deepEqual(result.rerender_messages_next_same_sender, []); assert.deepEqual(result.rerender_messages_next_same_sender, []);
}()); })();
}); });
@@ -533,7 +533,7 @@ run_test("render_windows", () => {
view.rerender_preserving_scrolltop = noop; view.rerender_preserving_scrolltop = noop;
return view; return view;
}()); })();
const list = view.list; const list = view.list;
@@ -541,7 +541,7 @@ run_test("render_windows", () => {
// The function should early exit here. // The function should early exit here.
const rendered = view.maybe_rerender(); const rendered = view.maybe_rerender();
assert.equal(rendered, false); assert.equal(rendered, false);
}()); })();
let messages; let messages;

View File

@@ -25,7 +25,7 @@ run_test("basics", () => {
}; };
return self; return self;
}()); })();
function password_field(min_length, min_guesses) { function password_field(min_length, min_guesses) {
const self = {}; const self = {};

View File

@@ -69,7 +69,7 @@ run_test("scroll_element_into_container", () => {
top = arg; top = arg;
}, },
}; };
}()); })();
const elem1 = { const elem1 = {
innerHeight: () => 25, innerHeight: () => 25,

View File

@@ -170,7 +170,7 @@ run_test("test tab clicks", () => {
assert(forms.add.visible()); assert(forms.add.visible());
assert(!forms.active.visible()); assert(!forms.active.visible());
assert(!forms.inactive.visible()); assert(!forms.inactive.visible());
}()); })();
(function () { (function () {
click_on_tab(tabs.active); click_on_tab(tabs.active);
@@ -181,7 +181,7 @@ run_test("test tab clicks", () => {
assert(!forms.add.visible()); assert(!forms.add.visible());
assert(forms.active.visible()); assert(forms.active.visible());
assert(!forms.inactive.visible()); assert(!forms.inactive.visible());
}()); })();
(function () { (function () {
click_on_tab(tabs.inactive); click_on_tab(tabs.inactive);
@@ -192,7 +192,7 @@ run_test("test tab clicks", () => {
assert(!forms.add.visible()); assert(!forms.add.visible());
assert(!forms.active.visible()); assert(!forms.active.visible());
assert(forms.inactive.visible()); assert(forms.inactive.visible());
}()); })();
}); });
run_test("can_create_new_bots", () => { run_test("can_create_new_bots", () => {

View File

@@ -198,7 +198,7 @@ run_test("populate_user_groups", () => {
return fake_person; return fake_person;
}; };
assert.equal(config.highlighter(), fake_person); assert.equal(config.highlighter(), fake_person);
}()); })();
const fake_context = { const fake_context = {
query: "ali", query: "ali",
@@ -212,7 +212,7 @@ run_test("populate_user_groups", () => {
const result = config.source.call(fake_context, iago); const result = config.source.call(fake_context, iago);
const emails = result.map((user) => user.email).sort(); const emails = result.map((user) => user.email).sort();
assert.deepEqual(emails, [alice.email, bob.email]); assert.deepEqual(emails, [alice.email, bob.email]);
}()); })();
(function test_matcher() { (function test_matcher() {
/* Here the query doesn't begin with an '@' because typeahead is triggered /* Here the query doesn't begin with an '@' because typeahead is triggered
@@ -232,7 +232,7 @@ run_test("populate_user_groups", () => {
page_params.is_admin = true; page_params.is_admin = true;
result = config.matcher.call(fake_context_for_email, bob); result = config.matcher.call(fake_context_for_email, bob);
assert(result); assert(result);
}()); })();
(function test_sorter() { (function test_sorter() {
let sort_recipientbox_typeahead_called = false; let sort_recipientbox_typeahead_called = false;
@@ -241,7 +241,7 @@ run_test("populate_user_groups", () => {
}; };
config.sorter.call(fake_context); config.sorter.call(fake_context);
assert(sort_recipientbox_typeahead_called); assert(sort_recipientbox_typeahead_called);
}()); })();
(function test_updater() { (function test_updater() {
input_field_stub.text("@ali"); input_field_stub.text("@ali");
@@ -287,7 +287,7 @@ run_test("populate_user_groups", () => {
assert(cancel_fade_to_called); assert(cancel_fade_to_called);
assert(instructions_fade_to_called); assert(instructions_fade_to_called);
assert.equal(text_cleared, true); assert.equal(text_cleared, true);
}()); })();
input_typeahead_called = true; input_typeahead_called = true;
}; };
@@ -313,7 +313,7 @@ run_test("populate_user_groups", () => {
const item = handler(iago.email, pills.items()); const item = handler(iago.email, pills.items());
assert(get_by_email_called); assert(get_by_email_called);
assert.equal(item, undefined); assert.equal(item, undefined);
}()); })();
(function test_success_path() { (function test_success_path() {
get_by_email_called = false; get_by_email_called = false;
@@ -322,7 +322,7 @@ run_test("populate_user_groups", () => {
assert.equal(typeof res, "object"); assert.equal(typeof res, "object");
assert.equal(res.user_id, bob.user_id); assert.equal(res.user_id, bob.user_id);
assert.equal(res.display_value, bob.full_name); assert.equal(res.display_value, bob.full_name);
}()); })();
} }
pills.onPillRemove = function (handler) { pills.onPillRemove = function (handler) {
@@ -572,7 +572,7 @@ run_test("on_events", () => {
assert(!$("#admin-user-group-status").visible()); assert(!$("#admin-user-group-status").visible());
assert.equal($("form.admin-user-group-form input[type='text']").val(), ""); assert.equal($("form.admin-user-group-form input[type='text']").val(), "");
}()); })();
(function test_post_error() { (function test_post_error() {
$("#admin-user-group-status").show(); $("#admin-user-group-status").show();
@@ -590,11 +590,11 @@ run_test("on_events", () => {
opts.error(xhr); opts.error(xhr);
assert(!$("#admin-user-group-status").visible()); assert(!$("#admin-user-group-status").visible());
}()); })();
}; };
handler.call(fake_this, event); handler.call(fake_this, event);
}()); })();
(function test_user_groups_delete_click_triggered() { (function test_user_groups_delete_click_triggered() {
const handler = $("#user-groups").get_on_handler("click", ".delete"); const handler = $("#user-groups").get_on_handler("click", ".delete");
@@ -626,7 +626,7 @@ run_test("on_events", () => {
}; };
handler.call(fake_this); handler.call(fake_this);
}()); })();
(function test_user_groups_keypress_enter_triggered() { (function test_user_groups_keypress_enter_triggered() {
const handler = $("#user-groups").get_on_handler("keypress", ".user-group h4 > span"); const handler = $("#user-groups").get_on_handler("keypress", ".user-group h4 > span");
@@ -639,7 +639,7 @@ run_test("on_events", () => {
}; };
handler(event); handler(event);
assert(default_action_for_enter_stopped); assert(default_action_for_enter_stopped);
}()); })();
(function test_do_not_blur() { (function test_do_not_blur() {
const blur_event_classes = [".name", ".description", ".input"]; const blur_event_classes = [".name", ".description", ".input"];
@@ -697,7 +697,7 @@ run_test("on_events", () => {
assert(!api_endpoint_called); assert(!api_endpoint_called);
assert(settings_user_groups_reload_called); assert(settings_user_groups_reload_called);
} }
}()); })();
(function test_update_cancel_button() { (function test_update_cancel_button() {
const handler_name = $(user_group_selector).get_on_handler("input", ".name"); const handler_name = $(user_group_selector).get_on_handler("input", ".name");
@@ -745,7 +745,7 @@ run_test("on_events", () => {
handler_desc.call(fake_this); handler_desc.call(fake_this);
assert(cancel_fade_out_called); assert(cancel_fade_out_called);
assert(instructions_fade_out_called); assert(instructions_fade_out_called);
}()); })();
(function test_user_groups_save_group_changes_triggered() { (function test_user_groups_save_group_changes_triggered() {
const handler_name = $(user_group_selector).get_on_handler("blur", ".name"); const handler_name = $(user_group_selector).get_on_handler("blur", ".name");
@@ -796,7 +796,7 @@ run_test("on_events", () => {
assert(cancel_fade_out_called); assert(cancel_fade_out_called);
assert(instructions_fade_out_called); assert(instructions_fade_out_called);
assert(saved_fade_to_called); assert(saved_fade_to_called);
}()); })();
(function test_post_error() { (function test_post_error() {
const user_group_error = $(user_group_selector + " .user-group-status"); const user_group_error = $(user_group_selector + " .user-group-status");
user_group_error.show(); user_group_error.show();
@@ -814,7 +814,7 @@ run_test("on_events", () => {
opts.error(xhr); opts.error(xhr);
assert(user_group_error.visible()); assert(user_group_error.visible());
}()); })();
}; };
const fake_this = $.create("fake-#user-groups_blur_name"); const fake_this = $.create("fake-#user-groups_blur_name");
@@ -841,7 +841,7 @@ run_test("on_events", () => {
api_endpoint_called = false; api_endpoint_called = false;
handler_desc.call(fake_this, event); handler_desc.call(fake_this, event);
assert(!api_endpoint_called); assert(!api_endpoint_called);
}()); })();
(function test_user_groups_save_member_changes_triggered() { (function test_user_groups_save_member_changes_triggered() {
const handler = $(user_group_selector).get_on_handler("blur", ".input"); const handler = $(user_group_selector).get_on_handler("blur", ".input");
@@ -886,7 +886,7 @@ run_test("on_events", () => {
assert(cancel_fade_out_called); assert(cancel_fade_out_called);
assert(instructions_fade_out_called); assert(instructions_fade_out_called);
assert(saved_fade_to_called); assert(saved_fade_to_called);
}()); })();
}; };
const fake_this = $.create("fake-#user-groups_blur_input"); const fake_this = $.create("fake-#user-groups_blur_input");
@@ -901,5 +901,5 @@ run_test("on_events", () => {
api_endpoint_called = false; api_endpoint_called = false;
handler.call(fake_this, event); handler.call(fake_this, event);
assert(api_endpoint_called); assert(api_endpoint_called);
}()); })();
}); });

View File

@@ -76,7 +76,7 @@ run_test("create_sidebar_row", () => {
stream_list.create_sidebar_row(devel); stream_list.create_sidebar_row(devel);
assert.equal(devel_value.text(), "42"); assert.equal(devel_value.text(), "42");
}()); })();
(function create_social_sidebar_row() { (function create_social_sidebar_row() {
const social_value = $.create("social-value"); const social_value = $.create("social-value");
@@ -95,7 +95,7 @@ run_test("create_sidebar_row", () => {
stream_list.create_sidebar_row(social); stream_list.create_sidebar_row(social);
assert.equal(social_value.text(), "42"); assert.equal(social_value.text(), "42");
}()); })();
const split = '<hr class="stream-split">'; const split = '<hr class="stream-split">';
const devel_sidebar = $("<devel sidebar row>"); const devel_sidebar = $("<devel sidebar row>");

View File

@@ -125,7 +125,7 @@ run_test("basics", () => {
verify_collapsed(); verify_collapsed();
assert.deepEqual(cursor_helper.events, ["reset", "clear"]); assert.deepEqual(cursor_helper.events, ["reset", "clear"]);
}()); })();
// Expand the widget. // Expand the widget.
toggle_filter(); toggle_filter();

View File

@@ -39,4 +39,4 @@ exports.with_stub = function (f) {
assert.equal(args.color, "blue"); assert.equal(args.color, "blue");
assert.equal(args.n, 42); assert.equal(args.n, 42);
}); });
}()); })();

View File

@@ -68,7 +68,7 @@ Logger.prototype = (function () {
} }
return proto; return proto;
}()); })();
const logger = new Logger(); const logger = new Logger();

View File

@@ -571,7 +571,7 @@ exports.initialize = function () {
$(sel).on("click", "a", function () { $(sel).on("click", "a", function () {
this.blur(); this.blur();
}); });
}()); })();
popovers.register_click_handlers(); popovers.register_click_handlers();
emoji_picker.register_click_handlers(); emoji_picker.register_click_handlers();
@@ -826,7 +826,7 @@ exports.initialize = function () {
$("[data-make-editable='" + selector + "']").html(""); $("[data-make-editable='" + selector + "']").html("");
} }
}); });
}()); })();
// HOTSPOTS // HOTSPOTS

View File

@@ -35,7 +35,7 @@ exports.toggle = function (opts) {
_component.append(tab); _component.append(tab);
}); });
return _component; return _component;
}(opts)); })(opts);
const meta = { const meta = {
$ind_tab: component.find(".ind-tab"), $ind_tab: component.find(".ind-tab"),
@@ -96,7 +96,7 @@ exports.toggle = function (opts) {
if (typeof opts.selected === "number") { if (typeof opts.selected === "number") {
select_tab(opts.selected); select_tab(opts.selected);
} }
}()); })();
const prototype = { const prototype = {
maybe_go_left: maybe_go_left, maybe_go_left: maybe_go_left,

View File

@@ -65,7 +65,7 @@ const draft_model = (function () {
}; };
return exports; return exports;
}()); })();
exports.draft_model = draft_model; exports.draft_model = draft_model;

View File

@@ -167,7 +167,7 @@ exports.process_fenced_code = function (content) {
handler_stack.pop(); handler_stack.pop();
}, },
}; };
}()); })();
} }
function default_hander() { function default_hander() {

View File

@@ -364,7 +364,7 @@ exports.create = function (opts) {
e.originalEvent.clipboardData.setData("text/plain", store.get_text_from_item(data.item)); e.originalEvent.clipboardData.setData("text/plain", store.get_text_from_item(data.item));
e.preventDefault(); e.preventDefault();
}); });
}()); })();
// the external, user-accessible prototype. // the external, user-accessible prototype.
const prototype = { const prototype = {

View File

@@ -51,6 +51,6 @@ exports.get_next_id_float = (function () {
return local_id_float; return local_id_float;
}; };
}()); })();
window.local_message = exports; window.local_message = exports;

View File

@@ -59,7 +59,7 @@ exports.send_read = (function () {
} }
return add; return add;
}()); })();
exports.save_collapsed = function (message) { exports.save_collapsed = function (message) {
send_flag_update(message, "collapsed", "add"); send_flag_update(message, "collapsed", "add");

View File

@@ -291,7 +291,7 @@ exports.activate = function (raw_operators, opts) {
maybe_report_narrow_time(msg_list); maybe_report_narrow_time(msg_list);
}, },
}); });
}()); })();
if (select_immediately) { if (select_immediately) {
exports.update_selection({ exports.update_selection({

View File

@@ -75,6 +75,6 @@ exports.recent = (function () {
}; };
return self; return self;
}()); })();
window.pm_conversations = exports; window.pm_conversations = exports;

View File

@@ -43,7 +43,7 @@ function elem_to_user_id(elem) {
// add back all shallow properties of $.fn.popover to the new proxied version. // add back all shallow properties of $.fn.popover to the new proxied version.
Object.assign($.fn.popover, popover); Object.assign($.fn.popover, popover);
}($.fn.popover)); })($.fn.popover);
function copy_email_handler(e) { function copy_email_handler(e) {
const email_el = $(e.trigger.parentElement); const email_el = $(e.trigger.parentElement);
@@ -1088,7 +1088,7 @@ exports.register_click_handlers = function () {
// retrigger `hide_all` while still scrolling. // retrigger `hide_all` while still scrolling.
last_scroll = date; last_scroll = date;
}); });
}()); })();
}; };
exports.any_active = function () { exports.any_active = function () {

View File

@@ -144,12 +144,12 @@ exports.watch_manual_resize = function (element) {
document.body.addEventListener("mouseup", body_handler); document.body.addEventListener("mouseup", body_handler);
return [box_handler, body_handler]; return [box_handler, body_handler];
}((height) => { })((height) => {
// This callback disables autosize on the textarea. It // This callback disables autosize on the textarea. It
// will be re-enabled when this component is next opened. // will be re-enabled when this component is next opened.
autosize.destroy($(element)) autosize.destroy($(element))
.height(height + "px"); .height(height + "px");
})); });
}; };
exports.resize_bottom_whitespace = function (h) { exports.resize_bottom_whitespace = function (h) {

View File

@@ -256,7 +256,7 @@ exports.populate_user_groups = function () {
input.focus(); input.focus();
}, 100); }, 100);
}); });
}()); })();
} }
}; };

View File

@@ -35,7 +35,7 @@ const stream_subscription_error = (function () {
return self; return self;
}()); })();
const stream_name_error = (function () { const stream_name_error = (function () {
const self = {}; const self = {};
@@ -95,7 +95,7 @@ const stream_name_error = (function () {
}; };
return self; return self;
}()); })();
// Within the new stream modal... // Within the new stream modal...
function update_announce_stream_state() { function update_announce_stream_state() {
@@ -374,7 +374,7 @@ exports.create_handlers_for_users = function (container) {
const display = user_checked ? "block" : "none"; const display = user_checked ? "block" : "none";
elem.css({display: display}); elem.css({display: display});
}); });
}()); })();
e.preventDefault(); e.preventDefault();
}); });

View File

@@ -53,7 +53,7 @@ exports.stream_sidebar = (function () {
}; };
return self; return self;
}()); })();
function get_search_term() { function get_search_term() {
const search_box = $(".stream-list-filter"); const search_box = $(".stream-list-filter");

View File

@@ -925,7 +925,7 @@ exports.initialize = function () {
stream_edit.open_edit_panel_empty(); stream_edit.open_edit_panel_empty();
} }
}); });
}()); })();
}; };

View File

@@ -289,7 +289,7 @@ exports.absolute_time = (function () {
str += " " + fmt_time(date, H_24); str += " " + fmt_time(date, H_24);
return str; return str;
}; };
}()); })();
exports.get_full_datetime = function (time) { exports.get_full_datetime = function (time) {
// Convert to number of hours ahead/behind UTC. // Convert to number of hours ahead/behind UTC.

View File

@@ -179,7 +179,7 @@ exports.unread_pm_counter = (function () {
}; };
return self; return self;
}()); })();
function make_per_stream_bucketer() { function make_per_stream_bucketer() {
return make_bucketer({ return make_bucketer({
@@ -372,7 +372,7 @@ exports.unread_topic_counter = (function () {
}; };
return self; return self;
}()); })();
exports.unread_mentions_counter = new Set(); exports.unread_mentions_counter = new Set();