diff --git a/lib/core/src/lib/form/components/widgets/amount/amount.widget.spec.ts b/lib/core/src/lib/form/components/widgets/amount/amount.widget.spec.ts index 1fc56dcd70..b4c20e00a9 100644 --- a/lib/core/src/lib/form/components/widgets/amount/amount.widget.spec.ts +++ b/lib/core/src/lib/form/components/widgets/amount/amount.widget.spec.ts @@ -890,6 +890,45 @@ describe('AmountWidgetComponent - rendering', () => { const expectedValue = '5.000,00 €'.replace(' ', '\u00A0'); expect(widget.placeholder).toBe(expectedValue); }); + + it('should format numeric placeholder with decimal digits', () => { + widget.field.placeholder = '1234.11'; + widget.currency = 'USD'; + widget.currencyDisplay = 'symbol'; + widget.decimalProperty = widget.showDecimalDigits; + + widget.enableDisplayBasedOnLocale = true; + widget.locale = 'de-DE'; + + const expected = '1.234,11 $'.replace(' ', '\u00A0'); + expect(widget.placeholder).toBe(expected); + }); + + it('should format numeric placeholder without decimal digits', () => { + widget.field.placeholder = '1234.11'; + widget.currency = 'USD'; + widget.currencyDisplay = 'symbol'; + widget.decimalProperty = widget.notShowDecimalDigits; + + widget.enableDisplayBasedOnLocale = true; + widget.locale = 'de-DE'; + + const expected = '1.234 $'.replace(' ', '\u00A0'); + expect(widget.placeholder).toBe(expected); + }); + + it('should format numeric placeholder without decimal digits and rounding', () => { + widget.field.placeholder = '1234.55'; + widget.currency = 'USD'; + widget.currencyDisplay = 'symbol'; + widget.decimalProperty = widget.notShowDecimalDigits; + + widget.enableDisplayBasedOnLocale = true; + widget.locale = 'de-DE'; + + const expected = '1.235 $'.replace(' ', '\u00A0'); + expect(widget.placeholder).toBe(expected); + }); }); describe('checkIfEmptyStringOrOnlySpaces', () => { diff --git a/lib/core/src/lib/form/components/widgets/amount/amount.widget.ts b/lib/core/src/lib/form/components/widgets/amount/amount.widget.ts index c5a4b20974..6ebb0f5901 100644 --- a/lib/core/src/lib/form/components/widgets/amount/amount.widget.ts +++ b/lib/core/src/lib/form/components/widgets/amount/amount.widget.ts @@ -83,7 +83,7 @@ export class AmountWidgetComponent extends WidgetComponent implements OnInit { if (isNaN(stringConvertedToNumber)) { return this.field.placeholder; } - return this.currencyPipe.transform(this.field.placeholder, this.currency, this.currencyDisplay, this.showDecimalDigits, this.locale); + return this.currencyPipe.transform(this.field.placeholder, this.currency, this.currencyDisplay, this.decimalProperty, this.locale); } constructor(