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.

tests: Use existing zjquery event handlers.

Anders Kaseorg9a6c4af0c3c1
diff --git a/web/tests/activity_init.test.cjs b/web/tests/activity_init.test.cjs
index 71166bbe87c..1dc86a4088c 100644
--- a/web/tests/activity_init.test.cjs
+++ b/web/tests/activity_init.test.cjs
@@ -39,16 +39,6 @@ run_test("activity.initialize", ({override}) => {
const $document_stub = $("document-stub");
const $window_stub = $("window-stub");
- $document_stub.on = (event, callback) => {
- assert.equal(event, "mousemove");
- callback(); // should be set_new_user_input(true)
- };
-
- $window_stub.on = (event, callback) => {
- assert.equal(event, "focus keydown mousedown mousemove touchmove touchstart wheel");
- assert.equal(callback, activity.mark_client_active);
- };
-
override(window, "to_$", () => $window_stub);
override(document, "to_$", () => $document_stub);
@@ -57,6 +47,11 @@ run_test("activity.initialize", ({override}) => {
activity.initialize();
+ assert.equal(
+ $window_stub.get_on_handler("focus keydown mousedown mousemove touchmove touchstart wheel"),
+ activity.mark_client_active,
+ );
+ $document_stub.trigger("mousemove"); // should be set_new_user_input(true)
assert.equal(activity.new_user_input, true);
});