Api: Fix Et2Number could not display empty value (""), gave 0 instead.

This commit is contained in:
nathan 2024-11-12 13:21:22 -07:00 committed by ralf
parent 6480464a66
commit 248bc5891e
2 changed files with 8 additions and 2 deletions

View File

@ -236,7 +236,7 @@ export class Et2Number extends Et2Textbox
val = parseFloat(val);
}
}
if(isNaN(val))
if(val == "" || isNaN(val))
{
super.value = val;
this.requestUpdate("value", old);

View File

@ -63,7 +63,13 @@ describe("Number widget", () =>
element.precision = 0;
element.value = "1,234";
assert.equal(element.value, "1", "Wrong number of decimals (, separator)");
})
});
it("handles blank ('')", () =>
{
element.value = "";
assert.equal(element.value, "");
});
it("Min limit", () =>
{