Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
hashchange: Show default view when the hash is unknown.
Riken Shah0e65225d06de
diff --git a/frontend_tests/node_tests/hashchange.js b/frontend_tests/node_tests/hashchange.jsindex 3a3203cf7c0..ecdd6f62a6f 100644--- a/frontend_tests/node_tests/hashchange.js+++ b/frontend_tests/node_tests/hashchange.js@@ -170,14 +170,29 @@ run_test("hash_interactions", ({override}) => {window_stub = $.create("window-stub");page_params.default_view = "recent_topics";- override(recent_topics_ui, "show", () => {});override(recent_topics_util, "is_visible", () => false);const helper = test_helper({override, change_tab: true});- window.location.hash = "#all_messages";+ let recent_topics_ui_shown = false;+ override(recent_topics_ui, "show", () => {+ recent_topics_ui_shown = true;+ });+ window.location.hash = "#unknown_hash";browser_history.clear_for_testing();hashchange.initialize();+ // If it's an unknown hash it should show the default view.+ assert.equal(recent_topics_ui_shown, true);+ helper.assert_events([+ [overlays, "close_for_hash_change"],+ [message_viewport, "stop_auto_scrolling"],+ ]);++ override(recent_topics_ui, "show", () => {});+ window.location.hash = "#all_messages";++ helper.clear_events();+ window_stub.trigger("hashchange");helper.assert_events([[overlays, "close_for_hash_change"],[message_viewport, "stop_auto_scrolling"],diff --git a/static/js/hashchange.js b/static/js/hashchange.jsindex 03b3c9bed09..5b2723e641d 100644--- a/static/js/hashchange.js+++ b/static/js/hashchange.js@@ -179,6 +179,8 @@ function do_hashchange_normal(from_reload) {case "#about-zulip":blueslip.error("overlay logic skipped for: " + hash);break;+ default:+ show_default_view();}return false;}