node tests: Fix zjquery leaks for popovers.

This commit is contained in:
Steve Howell 2021-02-21 11:44:39 +00:00 committed by Steve Howell
parent fc29ee02c8
commit 3829ab0ea9
1 changed files with 13 additions and 8 deletions

View File

@ -71,11 +71,6 @@ const me = {
timezone: "America/Los_Angeles",
};
const target = $.create("click target");
target.offset = () => ({
top: 10,
});
const e = {
stopPropagation: noop,
};
@ -111,9 +106,15 @@ function make_image_stubber() {
};
}
popovers.register_click_handlers();
function test_ui(label, f) {
$.clear_all_elements();
run_test(label, (override) => {
popovers.register_click_handlers();
f(override);
});
}
run_test("sender_hover", (override) => {
test_ui("sender_hover", (override) => {
override(popovers, "hide_user_profile", noop);
const selection = ".sender_name, .sender_name-in-status, .inline_profile_picture";
@ -140,6 +141,8 @@ run_test("sender_hover", (override) => {
assert.equal(msg_id, message.id);
};
const target = $.create("click target");
target.closest = (sel) => {
assert.equal(sel, ".message_row");
return {};
@ -206,7 +209,9 @@ run_test("sender_hover", (override) => {
// todo: load image
});
run_test("actions_popover", (override) => {
test_ui("actions_popover", (override) => {
const target = $.create("click target");
override(popovers, "hide_user_profile", noop);
const handler = $("#main_div").get_on_handler("click", ".actions_hover");