[REF] router: add TestRouter and improve tests

This commit is contained in:
Géry Debongnie
2019-07-25 23:17:34 +02:00
parent bb46346767
commit bf705fcd99
4 changed files with 74 additions and 20 deletions
+17
View File
@@ -0,0 +1,17 @@
import { Router } from "../../src/router/Router";
import { QWeb } from "../../src/qweb/index";
export class TestRouter extends Router {
destroy() {
window.removeEventListener("popstate", this.checkAndUpdateRoute);
delete QWeb.DIRECTIVE_NAMES.routecomponent;
QWeb.DIRECTIVES = QWeb.DIRECTIVES.filter(d => d.name !== "routecomponent");
// remove component defined inroutes
for (let key in QWeb.components) {
if (key.startsWith("__component__")) {
delete QWeb.components[key];
}
}
}
}