mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-02 17:53:30 +00:00
AAE-46654 Fix - return empty string when no value is provided in card… (#11969)
* AAE-46654 Fix - return empty string when no value is provided in card view text item * uncomment code
This commit is contained in:
+20
@@ -899,6 +899,26 @@ describe('CardViewTextItemComponent', () => {
|
||||
expect(await getTextFieldValue(component.property.key)).toEqual(expectedNumber.toString());
|
||||
expect(component.property.value).toBe(expectedNumber.toString());
|
||||
});
|
||||
|
||||
it('should set property value to empty string when value is cleared', async () => {
|
||||
const itemUpdatedSpy = spyOn(cardViewUpdateService.itemUpdated$, 'next');
|
||||
|
||||
await updateTextField(component.property.key, '');
|
||||
await fixture.whenStable();
|
||||
|
||||
expect(itemUpdatedSpy).toHaveBeenCalledWith({
|
||||
target: { ...component.property, isValidValue: true },
|
||||
changed: {
|
||||
textkey: ''
|
||||
},
|
||||
previousValue: {
|
||||
textkey: 10
|
||||
}
|
||||
});
|
||||
|
||||
verifyNoErrors(component.property.key);
|
||||
expect(component.property.value).toBe('');
|
||||
});
|
||||
});
|
||||
|
||||
describe('float', () => {
|
||||
|
||||
+4
@@ -251,6 +251,10 @@ export class CardViewTextItemComponent extends BaseCardView<CardViewTextItemMode
|
||||
}
|
||||
|
||||
private prepareIntLongValue(value: string): string {
|
||||
if (value === '') {
|
||||
return '';
|
||||
}
|
||||
|
||||
return String(Math.trunc(Number(value)));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user