[FIX] qweb: support #{} syntax in attribute string interpolation

closes #113
This commit is contained in:
Géry Debongnie
2019-05-17 16:14:54 +02:00
parent a1e982aba5
commit a1d7e6c987
4 changed files with 42 additions and 7 deletions
+11
View File
@@ -93,6 +93,17 @@ exports[`attributes format expression 1`] = `
}"
`;
exports[`attributes format expression, other format 1`] = `
"function anonymous(context,extra
) {
var h = this.utils.h;
var _1 = \`\${context['value'] + 37}\`;
let c2 = [], p2 = {key:2,attrs:{foo: _1}};
var vn2 = h('div', p2, c2);
return vn2;
}"
`;
exports[`attributes format literal 1`] = `
"function anonymous(context,extra
) {
+6
View File
@@ -511,6 +511,12 @@ describe("attributes", () => {
expect(result).toBe(`<div foo="42"></div>`);
});
test("format expression, other format", () => {
qweb.addTemplate("test", `<div t-attf-foo="#{value + 37}"/>`);
const result = renderToString(qweb, "test", { value: 5 });
expect(result).toBe(`<div foo="42"></div>`);
});
test("format multiple", () => {
qweb.addTemplate(
"test",