login_to_access: Take user to web_public_compatible hash on exit.

We save the last web_public_compatible hash that user visited
before the modal was shown and take user to that hash when
user exits the modal.
This commit is contained in:
Aman Agrawal
2021-05-19 09:17:33 +00:00
committed by Tim Abbott
parent 3e7538b974
commit cfd81b1bf4
4 changed files with 36 additions and 1 deletions

View File

@@ -67,3 +67,14 @@ test("update internal hash if required", ({override}) => {
// calls to stub.
assert.equal(stub.num_calls, 1);
});
test("web public view hash restore", () => {
const allowed_hash = "#";
browser_history.update(allowed_hash);
assert.equal(location.hash, allowed_hash);
const new_hash = "#narrow/is/private";
browser_history.update(new_hash);
assert.equal(location.hash, new_hash);
browser_history.return_to_web_public_hash();
assert.equal(location.hash, allowed_hash);
});