mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
28 lines
950 B
TypeScript
28 lines
950 B
TypeScript
|
|
import { QWeb } from "../../src/qweb/index";
|
||
|
|
import { renderToString } from "../helpers";
|
||
|
|
|
||
|
|
//------------------------------------------------------------------------------
|
||
|
|
// Setup and helpers
|
||
|
|
//------------------------------------------------------------------------------
|
||
|
|
|
||
|
|
function render(template, context = {}) {
|
||
|
|
const qweb = new QWeb();
|
||
|
|
qweb.addTemplate("test", template);
|
||
|
|
return renderToString(qweb, "test", context);
|
||
|
|
}
|
||
|
|
|
||
|
|
//------------------------------------------------------------------------------
|
||
|
|
// Tests
|
||
|
|
//------------------------------------------------------------------------------
|
||
|
|
|
||
|
|
describe("qweb t-att", () => {
|
||
|
|
test("t-att-class with multiple classes", () => {
|
||
|
|
expect(render(`<div t-att-class="{'a b c': value}" />`, { value: true })).toBe(
|
||
|
|
'<div class="a b c"></div>'
|
||
|
|
);
|
||
|
|
expect(render(`<div t-att-class="{['a b c']: value}" />`, { value: true })).toBe(
|
||
|
|
'<div class="a b c"></div>'
|
||
|
|
);
|
||
|
|
});
|
||
|
|
});
|