From 3733734ae5bdd1c85ecc52ff473c9087f7920d3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Sun, 14 Apr 2019 10:44:29 +0200 Subject: [PATCH] [REF] component: rename t-keep-alive to t-keepalive This is useful to preserve the following nice property: when we have an attribute t-something-someotherthing, we can get the directive name by removing 't-' at the front, and splitting on '-'. --- examples/web/static/src/xml/templates.xml | 2 +- src/qweb.ts | 4 ++-- tests/component.test.ts | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/web/static/src/xml/templates.xml b/examples/web/static/src/xml/templates.xml index b3f99c9d..4793603d 100644 --- a/examples/web/static/src/xml/templates.xml +++ b/examples/web/static/src/xml/templates.xml @@ -3,7 +3,7 @@
- +
diff --git a/src/qweb.ts b/src/qweb.ts index a588e8a7..7d6632bf 100644 --- a/src/qweb.ts +++ b/src/qweb.ts @@ -195,7 +195,7 @@ export class QWeb { attf: 1, props: 1, key: 1, - keep: 1 // todo: rename keep-alive to keepalive + keepalive: 1 }; [ forEachDirective, @@ -940,7 +940,7 @@ const widgetDirective: Directive = { ctx.addLine("//WIDGET"); ctx.rootContext.shouldDefineOwner = true; let props = node.getAttribute("t-props"); - let keepAlive = node.getAttribute("t-keep-alive") ? true : false; + let keepAlive = node.getAttribute("t-keepalive") ? true : false; // t-on- events... const events: [string, string][] = []; diff --git a/tests/component.test.ts b/tests/component.test.ts index cf8ff05e..bea82b43 100644 --- a/tests/component.test.ts +++ b/tests/component.test.ts @@ -739,10 +739,10 @@ describe("composition", () => { ); }); - test("sub widgets with t-keep-alive are not destroyed if no longer in dom", async () => { + test("sub widgets with t-keepalive are not destroyed if no longer in dom", async () => { class ParentWidget extends Widget { state = { ok: true }; - inlineTemplate = `
`; + inlineTemplate = `
`; widgets = { counter: Counter }; } const widget = new ParentWidget(env); @@ -765,10 +765,10 @@ describe("composition", () => { ); }); - test("sub widgets dom state with t-keep-alive is preserved", async () => { + test("sub widgets dom state with t-keepalive is preserved", async () => { class ParentWidget extends Widget { state = { ok: true }; - inlineTemplate = `
`; + inlineTemplate = `
`; widgets = { InputWidget }; } class InputWidget extends Widget {