Skip to content

Commit 5a27ed6

Browse files
showelltimabbott
authored andcommitted
refactor: Change where we initialize scrolling code.
This is a more sensible place to initialize the the scrolling handler, plus it breaks an annoying indirect dependency on jQuery for the unit tests.
1 parent 6c4b118 commit 5a27ed6

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

frontend_tests/node_tests/stream_data.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const {strict: assert} = require("assert");
44

55
const _ = require("lodash");
66

7-
const {set_global, stub_out_jquery, zrequire} = require("../zjsunit/namespace");
7+
const {set_global, zrequire} = require("../zjsunit/namespace");
88
const {run_test} = require("../zjsunit/test");
99

1010
set_global("page_params", {
@@ -13,9 +13,6 @@ set_global("page_params", {
1313
is_guest: false,
1414
});
1515

16-
set_global("document", null);
17-
stub_out_jquery();
18-
1916
zrequire("color_data");
2017
zrequire("hash_util");
2118
zrequire("stream_topic_history");

static/js/message_list.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -415,12 +415,4 @@ exports.all = new MessageList({
415415
muting_enabled: false,
416416
});
417417

418-
// We stop autoscrolling when the user is clearly in the middle of
419-
// doing something. Be careful, though, if you try to capture
420-
// mousemove, then you will have to contend with the autoscroll
421-
// itself generating mousemove events.
422-
$(document).on("message_selected.zulip wheel", () => {
423-
message_viewport.stop_auto_scrolling();
424-
});
425-
426418
window.message_list = exports;

static/js/message_viewport.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,14 @@ exports.initialize = function () {
457457
$(document).on("compose_started compose_canceled compose_finished", () => {
458458
bottom_of_feed.reset();
459459
});
460+
461+
// We stop autoscrolling when the user is clearly in the middle of
462+
// doing something. Be careful, though, if you try to capture
463+
// mousemove, then you will have to contend with the autoscroll
464+
// itself generating mousemove events.
465+
$(document).on("message_selected.zulip wheel", () => {
466+
exports.stop_auto_scrolling();
467+
});
460468
};
461469

462470
window.message_viewport = exports;

0 commit comments

Comments
 (0)