mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[FIX] qweb: cascading t-call and t-raw="0"
Have a t-call having a t-raw="0" that call is made to a template of the same form i.e. itself as a t-call t-raw="0" structure Before this commit, there was recursion crash This was because the caller to which a t-raw="0" referred to was incorrect. The caller here is the node which makes the t-call. In particular, the caller was always set to last caller of the context After this commit, there is no crash and this imbrication of t-call and t-raw="0" is well rendered. To sum up, we count the recursive calls to t-raw="0" and fetch the caller in the context accordingly closes #510
This commit is contained in:
committed by
Géry Debongnie
parent
6e5d6aa226
commit
7f6782d009
@@ -673,6 +673,39 @@ describe("t-call (template calling", () => {
|
||||
expect(renderToString(qweb, "main")).toBe(expected);
|
||||
});
|
||||
|
||||
test("cascading t-call t-raw='0'", () => {
|
||||
qweb.addTemplates(`
|
||||
<templates>
|
||||
<div t-name="finalTemplate">
|
||||
<span>cascade 2</span>
|
||||
<t t-raw="0"/>
|
||||
</div>
|
||||
|
||||
<div t-name="subSubTemplate">
|
||||
<t t-call="finalTemplate">
|
||||
<span>cascade 1</span>
|
||||
<t t-raw="0"/>
|
||||
</t>
|
||||
</div>
|
||||
|
||||
<div t-name="SubTemplate">
|
||||
<t t-call="subSubTemplate">
|
||||
<span>cascade 0</span>
|
||||
<t t-raw="0"/>
|
||||
</t>
|
||||
</div>
|
||||
|
||||
<div t-name="main">
|
||||
<t t-call="SubTemplate">
|
||||
<span>hey</span> <span>yay</span>
|
||||
</t>
|
||||
</div>
|
||||
</templates>
|
||||
`);
|
||||
const expected = "<div><div><div><div><span>cascade 2</span><span>cascade 1</span><span>cascade 0</span><span>hey</span> <span>yay</span></div></div></div></div>";
|
||||
expect(renderToString(qweb, "main")).toBe(expected);
|
||||
});
|
||||
|
||||
test("recursive template, part 1", () => {
|
||||
qweb.addTemplates(`
|
||||
<templates>
|
||||
|
||||
Reference in New Issue
Block a user