mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[FIX] fix some issues with t-out with falsy values, and with default value
This commit is contained in:
@@ -1084,4 +1084,25 @@ describe("t-out in components", () => {
|
||||
await nextTick();
|
||||
expect(fixture.innerHTML).toBe("<div>1</div><div>2</div>");
|
||||
});
|
||||
|
||||
test("t-out and updating falsy values, ", async () => {
|
||||
class Test extends Component {
|
||||
static template = xml`<t t-out="state.a"/>`;
|
||||
state: any = useState({ a: 0 });
|
||||
}
|
||||
|
||||
const comp = await mount(Test, fixture);
|
||||
expect(fixture.innerHTML).toBe("0");
|
||||
comp.state.a = undefined;
|
||||
await nextTick();
|
||||
expect(fixture.innerHTML).toBe("");
|
||||
|
||||
comp.state.a = "hello"
|
||||
await nextTick();
|
||||
expect(fixture.innerHTML).toBe("hello");
|
||||
|
||||
comp.state.a = false;
|
||||
await nextTick();
|
||||
expect(fixture.innerHTML).toBe("false");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user