mirror of https://github.com/zulip/zulip.git
eslint: Enable object-shorthand avoidExplicitReturnArrows option.
This is equivalent in the absence of ‘this’ (which ESLint knows to check for). Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
88873138ac
commit
eb2c822d3f
|
@ -101,7 +101,7 @@
|
||||||
"no-useless-concat": "error",
|
"no-useless-concat": "error",
|
||||||
"no-useless-constructor": "error",
|
"no-useless-constructor": "error",
|
||||||
"no-var": "error",
|
"no-var": "error",
|
||||||
"object-shorthand": "error",
|
"object-shorthand": ["error", "always", {"avoidExplicitReturnArrows": true}],
|
||||||
"one-var": ["error", "never"],
|
"one-var": ["error", "never"],
|
||||||
"prefer-arrow-callback": "error",
|
"prefer-arrow-callback": "error",
|
||||||
"prefer-const": [
|
"prefer-const": [
|
||||||
|
|
|
@ -322,7 +322,7 @@ test("handlers", ({override, mock_template}) => {
|
||||||
(function test_click_filter() {
|
(function test_click_filter() {
|
||||||
init();
|
init();
|
||||||
const e = {
|
const e = {
|
||||||
stopPropagation: () => {},
|
stopPropagation() {},
|
||||||
};
|
};
|
||||||
|
|
||||||
const handler = $(".user-list-filter").get_on_handler("focus");
|
const handler = $(".user-list-filter").get_on_handler("focus");
|
||||||
|
|
|
@ -22,7 +22,7 @@ run_test("rerender_alert_words_ui", ({mock_template}) => {
|
||||||
alert_words_ui.reset();
|
alert_words_ui.reset();
|
||||||
const ListWidget = mock_esm("../../static/js/list_widget", {
|
const ListWidget = mock_esm("../../static/js/list_widget", {
|
||||||
modifier: noop,
|
modifier: noop,
|
||||||
create: (container, words, opts) => {
|
create(container, words, opts) {
|
||||||
const alert_words = [];
|
const alert_words = [];
|
||||||
ListWidget.modifier = opts.modifier;
|
ListWidget.modifier = opts.modifier;
|
||||||
for (const word of words) {
|
for (const word of words) {
|
||||||
|
@ -104,7 +104,7 @@ run_test("close_status_message", ({override_rewire}) => {
|
||||||
$alert.show();
|
$alert.show();
|
||||||
|
|
||||||
const event = {
|
const event = {
|
||||||
preventDefault: () => {},
|
preventDefault() {},
|
||||||
currentTarget: ".close-alert-word-status",
|
currentTarget: ".close-alert-word-status",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ const document = dom.window.document;
|
||||||
const location = set_global("location", {});
|
const location = set_global("location", {});
|
||||||
|
|
||||||
const helpers = mock_esm("../../static/js/billing/helpers", {
|
const helpers = mock_esm("../../static/js/billing/helpers", {
|
||||||
set_tab: () => {},
|
set_tab() {},
|
||||||
});
|
});
|
||||||
|
|
||||||
zrequire("billing/billing");
|
zrequire("billing/billing");
|
||||||
|
@ -49,7 +49,7 @@ run_test("card_update", ({override}) => {
|
||||||
|
|
||||||
const update_card_click_handler = $("#update-card-button").get_on_handler("click");
|
const update_card_click_handler = $("#update-card-button").get_on_handler("click");
|
||||||
override(helpers, "create_ajax_request", card_change_ajax);
|
override(helpers, "create_ajax_request", card_change_ajax);
|
||||||
update_card_click_handler({preventDefault: () => {}});
|
update_card_click_handler({preventDefault() {}});
|
||||||
assert.ok(create_ajax_request_called);
|
assert.ok(create_ajax_request_called);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ run_test("planchange", ({override}) => {
|
||||||
const change_plan_status_click_handler = $("#change-plan-status").get_on_handler("click");
|
const change_plan_status_click_handler = $("#change-plan-status").get_on_handler("click");
|
||||||
|
|
||||||
override(helpers, "create_ajax_request", plan_change_ajax);
|
override(helpers, "create_ajax_request", plan_change_ajax);
|
||||||
change_plan_status_click_handler({preventDefault: () => {}});
|
change_plan_status_click_handler({preventDefault() {}});
|
||||||
assert.ok(create_ajax_request_called);
|
assert.ok(create_ajax_request_called);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ run_test("licensechange", ({override}) => {
|
||||||
const confirm_license_update_click_handler = $("#confirm-license-update-button").get_on_handler(
|
const confirm_license_update_click_handler = $("#confirm-license-update-button").get_on_handler(
|
||||||
"click",
|
"click",
|
||||||
);
|
);
|
||||||
confirm_license_update_click_handler({preventDefault: () => {}});
|
confirm_license_update_click_handler({preventDefault() {}});
|
||||||
assert.ok(create_ajax_request_called);
|
assert.ok(create_ajax_request_called);
|
||||||
|
|
||||||
let confirm_license_modal_shown = false;
|
let confirm_license_modal_shown = false;
|
||||||
|
@ -114,19 +114,20 @@ run_test("licensechange", ({override}) => {
|
||||||
create_ajax_request_called = false;
|
create_ajax_request_called = false;
|
||||||
const update_licenses_button_click_handler =
|
const update_licenses_button_click_handler =
|
||||||
$("#update-licenses-button").get_on_handler("click");
|
$("#update-licenses-button").get_on_handler("click");
|
||||||
update_licenses_button_click_handler({preventDefault: () => {}});
|
update_licenses_button_click_handler({preventDefault() {}});
|
||||||
assert.ok(create_ajax_request_called);
|
assert.ok(create_ajax_request_called);
|
||||||
assert.ok(!confirm_license_modal_shown);
|
assert.ok(!confirm_license_modal_shown);
|
||||||
|
|
||||||
$("#new_licenses_input").val = () => 25;
|
$("#new_licenses_input").val = () => 25;
|
||||||
create_ajax_request_called = false;
|
create_ajax_request_called = false;
|
||||||
update_licenses_button_click_handler({preventDefault: () => {}});
|
update_licenses_button_click_handler({preventDefault() {}});
|
||||||
assert.ok(!create_ajax_request_called);
|
assert.ok(!create_ajax_request_called);
|
||||||
assert.ok(confirm_license_modal_shown);
|
assert.ok(confirm_license_modal_shown);
|
||||||
|
|
||||||
override(helpers, "is_valid_input", () => false);
|
override(helpers, "is_valid_input", () => false);
|
||||||
const event = {
|
const event = {
|
||||||
preventDefault: /* istanbul ignore next */ () => {
|
/* istanbul ignore next */
|
||||||
|
preventDefault() {
|
||||||
throw new Error("unexpected preventDefault call");
|
throw new Error("unexpected preventDefault call");
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -154,7 +155,7 @@ run_test("licensechange", ({override}) => {
|
||||||
create_ajax_request_called = true;
|
create_ajax_request_called = true;
|
||||||
}
|
}
|
||||||
override(helpers, "create_ajax_request", licenses_at_next_renewal_change_ajax);
|
override(helpers, "create_ajax_request", licenses_at_next_renewal_change_ajax);
|
||||||
update_next_renewal_licenses_button_click_handler({preventDefault: () => {}});
|
update_next_renewal_licenses_button_click_handler({preventDefault() {}});
|
||||||
assert.ok(create_ajax_request_called);
|
assert.ok(create_ajax_request_called);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ run_test("create_ajax_request", ({override}) => {
|
||||||
$(form_error).show = () => {
|
$(form_error).show = () => {
|
||||||
state.form_error_show += 1;
|
state.form_error_show += 1;
|
||||||
return {
|
return {
|
||||||
text: (msg) => {
|
text(msg) {
|
||||||
assert.equal(msg, "response_message");
|
assert.equal(msg, "response_message");
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -14,14 +14,14 @@ const xhr_401 = {
|
||||||
|
|
||||||
let login_to_access_shown = false;
|
let login_to_access_shown = false;
|
||||||
mock_esm("../../static/js/spectators", {
|
mock_esm("../../static/js/spectators", {
|
||||||
login_to_access: () => {
|
login_to_access() {
|
||||||
login_to_access_shown = true;
|
login_to_access_shown = true;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
set_global("window", {
|
set_global("window", {
|
||||||
location: {
|
location: {
|
||||||
replace: () => {},
|
replace() {},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ const $ = require("../zjsunit/zjquery");
|
||||||
const noop = () => {};
|
const noop = () => {};
|
||||||
|
|
||||||
mock_esm("tippy.js", {
|
mock_esm("tippy.js", {
|
||||||
default: (arg) => {
|
default(arg) {
|
||||||
arg._tippy = {setContent: noop};
|
arg._tippy = {setContent: noop};
|
||||||
return arg._tippy;
|
return arg._tippy;
|
||||||
},
|
},
|
||||||
|
@ -158,8 +158,8 @@ run_test("show password", () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const ev = {
|
const ev = {
|
||||||
preventDefault: () => {},
|
preventDefault() {},
|
||||||
stopPropagation: () => {},
|
stopPropagation() {},
|
||||||
};
|
};
|
||||||
|
|
||||||
set_attribute("password");
|
set_attribute("password");
|
||||||
|
|
|
@ -14,7 +14,7 @@ const {page_params, user_settings} = require("../zjsunit/zpage_params");
|
||||||
const noop = () => {};
|
const noop = () => {};
|
||||||
|
|
||||||
set_global("document", {
|
set_global("document", {
|
||||||
querySelector: () => {},
|
querySelector() {},
|
||||||
});
|
});
|
||||||
set_global("navigator", {});
|
set_global("navigator", {});
|
||||||
set_global(
|
set_global(
|
||||||
|
@ -439,7 +439,7 @@ test_ui("initialize", ({override}) => {
|
||||||
assert.equal(config.mode, "compose");
|
assert.equal(config.mode, "compose");
|
||||||
setup_upload_called = true;
|
setup_upload_called = true;
|
||||||
return {
|
return {
|
||||||
cancelAll: () => {
|
cancelAll() {
|
||||||
uppy_cancel_all_called = true;
|
uppy_cancel_all_called = true;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -459,7 +459,7 @@ run_test("format_text", ({override}) => {
|
||||||
|
|
||||||
const $textarea = $("#compose-textarea");
|
const $textarea = $("#compose-textarea");
|
||||||
$textarea.get = () => ({
|
$textarea.get = () => ({
|
||||||
setSelectionRange: () => {},
|
setSelectionRange() {},
|
||||||
});
|
});
|
||||||
|
|
||||||
function init_textarea(val, range) {
|
function init_textarea(val, range) {
|
||||||
|
|
|
@ -486,7 +486,7 @@ test_ui("test_check_overflow_text", () => {
|
||||||
);
|
);
|
||||||
assert.ok($send_button.prop("disabled"));
|
assert.ok($send_button.prop("disabled"));
|
||||||
|
|
||||||
$("#compose-send-status").stop = () => ({fadeOut: () => {}});
|
$("#compose-send-status").stop = () => ({fadeOut() {}});
|
||||||
|
|
||||||
// Indicator should show orange colored text
|
// Indicator should show orange colored text
|
||||||
$textarea.val("a".repeat(9000 + 1));
|
$textarea.val("a".repeat(9000 + 1));
|
||||||
|
|
|
@ -16,7 +16,7 @@ mock_esm("../../static/js/resize", {
|
||||||
watch_manual_resize() {},
|
watch_manual_resize() {},
|
||||||
});
|
});
|
||||||
set_global("document", {
|
set_global("document", {
|
||||||
querySelector: () => {},
|
querySelector() {},
|
||||||
});
|
});
|
||||||
set_global("navigator", {});
|
set_global("navigator", {});
|
||||||
set_global(
|
set_global(
|
||||||
|
@ -82,8 +82,8 @@ test("videos", ({override}) => {
|
||||||
$textarea.set_parents_result(".message_edit_form", []);
|
$textarea.set_parents_result(".message_edit_form", []);
|
||||||
|
|
||||||
const ev = {
|
const ev = {
|
||||||
preventDefault: () => {},
|
preventDefault() {},
|
||||||
stopPropagation: () => {},
|
stopPropagation() {},
|
||||||
target: {
|
target: {
|
||||||
to_$: () => $textarea,
|
to_$: () => $textarea,
|
||||||
},
|
},
|
||||||
|
@ -106,8 +106,8 @@ test("videos", ({override}) => {
|
||||||
$textarea.set_parents_result(".message_edit_form", []);
|
$textarea.set_parents_result(".message_edit_form", []);
|
||||||
|
|
||||||
const ev = {
|
const ev = {
|
||||||
preventDefault: () => {},
|
preventDefault() {},
|
||||||
stopPropagation: () => {},
|
stopPropagation() {},
|
||||||
target: {
|
target: {
|
||||||
to_$: () => $textarea,
|
to_$: () => $textarea,
|
||||||
},
|
},
|
||||||
|
@ -144,8 +144,8 @@ test("videos", ({override}) => {
|
||||||
$textarea.set_parents_result(".message_edit_form", []);
|
$textarea.set_parents_result(".message_edit_form", []);
|
||||||
|
|
||||||
const ev = {
|
const ev = {
|
||||||
preventDefault: () => {},
|
preventDefault() {},
|
||||||
stopPropagation: () => {},
|
stopPropagation() {},
|
||||||
target: {
|
target: {
|
||||||
to_$: () => $textarea,
|
to_$: () => $textarea,
|
||||||
},
|
},
|
||||||
|
@ -173,7 +173,7 @@ test("videos", ({override}) => {
|
||||||
channel.post = (payload) => {
|
channel.post = (payload) => {
|
||||||
assert.equal(payload.url, "/json/calls/zoom/create");
|
assert.equal(payload.url, "/json/calls/zoom/create");
|
||||||
payload.success({url: "example.zoom.com"});
|
payload.success({url: "example.zoom.com"});
|
||||||
return {abort: () => {}};
|
return {abort() {}};
|
||||||
};
|
};
|
||||||
|
|
||||||
handler(ev);
|
handler(ev);
|
||||||
|
@ -190,8 +190,8 @@ test("videos", ({override}) => {
|
||||||
$textarea.set_parents_result(".message_edit_form", []);
|
$textarea.set_parents_result(".message_edit_form", []);
|
||||||
|
|
||||||
const ev = {
|
const ev = {
|
||||||
preventDefault: () => {},
|
preventDefault() {},
|
||||||
stopPropagation: () => {},
|
stopPropagation() {},
|
||||||
target: {
|
target: {
|
||||||
to_$: () => $textarea,
|
to_$: () => $textarea,
|
||||||
},
|
},
|
||||||
|
|
|
@ -41,15 +41,15 @@ let tippy_args;
|
||||||
let tippy_show_called;
|
let tippy_show_called;
|
||||||
let tippy_destroy_called;
|
let tippy_destroy_called;
|
||||||
mock_esm("tippy.js", {
|
mock_esm("tippy.js", {
|
||||||
default: (sel, opts) => {
|
default(sel, opts) {
|
||||||
assert.equal(sel, tippy_sel);
|
assert.equal(sel, tippy_sel);
|
||||||
assert.deepEqual(opts, tippy_args);
|
assert.deepEqual(opts, tippy_args);
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
show: () => {
|
show() {
|
||||||
tippy_show_called = true;
|
tippy_show_called = true;
|
||||||
},
|
},
|
||||||
destroy: () => {
|
destroy() {
|
||||||
tippy_destroy_called = true;
|
tippy_destroy_called = true;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -14,7 +14,7 @@ mock_esm("../../static/js/list_widget", {
|
||||||
});
|
});
|
||||||
|
|
||||||
mock_esm("tippy.js", {
|
mock_esm("tippy.js", {
|
||||||
default: (arg) => {
|
default(arg) {
|
||||||
arg._tippy = {setContent: noop, placement: noop, destroy: noop};
|
arg._tippy = {setContent: noop, placement: noop, destroy: noop};
|
||||||
return arg._tippy;
|
return arg._tippy;
|
||||||
},
|
},
|
||||||
|
@ -39,7 +39,7 @@ run_test("basic_functions", () => {
|
||||||
widget_name: "my_setting",
|
widget_name: "my_setting",
|
||||||
data: ["one", "two", "three"].map((x) => ({name: x, value: x})),
|
data: ["one", "two", "three"].map((x) => ({name: x, value: x})),
|
||||||
value: "one",
|
value: "one",
|
||||||
on_update: (val) => {
|
on_update(val) {
|
||||||
updated_value = val;
|
updated_value = val;
|
||||||
},
|
},
|
||||||
default_text: $t({defaultMessage: "not set"}),
|
default_text: $t({defaultMessage: "not set"}),
|
||||||
|
@ -106,7 +106,7 @@ run_test("basic MDLW functions", () => {
|
||||||
data: ["one", "two", "three", "four"].map((x) => ({name: x, value: x})),
|
data: ["one", "two", "three", "four"].map((x) => ({name: x, value: x})),
|
||||||
value: ["one"],
|
value: ["one"],
|
||||||
limit: 2,
|
limit: 2,
|
||||||
on_update: (val) => {
|
on_update(val) {
|
||||||
updated_value = val;
|
updated_value = val;
|
||||||
},
|
},
|
||||||
default_text: $t({defaultMessage: "not set"}),
|
default_text: $t({defaultMessage: "not set"}),
|
||||||
|
|
|
@ -16,11 +16,11 @@ const notifications = mock_esm("../../static/js/notifications");
|
||||||
let disparities = [];
|
let disparities = [];
|
||||||
|
|
||||||
mock_esm("../../static/js/ui", {
|
mock_esm("../../static/js/ui", {
|
||||||
show_failed_message_success: () => {},
|
show_failed_message_success() {},
|
||||||
});
|
});
|
||||||
|
|
||||||
mock_esm("../../static/js/sent_messages", {
|
mock_esm("../../static/js/sent_messages", {
|
||||||
mark_disparity: (local_id) => {
|
mark_disparity(local_id) {
|
||||||
disparities.push(local_id);
|
disparities.push(local_id);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -28,9 +28,9 @@ mock_esm("../../static/js/sent_messages", {
|
||||||
const message_store = mock_esm("../../static/js/message_store", {
|
const message_store = mock_esm("../../static/js/message_store", {
|
||||||
get: () => ({failed_request: true}),
|
get: () => ({failed_request: true}),
|
||||||
|
|
||||||
update_booleans: () => {},
|
update_booleans() {},
|
||||||
|
|
||||||
set_message_booleans: () => {},
|
set_message_booleans() {},
|
||||||
});
|
});
|
||||||
|
|
||||||
const noop = () => {};
|
const noop = () => {};
|
||||||
|
|
|
@ -17,7 +17,7 @@ run_test("initialize_retry_with_another_card_link_click_handler", ({override}) =
|
||||||
assert.equal(method, "POST");
|
assert.equal(method, "POST");
|
||||||
set_global("window", {
|
set_global("window", {
|
||||||
location: {
|
location: {
|
||||||
replace: (new_location) => {
|
replace(new_location) {
|
||||||
assert.equal(new_location, "stripe_session_url");
|
assert.equal(new_location, "stripe_session_url");
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -26,7 +26,7 @@ run_test("initialize_retry_with_another_card_link_click_handler", ({override}) =
|
||||||
});
|
});
|
||||||
event_status.initialize_retry_with_another_card_link_click_handler();
|
event_status.initialize_retry_with_another_card_link_click_handler();
|
||||||
const retry_click_handler = $("#retry-with-another-card-link").get_on_handler("click");
|
const retry_click_handler = $("#retry-with-another-card-link").get_on_handler("click");
|
||||||
retry_click_handler({preventDefault: () => {}});
|
retry_click_handler({preventDefault() {}});
|
||||||
});
|
});
|
||||||
|
|
||||||
run_test("check_status", async ({override}) => {
|
run_test("check_status", async ({override}) => {
|
||||||
|
@ -77,7 +77,7 @@ run_test("check_status", async ({override}) => {
|
||||||
});
|
});
|
||||||
set_global("window", {
|
set_global("window", {
|
||||||
location: {
|
location: {
|
||||||
replace: (new_location) => {
|
replace(new_location) {
|
||||||
assert.equal(
|
assert.equal(
|
||||||
new_location,
|
new_location,
|
||||||
"/billing/event_status?stripe_payment_intent_id=spid_1A",
|
"/billing/event_status?stripe_payment_intent_id=spid_1A",
|
||||||
|
@ -108,7 +108,7 @@ run_test("check_status", async ({override}) => {
|
||||||
});
|
});
|
||||||
set_global("window", {
|
set_global("window", {
|
||||||
location: {
|
location: {
|
||||||
replace: (new_location) => {
|
replace(new_location) {
|
||||||
assert.equal(
|
assert.equal(
|
||||||
new_location,
|
new_location,
|
||||||
"/billing/event_status?stripe_payment_intent_id=spid_1B",
|
"/billing/event_status?stripe_payment_intent_id=spid_1B",
|
||||||
|
@ -138,7 +138,7 @@ run_test("check_status", async ({override}) => {
|
||||||
});
|
});
|
||||||
set_global("window", {
|
set_global("window", {
|
||||||
location: {
|
location: {
|
||||||
replace: (new_location) => {
|
replace(new_location) {
|
||||||
assert.equal(new_location, "/billing");
|
assert.equal(new_location, "/billing");
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -165,7 +165,7 @@ run_test("check_status", async ({override}) => {
|
||||||
});
|
});
|
||||||
set_global("window", {
|
set_global("window", {
|
||||||
location: {
|
location: {
|
||||||
replace: (new_location) => {
|
replace(new_location) {
|
||||||
assert.equal(new_location, "/billing?onboarding=true");
|
assert.equal(new_location, "/billing?onboarding=true");
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -192,7 +192,7 @@ run_test("check_status", async ({override}) => {
|
||||||
});
|
});
|
||||||
set_global("window", {
|
set_global("window", {
|
||||||
location: {
|
location: {
|
||||||
replace: (new_location) => {
|
replace(new_location) {
|
||||||
assert.equal(new_location, "/billing#payment-method");
|
assert.equal(new_location, "/billing#payment-method");
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -300,7 +300,7 @@ run_test("check_status", async ({override}) => {
|
||||||
});
|
});
|
||||||
set_global("window", {
|
set_global("window", {
|
||||||
location: {
|
location: {
|
||||||
replace: (new_location) => {
|
replace(new_location) {
|
||||||
assert.equal(new_location, "/billing/");
|
assert.equal(new_location, "/billing/");
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -63,7 +63,7 @@ function test_helper({override}) {
|
||||||
const events = [];
|
const events = [];
|
||||||
|
|
||||||
return {
|
return {
|
||||||
redirect: (module, func_name) => {
|
redirect(module, func_name) {
|
||||||
override(module, func_name, () => {
|
override(module, func_name, () => {
|
||||||
events.push([module, func_name]);
|
events.push([module, func_name]);
|
||||||
});
|
});
|
||||||
|
|
|
@ -6,11 +6,11 @@ const {mock_esm, zrequire} = require("../zjsunit/namespace");
|
||||||
const {run_test} = require("../zjsunit/test");
|
const {run_test} = require("../zjsunit/test");
|
||||||
|
|
||||||
mock_esm("../../static/js/message_scroll", {
|
mock_esm("../../static/js/message_scroll", {
|
||||||
hide_loading_older: () => {},
|
hide_loading_older() {},
|
||||||
|
|
||||||
show_loading_older: () => {},
|
show_loading_older() {},
|
||||||
hide_loading_newer: () => {},
|
hide_loading_newer() {},
|
||||||
show_loading_newer: () => {},
|
show_loading_newer() {},
|
||||||
});
|
});
|
||||||
|
|
||||||
const {FetchStatus} = zrequire("fetch_status");
|
const {FetchStatus} = zrequire("fetch_status");
|
||||||
|
|
|
@ -12,7 +12,7 @@ let $window_stub;
|
||||||
set_global("to_$", () => $window_stub);
|
set_global("to_$", () => $window_stub);
|
||||||
|
|
||||||
mock_esm("../../static/js/search", {
|
mock_esm("../../static/js/search", {
|
||||||
update_button_visibility: () => {},
|
update_button_visibility() {},
|
||||||
});
|
});
|
||||||
set_global("document", "document-stub");
|
set_global("document", "document-stub");
|
||||||
const history = set_global("history", {});
|
const history = set_global("history", {});
|
||||||
|
@ -30,7 +30,7 @@ const stream_settings_ui = mock_esm("../../static/js/stream_settings_ui");
|
||||||
const ui_util = mock_esm("../../static/js/ui_util");
|
const ui_util = mock_esm("../../static/js/ui_util");
|
||||||
const ui_report = mock_esm("../../static/js/ui_report");
|
const ui_report = mock_esm("../../static/js/ui_report");
|
||||||
mock_esm("../../static/js/top_left_corner", {
|
mock_esm("../../static/js/top_left_corner", {
|
||||||
handle_narrow_deactivated: () => {},
|
handle_narrow_deactivated() {},
|
||||||
});
|
});
|
||||||
set_global("favicon", {});
|
set_global("favicon", {});
|
||||||
|
|
||||||
|
@ -152,10 +152,10 @@ function test_helper({override, change_tab}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
clear_events: () => {
|
clear_events() {
|
||||||
events = [];
|
events = [];
|
||||||
},
|
},
|
||||||
assert_events: (expected_events) => {
|
assert_events(expected_events) {
|
||||||
assert.deepEqual(events, expected_events);
|
assert.deepEqual(events, expected_events);
|
||||||
},
|
},
|
||||||
get_narrow_terms: () => narrow_terms,
|
get_narrow_terms: () => narrow_terms,
|
||||||
|
|
|
@ -168,7 +168,7 @@ run_test("copy from pill", ({mock_template}) => {
|
||||||
const e = {
|
const e = {
|
||||||
originalEvent: {
|
originalEvent: {
|
||||||
clipboardData: {
|
clipboardData: {
|
||||||
setData: (format, text) => {
|
setData(format, text) {
|
||||||
assert.equal(format, "text/plain");
|
assert.equal(format, "text/plain");
|
||||||
copied_text = text;
|
copied_text = text;
|
||||||
},
|
},
|
||||||
|
@ -204,7 +204,7 @@ run_test("paste to input", ({mock_template}) => {
|
||||||
const e = {
|
const e = {
|
||||||
originalEvent: {
|
originalEvent: {
|
||||||
clipboardData: {
|
clipboardData: {
|
||||||
getData: (format) => {
|
getData(format) {
|
||||||
assert.equal(format, "text/plain");
|
assert.equal(format, "text/plain");
|
||||||
return paste_text;
|
return paste_text;
|
||||||
},
|
},
|
||||||
|
@ -257,14 +257,14 @@ run_test("arrows on pills", ({mock_template}) => {
|
||||||
|
|
||||||
const $pill_stub = {
|
const $pill_stub = {
|
||||||
prev: () => ({
|
prev: () => ({
|
||||||
trigger: (type) => {
|
trigger(type) {
|
||||||
if (type === "focus") {
|
if (type === "focus") {
|
||||||
prev_focused = true;
|
prev_focused = true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
next: () => ({
|
next: () => ({
|
||||||
trigger: (type) => {
|
trigger(type) {
|
||||||
if (type === "focus") {
|
if (type === "focus") {
|
||||||
next_focused = true;
|
next_focused = true;
|
||||||
}
|
}
|
||||||
|
@ -303,7 +303,7 @@ run_test("left arrow on input", ({mock_template}) => {
|
||||||
|
|
||||||
$container.set_find_results(".pill", {
|
$container.set_find_results(".pill", {
|
||||||
last: () => ({
|
last: () => ({
|
||||||
trigger: (type) => {
|
trigger(type) {
|
||||||
if (type === "focus") {
|
if (type === "focus") {
|
||||||
last_pill_focused = true;
|
last_pill_focused = true;
|
||||||
}
|
}
|
||||||
|
@ -469,7 +469,7 @@ run_test("insert_remove", ({mock_template}) => {
|
||||||
let next_pill_focused = false;
|
let next_pill_focused = false;
|
||||||
|
|
||||||
const $next_pill_stub = {
|
const $next_pill_stub = {
|
||||||
trigger: (type) => {
|
trigger(type) {
|
||||||
if (type === "focus") {
|
if (type === "focus") {
|
||||||
next_pill_focused = true;
|
next_pill_focused = true;
|
||||||
}
|
}
|
||||||
|
@ -520,7 +520,7 @@ run_test("exit button on pill", ({mock_template}) => {
|
||||||
let next_pill_focused = false;
|
let next_pill_focused = false;
|
||||||
|
|
||||||
const $next_pill_stub = {
|
const $next_pill_stub = {
|
||||||
trigger: (type) => {
|
trigger(type) {
|
||||||
if (type === "focus") {
|
if (type === "focus") {
|
||||||
next_pill_focused = true;
|
next_pill_focused = true;
|
||||||
}
|
}
|
||||||
|
@ -534,7 +534,7 @@ run_test("exit button on pill", ({mock_template}) => {
|
||||||
|
|
||||||
const exit_button_stub = {
|
const exit_button_stub = {
|
||||||
to_$: () => ({
|
to_$: () => ({
|
||||||
closest: (sel) => {
|
closest(sel) {
|
||||||
assert.equal(sel, ".pill");
|
assert.equal(sel, ".pill");
|
||||||
return $curr_pill_stub;
|
return $curr_pill_stub;
|
||||||
},
|
},
|
||||||
|
@ -569,7 +569,7 @@ run_test("misc things", () => {
|
||||||
|
|
||||||
const input_stub = {
|
const input_stub = {
|
||||||
to_$: () => ({
|
to_$: () => ({
|
||||||
removeClass: (cls) => {
|
removeClass(cls) {
|
||||||
assert.equal(cls, "shake");
|
assert.equal(cls, "shake");
|
||||||
shake_class_removed = true;
|
shake_class_removed = true;
|
||||||
},
|
},
|
||||||
|
|
|
@ -13,7 +13,8 @@ run_test("test_early_returns", () => {
|
||||||
const opts = {
|
const opts = {
|
||||||
$elem: $stub,
|
$elem: $stub,
|
||||||
handlers: {
|
handlers: {
|
||||||
ArrowLeft: /* istanbul ignore next */ () => {
|
/* istanbul ignore next */
|
||||||
|
ArrowLeft() {
|
||||||
throw new Error("do not dispatch this with alt key");
|
throw new Error("do not dispatch this with alt key");
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -8,13 +8,13 @@ const $ = require("../zjsunit/zjquery");
|
||||||
|
|
||||||
set_global("Image", class Image {});
|
set_global("Image", class Image {});
|
||||||
mock_esm("../../static/js/overlays", {
|
mock_esm("../../static/js/overlays", {
|
||||||
close_overlay: () => {},
|
close_overlay() {},
|
||||||
|
|
||||||
close_active: () => {},
|
close_active() {},
|
||||||
open_overlay: () => {},
|
open_overlay() {},
|
||||||
});
|
});
|
||||||
mock_esm("../../static/js/popovers", {
|
mock_esm("../../static/js/popovers", {
|
||||||
hide_all: () => {},
|
hide_all() {},
|
||||||
});
|
});
|
||||||
const rows = mock_esm("../../static/js/rows");
|
const rows = mock_esm("../../static/js/rows");
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ run_test("config errors", () => {
|
||||||
function basic_conf({first_key, prev_key, next_key}) {
|
function basic_conf({first_key, prev_key, next_key}) {
|
||||||
const list = {
|
const list = {
|
||||||
scroll_container_sel: "whatever",
|
scroll_container_sel: "whatever",
|
||||||
find_li: () => {},
|
find_li() {},
|
||||||
first_key,
|
first_key,
|
||||||
prev_key,
|
prev_key,
|
||||||
next_key,
|
next_key,
|
||||||
|
@ -72,7 +72,7 @@ run_test("single item list", ({override}) => {
|
||||||
|
|
||||||
const $li_stub = {
|
const $li_stub = {
|
||||||
length: 1,
|
length: 1,
|
||||||
addClass: () => {},
|
addClass() {},
|
||||||
};
|
};
|
||||||
|
|
||||||
override(conf.list, "find_li", () => $li_stub);
|
override(conf.list, "find_li", () => $li_stub);
|
||||||
|
|
|
@ -25,7 +25,7 @@ mock_jquery((arg) => {
|
||||||
addClass() {
|
addClass() {
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
replace: (regex, string) => {
|
replace(regex, string) {
|
||||||
arg = arg.replace(regex, string);
|
arg = arg.replace(regex, string);
|
||||||
},
|
},
|
||||||
html: () => arg,
|
html: () => arg,
|
||||||
|
@ -285,7 +285,7 @@ run_test("no filtering", () => {
|
||||||
const opts = {
|
const opts = {
|
||||||
modifier: (item) => div(item),
|
modifier: (item) => div(item),
|
||||||
$simplebar_container: $scroll_container,
|
$simplebar_container: $scroll_container,
|
||||||
callback_after_render: () => {
|
callback_after_render() {
|
||||||
callback_called = true;
|
callback_called = true;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -329,15 +329,15 @@ function sort_button(opts) {
|
||||||
closest: lookup(".progressive-table-wrapper", {
|
closest: lookup(".progressive-table-wrapper", {
|
||||||
data: lookup("list-widget", opts.list_name),
|
data: lookup("list-widget", opts.list_name),
|
||||||
}),
|
}),
|
||||||
addClass: (cls) => {
|
addClass(cls) {
|
||||||
classList.add(cls);
|
classList.add(cls);
|
||||||
},
|
},
|
||||||
hasClass: (cls) => classList.has(cls),
|
hasClass: (cls) => classList.has(cls),
|
||||||
removeClass: (cls) => {
|
removeClass(cls) {
|
||||||
classList.delete(cls);
|
classList.delete(cls);
|
||||||
},
|
},
|
||||||
siblings: lookup(".active", {
|
siblings: lookup(".active", {
|
||||||
removeClass: (cls) => {
|
removeClass(cls) {
|
||||||
assert.equal(cls, "active");
|
assert.equal(cls, "active");
|
||||||
$button.siblings_deactivated = true;
|
$button.siblings_deactivated = true;
|
||||||
},
|
},
|
||||||
|
@ -528,7 +528,7 @@ run_test("clear_event_handlers", () => {
|
||||||
const opts = {
|
const opts = {
|
||||||
name: "list-we-create-twice",
|
name: "list-we-create-twice",
|
||||||
$parent_container: $sort_container,
|
$parent_container: $sort_container,
|
||||||
modifier: () => {},
|
modifier() {},
|
||||||
filter: {
|
filter: {
|
||||||
$element: $filter_element,
|
$element: $filter_element,
|
||||||
predicate: /* istanbul ignore next */ () => true,
|
predicate: /* istanbul ignore next */ () => true,
|
||||||
|
@ -640,7 +640,7 @@ run_test("replace_list_data w/filter update", () => {
|
||||||
modifier: (n) => "(" + n.toString() + ")",
|
modifier: (n) => "(" + n.toString() + ")",
|
||||||
filter: {
|
filter: {
|
||||||
predicate: (n) => n % 2 === 0,
|
predicate: (n) => n % 2 === 0,
|
||||||
onupdate: () => {
|
onupdate() {
|
||||||
num_updates += 1;
|
num_updates += 1;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -722,7 +722,7 @@ run_test("render item", () => {
|
||||||
// Return a JQuery stub for the original HTML.
|
// Return a JQuery stub for the original HTML.
|
||||||
// We want this to be called when we replace
|
// We want this to be called when we replace
|
||||||
// the existing HTML with newly rendered HTML.
|
// the existing HTML with newly rendered HTML.
|
||||||
replaceWith: (html) => {
|
replaceWith(html) {
|
||||||
assert.equal(new_html, html);
|
assert.equal(new_html, html);
|
||||||
called = true;
|
called = true;
|
||||||
$container.$appended_data.replace(regex, new_html);
|
$container.$appended_data.replace(regex, new_html);
|
||||||
|
@ -786,7 +786,7 @@ run_test("render item", () => {
|
||||||
const widget_2 = ListWidget.create($container, list, {
|
const widget_2 = ListWidget.create($container, list, {
|
||||||
name: "replace-list",
|
name: "replace-list",
|
||||||
modifier: (item) => `<tr data-item=${item.value}>${item.text}</tr>\n`,
|
modifier: (item) => `<tr data-item=${item.value}>${item.text}</tr>\n`,
|
||||||
get_item: (item) => {
|
get_item(item) {
|
||||||
get_item_called = true;
|
get_item_called = true;
|
||||||
return item;
|
return item;
|
||||||
},
|
},
|
||||||
|
|
|
@ -844,7 +844,7 @@ test("missing unicode emojis", ({override}) => {
|
||||||
test("katex_throws_unexpected_exceptions", ({override_rewire}) => {
|
test("katex_throws_unexpected_exceptions", ({override_rewire}) => {
|
||||||
const message = {raw_content: "$$a$$"};
|
const message = {raw_content: "$$a$$"};
|
||||||
override_rewire(markdown, "katex", {
|
override_rewire(markdown, "katex", {
|
||||||
renderToString: () => {
|
renderToString() {
|
||||||
throw new Error("some-exception");
|
throw new Error("some-exception");
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -38,14 +38,14 @@ const message_helper = mock_esm("../../static/js/message_helper");
|
||||||
const message_lists = mock_esm("../../static/js/message_lists");
|
const message_lists = mock_esm("../../static/js/message_lists");
|
||||||
const message_util = mock_esm("../../static/js/message_util");
|
const message_util = mock_esm("../../static/js/message_util");
|
||||||
const stream_list = mock_esm("../../static/js/stream_list", {
|
const stream_list = mock_esm("../../static/js/stream_list", {
|
||||||
maybe_scroll_narrow_into_view: () => {},
|
maybe_scroll_narrow_into_view() {},
|
||||||
});
|
});
|
||||||
mock_esm("../../static/js/message_scroll", {
|
mock_esm("../../static/js/message_scroll", {
|
||||||
show_loading_older: noop,
|
show_loading_older: noop,
|
||||||
hide_loading_older: noop,
|
hide_loading_older: noop,
|
||||||
show_loading_newer: noop,
|
show_loading_newer: noop,
|
||||||
hide_loading_newer: noop,
|
hide_loading_newer: noop,
|
||||||
update_top_of_narrow_notices: () => {},
|
update_top_of_narrow_notices() {},
|
||||||
});
|
});
|
||||||
set_global("document", "document-stub");
|
set_global("document", "document-stub");
|
||||||
|
|
||||||
|
|
|
@ -9,9 +9,9 @@ const channel = mock_esm("../../static/js/channel");
|
||||||
const ui = mock_esm("../../static/js/ui");
|
const ui = mock_esm("../../static/js/ui");
|
||||||
|
|
||||||
mock_esm("../../static/js/starred_messages", {
|
mock_esm("../../static/js/starred_messages", {
|
||||||
add: () => {},
|
add() {},
|
||||||
get_starred_msg_ids: () => [1, 2, 3, 4, 5],
|
get_starred_msg_ids: () => [1, 2, 3, 4, 5],
|
||||||
remove: () => {},
|
remove() {},
|
||||||
});
|
});
|
||||||
|
|
||||||
const message_flags = zrequire("message_flags");
|
const message_flags = zrequire("message_flags");
|
||||||
|
|
|
@ -19,7 +19,7 @@ const settings_config = zrequire("settings_config");
|
||||||
|
|
||||||
const compose_pm_pill = mock_esm("../../static/js/compose_pm_pill");
|
const compose_pm_pill = mock_esm("../../static/js/compose_pm_pill");
|
||||||
mock_esm("../../static/js/spectators", {
|
mock_esm("../../static/js/spectators", {
|
||||||
login_to_access: () => {},
|
login_to_access() {},
|
||||||
});
|
});
|
||||||
|
|
||||||
function empty_narrow_html(title, html, search_data) {
|
function empty_narrow_html(title, html, search_data) {
|
||||||
|
|
|
@ -7,7 +7,7 @@ const {run_test} = require("../zjsunit/test");
|
||||||
const $ = require("../zjsunit/zjquery");
|
const $ = require("../zjsunit/zjquery");
|
||||||
|
|
||||||
mock_esm("../../static/js/resize", {
|
mock_esm("../../static/js/resize", {
|
||||||
resize_stream_filters_container: () => {},
|
resize_stream_filters_container() {},
|
||||||
});
|
});
|
||||||
|
|
||||||
const all_messages_data = mock_esm("../../static/js/all_messages_data");
|
const all_messages_data = mock_esm("../../static/js/all_messages_data");
|
||||||
|
@ -38,7 +38,7 @@ const typing_events = mock_esm("../../static/js/typing_events");
|
||||||
const ui_util = mock_esm("../../static/js/ui_util");
|
const ui_util = mock_esm("../../static/js/ui_util");
|
||||||
const unread_ops = mock_esm("../../static/js/unread_ops");
|
const unread_ops = mock_esm("../../static/js/unread_ops");
|
||||||
mock_esm("../../static/js/recent_topics_util", {
|
mock_esm("../../static/js/recent_topics_util", {
|
||||||
is_visible: () => {},
|
is_visible() {},
|
||||||
});
|
});
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -98,13 +98,13 @@ function test_helper() {
|
||||||
$("#mark_as_read_turned_off_banner").toggleClass = () => {};
|
$("#mark_as_read_turned_off_banner").toggleClass = () => {};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
clear: () => {
|
clear() {
|
||||||
events = [];
|
events = [];
|
||||||
},
|
},
|
||||||
push_event: (event) => {
|
push_event(event) {
|
||||||
events.push(event);
|
events.push(event);
|
||||||
},
|
},
|
||||||
assert_events: (expected_events) => {
|
assert_events(expected_events) {
|
||||||
assert.deepEqual(events, expected_events);
|
assert.deepEqual(events, expected_events);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -44,15 +44,15 @@ function test_with(fixture) {
|
||||||
has_found_newest: () => fixture.has_found_newest,
|
has_found_newest: () => fixture.has_found_newest,
|
||||||
},
|
},
|
||||||
empty: () => fixture.empty,
|
empty: () => fixture.empty,
|
||||||
all_messages: () => {
|
all_messages() {
|
||||||
assert.notEqual(fixture.all_messages, undefined);
|
assert.notEqual(fixture.all_messages, undefined);
|
||||||
return fixture.all_messages;
|
return fixture.all_messages;
|
||||||
},
|
},
|
||||||
first: () => {
|
first() {
|
||||||
assert.notEqual(fixture.all_messages, undefined);
|
assert.notEqual(fixture.all_messages, undefined);
|
||||||
return fixture.all_messages[0];
|
return fixture.all_messages[0];
|
||||||
},
|
},
|
||||||
last: () => {
|
last() {
|
||||||
assert.notEqual(fixture.all_messages, undefined);
|
assert.notEqual(fixture.all_messages, undefined);
|
||||||
return fixture.all_messages.at(-1);
|
return fixture.all_messages.at(-1);
|
||||||
},
|
},
|
||||||
|
|
|
@ -199,7 +199,7 @@ test("get_active_user_ids_string", () => {
|
||||||
|
|
||||||
function set_filter_result(emails) {
|
function set_filter_result(emails) {
|
||||||
const active_filter = {
|
const active_filter = {
|
||||||
operands: (operand) => {
|
operands(operand) {
|
||||||
assert.equal(operand, "pm-with");
|
assert.equal(operand, "pm-with");
|
||||||
return emails;
|
return emails;
|
||||||
},
|
},
|
||||||
|
@ -216,7 +216,7 @@ test("get_active_user_ids_string", () => {
|
||||||
|
|
||||||
function private_filter() {
|
function private_filter() {
|
||||||
return {
|
return {
|
||||||
operands: (operand) => {
|
operands(operand) {
|
||||||
assert.equal(operand, "is");
|
assert.equal(operand, "is");
|
||||||
return ["private", "starred"];
|
return ["private", "starred"];
|
||||||
},
|
},
|
||||||
|
@ -247,7 +247,7 @@ test("get_list_info", ({override}) => {
|
||||||
// Filter` rather than creating a mock.
|
// Filter` rather than creating a mock.
|
||||||
function set_filter_result(emails) {
|
function set_filter_result(emails) {
|
||||||
const active_filter = {
|
const active_filter = {
|
||||||
operands: (operand) => {
|
operands(operand) {
|
||||||
assert.equal(operand, "pm-with");
|
assert.equal(operand, "pm-with");
|
||||||
return emails;
|
return emails;
|
||||||
},
|
},
|
||||||
|
|
|
@ -42,7 +42,7 @@ let expected_data_to_replace_in_list_widget;
|
||||||
const ListWidget = mock_esm("../../static/js/list_widget", {
|
const ListWidget = mock_esm("../../static/js/list_widget", {
|
||||||
modifier: noop,
|
modifier: noop,
|
||||||
|
|
||||||
create: (container, mapped_topic_values, opts) => {
|
create(container, mapped_topic_values, opts) {
|
||||||
const formatted_topics = [];
|
const formatted_topics = [];
|
||||||
ListWidget.modifier = opts.modifier;
|
ListWidget.modifier = opts.modifier;
|
||||||
for (const item of mapped_topic_values) {
|
for (const item of mapped_topic_values) {
|
||||||
|
@ -64,7 +64,7 @@ const ListWidget = mock_esm("../../static/js/list_widget", {
|
||||||
|
|
||||||
hard_redraw: noop,
|
hard_redraw: noop,
|
||||||
filter_and_sort: noop,
|
filter_and_sort: noop,
|
||||||
replace_list_data: (data) => {
|
replace_list_data(data) {
|
||||||
assert.notEqual(
|
assert.notEqual(
|
||||||
expected_data_to_replace_in_list_widget,
|
expected_data_to_replace_in_list_widget,
|
||||||
undefined,
|
undefined,
|
||||||
|
@ -94,7 +94,7 @@ mock_esm("../../static/js/message_view_header", {
|
||||||
render_title_area: noop,
|
render_title_area: noop,
|
||||||
});
|
});
|
||||||
mock_esm("../../static/js/user_topics", {
|
mock_esm("../../static/js/user_topics", {
|
||||||
is_topic_muted: (stream_id, topic) => {
|
is_topic_muted(stream_id, topic) {
|
||||||
if (stream_id === stream1 && topic === topic7) {
|
if (stream_id === stream1 && topic === topic7) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ mock_esm("../../static/js/timerender", {
|
||||||
get_full_datetime: () => "date at time",
|
get_full_datetime: () => "date at time",
|
||||||
});
|
});
|
||||||
mock_esm("../../static/js/sub_store", {
|
mock_esm("../../static/js/sub_store", {
|
||||||
get: (stream) => {
|
get(stream) {
|
||||||
if (stream === stream5) {
|
if (stream === stream5) {
|
||||||
// No data is available for deactivated streams
|
// No data is available for deactivated streams
|
||||||
return undefined;
|
return undefined;
|
||||||
|
@ -146,7 +146,7 @@ mock_esm("../../static/js/top_left_corner", {
|
||||||
narrow_to_recent_topics: noop,
|
narrow_to_recent_topics: noop,
|
||||||
});
|
});
|
||||||
mock_esm("../../static/js/unread", {
|
mock_esm("../../static/js/unread", {
|
||||||
num_unread_for_topic: (stream_id, topic) => {
|
num_unread_for_topic(stream_id, topic) {
|
||||||
if (stream_id === 1 && topic === "topic-1") {
|
if (stream_id === 1 && topic === "topic-1") {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -368,7 +368,7 @@ function assert_clipboard_setup() {
|
||||||
assert.equal(clipboard_args[0], "copy-code-stub");
|
assert.equal(clipboard_args[0], "copy-code-stub");
|
||||||
const text = clipboard_args[1].text({
|
const text = clipboard_args[1].text({
|
||||||
to_$: () => ({
|
to_$: () => ({
|
||||||
siblings: (arg) => {
|
siblings(arg) {
|
||||||
assert.equal(arg, "code");
|
assert.equal(arg, "code");
|
||||||
return {
|
return {
|
||||||
text: () => "text",
|
text: () => "text",
|
||||||
|
|
|
@ -47,7 +47,7 @@ const custom_profile_field_types = {
|
||||||
|
|
||||||
page_params.custom_profile_field_types = custom_profile_field_types;
|
page_params.custom_profile_field_types = custom_profile_field_types;
|
||||||
|
|
||||||
mock_esm("sortablejs", {Sortable: {create: () => {}}});
|
mock_esm("sortablejs", {Sortable: {create() {}}});
|
||||||
|
|
||||||
const settings_profile_fields = zrequire("settings_profile_fields");
|
const settings_profile_fields = zrequire("settings_profile_fields");
|
||||||
|
|
||||||
|
|
|
@ -26,10 +26,10 @@ const message_view_header = mock_esm("../../static/js/message_view_header", {
|
||||||
maybe_rerender_title_area_for_stream() {},
|
maybe_rerender_title_area_for_stream() {},
|
||||||
});
|
});
|
||||||
mock_esm("../../static/js/recent_topics_ui", {
|
mock_esm("../../static/js/recent_topics_ui", {
|
||||||
complete_rerender: () => {},
|
complete_rerender() {},
|
||||||
});
|
});
|
||||||
mock_esm("../../static/js/settings_notifications", {
|
mock_esm("../../static/js/settings_notifications", {
|
||||||
update_page: () => {},
|
update_page() {},
|
||||||
});
|
});
|
||||||
|
|
||||||
mock_esm("../../static/js/overlays", {streams_open: () => true});
|
mock_esm("../../static/js/overlays", {streams_open: () => true});
|
||||||
|
|
|
@ -379,7 +379,7 @@ test_ui("zoom_in_and_zoom_out", ({mock_template}) => {
|
||||||
mock_template("filter_topics", false, () => "filter-topics-stub");
|
mock_template("filter_topics", false, () => "filter-topics-stub");
|
||||||
let filter_topics_appended = false;
|
let filter_topics_appended = false;
|
||||||
$stream_li1.children = () => ({
|
$stream_li1.children = () => ({
|
||||||
append: (html) => {
|
append(html) {
|
||||||
assert.equal(html, "filter-topics-stub");
|
assert.equal(html, "filter-topics-stub");
|
||||||
filter_topics_appended = true;
|
filter_topics_appended = true;
|
||||||
},
|
},
|
||||||
|
|
|
@ -30,10 +30,10 @@ function make_cursor_helper() {
|
||||||
const events = [];
|
const events = [];
|
||||||
|
|
||||||
stream_list.__Rewire__("stream_cursor", {
|
stream_list.__Rewire__("stream_cursor", {
|
||||||
reset: () => {
|
reset() {
|
||||||
events.push("reset");
|
events.push("reset");
|
||||||
},
|
},
|
||||||
clear: () => {
|
clear() {
|
||||||
events.push("clear");
|
events.push("clear");
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -13,7 +13,7 @@ const ui = mock_esm("../../static/js/ui", {
|
||||||
});
|
});
|
||||||
|
|
||||||
mock_esm("../../static/js/hash_util", {
|
mock_esm("../../static/js/hash_util", {
|
||||||
by_stream_url: () => {},
|
by_stream_url() {},
|
||||||
get_current_hash_section: () => denmark_stream_id,
|
get_current_hash_section: () => denmark_stream_id,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -27,12 +27,12 @@ run_test("scrub_realm", () => {
|
||||||
|
|
||||||
let submit_form_called = false;
|
let submit_form_called = false;
|
||||||
$fake_this.form = {
|
$fake_this.form = {
|
||||||
submit: () => {
|
submit() {
|
||||||
submit_form_called = true;
|
submit_form_called = true;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
const event = {
|
const event = {
|
||||||
preventDefault: () => {},
|
preventDefault() {},
|
||||||
};
|
};
|
||||||
|
|
||||||
window.prompt = () => "zulip";
|
window.prompt = () => "zulip";
|
||||||
|
|
|
@ -7,7 +7,7 @@ const {run_test} = require("../zjsunit/test");
|
||||||
const $ = require("../zjsunit/zjquery");
|
const $ = require("../zjsunit/zjquery");
|
||||||
|
|
||||||
mock_esm("../../static/js/resize", {
|
mock_esm("../../static/js/resize", {
|
||||||
resize_stream_filters_container: () => {},
|
resize_stream_filters_container() {},
|
||||||
});
|
});
|
||||||
|
|
||||||
const {Filter} = zrequire("../js/filter");
|
const {Filter} = zrequire("../js/filter");
|
||||||
|
|
|
@ -195,10 +195,10 @@ test("upload_files", ({override, override_rewire}) => {
|
||||||
];
|
];
|
||||||
let uppy_add_file_called = false;
|
let uppy_add_file_called = false;
|
||||||
const uppy = {
|
const uppy = {
|
||||||
cancelAll: () => {
|
cancelAll() {
|
||||||
uppy_cancel_all_called = true;
|
uppy_cancel_all_called = true;
|
||||||
},
|
},
|
||||||
addFile: (params) => {
|
addFile(params) {
|
||||||
uppy_add_file_called = true;
|
uppy_add_file_called = true;
|
||||||
assert.equal(params.source, "compose-file-input");
|
assert.equal(params.source, "compose-file-input");
|
||||||
assert.equal(params.name, "budapest.png");
|
assert.equal(params.name, "budapest.png");
|
||||||
|
@ -325,11 +325,11 @@ test("uppy_config", () => {
|
||||||
assert.ok("exceedsSize" in config.locale.strings);
|
assert.ok("exceedsSize" in config.locale.strings);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
setMeta: (params) => {
|
setMeta(params) {
|
||||||
uppy_set_meta_called = true;
|
uppy_set_meta_called = true;
|
||||||
assert.equal(params.csrfmiddlewaretoken, "csrf_token");
|
assert.equal(params.csrfmiddlewaretoken, "csrf_token");
|
||||||
},
|
},
|
||||||
use: (func, params) => {
|
use(func, params) {
|
||||||
const func_name = func.name;
|
const func_name = func.name;
|
||||||
if (func_name === "XHRUpload") {
|
if (func_name === "XHRUpload") {
|
||||||
uppy_used_xhrupload = true;
|
uppy_used_xhrupload = true;
|
||||||
|
@ -348,7 +348,7 @@ test("uppy_config", () => {
|
||||||
assert.fail(`Missing tests for ${func_name}`);
|
assert.fail(`Missing tests for ${func_name}`);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
on: () => {},
|
on() {},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
upload.setup_upload({mode: "compose"});
|
upload.setup_upload({mode: "compose"});
|
||||||
|
@ -385,7 +385,7 @@ test("file_drop", ({override_rewire}) => {
|
||||||
|
|
||||||
let prevent_default_counter = 0;
|
let prevent_default_counter = 0;
|
||||||
const drag_event = {
|
const drag_event = {
|
||||||
preventDefault: () => {
|
preventDefault() {
|
||||||
prevent_default_counter += 1;
|
prevent_default_counter += 1;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -399,7 +399,7 @@ test("file_drop", ({override_rewire}) => {
|
||||||
|
|
||||||
const files = ["file1", "file2"];
|
const files = ["file1", "file2"];
|
||||||
const drop_event = {
|
const drop_event = {
|
||||||
preventDefault: () => {
|
preventDefault() {
|
||||||
prevent_default_counter += 1;
|
prevent_default_counter += 1;
|
||||||
},
|
},
|
||||||
originalEvent: {
|
originalEvent: {
|
||||||
|
@ -429,7 +429,7 @@ test("copy_paste", ({override_rewire}) => {
|
||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
kind: "file",
|
kind: "file",
|
||||||
getAsFile: () => {
|
getAsFile() {
|
||||||
get_as_file_called = true;
|
get_as_file_called = true;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -465,16 +465,16 @@ test("uppy_events", ({override, override_rewire}) => {
|
||||||
|
|
||||||
uppy_stub = function () {
|
uppy_stub = function () {
|
||||||
return {
|
return {
|
||||||
setMeta: () => {},
|
setMeta() {},
|
||||||
use: () => {},
|
use() {},
|
||||||
cancelAll: () => {
|
cancelAll() {
|
||||||
uppy_cancel_all_called = true;
|
uppy_cancel_all_called = true;
|
||||||
},
|
},
|
||||||
on: (event_name, callback) => {
|
on(event_name, callback) {
|
||||||
callbacks[event_name] = callback;
|
callbacks[event_name] = callback;
|
||||||
},
|
},
|
||||||
getFiles: () => [...files],
|
getFiles: () => [...files],
|
||||||
removeFile: (file_id) => {
|
removeFile(file_id) {
|
||||||
files = files.filter((file) => file.id !== file_id);
|
files = files.filter((file) => file.id !== file_id);
|
||||||
},
|
},
|
||||||
getState: () => ({
|
getState: () => ({
|
||||||
|
|
|
@ -15,10 +15,10 @@ const _document = {
|
||||||
|
|
||||||
const fake_buddy_list = {
|
const fake_buddy_list = {
|
||||||
scroll_container_sel: "#whatever",
|
scroll_container_sel: "#whatever",
|
||||||
find_li: () => {},
|
find_li() {},
|
||||||
first_key: () => {},
|
first_key() {},
|
||||||
prev_key: () => {},
|
prev_key() {},
|
||||||
next_key: () => {},
|
next_key() {},
|
||||||
};
|
};
|
||||||
|
|
||||||
mock_esm("../../static/js/buddy_list", {
|
mock_esm("../../static/js/buddy_list", {
|
||||||
|
|
|
@ -129,7 +129,7 @@ run_test("server", () => {
|
||||||
|
|
||||||
user_status.server_update_status({
|
user_status.server_update_status({
|
||||||
status_text: "out to lunch",
|
status_text: "out to lunch",
|
||||||
success: () => {
|
success() {
|
||||||
called = true;
|
called = true;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -71,13 +71,13 @@ run_test("attribute updates", () => {
|
||||||
return {
|
return {
|
||||||
children: () => [],
|
children: () => [],
|
||||||
|
|
||||||
attr: (k, v) => {
|
attr(k, v) {
|
||||||
assert.equal(k, "color");
|
assert.equal(k, "color");
|
||||||
assert.equal(v, "red");
|
assert.equal(v, "red");
|
||||||
updated = true;
|
updated = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
removeAttr: (k) => {
|
removeAttr(k) {
|
||||||
assert.equal(k, "id");
|
assert.equal(k, "id");
|
||||||
removed = true;
|
removed = true;
|
||||||
},
|
},
|
||||||
|
@ -184,10 +184,10 @@ run_test("partial updates", () => {
|
||||||
|
|
||||||
find = () => ({
|
find = () => ({
|
||||||
children: () => ({
|
children: () => ({
|
||||||
eq: (i) => {
|
eq(i) {
|
||||||
assert.equal(i, 0);
|
assert.equal(i, 0);
|
||||||
return {
|
return {
|
||||||
replaceWith: (html) => {
|
replaceWith(html) {
|
||||||
patched_html = html;
|
patched_html = html;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -90,7 +90,7 @@ test("activate", ({override}) => {
|
||||||
message: {
|
message: {
|
||||||
id: 2001,
|
id: 2001,
|
||||||
},
|
},
|
||||||
post_to_server: (data) => {
|
post_to_server(data) {
|
||||||
assert.equal(data.msg_type, "widget");
|
assert.equal(data.msg_type, "widget");
|
||||||
assert.equal(data.data, "test_data");
|
assert.equal(data.data, "test_data");
|
||||||
},
|
},
|
||||||
|
|
|
@ -46,7 +46,7 @@ assert.notEqual(files.length, 0, "No tests found");
|
||||||
|
|
||||||
// Set up our namespace helpers.
|
// Set up our namespace helpers.
|
||||||
const window = new Proxy(global, {
|
const window = new Proxy(global, {
|
||||||
set: (obj, prop, value) => {
|
set(obj, prop, value) {
|
||||||
namespace.set_global(prop, value);
|
namespace.set_global(prop, value);
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
|
@ -51,7 +51,7 @@ function make_zjquery() {
|
||||||
// that you'd find on a "real" jQuery object. Sometimes we
|
// that you'd find on a "real" jQuery object. Sometimes we
|
||||||
// expects devs to create their own stubs.
|
// expects devs to create their own stubs.
|
||||||
const handler = {
|
const handler = {
|
||||||
get: (target, key) => {
|
get(target, key) {
|
||||||
// Handle the special case of equality checks, which
|
// Handle the special case of equality checks, which
|
||||||
// we can infer by assert.equal trying to access the
|
// we can infer by assert.equal trying to access the
|
||||||
// "stack" key.
|
// "stack" key.
|
||||||
|
|
|
@ -614,13 +614,13 @@ export function initialize() {
|
||||||
arrow: true,
|
arrow: true,
|
||||||
placement,
|
placement,
|
||||||
showOnCreate: true,
|
showOnCreate: true,
|
||||||
onHidden: (instance) => {
|
onHidden(instance) {
|
||||||
instance.destroy();
|
instance.destroy();
|
||||||
if (is_custom_observer_needed) {
|
if (is_custom_observer_needed) {
|
||||||
observer.disconnect();
|
observer.disconnect();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onShow: (instance) => {
|
onShow(instance) {
|
||||||
if (!is_custom_observer_needed) {
|
if (!is_custom_observer_needed) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ export function maybe_show_deprecation_notice(key) {
|
||||||
html_heading: $t_html({defaultMessage: "Deprecation notice"}),
|
html_heading: $t_html({defaultMessage: "Deprecation notice"}),
|
||||||
html_body: message,
|
html_body: message,
|
||||||
html_submit_button: $t_html({defaultMessage: "Got it"}),
|
html_submit_button: $t_html({defaultMessage: "Got it"}),
|
||||||
on_click: () => {},
|
on_click() {},
|
||||||
close_on_submit: true,
|
close_on_submit: true,
|
||||||
focus_submit_on_open: true,
|
focus_submit_on_open: true,
|
||||||
single_footer_button: true,
|
single_footer_button: true,
|
||||||
|
|
|
@ -153,7 +153,7 @@ export function launch(conf) {
|
||||||
|
|
||||||
overlays.open_modal("dialog_widget_modal", {
|
overlays.open_modal("dialog_widget_modal", {
|
||||||
autoremove: true,
|
autoremove: true,
|
||||||
on_show: () => {
|
on_show() {
|
||||||
if (conf.focus_submit_on_open) {
|
if (conf.focus_submit_on_open) {
|
||||||
$submit_button.trigger("focus");
|
$submit_button.trigger("focus");
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ export function show_flatpickr(element, callback, default_timestamp, options = {
|
||||||
formatDate: (date) => formatISO(date),
|
formatDate: (date) => formatISO(date),
|
||||||
disableMobile: true,
|
disableMobile: true,
|
||||||
time_24hr: user_settings.twenty_four_hour_time,
|
time_24hr: user_settings.twenty_four_hour_time,
|
||||||
onKeyDown: (selectedDates, dateStr, instance, event) => {
|
onKeyDown(selectedDates, dateStr, instance, event) {
|
||||||
if (is_numeric_key(event.key)) {
|
if (is_numeric_key(event.key)) {
|
||||||
// Don't attempt to get_keydown_hotkey for numeric inputs
|
// Don't attempt to get_keydown_hotkey for numeric inputs
|
||||||
// as it would return undefined.
|
// as it would return undefined.
|
||||||
|
|
|
@ -101,7 +101,7 @@ async function renderGIPHYGrid(targetEl) {
|
||||||
// Hide the creator attribution that appears over a
|
// Hide the creator attribution that appears over a
|
||||||
// GIF; nice in principle but too distracting.
|
// GIF; nice in principle but too distracting.
|
||||||
hideAttribution: true,
|
hideAttribution: true,
|
||||||
onGifClick: (props) => {
|
onGifClick(props) {
|
||||||
let $textarea = $("#compose-textarea");
|
let $textarea = $("#compose-textarea");
|
||||||
if (edit_message_id !== undefined) {
|
if (edit_message_id !== undefined) {
|
||||||
$textarea = $(
|
$textarea = $(
|
||||||
|
@ -115,7 +115,7 @@ async function renderGIPHYGrid(targetEl) {
|
||||||
);
|
);
|
||||||
hide_giphy_popover();
|
hide_giphy_popover();
|
||||||
},
|
},
|
||||||
onGifVisible: (gif, e) => {
|
onGifVisible(gif, e) {
|
||||||
// Set tabindex for all the GIFs that
|
// Set tabindex for all the GIFs that
|
||||||
// are visible to the user. This allows
|
// are visible to the user. This allows
|
||||||
// user to navigate the GIFs using tab.
|
// user to navigate the GIFs using tab.
|
||||||
|
@ -134,7 +134,7 @@ async function renderGIPHYGrid(targetEl) {
|
||||||
window.addEventListener("resize", resizeRender, false);
|
window.addEventListener("resize", resizeRender, false);
|
||||||
const remove = render();
|
const remove = render();
|
||||||
return {
|
return {
|
||||||
remove: () => {
|
remove() {
|
||||||
remove();
|
remove();
|
||||||
window.removeEventListener("resize", resizeRender, false);
|
window.removeEventListener("resize", resizeRender, false);
|
||||||
},
|
},
|
||||||
|
|
|
@ -14,7 +14,8 @@ export const intl = createIntl(
|
||||||
locale: page_params.request_language,
|
locale: page_params.request_language,
|
||||||
defaultLocale: "en",
|
defaultLocale: "en",
|
||||||
messages: page_params.translation_data,
|
messages: page_params.translation_data,
|
||||||
onError: /* istanbul ignore next */ (error) => {
|
/* istanbul ignore next */
|
||||||
|
onError(error) {
|
||||||
// Ignore complaints about untranslated strings that were
|
// Ignore complaints about untranslated strings that were
|
||||||
// added since the last sync-translations run.
|
// added since the last sync-translations run.
|
||||||
if (error.code !== IntlErrorCode.MISSING_TRANSLATION) {
|
if (error.code !== IntlErrorCode.MISSING_TRANSLATION) {
|
||||||
|
|
|
@ -153,11 +153,11 @@ export function show_history(message) {
|
||||||
html_body: rendered_message_history,
|
html_body: rendered_message_history,
|
||||||
html_submit_button: $t_html({defaultMessage: "Close"}),
|
html_submit_button: $t_html({defaultMessage: "Close"}),
|
||||||
id: "message-edit-history",
|
id: "message-edit-history",
|
||||||
on_click: () => {},
|
on_click() {},
|
||||||
close_on_submit: true,
|
close_on_submit: true,
|
||||||
focus_submit_on_open: true,
|
focus_submit_on_open: true,
|
||||||
single_footer_button: true,
|
single_footer_button: true,
|
||||||
post_render: () => {
|
post_render() {
|
||||||
fetch_and_render_message_history(message);
|
fetch_and_render_message_history(message);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -17,7 +17,7 @@ export function show_user_list(message_id) {
|
||||||
$("body").append(render_read_receipts_modal());
|
$("body").append(render_read_receipts_modal());
|
||||||
overlays.open_modal("read_receipts_modal", {
|
overlays.open_modal("read_receipts_modal", {
|
||||||
autoremove: true,
|
autoremove: true,
|
||||||
on_show: () => {
|
on_show() {
|
||||||
const message = message_store.get(message_id);
|
const message = message_store.get(message_id);
|
||||||
if (message.sender_email === "notification-bot@zulip.com") {
|
if (message.sender_email === "notification-bot@zulip.com") {
|
||||||
$("#read_receipts_modal .read_receipts_info").text(
|
$("#read_receipts_modal .read_receipts_info").text(
|
||||||
|
@ -79,7 +79,7 @@ export function show_user_list(message_id) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
on_hide: () => {
|
on_hide() {
|
||||||
// Ensure any user info popovers are closed
|
// Ensure any user info popovers are closed
|
||||||
popovers.hide_all();
|
popovers.hide_all();
|
||||||
},
|
},
|
||||||
|
|
|
@ -438,7 +438,7 @@ export function set_up() {
|
||||||
$("#api_key_status").hide();
|
$("#api_key_status").hide();
|
||||||
overlays.open_modal("api_key_modal", {
|
overlays.open_modal("api_key_modal", {
|
||||||
autoremove: true,
|
autoremove: true,
|
||||||
on_show: () => {
|
on_show() {
|
||||||
$("#get_api_key_password").trigger("focus");
|
$("#get_api_key_password").trigger("focus");
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -658,7 +658,7 @@ export function set_up() {
|
||||||
form_id: "change_email_container",
|
form_id: "change_email_container",
|
||||||
on_click: do_change_email,
|
on_click: do_change_email,
|
||||||
post_render: change_email_post_render,
|
post_render: change_email_post_render,
|
||||||
on_shown: () => {
|
on_shown() {
|
||||||
$("#change_email_container input").trigger("focus");
|
$("#change_email_container input").trigger("focus");
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -144,7 +144,7 @@ export function launch_default_language_setting_modal() {
|
||||||
focus_submit_on_open: true,
|
focus_submit_on_open: true,
|
||||||
single_footer_button: true,
|
single_footer_button: true,
|
||||||
post_render: default_language_modal_post_render,
|
post_render: default_language_modal_post_render,
|
||||||
on_click: () => {},
|
on_click() {},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -887,7 +887,7 @@ export function init_dropdown_widgets() {
|
||||||
name: x.name,
|
name: x.name,
|
||||||
value: x.stream_id.toString(),
|
value: x.stream_id.toString(),
|
||||||
})),
|
})),
|
||||||
on_update: () => {
|
on_update() {
|
||||||
save_discard_widget_status_handler($("#org-notifications"));
|
save_discard_widget_status_handler($("#org-notifications"));
|
||||||
},
|
},
|
||||||
default_text: $t({defaultMessage: "Disabled"}),
|
default_text: $t({defaultMessage: "Disabled"}),
|
||||||
|
@ -913,7 +913,7 @@ export function init_dropdown_widgets() {
|
||||||
value: x,
|
value: x,
|
||||||
})),
|
})),
|
||||||
value: page_params.realm_default_code_block_language,
|
value: page_params.realm_default_code_block_language,
|
||||||
on_update: () => {
|
on_update() {
|
||||||
save_discard_widget_status_handler($("#org-other-settings"));
|
save_discard_widget_status_handler($("#org-other-settings"));
|
||||||
},
|
},
|
||||||
default_text: $t({defaultMessage: "No language set"}),
|
default_text: $t({defaultMessage: "No language set"}),
|
||||||
|
|
|
@ -142,11 +142,11 @@ export function show_realm_domains_modal() {
|
||||||
html_body: realm_domains_table_body,
|
html_body: realm_domains_table_body,
|
||||||
html_submit_button: $t_html({defaultMessage: "Close"}),
|
html_submit_button: $t_html({defaultMessage: "Close"}),
|
||||||
id: "realm_domains_modal",
|
id: "realm_domains_modal",
|
||||||
on_click: () => {},
|
on_click() {},
|
||||||
close_on_submit: true,
|
close_on_submit: true,
|
||||||
focus_submit_on_open: true,
|
focus_submit_on_open: true,
|
||||||
single_footer_button: true,
|
single_footer_button: true,
|
||||||
post_render: () => {
|
post_render() {
|
||||||
setup_realm_domains_modal_handlers();
|
setup_realm_domains_modal_handlers();
|
||||||
populate_realm_domains_table(page_params.realm_domains);
|
populate_realm_domains_table(page_params.realm_domains);
|
||||||
},
|
},
|
||||||
|
|
|
@ -31,7 +31,7 @@ export function login_to_access(empty_narrow) {
|
||||||
|
|
||||||
overlays.open_modal("login_to_access_modal", {
|
overlays.open_modal("login_to_access_modal", {
|
||||||
autoremove: true,
|
autoremove: true,
|
||||||
on_hide: () => {
|
on_hide() {
|
||||||
browser_history.return_to_web_public_hash();
|
browser_history.return_to_web_public_hash();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -372,7 +372,7 @@ export function set_up_handlers() {
|
||||||
confirm_dialog.launch({
|
confirm_dialog.launch({
|
||||||
html_heading: $t_html({defaultMessage: "Large number of subscribers"}),
|
html_heading: $t_html({defaultMessage: "Large number of subscribers"}),
|
||||||
html_body,
|
html_body,
|
||||||
on_click: () => {
|
on_click() {
|
||||||
create_stream();
|
create_stream();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -105,7 +105,7 @@ export function build_widgets() {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
$simplebar_container,
|
$simplebar_container,
|
||||||
html_selector: (user_id) => {
|
html_selector(user_id) {
|
||||||
const user = people.get_by_user_id(user_id);
|
const user = people.get_by_user_id(user_id);
|
||||||
return $(`#${CSS.escape("user_checkbox_" + user.user_id)}`);
|
return $(`#${CSS.escape("user_checkbox_" + user.user_id)}`);
|
||||||
},
|
},
|
||||||
|
|
|
@ -527,7 +527,7 @@ export function initialize() {
|
||||||
close_on_submit: true,
|
close_on_submit: true,
|
||||||
id: "stream_privacy_modal",
|
id: "stream_privacy_modal",
|
||||||
on_click: change_stream_privacy,
|
on_click: change_stream_privacy,
|
||||||
post_render: () => {
|
post_render() {
|
||||||
$("#stream_privacy_modal .dialog_submit_button").attr("data-stream-id", stream_id);
|
$("#stream_privacy_modal .dialog_submit_button").attr("data-stream-id", stream_id);
|
||||||
set_stream_message_retention_setting_dropdown(stream);
|
set_stream_message_retention_setting_dropdown(stream);
|
||||||
|
|
||||||
|
@ -536,7 +536,7 @@ export function initialize() {
|
||||||
change_stream_message_retention_days_block_display_property(dropdown_value);
|
change_stream_message_retention_days_block_display_property(dropdown_value);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
on_show: () => {
|
on_show() {
|
||||||
stream_settings_ui.hide_or_disable_stream_privacy_options_if_required(
|
stream_settings_ui.hide_or_disable_stream_privacy_options_if_required(
|
||||||
$("#stream_privacy_modal"),
|
$("#stream_privacy_modal"),
|
||||||
);
|
);
|
||||||
|
@ -564,7 +564,7 @@ export function initialize() {
|
||||||
html_body: change_stream_info_modal,
|
html_body: change_stream_info_modal,
|
||||||
id: "change_stream_info_modal",
|
id: "change_stream_info_modal",
|
||||||
on_click: save_stream_info,
|
on_click: save_stream_info,
|
||||||
post_render: () => {
|
post_render() {
|
||||||
$("#change_stream_info_modal .dialog_submit_button")
|
$("#change_stream_info_modal .dialog_submit_button")
|
||||||
.addClass("save-button")
|
.addClass("save-button")
|
||||||
.attr("data-stream-id", stream_id);
|
.attr("data-stream-id", stream_id);
|
||||||
|
@ -646,7 +646,7 @@ export function initialize() {
|
||||||
id: "copy_email_address_modal",
|
id: "copy_email_address_modal",
|
||||||
html_submit_button: $t_html({defaultMessage: "Copy address"}),
|
html_submit_button: $t_html({defaultMessage: "Copy address"}),
|
||||||
help_link: "/help/message-a-stream-by-email#configuration-options",
|
help_link: "/help/message-a-stream-by-email#configuration-options",
|
||||||
on_click: () => {},
|
on_click() {},
|
||||||
close_on_submit: true,
|
close_on_submit: true,
|
||||||
});
|
});
|
||||||
$("#show-sender").prop("checked", true);
|
$("#show-sender").prop("checked", true);
|
||||||
|
|
|
@ -837,7 +837,7 @@ export function register_topic_handlers() {
|
||||||
html_heading: $t_html({defaultMessage: "Delete topic"}),
|
html_heading: $t_html({defaultMessage: "Delete topic"}),
|
||||||
help_link: "/help/delete-a-topic",
|
help_link: "/help/delete-a-topic",
|
||||||
html_body,
|
html_body,
|
||||||
on_click: () => {
|
on_click() {
|
||||||
message_edit.delete_topic(stream_id, topic);
|
message_edit.delete_topic(stream_id, topic);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -118,7 +118,7 @@ export class TaskData {
|
||||||
},
|
},
|
||||||
|
|
||||||
strike: {
|
strike: {
|
||||||
outbound: (key) => {
|
outbound(key) {
|
||||||
const event = {
|
const event = {
|
||||||
type: "strike",
|
type: "strike",
|
||||||
key,
|
key,
|
||||||
|
|
|
@ -113,7 +113,7 @@ export function build_widgets() {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
$simplebar_container,
|
$simplebar_container,
|
||||||
html_selector: (user_id) => {
|
html_selector(user_id) {
|
||||||
const user = people.get_by_user_id(user_id);
|
const user = people.get_by_user_id(user_id);
|
||||||
return $(`#${CSS.escape("user_checkbox_" + user.user_id)}`);
|
return $(`#${CSS.escape("user_checkbox_" + user.user_id)}`);
|
||||||
},
|
},
|
||||||
|
|
|
@ -150,7 +150,7 @@ export function initialize() {
|
||||||
html_body: change_user_group_info_modal,
|
html_body: change_user_group_info_modal,
|
||||||
id: "change_group_info_modal",
|
id: "change_group_info_modal",
|
||||||
on_click: save_group_info,
|
on_click: save_group_info,
|
||||||
post_render: () => {
|
post_render() {
|
||||||
$("#change_group_info_modal .dialog_submit_button")
|
$("#change_group_info_modal .dialog_submit_button")
|
||||||
.addClass("save-button")
|
.addClass("save-button")
|
||||||
.attr("data-group-id", user_group_id);
|
.attr("data-group-id", user_group_id);
|
||||||
|
|
|
@ -40,7 +40,7 @@ export function open_user_status_modal() {
|
||||||
id: "set_user_status_modal",
|
id: "set_user_status_modal",
|
||||||
on_click: submit_new_status,
|
on_click: submit_new_status,
|
||||||
post_render: user_status_post_render,
|
post_render: user_status_post_render,
|
||||||
on_shown: () => {
|
on_shown() {
|
||||||
input_field().trigger("focus");
|
input_field().trigger("focus");
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue