Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
node_tests: Trigger events instead of mocking handler installation.
Anders Kaseorg9102c5a519ff
diff --git a/frontend_tests/node_tests/buddy_list.js b/frontend_tests/node_tests/buddy_list.jsindex cdad62b8148..a9e65e363a4 100644--- a/frontend_tests/node_tests/buddy_list.js+++ b/frontend_tests/node_tests/buddy_list.js@@ -193,12 +193,6 @@ run_test("find_li w/force_render", () => {});run_test("scrolling", () => {- let scroll_f;-- $(buddy_list.scroll_container_sel).scroll = (f) => {- scroll_f = f;- };-buddy_list.populate({keys: [],});@@ -212,7 +206,7 @@ run_test("scrolling", () => {assert(!tried_to_fill);buddy_list.start_scroll_handler();- scroll_f();+ $(buddy_list.scroll_container_sel).trigger("scroll");assert(tried_to_fill);});diff --git a/frontend_tests/node_tests/composebox_typeahead.js b/frontend_tests/node_tests/composebox_typeahead.jsindex a29e7efa643..1eb17d01efd 100644--- a/frontend_tests/node_tests/composebox_typeahead.js+++ b/frontend_tests/node_tests/composebox_typeahead.js@@ -959,23 +959,6 @@ run_test("initialize", () => {compose_textarea_typeahead_called = true;};- let pm_recipient_blur_called = false;- const old_pm_recipient_blur = $("#private_message_recipient").blur;- $("#private_message_recipient").blur = function (handler) {- if (handler) {- // The blur handler is being set.- this.val("[email protected], ");- handler.call(this);- const actual_value = this.val();- const expected_value = "[email protected]";- assert.equal(actual_value, expected_value);- } else {- // The element is simply losing the focus.- old_pm_recipient_blur();- }- pm_recipient_blur_called = true;- };-page_params.enter_sends = false;// We manually specify it the first time because the click_func// doesn't exist yet.@@ -985,6 +968,10 @@ run_test("initialize", () => {ct.initialize();+ $("#private_message_recipient").val("[email protected], ");+ $("#private_message_recipient").trigger("blur");+ assert.equal($("#private_message_recipient").val(), "[email protected]");+// handle_keydown()let event = {keyCode: 13,@@ -1088,19 +1075,6 @@ run_test("initialize", () => {$("form#send_message_form").keyup(event);// select_on_focus()- let focus_handler_called = false;- let stream_one_called = false;- $("#stream_message_recipient_stream").focus = function (f) {- // This .one() function emulates the possible infinite recursion that- // in_handler tries to avoid.- $("#stream_message_recipient_stream").one = function (event, handler) {- handler({preventDefault: noop});- f(); // This time in_handler will already be true.- stream_one_called = true;- };- f(); // Here in_handler is false.- focus_handler_called = true;- };$("#compose-send-button").fadeOut = noop;$("#compose-send-button").fadeIn = noop;@@ -1130,11 +1104,8 @@ run_test("initialize", () => {assert(stream_typeahead_called);assert(subject_typeahead_called);assert(pm_recipient_typeahead_called);- assert(pm_recipient_blur_called);assert(channel_post_called);assert(compose_textarea_typeahead_called);- assert(focus_handler_called);- assert(stream_one_called);});run_test("begins_typeahead", () => {diff --git a/frontend_tests/node_tests/drafts.js b/frontend_tests/node_tests/drafts.jsindex a72620f2625..089392cccf7 100644--- a/frontend_tests/node_tests/drafts.js+++ b/frontend_tests/node_tests/drafts.js@@ -184,12 +184,6 @@ run_test("snapshot_message", () => {});run_test("initialize", () => {- const message_content = $("#compose-textarea");- message_content.focusout = function (f) {- assert.equal(f, drafts.update_draft);- f();- };-global.window.addEventListener = function (event_name, f) {assert.equal(event_name, "beforeunload");let called = false;@@ -201,6 +195,10 @@ run_test("initialize", () => {};drafts.initialize();++ const message_content = $("#compose-textarea");+ assert.equal(message_content.get_on_handler("focusout"), drafts.update_draft);+ message_content.trigger("focusout");});run_test("remove_old_drafts", () => {diff --git a/frontend_tests/node_tests/hotkey.js b/frontend_tests/node_tests/hotkey.jsindex cdd6cb22066..deeaa78c485 100644--- a/frontend_tests/node_tests/hotkey.js+++ b/frontend_tests/node_tests/hotkey.js@@ -21,13 +21,9 @@ set_global("page_params", {});set_global("overlays", {});-const noop = () => {};-// jQuery stuff should go away if we make an initialize() method.set_global("document", "document-stub");set_global("$", global.make_zjquery());-$.fn.keydown = noop;-$.fn.keypress = noop;zrequire("emoji");const hotkey = zrequire("hotkey");diff --git a/frontend_tests/node_tests/poll_widget.js b/frontend_tests/node_tests/poll_widget.jsindex e564a37db52..f0ccf334a09 100644--- a/frontend_tests/node_tests/poll_widget.js+++ b/frontend_tests/node_tests/poll_widget.js@@ -4,7 +4,6 @@ set_global("$", global.make_zjquery());set_global("people", {});-const noop = () => {};const return_false = () => false;const return_true = () => true;@@ -185,19 +184,6 @@ run_test("activate another person poll", () => {set_widget_find_result("button.poll-question-remove");set_widget_find_result("input.poll-question");- let option_button_callback;- let vote_button_callback;-- poll_option.on = (event, func) => {- assert.equal(event, "click");- option_button_callback = func;- };-- poll_vote_button.on = (event, func) => {- assert.equal(event, "click");- vote_button_callback = func;- };-poll_question_header.toggle = (show) => {assert(show);};@@ -233,20 +219,16 @@ run_test("activate another person poll", () => {assert.equal(widget_option_container.html(), "widgets/poll_widget_results");assert.equal(poll_question_header.text(), "What do you want?");- const e = {- stopPropagation: noop,- };-{/* Testing data sent to server on adding option */poll_option_input.val("cool choice");out_data = undefined;- option_button_callback(e);+ poll_option.trigger("click");assert.deepEqual(out_data, {type: "new_option", idx: 1, option: "cool choice"});poll_option_input.val("");out_data = undefined;- option_button_callback(e);+ poll_option.trigger("click");assert.deepEqual(out_data, undefined);}@@ -274,12 +256,12 @@ run_test("activate another person poll", () => {{/* Testing data sent to server on voting */poll_vote_button.attr("data-key", "100,1");- const e = {- stopPropagation: noop,- target: poll_vote_button,- };out_data = undefined;- vote_button_callback(e);+ poll_vote_button.trigger(+ $.Event("click", {+ target: poll_vote_button,+ }),+ );assert.deepEqual(out_data, {type: "vote", key: "100,1", vote: 1});}@@ -331,7 +313,7 @@ run_test("activate own poll", () => {return elem;};- const poll_option = set_widget_find_result("button.poll-option");+ set_widget_find_result("button.poll-option");const poll_option_input = set_widget_find_result("input.poll-option");const widget_option_container = set_widget_find_result("ul.poll-widget");@@ -342,24 +324,12 @@ run_test("activate own poll", () => {const poll_question_container = set_widget_find_result(".poll-question-bar");const poll_option_container = set_widget_find_result(".poll-option-bar");- const poll_vote_button = set_widget_find_result("button.poll-vote");+ set_widget_find_result("button.poll-vote");const poll_please_wait = set_widget_find_result(".poll-please-wait");const poll_author_help = set_widget_find_result(".poll-author-help");set_widget_find_result("button.poll-question-remove");- let question_button_callback;-- poll_question_submit.on = (event, func) => {- assert.equal(event, "click");- question_button_callback = func;- };-- // Following event handler are already tested and doesn't make sense- // to test them again- poll_option.on = noop;- poll_vote_button.on = noop;-poll_question_header.toggle = (show) => {assert(show);};@@ -397,19 +367,15 @@ run_test("activate own poll", () => {{/* Testing data sent to server on editing question */- const e = {- stopPropagation: noop,- };-poll_question_input.val("Is it new?");out_data = undefined;show_submit = true;- question_button_callback(e);+ poll_question_submit.trigger("click");assert.deepEqual(out_data, {type: "question", question: "Is it new?"});poll_option_input.val("");out_data = undefined;- question_button_callback(e);+ poll_question_submit.trigger("click");assert.deepEqual(out_data, undefined);}});diff --git a/frontend_tests/node_tests/search.js b/frontend_tests/node_tests/search.jsindex 486d5e15808..bbfcc478c45 100644--- a/frontend_tests/node_tests/search.js+++ b/frontend_tests/node_tests/search.js@@ -80,13 +80,6 @@ run_test("initialize", () => {const search_button = $(".search_button");const searchbox = $("#searchbox");- searchbox_form.on = (event, func) => {- assert.equal(event, "compositionend");- search.is_using_input_method = false;- func();- assert(search.is_using_input_method);- };-search_pill.get_search_string_for_current_filter = function () {return "is:starred";};@@ -142,9 +135,9 @@ run_test("initialize", () => {let operators;let is_blurred;let is_append_search_string_called;- search_query_box.blur = () => {+ search_query_box.on("blur", () => {is_blurred = true;- };+ });search_pill.append_search_string = () => {is_append_search_string_called = true;};@@ -196,120 +189,117 @@ run_test("initialize", () => {assert.equal(opts.updater("stream:Verona"), "stream:Verona");assert(!is_blurred);assert(is_append_search_string_called);++ search_query_box.off("blur");}};- searchbox_form.keydown = (func) => {- const ev = {- which: 15,- };- search_query_box.is = return_false;- assert.equal(func(ev), undefined);+ search.initialize();- ev.which = 13;- assert.equal(func(ev), undefined);+ const search_pill_stub = $.create(".pill");+ search_pill_stub.closest = () => ({data: noop});+ const stub_event = {+ relatedTarget: search_pill_stub,+ };+ search_query_box.val("test string");+ narrow_state.search_string = () => "ver";+ search_query_box.trigger($.Event("blur", stub_event));+ assert.equal(search_query_box.val(), "test string");++ searchbox.css({"box-shadow": "inset 0px 0px 0px 2px hsl(204, 20%, 74%)"});+ searchbox.trigger("focusout");+ assert.deepEqual(searchbox.css(), {"box-shadow": "unset"});++ search.is_using_input_method = false;+ searchbox_form.trigger("compositionend");+ assert(search.is_using_input_method);++ const keydown = searchbox_form.get_on_handler("keydown");+ let ev = {+ type: "keydown",+ which: 15,+ };+ search_query_box.is = return_false;+ assert.equal(keydown(ev), undefined);- ev.which = 13;- search_query_box.is = return_true;- assert.equal(func(ev), false);+ ev.which = 13;+ assert.equal(keydown(ev), undefined);- return search_query_box;- };+ ev.which = 13;+ search_query_box.is = return_true;+ assert.equal(keydown(ev), false);- search_query_box.keyup = (func) => {- const ev = {};- let operators;- let is_blurred;- narrow_state.active = return_false;- search_query_box.blur = () => {- is_blurred = true;+ let operators;+ let is_blurred;+ narrow_state.active = return_false;+ search_query_box.off("blur");+ search_query_box.on("blur", () => {+ is_blurred = true;+ });++ const _setup = (search_box_val) => {+ is_blurred = false;+ search_button.prop("disabled", false);+ search_query_box.val(search_box_val);+ Filter.parse = (search_string) => {+ assert.equal(search_string, search_box_val);+ return operators;};-- const _setup = (search_box_val) => {- is_blurred = false;- search_button.prop("disabled", false);- search_query_box.val(search_box_val);- Filter.parse = (search_string) => {- assert.equal(search_string, search_box_val);- return operators;- };- narrow.activate = (raw_operators, options) => {- assert.deepEqual(raw_operators, operators);- assert.deepEqual(options, {trigger: "search"});- };- search_pill.get_search_string_for_current_filter = () => search_box_val;+ narrow.activate = (raw_operators, options) => {+ assert.deepEqual(raw_operators, operators);+ assert.deepEqual(options, {trigger: "search"});};-- operators = [- {- negated: false,- operator: "search",- operand: "",- },- ];- _setup("");-- ev.which = 15;- search_query_box.is = return_false;- func(ev);-- assert(!is_blurred);- assert(!search_button.prop("disabled"));-- ev.which = 13;- search_query_box.is = return_false;- func(ev);-- assert(!is_blurred);- assert(!search_button.prop("disabled"));-- ev.which = 13;- search_query_box.is = return_true;- func(ev);- assert(is_blurred);-- _setup("ver");- search.is_using_input_method = true;- func(ev);- // No change on enter keyup event when using input tool- assert(!is_blurred);- assert(!search_button.prop("disabled"));-- _setup("ver");- ev.which = 13;- search_query_box.is = return_true;- func(ev);- assert(is_blurred);- assert(!search_button.prop("disabled"));+ search_pill.get_search_string_for_current_filter = () => search_box_val;};- const search_pill_stub = $.create(".pill");- search_pill_stub.closest = () => ({data: noop});- const stub_event = {- relatedTarget: search_pill_stub,- };- search_query_box.on = (event, callback) => {- if (event === "focus") {- search_button.prop("disabled", true);- callback();- assert(!search_button.prop("disabled"));- } else if (event === "blur") {- search_query_box.val("test string");- narrow_state.search_string = () => "ver";- callback(stub_event);- assert.equal(search_query_box.val(), "test string");- }+ operators = [+ {+ negated: false,+ operator: "search",+ operand: "",+ },+ ];+ _setup("");++ ev = {+ type: "keyup",+ which: 15,};+ search_query_box.is = return_false;+ searchbox_form.trigger(ev);- searchbox.on = (event, callback) => {- if (event === "focusout") {- searchbox.css({"box-shadow": "inset 0px 0px 0px 2px hsl(204, 20%, 74%)"});- callback();- assert.deepEqual(searchbox.css(), {"box-shadow": "unset"});- }- };+ assert(!is_blurred);+ assert(!search_button.prop("disabled"));- search.initialize();+ ev.which = 13;+ search_query_box.is = return_false;+ searchbox_form.trigger(ev);++ assert(!is_blurred);+ assert(!search_button.prop("disabled"));++ ev.which = 13;+ search_query_box.is = return_true;+ searchbox_form.trigger(ev);+ assert(is_blurred);++ _setup("ver");+ search.is_using_input_method = true;+ searchbox_form.trigger(ev);+ // No change on enter keyup event when using input tool+ assert(!is_blurred);+ assert(!search_button.prop("disabled"));++ _setup("ver");+ ev.which = 13;+ search_query_box.is = return_true;+ searchbox_form.trigger(ev);+ assert(is_blurred);+ assert(!search_button.prop("disabled"));++ search_button.prop("disabled", true);+ search_query_box.trigger("focus");+ assert(!search_button.prop("disabled"));});run_test("initiate_search", () => {@@ -320,10 +310,10 @@ run_test("initiate_search", () => {let typeahead_forced_open = false;let is_searchbox_text_selected = false;let is_searchbox_focused = false;- $("#search_query").focus = () => {+ $("#search_query").off("focus");+ $("#search_query").on("focus", () => {is_searchbox_focused = true;- };- $("#search_query").select = noop;+ });$("#search_query").typeahead = (lookup) => {if (lookup === "lookup") {typeahead_forced_open = true;diff --git a/frontend_tests/node_tests/search_legacy.js b/frontend_tests/node_tests/search_legacy.jsindex b64327215dc..55649008c43 100644--- a/frontend_tests/node_tests/search_legacy.js+++ b/frontend_tests/node_tests/search_legacy.js@@ -57,13 +57,6 @@ run_test("initialize", () => {const searchbox_form = $("#searchbox_form");const search_button = $(".search_button");- searchbox_form.on = (event, func) => {- assert.equal(event, "compositionend");- search.is_using_input_method = false;- func();- assert(search.is_using_input_method);- };-search_suggestion.max_num_of_search_results = 999;search_query_box.typeahead = (opts) => {assert.equal(opts.fixed, true);@@ -113,9 +106,9 @@ run_test("initialize", () => {{let operators;let is_blurred;- search_query_box.blur = () => {+ search_query_box.on("blur", () => {is_blurred = true;- };+ });/* Test updater */const _setup = (search_box_val) => {is_blurred = false;@@ -156,106 +149,107 @@ run_test("initialize", () => {_setup("stream:Verona");assert.equal(opts.updater("stream:Verona"), "stream:Verona");assert(!is_blurred);++ search_query_box.off("blur");}};- searchbox_form.keydown = (func) => {- const ev = {- which: 15,- };- search_query_box.is = return_false;- assert.equal(func(ev), undefined);+ search.initialize();- ev.which = 13;- assert.equal(func(ev), undefined);+ search_button.prop("disabled", true);+ search_query_box.trigger("focus");+ assert(!search_button.prop("disabled"));- ev.which = 13;- search_query_box.is = return_true;- assert.equal(func(ev), false);+ search_query_box.val("test string");+ narrow_state.search_string = () => "ver";+ search_query_box.trigger("blur");+ assert.equal(search_query_box.val(), "test string");- return search_query_box;+ search.is_using_input_method = false;+ searchbox_form.trigger("compositionend");+ assert(search.is_using_input_method);++ const keydown = searchbox_form.get_on_handler("keydown");+ let ev = {+ type: "keydown",+ which: 15,};+ search_query_box.is = return_false;+ assert.equal(keydown(ev), undefined);- search_query_box.keyup = (func) => {- const ev = {};- let operators;- let is_blurred;- narrow_state.active = return_false;- search_query_box.blur = () => {- is_blurred = true;- };+ ev.which = 13;+ assert.equal(keydown(ev), undefined);- const _setup = (search_box_val) => {- is_blurred = false;- search_button.prop("disabled", false);- search_query_box.val(search_box_val);- Filter.parse = (search_string) => {- assert.equal(search_string, search_box_val);- return operators;- };- narrow.activate = (raw_operators, options) => {- assert.deepEqual(raw_operators, operators);- assert.deepEqual(options, {trigger: "search"});- };- };+ ev.which = 13;+ search_query_box.is = return_true;+ assert.equal(keydown(ev), false);- operators = [- {- negated: false,- operator: "search",- operand: "",- },- ];- _setup("");-- ev.which = 15;- search_query_box.is = return_false;- func(ev);-- assert(!is_blurred);- assert(!search_button.prop("disabled"));-- ev.which = 13;- search_query_box.is = return_false;- func(ev);-- assert(!is_blurred);- assert(!search_button.prop("disabled"));-- ev.which = 13;- search_query_box.is = return_true;- func(ev);- assert(is_blurred);-- _setup("ver");- search.is_using_input_method = true;- func(ev);- // No change on enter keyup event when using input tool- assert(!is_blurred);- assert(!search_button.prop("disabled"));-- _setup("ver");- ev.which = 13;- search_query_box.is = return_true;- func(ev);- assert(is_blurred);- assert(!search_button.prop("disabled"));+ ev = {+ type: "keyup",};-- search_query_box.on = (event, callback) => {- if (event === "focus") {- search_button.prop("disabled", true);- callback();- assert(!search_button.prop("disabled"));- } else if (event === "blur") {- search_query_box.val("test string");- narrow_state.search_string = () => "ver";- callback();- assert.equal(search_query_box.val(), "test string");- }+ let operators;+ let is_blurred;+ narrow_state.active = return_false;+ search_query_box.off("blur");+ search_query_box.on("blur", () => {+ is_blurred = true;+ });++ const _setup = (search_box_val) => {+ is_blurred = false;+ search_button.prop("disabled", false);+ search_query_box.val(search_box_val);+ Filter.parse = (search_string) => {+ assert.equal(search_string, search_box_val);+ return operators;+ };+ narrow.activate = (raw_operators, options) => {+ assert.deepEqual(raw_operators, operators);+ assert.deepEqual(options, {trigger: "search"});+ };};- search.initialize();+ operators = [+ {+ negated: false,+ operator: "search",+ operand: "",+ },+ ];+ _setup("");++ ev.which = 15;+ search_query_box.is = return_false;+ searchbox_form.trigger(ev);++ assert(!is_blurred);+ assert(!search_button.prop("disabled"));++ ev.which = 13;+ search_query_box.is = return_false;+ searchbox_form.trigger(ev);++ assert(!is_blurred);+ assert(!search_button.prop("disabled"));++ ev.which = 13;+ search_query_box.is = return_true;+ searchbox_form.trigger(ev);+ assert(is_blurred);++ _setup("ver");+ search.is_using_input_method = true;+ searchbox_form.trigger(ev);+ // No change on enter keyup event when using input tool+ assert(!is_blurred);+ assert(!search_button.prop("disabled"));++ _setup("ver");+ ev.which = 13;+ search_query_box.is = return_true;+ searchbox_form.trigger(ev);+ assert(is_blurred);+ assert(!search_button.prop("disabled"));});run_test("initiate_search", () => {@@ -266,7 +260,6 @@ run_test("initiate_search", () => {narrow_state.filter = () => ({is_search: return_true});let typeahead_forced_open = false;let is_searchbox_text_selected = false;- $("#search_query").select = noop;$("#search_query").typeahead = (lookup) => {if (lookup === "lookup") {typeahead_forced_open = true;diff --git a/frontend_tests/node_tests/settings_bots.js b/frontend_tests/node_tests/settings_bots.jsindex e0eff847db9..51798394275 100644--- a/frontend_tests/node_tests/settings_bots.js+++ b/frontend_tests/node_tests/settings_bots.js@@ -118,12 +118,6 @@ function set_up() {$("#create_bot_form").validate = () => {};- $("#create_bot_type").on = (action, f) => {- if (action === "change") {- test_create_bot_type_input_box_toggle(f);- }- };-$("#config_inputbox").children = () => {const mock_children = {hide: () => {},@@ -134,6 +128,8 @@ function set_up() {avatar.build_bot_edit_widget = () => {};settings_bots.set_up();++ test_create_bot_type_input_box_toggle(() => $("#create_bot_type").trigger("change"));}run_test("set_up", () => {diff --git a/frontend_tests/node_tests/settings_org.js b/frontend_tests/node_tests/settings_org.jsindex 3a447c9f52a..963dd820660 100644--- a/frontend_tests/node_tests/settings_org.js+++ b/frontend_tests/node_tests/settings_org.js@@ -734,12 +734,6 @@ function test_discard_changes_button(discard_changes) {}run_test("set_up", () => {- const callbacks = {};-- const set_callback = (name) => (f) => {- callbacks[name] = f;- };-const verify_realm_domains = simulate_realm_domains_table();page_params.realm_available_video_chat_providers = {jitsi_meet: {@@ -756,30 +750,6 @@ run_test("set_up", () => {},};- $("#id_realm_video_chat_provider").change = set_callback("realm_video_chat_provider");- $("#id_realm_org_join_restrictions").change = set_callback("change_org_join_restrictions");- $("#submit-add-realm-domain").click = set_callback("add_realm_domain");-- let submit_settings_form;- let discard_changes;- $(".organization").on = function (action, selector, f) {- if (selector === ".subsection-header .subsection-changes-save .button") {- assert.equal(action, "click");- submit_settings_form = f;- } else if (selector === ".subsection-header .subsection-changes-discard .button") {- assert.equal(action, "click");- discard_changes = f;- }- };-- let change_allow_subdomains;- $("#realm_domains_table").on = function (action, selector, f) {- if (action === "change") {- assert.equal(selector, ".allow-subdomains");- change_allow_subdomains = f;- }- };-let upload_realm_logo_or_icon;realm_icon.build_realm_icon_widget = function (f) {upload_realm_logo_or_icon = f;@@ -797,18 +767,14 @@ run_test("set_up", () => {$.create("<stub delete limit parent>"),);$("#id_realm_message_retention_days").set_parent($.create("<stub retention period parent>"));- $("#id_realm_message_retention_setting").change = noop;$("#message_content_in_email_notifications_label").set_parent($.create("<stub in-content setting checkbox>"),);$("#enable_digest_emails_label").set_parent($.create("<stub digest setting checkbox>"));$("#id_realm_digest_weekday").set_parent($.create("<stub digest weekday setting dropdown>"));- $("#id_realm_msg_edit_limit_setting").change = noop;- $("#id_realm_msg_delete_limit_setting").change = noop;$("#allowed_domains_label").set_parent($.create("<stub-allowed-domain-label-parent>"));const waiting_period_parent_elem = $.create("waiting-period-parent-stub");$("#id_realm_waiting_period_threshold").set_parent(waiting_period_parent_elem);- $("#id_realm_waiting_period_setting").change = noop;const allow_topic_edit_label_parent = $.create("allow-topic-edit-label-parent");$("#id_realm_allow_community_topic_editing_label").set_parent(allow_topic_edit_label_parent);@@ -824,15 +790,27 @@ run_test("set_up", () => {verify_realm_domains();- test_realms_domain_modal(callbacks.add_realm_domain);- test_submit_settings_form(submit_settings_form);+ test_realms_domain_modal(() => $("#submit-add-realm-domain").trigger("click"));+ test_submit_settings_form(+ $(".organization").get_on_handler(+ "click",+ ".subsection-header .subsection-changes-save .button",+ ),+ );test_upload_realm_icon(upload_realm_logo_or_icon);- test_change_allow_subdomains(change_allow_subdomains);+ test_change_allow_subdomains(+ $("#realm_domains_table").get_on_handler("change", ".allow-subdomains"),+ );test_extract_property_name();test_change_save_button_state();test_sync_realm_settings();test_parse_time_limit();- test_discard_changes_button(discard_changes);+ test_discard_changes_button(+ $(".organization").get_on_handler(+ "click",+ ".subsection-header .subsection-changes-discard .button",+ ),+ );window.dropdown_list_widget = dropdown_list_widget_backup;});diff --git a/frontend_tests/node_tests/ui_init.js b/frontend_tests/node_tests/ui_init.jsindex bc92237c8ab..3a7aff6bcd0 100644--- a/frontend_tests/node_tests/ui_init.js+++ b/frontend_tests/node_tests/ui_init.js@@ -132,7 +132,6 @@ set_global("$", global.make_zjquery());const document_stub = $.create("document-stub");document.to_$ = () => document_stub;-document_stub.on = () => {};document_stub.idle = () => {};const window_stub = $.create("window-stub");diff --git a/frontend_tests/node_tests/widgetize.js b/frontend_tests/node_tests/widgetize.jsindex 1e616209a58..b020c191b85 100644--- a/frontend_tests/node_tests/widgetize.js+++ b/frontend_tests/node_tests/widgetize.js@@ -5,12 +5,9 @@ set_global("todo_widget", {});set_global("zform", {});set_global("document", "document-stub");-const noop = () => {};const return_true = () => true;const return_false = () => false;-$(document).on = noop;-zrequire("widgetize");set_global("narrow_state", {});