[ADF-5390] [ADF-5391] Add multivalue cardview for Date, Datetime, Integers and Decimal properties. (#6980)

* [ADF-5390] Addd multivalue cardview for Date, Datetime, Integers and Decimal properties

* Fix unit test

* Fix linting

* Fix e2e tests

* fix e2e

Co-authored-by: Eugenio Romano <eugenio.romano@alfresco.com>
This commit is contained in:
davidcanonieto
2021-05-09 04:05:26 +01:00
committed by GitHub
parent 71cad4c287
commit bd805cb34b
23 changed files with 280 additions and 54 deletions

View File

@@ -180,7 +180,48 @@ describe('CardViewTextItemComponent', () => {
expect(valueChips[0].nativeElement.innerText.trim()).toBe('item1');
expect(valueChips[1].nativeElement.innerText.trim()).toBe('item2');
expect(valueChips[2].nativeElement.innerText.trim()).toBe('item3');
});
it('should render chips for multivalue integers when chips are enabled', async () => {
component.property = new CardViewIntItemModel({
label: 'Text label',
value: [1, 2, 3],
key: 'textkey',
editable: true,
multivalued: true
});
component.useChipsForMultiValueProperty = true;
component.ngOnChanges({ property: new SimpleChange(null, null, true) });
fixture.detectChanges();
await fixture.whenStable();
const valueChips = fixture.debugElement.queryAll(By.css(`mat-chip`));
expect(valueChips).not.toBeNull();
expect(valueChips.length).toBe(3);
expect(valueChips[0].nativeElement.innerText.trim()).toBe('1');
expect(valueChips[1].nativeElement.innerText.trim()).toBe('2');
expect(valueChips[2].nativeElement.innerText.trim()).toBe('3');
});
it('should render chips for multivalue decimal numbers when chips are enabled', async () => {
component.property = new CardViewFloatItemModel({
label: 'Text label',
value: [1.1, 2.2, 3.3],
key: 'textkey',
editable: true,
multivalued: true
});
component.useChipsForMultiValueProperty = true;
component.ngOnChanges({ property: new SimpleChange(null, null, true) });
fixture.detectChanges();
await fixture.whenStable();
const valueChips = fixture.debugElement.queryAll(By.css(`mat-chip`));
expect(valueChips).not.toBeNull();
expect(valueChips.length).toBe(3);
expect(valueChips[0].nativeElement.innerText.trim()).toBe('1.1');
expect(valueChips[1].nativeElement.innerText.trim()).toBe('2.2');
expect(valueChips[2].nativeElement.innerText.trim()).toBe('3.3');
});
it('should render string for multivalue properties when chips are disabled', async () => {