mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[FIX] qweb: conditional t-call with body
When a t-call has a condition and a body the t-if's and its flavors should be ignored when compiling the body of a t-call
This commit is contained in:
committed by
Géry Debongnie
parent
b96ea79f2b
commit
08022b49df
@@ -882,6 +882,22 @@ describe("t-call (template calling", () => {
|
||||
expect(trim(renderToString(qweb, "abcd"))).toBe(expected);
|
||||
});
|
||||
|
||||
test("t-call, conditional and t-set in t-call body", () => {
|
||||
QWeb.registerTemplate("callee1", '<div>callee1</div>');
|
||||
QWeb.registerTemplate("callee2", '<div>callee2 <t t-esc="v"/></div>');
|
||||
QWeb.registerTemplate("caller",
|
||||
`<div>
|
||||
<t t-set="v1" t-value="'elif'"/>
|
||||
<t t-if="v1 === 'if'" t-call="callee1" />
|
||||
<t t-elif="v1 === 'elif'" t-call="callee2" >
|
||||
<t t-set="v" t-value="'success'" />
|
||||
</t>
|
||||
</div>`
|
||||
);
|
||||
const rendered = renderToString(qweb, "caller");
|
||||
expect(rendered).toBe(`<div><div>callee2 success</div></div>`);
|
||||
});
|
||||
|
||||
test("t-call with t-set inside and outside", () => {
|
||||
qweb.addTemplates(`
|
||||
<templates>
|
||||
|
||||
Reference in New Issue
Block a user