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:
Tomasz Gnyp
2026-06-09 14:25:49 +02:00
committed by GitHub
parent 9ec31dd543
commit 7bb219e4dd
2 changed files with 24 additions and 0 deletions
@@ -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', () => {
@@ -251,6 +251,10 @@ export class CardViewTextItemComponent extends BaseCardView<CardViewTextItemMode
}
private prepareIntLongValue(value: string): string {
if (value === '') {
return '';
}
return String(Math.trunc(Number(value)));
}
}