mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 05:23:35 +00:00
subs: Move active_stream function to hash_util.
This function better belongs in hash_util since it relies on the current window hash.
This commit is contained in:
@@ -119,6 +119,15 @@ run_test("build_reload_url", () => {
|
||||
assert.equal(hash_util.build_reload_url(), "+oldhash=");
|
||||
});
|
||||
|
||||
run_test("test_active_stream", () => {
|
||||
location.hash = "#streams/1/announce";
|
||||
assert.equal(hash_util.active_stream().id, 1);
|
||||
assert.equal(hash_util.active_stream().name, "announce");
|
||||
|
||||
location.hash = "#test/narrow";
|
||||
assert.equal(hash_util.active_stream(), undefined);
|
||||
});
|
||||
|
||||
run_test("test_parse_narrow", () => {
|
||||
assert.deepEqual(hash_util.parse_narrow(["narrow", "stream", "99-frontend"]), [
|
||||
{negated: false, operator: "stream", operand: "frontend"},
|
||||
|
||||
@@ -21,6 +21,7 @@ mock_esm("../../static/js/browser_history", {update: noop});
|
||||
mock_esm("../../static/js/hash_util", {
|
||||
stream_edit_uri: noop,
|
||||
by_stream_uri: noop,
|
||||
active_stream: noop,
|
||||
});
|
||||
mock_esm("../../static/js/list_widget", {
|
||||
create: () => ({init: noop}),
|
||||
|
||||
Reference in New Issue
Block a user