mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[FIX] qweb: enclose interpolated expr in parentheses
Since rev 53e53e9b,
<div class="o_app" t-attf-class="{{ true ? 'o_extra' : '' }}"/>
produced
<div class="o_extra"/>
whereas it should have produced
<div class="o_app o_extra"/>
This is because there were missing parentheses around the string
returned by `interpolate`, which produced instructions like
var _1 = 'o_app ' + true ? 'o_extra' : '';
Fixes #132
This commit is contained in:
committed by
Géry Debongnie
parent
a08deb895d
commit
4d72a4f240
@@ -522,6 +522,12 @@ describe("attributes", () => {
|
||||
expect(result).toBe(`<div class="hello world"></div>`);
|
||||
});
|
||||
|
||||
test("class and t-attf-class with ternary operation", () => {
|
||||
qweb.addTemplate("test", `<div class="hello" t-attf-class="#{value ? 'world' : ''}"/>`);
|
||||
const result = renderToString(qweb, "test", { value: true });
|
||||
expect(result).toBe(`<div class="hello world"></div>`);
|
||||
});
|
||||
|
||||
test("t-att-class with object", () => {
|
||||
qweb.addTemplate(
|
||||
"test",
|
||||
|
||||
Reference in New Issue
Block a user