Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
zjsunit: Fix trigger mock argument handling.
Anders Kaseorg5a87c347056b
diff --git a/frontend_tests/node_tests/poll_widget.js b/frontend_tests/node_tests/poll_widget.jsindex b359edf6cdf..d497f6b366e 100644--- a/frontend_tests/node_tests/poll_widget.js+++ b/frontend_tests/node_tests/poll_widget.js@@ -267,11 +267,7 @@ run_test("activate another person poll", () => {/* Testing data sent to server on voting */poll_vote_button.attr("data-key", "100,1");out_data = undefined;- poll_vote_button.trigger(- $.Event("click", {- target: poll_vote_button,- }),- );+ poll_vote_button.trigger("click");assert.deepEqual(out_data, {type: "vote", key: "100,1", vote: 1});}diff --git a/frontend_tests/zjsunit/zjquery.js b/frontend_tests/zjsunit/zjquery.jsindex 03b17f01a44..509cdf902f2 100644--- a/frontend_tests/zjsunit/zjquery.js+++ b/frontend_tests/zjsunit/zjquery.js@@ -112,7 +112,10 @@ exports.make_event_store = (selector) => {trigger($element, ev, data) {if (typeof ev === "string") {- ev = new Event(ev, data);+ ev = new Event(ev);+ }+ if (!ev.target) {+ ev.target = $element;}const func = on_functions.get(ev.type);