Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

node tests: Add popovers.clear_for_testing().

Steve Howelle9e8bcd26e6c
diff --git a/frontend_tests/node_tests/popovers.js b/frontend_tests/node_tests/popovers.js
index bf4d4f51812..82d0296b03c 100644
--- a/frontend_tests/node_tests/popovers.js
+++ b/frontend_tests/node_tests/popovers.js
@@ -94,6 +94,7 @@ function make_image_stubber() {
function test_ui(label, f) {
run_test(label, (override) => {
override(popovers, "clipboard_enable", noop);
+ popovers.clear_for_testing();
popovers.register_click_handlers();
f(override);
});
diff --git a/static/js/popovers.js b/static/js/popovers.js
index dbc4df10bc9..a92706fbbf8 100644
--- a/static/js/popovers.js
+++ b/static/js/popovers.js
@@ -55,6 +55,17 @@ let userlist_placement = "right";
let list_of_popovers = [];
+export function clear_for_testing() {
+ current_actions_popover_elem = undefined;
+ current_flatpickr_instance = undefined;
+ current_message_info_popover_elem = undefined;
+ current_mobile_message_buttons_popover_elem = undefined;
+ current_user_info_popover_elem = undefined;
+ current_playground_links_popover_elem = undefined;
+ list_of_popovers.length = 0;
+ userlist_placement = "right";
+}
+
export function clipboard_enable(arg) {
// arg is a selector or element
// We extract this function for testing purpose.