[IMP] router: add validation for destinations

This commit is contained in:
Géry Debongnie
2019-07-26 08:31:22 +02:00
parent 1a931a2a08
commit 6ecd1d6ea2
3 changed files with 31 additions and 14 deletions
+4 -4
View File
@@ -43,12 +43,12 @@ describe("router directive t-routecomponent", () => {
];
router = new TestRouter(env, routes, { mode: "history" });
router.navigate({ name: "about" });
router.navigate({ to: "about" });
const app = new App(env);
await app.mount(fixture);
expect(fixture.innerHTML).toBe("<div><span>About</span></div>");
router.navigate({ name: "users" });
router.navigate({ to: "users" });
await nextTick();
expect(fixture.innerHTML).toBe("<div><span>Users</span></div>");
expect(env.qweb.templates.App.fn.toString()).toMatchSnapshot();
@@ -70,7 +70,7 @@ describe("router directive t-routecomponent", () => {
const routes = [{ name: "book", path: "/book/{{title}}", component: Book }];
router = new TestRouter(env, routes, { mode: "history" });
router.navigate({ name: "book", params: { title: "1984" } });
router.navigate({ to: "book", params: { title: "1984" } });
const app = new App(env);
await app.mount(fixture);
expect(fixture.innerHTML).toBe("<div><span>Book 1984</span></div>");
@@ -97,7 +97,7 @@ describe("router directive t-routecomponent", () => {
const routes = [{ name: "book", path: "/book/{{title}}/{{val.number}}", component: Book }];
router = new TestRouter(env, routes, { mode: "history" });
router.navigate({ name: "book", params: { title: "1984", val: "123" } });
router.navigate({ to: "book", params: { title: "1984", val: "123" } });
const app = new App(env);
await app.mount(fixture);
expect(fixture.innerHTML).toBe("<div><span>Book 1984|124</span></div>");