diff --git a/packages/form/addon/components/cf-field/input/number-separator.js b/packages/form/addon/components/cf-field/input/number-separator.js index 8c7f009a5..4b3b0d95a 100644 --- a/packages/form/addon/components/cf-field/input/number-separator.js +++ b/packages/form/addon/components/cf-field/input/number-separator.js @@ -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 ""; } diff --git a/packages/form/tests/integration/components/cf-field/input/number-separator-test.js b/packages/form/tests/integration/components/cf-field/input/number-separator-test.js index e26789eaf..daae2395d 100644 --- a/packages/form/tests/integration/components/cf-field/input/number-separator-test.js +++ b/packages/form/tests/integration/components/cf-field/input/number-separator-test.js @@ -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) { @@ -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) {