support dynamic formatted attributes with dashes

This commit is contained in:
Géry Debongnie
2019-03-05 08:35:19 +01:00
parent b15761de8b
commit 484692b53a
3 changed files with 22 additions and 1 deletions
@@ -33,6 +33,17 @@ exports[`attributes dynamic attributes 1`] = `
}"
`;
exports[`attributes dynamic formatted attributes with a dash 1`] = `
"function anonymous(context,extra
) {
let h = this.h;
let _1 = \`Some text \${context['id']}\`;
let c2 = [], p2 = {key:2,attrs:{\\"aria-label\\": _1}};
let vn2 = h('div', p2, c2);
return vn2;
}"
`;
exports[`attributes fixed variable 1`] = `
"function anonymous(context,extra
) {
+6
View File
@@ -316,6 +316,12 @@ describe("attributes", () => {
expect(result).toBe(`<div data-action-id="32"></div>`);
});
test("dynamic formatted attributes with a dash", () => {
qweb.addTemplate("test", `<div t-attf-aria-label="Some text {{id}}"/>`);
const result = renderToString(qweb, "test", { id: 32 });
expect(result).toBe(`<div aria-label="Some text 32"></div>`);
});
test("fixed variable", () => {
qweb.addTemplate("test", `<div t-att-foo="value"/>`);
const result = renderToString(qweb, "test", { value: "ok" });