mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[IMP] router: allow query string in paths
This commit is contained in:
committed by
Géry Debongnie
parent
a1552117f9
commit
f0b75b6890
@@ -60,6 +60,13 @@ describe("router miscellaneous", () => {
|
||||
await router.navigate({ to: "users", params: { id: 3 } });
|
||||
expect(window.location.href).toBe("http://localhost/test.html#/users/3");
|
||||
});
|
||||
|
||||
test("navigate using path and query string should preserve query string", async () => {
|
||||
router = new TestRouter(env, [{ name: "users", path: "/users/{{id}}" }]);
|
||||
await router.navigate({ path: "/users/3?test=1" });
|
||||
expect(window.location.pathname).toBe("/users/3");
|
||||
expect(window.location.search).toBe("?test=1");
|
||||
});
|
||||
});
|
||||
|
||||
describe("routeToPath", () => {
|
||||
@@ -117,6 +124,11 @@ describe("getRouteParams", () => {
|
||||
expect(getRouteParams({ path: "*" }, "somepath")).toEqual({});
|
||||
});
|
||||
|
||||
test("properly match routes with query params", () => {
|
||||
expect(getRouteParams({ path: "/home" }, "/home?test=1")).toEqual({});
|
||||
expect(getRouteParams({ path: "/home" }, "/home?test1=1&test2=2")).toEqual({});
|
||||
});
|
||||
|
||||
test("properly match simple routes, mode hash", () => {
|
||||
// simple route
|
||||
expect(getRouteParams({ path: "/home" }, "#/home")).toEqual({});
|
||||
|
||||
Reference in New Issue
Block a user