fix: allow t-attf- attributes to combine with regular attrs

fixes #10
This commit is contained in:
Géry Debongnie
2019-04-02 09:22:37 +02:00
parent 990a08dc04
commit 56be87f26e
3 changed files with 29 additions and 2 deletions
+11
View File
@@ -207,6 +207,17 @@ exports[`attributes t-att-class with object 1`] = `
}"
`;
exports[`attributes t-attf-class should combine with class 1`] = `
"function anonymous(context,extra
) {
let h = this.utils.h;
let _1 = 'hello ' + \`world\`;
let c2 = [], p2 = {key:2,attrs:{class: _1}};
let vn2 = h('div', p2, c2);
return vn2;
}"
`;
exports[`attributes tuple literal 1`] = `
"function anonymous(context,extra
) {
+6
View File
@@ -401,6 +401,12 @@ describe("attributes", () => {
expect(result).toBe(`<div foo="bar"></div>`);
});
test("t-attf-class should combine with class", () => {
qweb.addTemplate("test", `<div class="hello" t-attf-class="world"/>`);
const result = renderToString(qweb, "test");
expect(result).toBe(`<div class="hello world"></div>`);
});
test("format value", () => {
qweb.addTemplate("test", `<div t-attf-foo="b{{value}}r"/>`);
const result = renderToString(qweb, "test", { value: "a" });