[FIX] router: preserve pathname in hash mode

closes #397
This commit is contained in:
Géry Debongnie
2019-10-27 21:11:11 +01:00
committed by Aaron Bohy
parent 5911c8e3f6
commit 2aa705f5c8
2 changed files with 10 additions and 1 deletions
+9
View File
@@ -52,6 +52,15 @@ describe("router miscellaneous", () => {
expect(window.location.hash).toBe("#/users/5");
expect(env.qweb.forceUpdate).toHaveBeenCalledTimes(2);
});
test("navigate in hash mode preserve location", async () => {
router = new TestRouter(env, [{ name: "users", path: "/users/{{id}}" }], {mode: "hash"});
window.history.pushState({}, "title", window.location.origin + '/test.html');
expect(window.location.href).toBe("http://localhost/test.html");
await router.navigate({ to: "users", params: { id: 3 } });
expect(window.location.href).toBe("http://localhost/test.html#/users/3");
});
});
describe("routeToPath", () => {