minor: Inline filter_table in subs.js.

The old structure of having a two-line wrapper was
mostly driven by testing concerns.  Now I just
have a single function with the optional argument.
This commit is contained in:
Steve Howell 2021-02-17 11:55:17 +00:00 committed by Tim Abbott
parent c3ee1286f4
commit fed1eaf7d7
2 changed files with 9 additions and 8 deletions

View File

@ -27,7 +27,7 @@ set_global("hash_util", {
by_stream_uri: () => {}, by_stream_uri: () => {},
}); });
run_test("filter_table", (override) => { run_test("redraw_left_panel", (override) => {
override(subs, "add_tooltip_to_left_panel_row", () => {}); override(subs, "add_tooltip_to_left_panel_row", () => {});
// set-up sub rows stubs // set-up sub rows stubs
@ -124,7 +124,7 @@ run_test("filter_table", (override) => {
assert(!denmark_row.hasClass("active")); assert(!denmark_row.hasClass("active"));
function test_filter(params, expected_streams) { function test_filter(params, expected_streams) {
const stream_ids = subs.filter_table(params); const stream_ids = subs.redraw_left_panel(params);
assert.deepEqual( assert.deepEqual(
stream_ids, stream_ids,
expected_streams.map((sub) => sub.stream_id), expected_streams.map((sub) => sub.stream_id),

View File

@ -429,7 +429,13 @@ exports.render_left_panel_superset = function () {
}; };
// LeftPanelParams { input: String, subscribed_only: Boolean, sort_order: String } // LeftPanelParams { input: String, subscribed_only: Boolean, sort_order: String }
exports.filter_table = function (left_panel_params) { exports.redraw_left_panel = function (left_panel_params) {
// We only get left_panel_params passed in from tests. Real
// code calls get_left_panel_params().
if (left_panel_params === undefined) {
left_panel_params = exports.get_left_panel_params();
}
exports.show_active_stream_in_left_panel(); exports.show_active_stream_in_left_panel();
function stream_id_for_row(row) { function stream_id_for_row(row) {
@ -508,11 +514,6 @@ exports.maybe_reset_right_panel = function () {
} }
}; };
exports.redraw_left_panel = function () {
const left_panel_params = exports.get_left_panel_params();
exports.filter_table(left_panel_params);
};
// Make it explicit that our toggler is not created right away. // Make it explicit that our toggler is not created right away.
exports.toggler = undefined; exports.toggler = undefined;