mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[FIX] qweb: support #{} syntax in attribute string interpolation
closes #113
This commit is contained in:
@@ -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
|
||||
) {
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user