[FIX] qweb: scope t-key directive to node and subnodes

not to siblings

closes #503
This commit is contained in:
Géry Debongnie
2019-11-27 07:24:33 +01:00
committed by aab-odoo
parent 1f079b883e
commit 6c753bb49f
6 changed files with 106 additions and 12 deletions
+20
View File
@@ -336,6 +336,26 @@ describe("basic widget properties", () => {
await widget.mount(fixture);
expect(fixture.innerHTML).toBe("<div><div><span>1</span></div><div><span>2</span></div></div>");
});
test("t-key on a component with t-if, and a sibling component", async () => {
class Child extends Component<any, any> {
static template = xml`<span>child</span>`;
}
class Parent extends Component<any, any> {
static template = xml`
<div>
<Child t-if="false" t-key="'str'"/>
<Child/>
</div>`;
static components = { Child };
}
const widget = new Parent();
await widget.mount(fixture);
expect(fixture.innerHTML).toBe("<div><span>child</span></div>");
expect(env.qweb.templates[Parent.template].fn.toString()).toMatchSnapshot();
});
});
describe("lifecycle hooks", () => {