mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
@@ -1467,6 +1467,41 @@ exports[`t-if can use some boolean operators in expressions 1`] = `
|
||||
}"
|
||||
`;
|
||||
|
||||
exports[`t-if t-esc with t-elif 1`] = `
|
||||
"function anonymous(context,extra
|
||||
) {
|
||||
var h = this.h;
|
||||
let c1 = [], p1 = {key:1};
|
||||
var vn1 = h('div', p1, c1);
|
||||
if (false) {
|
||||
c1.push({text: \`abc\`});
|
||||
}
|
||||
else {
|
||||
var _2 = 'x';
|
||||
if (_2 || _2 === 0) {
|
||||
c1.push({text: _2});
|
||||
}
|
||||
}
|
||||
return vn1;
|
||||
}"
|
||||
`;
|
||||
|
||||
exports[`t-if t-esc with t-if 1`] = `
|
||||
"function anonymous(context,extra
|
||||
) {
|
||||
var h = this.h;
|
||||
let c1 = [], p1 = {key:1};
|
||||
var vn1 = h('div', p1, c1);
|
||||
if (true) {
|
||||
var _2 = 'x';
|
||||
if (_2 || _2 === 0) {
|
||||
c1.push({text: _2});
|
||||
}
|
||||
}
|
||||
return vn1;
|
||||
}"
|
||||
`;
|
||||
|
||||
exports[`t-key can use t-key directive on a node 1`] = `
|
||||
"function anonymous(context,extra
|
||||
) {
|
||||
|
||||
@@ -328,6 +328,16 @@ describe("t-if", () => {
|
||||
};
|
||||
expect(normalize(renderToString(qweb, "test", context))).toBe("<div>andormgtnlt</div>");
|
||||
});
|
||||
|
||||
test("t-esc with t-if", () => {
|
||||
qweb.addTemplate("test", `<div><t t-if="true" t-esc="'x'"/></div>`);
|
||||
expect(renderToString(qweb, "test")).toBe("<div>x</div>");
|
||||
});
|
||||
|
||||
test("t-esc with t-elif", () => {
|
||||
qweb.addTemplate("test", `<div><t t-if="false">abc</t><t t-else="1" t-esc="'x'"/></div>`);
|
||||
expect(renderToString(qweb, "test")).toBe("<div>x</div>");
|
||||
});
|
||||
});
|
||||
|
||||
describe("attributes", () => {
|
||||
|
||||
Reference in New Issue
Block a user