[FIX] compiler: allow t-out on component tag

Before this commit, the template parser would allow using t-esc on a
component tag (<MyComponent t-esc="expr"/>) but would incorrectly ignore
the component when parsing a t-out: <MyComponent t-out="expr"/> would be
parsed as <t t-out="expr"/>

This commit solves the issue, and also, moves the `t-out` parsing code
next to `t-esc` so they have the same priority relatively to other
directives.

closes #1483
This commit is contained in:
Géry Debongnie
2023-07-19 14:55:25 +02:00
committed by Sam Degueldre
parent 0d9d21a5c1
commit 2e07799250
2 changed files with 24 additions and 19 deletions
+6
View File
@@ -1569,6 +1569,12 @@ describe("qweb parser", () => {
);
});
test("component with t-out", async () => {
expect(parse(`<MyComponent t-out="someValue"/>`)).toEqual(
parse(`<MyComponent><t t-out="someValue"/></MyComponent>`)
);
});
test("component with t-esc and content", async () => {
expect(() => parse(`<MyComponent t-esc="someValue">Some content</MyComponent>`)).toThrow(
"Cannot have t-esc on a component that already has content"