[ADF-5004] [CardViewTextItemComponent] Provide a way to have an icon for the clickable items (#5270)

* [ADF-5004] [CardViewTextItemComponent] Provide a way to have an icon for the clickable items.

* * FIxed failing unit tests* Modified task-details tests and add few more.
This commit is contained in:
siva kumar
2019-11-22 15:07:32 +05:30
committed by Maurizio Vitale
parent e806e97c75
commit 5068cbf539
8 changed files with 528 additions and 125 deletions

View File

@@ -154,6 +154,54 @@ describe('CardViewTextItemComponent', () => {
expect(value).toBeNull();
});
it('should not render the clickable icon in case editable set to false', () => {
component.property = new CardViewTextItemModel({
label: 'Text label',
value: '',
key: 'textkey',
default: 'FAKE-DEFAULT-KEY',
clickable: true,
icon: 'create'
});
component.editable = false;
fixture.detectChanges();
const value = fixture.debugElement.query(By.css(`[data-automation-id="card-textitem-clickable-icon-textkey"]`));
expect(value).toBeNull('icon should NOT be shown');
});
it('should render the defined clickable icon in case of clickable true and editable input set to true', () => {
component.property = new CardViewTextItemModel({
label: 'Text label',
value: '',
key: 'textkey',
default: 'FAKE-DEFAULT-KEY',
clickable: true,
icon: 'FAKE_ICON'
});
component.editable = true;
fixture.detectChanges();
const value = fixture.debugElement.query(By.css(`[data-automation-id="card-textitem-clickable-icon-textkey"]`));
expect(value).not.toBeNull();
expect(value.nativeElement.innerText).toBe('FAKE_ICON');
});
it('should not render clickable icon in case of clickable true and icon undefined', () => {
component.property = new CardViewTextItemModel({
label: 'Text label',
value: '',
key: 'textkey',
default: 'FAKE-DEFAULT-KEY',
clickable: true
});
component.editable = true;
fixture.detectChanges();
const value = fixture.debugElement.query(By.css(`[data-automation-id="card-textitem-clickable-icon-textkey"]`));
expect(value).toBeNull('icon should NOT be shown');
});
it('should not render the edit icon in case of clickable true and icon undefined', () => {
component.property = new CardViewTextItemModel({
label: 'Text label',