[FIX] blockdom: undefined properties are treated as empty strings

This commit is contained in:
Géry Debongnie
2022-02-15 08:58:07 +01:00
committed by Samuel Degueldre
parent 804ad3c35e
commit 3536f41f00
4 changed files with 41 additions and 1 deletions
+13
View File
@@ -30,6 +30,19 @@ describe("t-model directive", () => {
expect(fixture.innerHTML).toBe("<div><input><span>test</span></div>");
});
test("t-model on an input with an undefined value", async () => {
class SomeComponent extends Component {
static template = xml`<input t-model="state.text"/>`;
state = useState({ text: undefined });
}
await mount(SomeComponent, fixture);
expect(fixture.innerHTML).toBe("<input>");
const input = fixture.querySelector("input")!;
expect(input.value).toBe("");
});
test("basic use, on an input with bracket expression", async () => {
class SomeComponent extends Component {
static template = xml`