diff --git a/.eslintrc.json b/.eslintrc.json index 3e783ec5d2..ba32c15052 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -153,7 +153,6 @@ "message_events": false, "message_list": false, "narrow": false, - "padded_widget": false, "page_params": false, "panels": false, "pointer": false, diff --git a/frontend_tests/node_tests/activity.js b/frontend_tests/node_tests/activity.js index 83774b503f..13ba253bd0 100644 --- a/frontend_tests/node_tests/activity.js +++ b/frontend_tests/node_tests/activity.js @@ -69,7 +69,7 @@ const _resize = { resize_page_components: () => {}, }; -set_global("padded_widget", { +rewiremock("../../static/js/padded_widget").with({ update_padding: () => {}, }); rewiremock("../../static/js/channel").with(channel); diff --git a/frontend_tests/node_tests/buddy_list.js b/frontend_tests/node_tests/buddy_list.js index 91eed08e77..ce951a4211 100644 --- a/frontend_tests/node_tests/buddy_list.js +++ b/frontend_tests/node_tests/buddy_list.js @@ -5,11 +5,11 @@ const {strict: assert} = require("assert"); const _ = require("lodash"); const rewiremock = require("rewiremock/node"); -const {set_global, zrequire} = require("../zjsunit/namespace"); +const {zrequire} = require("../zjsunit/namespace"); const {run_test} = require("../zjsunit/test"); const $ = require("../zjsunit/zjquery"); -set_global("padded_widget", { +rewiremock("../../static/js/padded_widget").with({ update_padding: () => {}, }); diff --git a/static/js/buddy_list.js b/static/js/buddy_list.js index 748f547373..901dc9b3c4 100644 --- a/static/js/buddy_list.js +++ b/static/js/buddy_list.js @@ -5,6 +5,7 @@ const render_user_presence_rows = require("../templates/user_presence_rows.hbs") const buddy_data = require("./buddy_data"); const message_viewport = require("./message_viewport"); +const padded_widget = require("./padded_widget"); class BuddyListConf { container_sel = "#user_presences"; diff --git a/static/js/bundles/app.js b/static/js/bundles/app.js index e4d3b1880d..4be523885a 100644 --- a/static/js/bundles/app.js +++ b/static/js/bundles/app.js @@ -33,7 +33,6 @@ import "../notifications"; import "../message_events"; import "../server_events"; import "../zulip"; -import "../padded_widget"; import "../buddy_list"; import "../activity"; import "../user_events"; diff --git a/static/js/global.d.ts b/static/js/global.d.ts index bde9d5acdc..49e45d3176 100644 --- a/static/js/global.d.ts +++ b/static/js/global.d.ts @@ -26,7 +26,6 @@ declare let input_pill: any; declare let message_events: any; declare let message_list: any; declare let narrow: any; -declare let padded_widget: any; declare let page_params: any; declare let panels: any; declare let pointer: any; diff --git a/static/js/padded_widget.js b/static/js/padded_widget.js index 3a74104e90..84a7320eb8 100644 --- a/static/js/padded_widget.js +++ b/static/js/padded_widget.js @@ -1,6 +1,4 @@ -"use strict"; - -exports.update_padding = function (opts) { +export function update_padding(opts) { const content = $(opts.content_sel); const padding = $(opts.padding_sel); const total_rows = opts.total_rows; @@ -19,6 +17,4 @@ exports.update_padding = function (opts) { padding.height(new_padding_height); padding.width(1); -}; - -window.padded_widget = exports; +}