mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
zjquery: Refactor generic_event to wrap on.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
9102c5a519
commit
ded548ad16
@@ -700,6 +700,7 @@ run_test("initialize", () => {
|
||||
|
||||
activity.client_is_active = false;
|
||||
|
||||
$(window).off("focus");
|
||||
activity.initialize();
|
||||
$(window).trigger("focus");
|
||||
clear();
|
||||
@@ -719,6 +720,7 @@ run_test("initialize", () => {
|
||||
};
|
||||
global.setInterval = (func) => func();
|
||||
|
||||
$(window).off("focus");
|
||||
activity.initialize();
|
||||
|
||||
assert($("#zephyr-mirror-error").hasClass("show"));
|
||||
|
||||
@@ -748,6 +748,7 @@ run_test("send_message", () => {
|
||||
$("#compose-send-status").show();
|
||||
$("#compose-send-button").attr("disabled", "disabled");
|
||||
$("#sending-indicator").show();
|
||||
$("#compose-textarea").off("select");
|
||||
$("#compose-textarea").select(noop);
|
||||
echo_error_msg_checked = false;
|
||||
echo.try_deliver_locally = function () {
|
||||
@@ -822,6 +823,7 @@ run_test("finish", () => {
|
||||
$("#compose-send-button").prop("disabled", false);
|
||||
$("#compose-send-button").focus();
|
||||
$("#sending-indicator").hide();
|
||||
$("#compose-textarea").off("select");
|
||||
$("#compose-textarea").select(noop);
|
||||
$("#compose-textarea").val("");
|
||||
const res = compose.finish();
|
||||
|
||||
@@ -1097,6 +1097,14 @@ run_test("initialize", () => {
|
||||
return true;
|
||||
};
|
||||
$("#enter_sends").click();
|
||||
|
||||
$("#stream_message_recipient_stream").off("focus");
|
||||
$("#stream_message_recipient_topic").off("focus");
|
||||
$("#private_message_recipient").off("focus");
|
||||
$("form#send_message_form").off("keydown");
|
||||
$("form#send_message_form").off("keyup");
|
||||
$("#enter_sends").off("click");
|
||||
$("#private_message_recipient").off("blur");
|
||||
ct.initialize();
|
||||
|
||||
// Now let's make sure that all the stub functions have been called
|
||||
|
||||
@@ -130,7 +130,7 @@ exports.make_event_store = (selector) => {
|
||||
|
||||
generic_event($element, event_name, arg) {
|
||||
if (typeof arg === "function") {
|
||||
on_functions.set(event_name, arg);
|
||||
self.on(event_name, arg);
|
||||
} else {
|
||||
self.trigger($element, event_name, arg);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user