js: Replace deprecated jQuery.fn.hover.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2020-07-20 12:55:26 -07:00 committed by Tim Abbott
parent 25883d7827
commit 97feea42a1
5 changed files with 17 additions and 37 deletions

View File

@ -430,17 +430,6 @@ run_test("with_external_user", () => {
turned_off[event_name + "/" + sel] = true; turned_off[event_name + "/" + sel] = true;
}; };
let pill_hover_called = false;
let callback;
let empty_fn;
pill_stub.hover = function (one, two) {
callback = one;
empty_fn = two;
pill_hover_called = true;
assert.equal(typeof one, "function");
assert.equal(typeof two, "function");
};
const exit_button = $.create("fake-pill-exit"); const exit_button = $.create("fake-pill-exit");
pill_stub.set_find_results(".exit", exit_button); pill_stub.set_find_results(".exit", exit_button);
let exit_button_called = false; let exit_button_called = false;
@ -487,14 +476,9 @@ run_test("with_external_user", () => {
const event = { const event = {
stopPropagation: noop, stopPropagation: noop,
}; };
let pill_click_called = false; const pill_mouseenter_handler = pill_stub.get_on_handler("mouseenter");
const pill_click_handler = pill_container_stub.get_on_handler("click"); const pill_click_handler = pill_container_stub.get_on_handler("click");
pill_click_called = true; pill_mouseenter_handler(event);
assert(callback);
assert(empty_fn);
callback();
empty_fn();
pill_click_handler(event); pill_click_handler(event);
assert.equal(delete_handler.call(fake_delete), undefined); assert.equal(delete_handler.call(fake_delete), undefined);
assert.equal(name_update_handler(), undefined); assert.equal(name_update_handler(), undefined);
@ -506,8 +490,6 @@ run_test("with_external_user", () => {
assert.equal(set_attributes_called, 1); assert.equal(set_attributes_called, 1);
assert.equal(can_edit_called, 9); assert.equal(can_edit_called, 9);
assert(exit_button_called); assert(exit_button_called);
assert(pill_click_called);
assert(pill_hover_called);
assert.equal(user_group_find_called, 2); assert.equal(user_group_find_called, 2);
assert.equal(pill_container_find_called, 4); assert.equal(pill_container_find_called, 4);
assert.equal(turned_off["keydown/.pill"], true); assert.equal(turned_off["keydown/.pill"], true);

View File

@ -190,8 +190,6 @@ $tab_bar.find = () => false;
compose.compute_show_video_chat_button = () => {}; compose.compute_show_video_chat_button = () => {};
$("#below-compose-content .video_link").toggle = () => {}; $("#below-compose-content .video_link").toggle = () => {};
$("#tab_bar .narrow_description > a").hover = () => {};
run_test("initialize_everything", () => { run_test("initialize_everything", () => {
ui_init.initialize_everything(); ui_init.initialize_everything();
}); });

View File

@ -80,12 +80,9 @@ exports.populate_user_groups = function () {
pill_container.on("click", (e) => { pill_container.on("click", (e) => {
e.stopPropagation(); e.stopPropagation();
}); });
pill_container.find(".pill").hover( pill_container.find(".pill").on("mouseenter", () => {
() => { pill_container.find(".pill").find(".exit").css("opacity", "0.5");
pill_container.find(".pill").find(".exit").css("opacity", "0.5"); });
},
() => {},
);
} }
update_membership(data.id); update_membership(data.id);

View File

@ -81,9 +81,13 @@ $(() => {
placement: "top", placement: "top",
trigger: "manual", trigger: "manual",
}); });
$("#id_last_update_question_sign").hover(() => { $("#id_last_update_question_sign")
$("span.last_update_tooltip").tooltip("toggle"); .on("mouseenter", () => {
}); $("span.last_update_tooltip").tooltip("show");
})
.on("mouseleave", () => {
$("span.last_update_tooltip").tooltip("hide");
});
// Add configuration for any additional tooltips here. // Add configuration for any additional tooltips here.
}); });

View File

@ -97,14 +97,13 @@ function bind_title_area_handlers() {
// handler that makes sure that hover plays nicely // handler that makes sure that hover plays nicely
// with whether search is being opened or not. // with whether search is being opened or not.
$("#tab_bar .narrow_description > a").hover( $("#tab_bar .narrow_description > a")
() => { .on("mouseenter", () => {
$("#tab_bar .search_closed").addClass("search_icon_hover_highlight"); $("#tab_bar .search_closed").addClass("search_icon_hover_highlight");
}, })
() => { .on("mouseleave", () => {
$("#tab_bar .search_closed").removeClass("search_icon_hover_highlight"); $("#tab_bar .search_closed").removeClass("search_icon_hover_highlight");
}, });
);
} }
function build_tab_bar(filter) { function build_tab_bar(filter) {