[FIX] qweb: remove comments in xml strings before parsing

It was done in loadTemplates, but this does not work if we want to add
templates from another source.
This commit is contained in:
Géry Debongnie
2019-09-19 15:18:59 +02:00
parent c9910077a4
commit 8edc637033
4 changed files with 22 additions and 3 deletions
@@ -768,6 +768,18 @@ exports[`static templates empty div 1`] = `
}"
`;
exports[`static templates ignore comments 1`] = `
"function anonymous(context,extra
) {
var h = this.h;
let c1 = [], p1 = {key:1};
var vn1 = h('div', p1, c1);
result = vn1;
c1.push({text: \`hello owl\`});
return vn1;
}"
`;
exports[`static templates simple dynamic value 1`] = `
"function anonymous(context,extra
) {
+6
View File
@@ -49,6 +49,12 @@ describe("static templates", () => {
qweb.addTemplate("test", "<div><span>word</span></div>");
expect(renderToString(qweb, "test")).toBe("<div><span>word</span></div>");
});
test("ignore comments", () => {
qweb.addTemplate("test", "<div>hello <!-- comment-->owl</div>");
expect(renderToString(qweb, "test")).toBe("<div>hello owl</div>");
});
});
describe("error handling", () => {