mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[AAE-485] Fix card view int item validator (#5135)
* [AAE-485] Fix card view int item validator * Improve code * Fix unit tests * Remove outdated test * Fix login of int validator * Fix e2e test * fix linting
This commit is contained in:
committed by
Eugenio Romano
parent
f2c1778eda
commit
2a033507b3
@@ -46,12 +46,13 @@ describe('CardViewTextItemModel', () => {
|
||||
expect(itemModel.displayValue).toBe('Banuk');
|
||||
});
|
||||
|
||||
it('should return the default value if the value is not present', () => {
|
||||
it('should return the default value if the value is not present the first time it loads', () => {
|
||||
properties.value = undefined;
|
||||
properties.default = 'default-value';
|
||||
const itemModel = new CardViewTextItemModel(properties);
|
||||
|
||||
expect(itemModel.displayValue).toBe('default-value');
|
||||
itemModel.value = '';
|
||||
expect(itemModel.displayValue).toBe('');
|
||||
});
|
||||
|
||||
it('should apply a pipe on the value if it is present', () => {
|
||||
|
@@ -33,14 +33,14 @@ export class CardViewTextItemModel extends CardViewBaseItemModel implements Card
|
||||
this.multivalued = !!cardViewTextItemProperties.multivalued;
|
||||
this.pipes = cardViewTextItemProperties.pipes || [];
|
||||
this.clickCallBack = cardViewTextItemProperties.clickCallBack ? cardViewTextItemProperties.clickCallBack : null;
|
||||
|
||||
if (this.default && this.isEmpty()) {
|
||||
this.value = this.default;
|
||||
}
|
||||
}
|
||||
|
||||
get displayValue() {
|
||||
if (this.isEmpty()) {
|
||||
return this.default;
|
||||
} else {
|
||||
return this.applyPipes(this.value);
|
||||
}
|
||||
get displayValue(): string {
|
||||
return this.applyPipes(this.value);
|
||||
}
|
||||
|
||||
private applyPipes(displayValue) {
|
||||
|
Reference in New Issue
Block a user