mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[IMP] templates: can load multiple at once and also from XMLDocument
This commit is contained in:
@@ -138,51 +138,3 @@ describe("simple templates, mostly static", () => {
|
||||
expect(renderToString(template, { v: "from context" })).toBe("text from context");
|
||||
});
|
||||
});
|
||||
|
||||
describe("loading templates", () => {
|
||||
test.skip("can initialize qweb with a string", () => {
|
||||
/* const templates = `<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templates id="template" xml:space="preserve">
|
||||
<div t-name="hey">jupiler</div>
|
||||
</templates>`;
|
||||
const qweb = new QWeb({ templates });
|
||||
expect(renderToString(qweb, "hey")).toBe("<div>jupiler</div>");*/
|
||||
});
|
||||
|
||||
test.skip("can load a few templates from a xml string", () => {
|
||||
/*const data = `<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templates id="template" xml:space="preserve">
|
||||
|
||||
<t t-name="items"><li>ok</li><li>foo</li></t>
|
||||
|
||||
<ul t-name="main"><t t-call="items"/></ul>
|
||||
</templates>`;
|
||||
qweb.addTemplates(data);
|
||||
const result = renderToString(qweb, "main");
|
||||
expect(result).toBe("<ul><li>ok</li><li>foo</li></ul>");*/
|
||||
});
|
||||
|
||||
test.skip("does not crash if string does not have templates", () => {
|
||||
/*const data = "";
|
||||
qweb.addTemplates(data);
|
||||
expect(Object.keys(qweb.templates)).toEqual([]);*/
|
||||
});
|
||||
});
|
||||
|
||||
describe("global template registration", () => {
|
||||
test.skip("can register template globally", () => {
|
||||
// expect.assertions(5);
|
||||
// let qweb = new QWeb();
|
||||
// try {
|
||||
// qweb.render("mytemplate");
|
||||
// } catch (e) {
|
||||
// expect(e.message).toMatch("Template mytemplate does not exist");
|
||||
// }
|
||||
// expect(qweb.templates.mytemplate).toBeUndefined();
|
||||
// QWeb.registerTemplate("mytemplate", "<div>global</div>");
|
||||
// expect(qweb.templates.mytemplate).toBeDefined();
|
||||
// const vnode = qweb.render("mytemplate");
|
||||
// expect(vnode.sel).toBe("div");
|
||||
// expect((vnode as any).children[0].text).toBe("global");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user