Skip to content

Commit

Permalink
fix(number-separator): display zero values correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
anehx committed Sep 4, 2024
1 parent 89fafb5 commit c80f9b7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default class CfFieldInputNumberSeparatorComponent extends Component {
}

get displayValue() {
if (!this.args.field.value) {
if (isNaN(parseFloat(this.args.field.value))) {
return "";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ module(

assert.strictEqual(this.field.value, 1234);
assert.dom("input").hasValue("1’234");

await fillIn("input", "0");
assert.dom("input").hasValue("0");
});

test("it converts floats to formatted strings and saves them properly", async function (assert) {
Expand All @@ -47,6 +50,9 @@ module(

assert.strictEqual(this.field.value, 1234.123);
assert.dom("input").hasValue("1’234.123");

await fillIn("input", "0");
assert.dom("input").hasValue("0");
});

test("it displays calculated floats properly", async function (assert) {
Expand Down

0 comments on commit c80f9b7

Please sign in to comment.