mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
* fixing the existing behavior
This commit is contained in:
@@ -135,7 +135,7 @@ describe('CardView Component - properties', () => {
|
|||||||
metadataViewPage.clickOnInformationButton();
|
metadataViewPage.clickOnInformationButton();
|
||||||
|
|
||||||
metadataViewPage.checkMetadataGroupIsNotExpand('EXIF');
|
metadataViewPage.checkMetadataGroupIsNotExpand('EXIF');
|
||||||
metadataViewPage.checkMetadataGroupIsExpand('properties');
|
metadataViewPage.checkMetadataGroupIsNotExpand('properties');
|
||||||
|
|
||||||
metadataViewPage.clickMetadataGroup('properties');
|
metadataViewPage.clickMetadataGroup('properties');
|
||||||
|
|
||||||
|
@@ -2,8 +2,8 @@
|
|||||||
<mat-accordion displayMode="flat" [multi]="multi">
|
<mat-accordion displayMode="flat" [multi]="multi">
|
||||||
<mat-expansion-panel
|
<mat-expansion-panel
|
||||||
*ngIf="displayDefaultProperties"
|
*ngIf="displayDefaultProperties"
|
||||||
[expanded]="!expanded || !displayAspect"
|
[expanded]="canExpandProperties()"
|
||||||
[hideToggle]="!expanded || !displayAspect"
|
[hideToggle]="canExpandProperties()"
|
||||||
[attr.data-automation-id]="'adf-metadata-group-properties'" >
|
[attr.data-automation-id]="'adf-metadata-group-properties'" >
|
||||||
<mat-expansion-panel-header>
|
<mat-expansion-panel-header>
|
||||||
<mat-panel-title>
|
<mat-panel-title>
|
||||||
|
@@ -312,21 +312,30 @@ describe('ContentMetadataComponent', () => {
|
|||||||
component.displayEmpty = true;
|
component.displayEmpty = true;
|
||||||
|
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
const defaultProp = queryDom(fixture);
|
let defaultProp = queryDom(fixture);
|
||||||
const exifProp = queryDom(fixture, 'EXIF');
|
let exifProp = queryDom(fixture, 'EXIF');
|
||||||
const customProp = queryDom(fixture, 'CUSTOM');
|
let customProp = queryDom(fixture, 'CUSTOM');
|
||||||
expect(defaultProp.componentInstance.expanded).toBeFalsy();
|
expect(defaultProp.componentInstance.expanded).toBeFalsy();
|
||||||
expect(exifProp.componentInstance.expanded).toBeTruthy();
|
expect(exifProp.componentInstance.expanded).toBeTruthy();
|
||||||
expect(customProp.componentInstance.expanded).toBeFalsy();
|
expect(customProp.componentInstance.expanded).toBeFalsy();
|
||||||
|
|
||||||
component.displayAspect = 'CUSTOM';
|
component.displayAspect = 'CUSTOM';
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
const updatedDefault = queryDom(fixture);
|
defaultProp = queryDom(fixture);
|
||||||
const updatedExif = queryDom(fixture, 'EXIF');
|
exifProp = queryDom(fixture, 'EXIF');
|
||||||
const updatedCustom = queryDom(fixture, 'CUSTOM');
|
customProp = queryDom(fixture, 'CUSTOM');
|
||||||
expect(updatedDefault.componentInstance.expanded).toBeFalsy();
|
expect(defaultProp.componentInstance.expanded).toBeFalsy();
|
||||||
expect(updatedExif.componentInstance.expanded).toBeFalsy();
|
expect(exifProp.componentInstance.expanded).toBeFalsy();
|
||||||
expect(updatedCustom.componentInstance.expanded).toBeTruthy();
|
expect(customProp.componentInstance.expanded).toBeTruthy();
|
||||||
|
|
||||||
|
component.displayAspect = 'Properties';
|
||||||
|
fixture.detectChanges();
|
||||||
|
defaultProp = queryDom(fixture);
|
||||||
|
exifProp = queryDom(fixture, 'EXIF');
|
||||||
|
customProp = queryDom(fixture, 'CUSTOM');
|
||||||
|
expect(defaultProp.componentInstance.expanded).toBeTruthy();
|
||||||
|
expect(exifProp.componentInstance.expanded).toBeFalsy();
|
||||||
|
expect(customProp.componentInstance.expanded).toBeFalsy();
|
||||||
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@@ -344,21 +353,6 @@ describe('ContentMetadataComponent', () => {
|
|||||||
expect(customProp.componentInstance.expanded).toBeFalsy();
|
expect(customProp.componentInstance.expanded).toBeFalsy();
|
||||||
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should expand the properties section when input is null', async(() => {
|
|
||||||
component.displayAspect = null;
|
|
||||||
component.expanded = true;
|
|
||||||
component.displayEmpty = true;
|
|
||||||
|
|
||||||
fixture.detectChanges();
|
|
||||||
const defaultProp = queryDom(fixture);
|
|
||||||
const exifProp = queryDom(fixture, 'EXIF');
|
|
||||||
const customProp = queryDom(fixture, 'CUSTOM');
|
|
||||||
expect(defaultProp.componentInstance.expanded).toBeTruthy();
|
|
||||||
expect(exifProp.componentInstance.expanded).toBeFalsy();
|
|
||||||
expect(customProp.componentInstance.expanded).toBeFalsy();
|
|
||||||
|
|
||||||
}));
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -126,4 +126,8 @@ export class ContentMetadataComponent implements OnChanges, OnInit, OnDestroy {
|
|||||||
return group.title === this.displayAspect;
|
return group.title === this.displayAspect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public canExpandProperties(): boolean {
|
||||||
|
return !this.expanded || this.displayAspect === 'Properties';
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user