From 706e2baf7e504252a53ba9353b050e274a9f0de8 Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Sun, 21 Feb 2021 14:01:54 +0000 Subject: [PATCH] node_test: Avoid make_zjquery. We just use $.clear_all_elements() now. --- frontend_tests/node_tests/compose.js | 6 +++--- frontend_tests/node_tests/input_pill.js | 2 +- frontend_tests/node_tests/settings_bots.js | 2 +- frontend_tests/node_tests/settings_user_groups.js | 2 +- frontend_tests/node_tests/upload.js | 9 ++++----- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/frontend_tests/node_tests/compose.js b/frontend_tests/node_tests/compose.js index d99dbc80a1..93097bb44c 100644 --- a/frontend_tests/node_tests/compose.js +++ b/frontend_tests/node_tests/compose.js @@ -113,7 +113,7 @@ function stub_out_video_calls() { function reset_jquery() { // Avoid leaks. - set_global("$", make_zjquery()); + $.clear_all_elements(); } const new_user = { @@ -206,7 +206,7 @@ run_test("validate_stream_message_address_info", () => { run_test("validate", () => { function initialize_pm_pill() { - set_global("$", make_zjquery()); + reset_jquery(); $("#compose-send-button").prop("disabled", false); $("#compose-send-button").trigger("focus"); @@ -1891,7 +1891,7 @@ run_test("create_message_object", () => { }); run_test("nonexistent_stream_reply_error", () => { - set_global("$", make_zjquery()); + reset_jquery(); const actions = []; $("#nonexistent_stream_reply_error").show = () => { diff --git a/frontend_tests/node_tests/input_pill.js b/frontend_tests/node_tests/input_pill.js index ea1bcf9f71..c25863c6de 100644 --- a/frontend_tests/node_tests/input_pill.js +++ b/frontend_tests/node_tests/input_pill.js @@ -93,7 +93,7 @@ run_test("basics", () => { }); function set_up() { - set_global("$", make_zjquery()); + $.clear_all_elements(); const items = { blue: { display_value: "BLUE", diff --git a/frontend_tests/node_tests/settings_bots.js b/frontend_tests/node_tests/settings_bots.js index c0e5c2a445..278f399e39 100644 --- a/frontend_tests/node_tests/settings_bots.js +++ b/frontend_tests/node_tests/settings_bots.js @@ -121,7 +121,7 @@ function test_create_bot_type_input_box_toggle(f) { } function set_up() { - set_global("$", make_zjquery()); + $.clear_all_elements(); // bunch of stubs diff --git a/frontend_tests/node_tests/settings_user_groups.js b/frontend_tests/node_tests/settings_user_groups.js index fe53bf28ae..95e8210d6f 100644 --- a/frontend_tests/node_tests/settings_user_groups.js +++ b/frontend_tests/node_tests/settings_user_groups.js @@ -393,7 +393,7 @@ run_test("with_external_user", () => { }; // Reset zjquery to test stuff with user who cannot edit - set_global("$", make_zjquery()); + $.clear_all_elements(); let user_group_find_called = 0; const user_group_stub = $(`div.user-group[id="${CSS.escape(1)}"]`); diff --git a/frontend_tests/node_tests/upload.js b/frontend_tests/node_tests/upload.js index 112417e1c8..345af29e7a 100644 --- a/frontend_tests/node_tests/upload.js +++ b/frontend_tests/node_tests/upload.js @@ -368,7 +368,7 @@ run_test("uppy_config", () => { }); run_test("file_input", () => { - set_global("$", make_zjquery()); + $.clear_all_elements(); upload.setup_upload({mode: "compose"}); @@ -391,8 +391,7 @@ run_test("file_input", () => { }); run_test("file_drop", () => { - set_global("$", make_zjquery()); - + $.clear_all_elements(); upload.setup_upload({mode: "compose"}); let prevent_default_counter = 0; @@ -431,7 +430,7 @@ run_test("file_drop", () => { }); run_test("copy_paste", () => { - set_global("$", make_zjquery()); + $.clear_all_elements(); upload.setup_upload({mode: "compose"}); @@ -472,7 +471,7 @@ run_test("copy_paste", () => { }); run_test("uppy_events", () => { - set_global("$", make_zjquery()); + $.clear_all_elements(); const callbacks = {}; let uppy_cancel_all_called = false; let state = {};