mirror of
https://github.com/zulip/zulip.git
synced 2025-11-10 08:56:10 +00:00
hotkey: Fix warning about unused login_to_access import.
This commit is contained in:
@@ -26,7 +26,7 @@ export function build_login_link(): string {
|
|||||||
return login_link;
|
return login_link;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function login_to_access(empty_narrow?: boolean): void {
|
export let login_to_access = (empty_narrow?: boolean): void => {
|
||||||
// Hide all overlays, popover and go back to the previous hash if the
|
// Hide all overlays, popover and go back to the previous hash if the
|
||||||
// hash has changed.
|
// hash has changed.
|
||||||
const login_link = build_login_link();
|
const login_link = build_login_link();
|
||||||
@@ -49,4 +49,8 @@ export function login_to_access(empty_narrow?: boolean): void {
|
|||||||
browser_history.return_to_web_public_hash();
|
browser_history.return_to_web_public_hash();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export function rewire_login_to_access(value: typeof login_to_access): void {
|
||||||
|
login_to_access = value;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,9 +96,7 @@ mock_esm("../src/recent_view_ui", {
|
|||||||
is_in_focus: () => false,
|
is_in_focus: () => false,
|
||||||
});
|
});
|
||||||
|
|
||||||
const spectators = mock_esm("../src/spectators", {
|
const spectators = zrequire("../src/spectators");
|
||||||
login_to_access() {},
|
|
||||||
});
|
|
||||||
|
|
||||||
message_lists.current = {
|
message_lists.current = {
|
||||||
visibly_empty() {
|
visibly_empty() {
|
||||||
@@ -569,11 +567,11 @@ run_test("test new user input hook called", () => {
|
|||||||
assert.ok(hook_called);
|
assert.ok(hook_called);
|
||||||
});
|
});
|
||||||
|
|
||||||
run_test("e shortcut works for anonymous users", () => {
|
run_test("e shortcut works for anonymous users", ({override_rewire}) => {
|
||||||
page_params.is_spectator = true;
|
page_params.is_spectator = true;
|
||||||
|
|
||||||
const stub = make_stub();
|
const stub = make_stub();
|
||||||
spectators.login_to_access = stub.f;
|
override_rewire(spectators, "login_to_access", stub.f);
|
||||||
|
|
||||||
const e = {
|
const e = {
|
||||||
which: "e".codePointAt(0),
|
which: "e".codePointAt(0),
|
||||||
@@ -581,4 +579,7 @@ run_test("e shortcut works for anonymous users", () => {
|
|||||||
|
|
||||||
process_keydown(e);
|
process_keydown(e);
|
||||||
assert.equal(stub.num_calls, 0, "login_to_access should not be called for 'e' shortcut");
|
assert.equal(stub.num_calls, 0, "login_to_access should not be called for 'e' shortcut");
|
||||||
|
// Fake call to avoid warning about unused stub.
|
||||||
|
spectators.login_to_access();
|
||||||
|
assert.equal(stub.num_calls, 1);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user