diff --git a/frontend_tests/node_tests/general.js b/frontend_tests/node_tests/general.js index 6bc0940a6a..3dc07c89d7 100644 --- a/frontend_tests/node_tests/general.js +++ b/frontend_tests/node_tests/general.js @@ -707,16 +707,10 @@ run_test('stream_list', () => { const sidebar_helper = make_sidebar_helper(); const topic_list_helper = make_topic_list_helper(); - var streams_shown; - stream_list.zoom_out_topics = () => { - streams_shown = true; - }; // This is what we are testing! stream_list.update_streams_sidebar(); - assert(streams_shown); - jquery_helper.verify_actions(); sidebar_helper.verify_actions(); topic_list_helper.verify_actions(); diff --git a/static/js/topic_zoom.js b/static/js/topic_zoom.js index b3d637fe9e..82d342f911 100644 --- a/static/js/topic_zoom.js +++ b/static/js/topic_zoom.js @@ -2,6 +2,8 @@ var topic_zoom = (function () { var exports = {}; +var zoomed_in = false; + function zoom_in() { var stream_id = topic_list.active_stream_id(); @@ -10,6 +12,8 @@ function zoom_in() { stream_list.zoom_in_topics({ stream_id: stream_id, }); + + zoomed_in = true; } function zoom_out() { @@ -22,11 +26,18 @@ function zoom_out() { if (stream_li) { stream_list.scroll_stream_into_view(stream_li); } + + zoomed_in = false; } exports.clear_topics = function () { topic_list.close(); - stream_list.zoom_out_topics(); + + if (zoomed_in) { + stream_list.zoom_out_topics(); + } + + zoomed_in = false; }; exports.initialize = function () {