mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[FIX] qweb: allow t-call on arbitrary html nodes
This is a rarely (if ever) used feature, but according to our qweb reference implementation, it is possible to use the t-call directive on an arbitrary html tag, like this: <div t-call="my.template"/> It is then interpreted as: <div><t t-call="my.template"/></div> So, with this commit, we make sure that the owl qweb implementation matches that behaviour. closes #706
This commit is contained in:
@@ -766,10 +766,11 @@ describe("t-call (template calling", () => {
|
||||
expect(qweb.subTemplates["sub"]).toBeTruthy();
|
||||
});
|
||||
|
||||
test("t-call not allowed on a non t node", () => {
|
||||
qweb.addTemplate("_basic-callee", "<t>ok</t>");
|
||||
test("t-call allowed on a non t node", () => {
|
||||
qweb.addTemplate("_basic-callee", "<span>ok</span>");
|
||||
qweb.addTemplate("caller", '<div t-call="_basic-callee"/>');
|
||||
expect(() => renderToString(qweb, "caller")).toThrow("Invalid tag");
|
||||
const expected = "<div><span>ok</span></div>";
|
||||
expect(renderToString(qweb, "caller")).toBe(expected);
|
||||
});
|
||||
|
||||
test("with unused body", () => {
|
||||
|
||||
Reference in New Issue
Block a user