diff --git a/web/src/click_handlers.js b/web/src/click_handlers.js index 778d60b7bd..c7f8c59786 100644 --- a/web/src/click_handlers.js +++ b/web/src/click_handlers.js @@ -658,7 +658,6 @@ export function initialize() { popovers.register_click_handlers(); user_profile.register_click_handlers(); - emoji_picker.register_click_handlers(); stream_popover.register_click_handlers(); $("body").on("click", ".logout_button", () => { diff --git a/web/src/emoji_picker.js b/web/src/emoji_picker.js index 25b0ad1bbd..c7fe6591ac 100644 --- a/web/src/emoji_picker.js +++ b/web/src/emoji_picker.js @@ -695,7 +695,7 @@ export function toggle_emoji_popover(target, id, additional_popover_options) { {show_as_overlay}, ); } -export function register_click_handlers() { +function register_click_handlers() { $(document).on("click", ".emoji-popover-emoji.reaction", function (e) { // When an emoji is clicked in the popover, // if the user has reacted to this message with this emoji @@ -824,4 +824,5 @@ export function register_click_handlers() { export function initialize() { rebuild_catalog(); + register_click_handlers(); } diff --git a/web/tests/emoji_picker.test.js b/web/tests/emoji_picker.test.js index 3164fd853b..6ed98f8866 100644 --- a/web/tests/emoji_picker.test.js +++ b/web/tests/emoji_picker.test.js @@ -4,7 +4,7 @@ const {strict: assert} = require("assert"); const _ = require("lodash"); -const {zrequire} = require("./lib/namespace"); +const {zrequire, set_global} = require("./lib/namespace"); const {run_test} = require("./lib/test"); const emoji = zrequire("emoji"); @@ -12,6 +12,8 @@ const emoji_picker = zrequire("emoji_picker"); const emoji_codes = zrequire("../../static/generated/emoji/emoji_codes.json"); +set_global("document", "document-stub"); + run_test("initialize", () => { emoji.initialize({ realm_emoji: {},