mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
AAE-39923 Placholeder is formatted according to the enableFractions (#11441)
* [AAE-39923] placholeder is formatted according to the enableFractions property * [AAE-39923] unit tests for placeholder decimal part
This commit is contained in:
@@ -890,6 +890,45 @@ describe('AmountWidgetComponent - rendering', () => {
|
|||||||
const expectedValue = '5.000,00 €'.replace(' ', '\u00A0');
|
const expectedValue = '5.000,00 €'.replace(' ', '\u00A0');
|
||||||
expect(widget.placeholder).toBe(expectedValue);
|
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', () => {
|
describe('checkIfEmptyStringOrOnlySpaces', () => {
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ export class AmountWidgetComponent extends WidgetComponent implements OnInit {
|
|||||||
if (isNaN(stringConvertedToNumber)) {
|
if (isNaN(stringConvertedToNumber)) {
|
||||||
return this.field.placeholder;
|
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(
|
constructor(
|
||||||
|
|||||||
Reference in New Issue
Block a user