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.checkMetadataGroupIsNotExpand('EXIF');
|
||||
metadataViewPage.checkMetadataGroupIsExpand('properties');
|
||||
metadataViewPage.checkMetadataGroupIsNotExpand('properties');
|
||||
|
||||
metadataViewPage.clickMetadataGroup('properties');
|
||||
|
||||
|
@@ -2,8 +2,8 @@
|
||||
<mat-accordion displayMode="flat" [multi]="multi">
|
||||
<mat-expansion-panel
|
||||
*ngIf="displayDefaultProperties"
|
||||
[expanded]="!expanded || !displayAspect"
|
||||
[hideToggle]="!expanded || !displayAspect"
|
||||
[expanded]="canExpandProperties()"
|
||||
[hideToggle]="canExpandProperties()"
|
||||
[attr.data-automation-id]="'adf-metadata-group-properties'" >
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>
|
||||
|
@@ -312,21 +312,30 @@ describe('ContentMetadataComponent', () => {
|
||||
component.displayEmpty = true;
|
||||
|
||||
fixture.detectChanges();
|
||||
const defaultProp = queryDom(fixture);
|
||||
const exifProp = queryDom(fixture, 'EXIF');
|
||||
const customProp = queryDom(fixture, 'CUSTOM');
|
||||
let defaultProp = queryDom(fixture);
|
||||
let exifProp = queryDom(fixture, 'EXIF');
|
||||
let customProp = queryDom(fixture, 'CUSTOM');
|
||||
expect(defaultProp.componentInstance.expanded).toBeFalsy();
|
||||
expect(exifProp.componentInstance.expanded).toBeTruthy();
|
||||
expect(customProp.componentInstance.expanded).toBeFalsy();
|
||||
|
||||
component.displayAspect = 'CUSTOM';
|
||||
fixture.detectChanges();
|
||||
const updatedDefault = queryDom(fixture);
|
||||
const updatedExif = queryDom(fixture, 'EXIF');
|
||||
const updatedCustom = queryDom(fixture, 'CUSTOM');
|
||||
expect(updatedDefault.componentInstance.expanded).toBeFalsy();
|
||||
expect(updatedExif.componentInstance.expanded).toBeFalsy();
|
||||
expect(updatedCustom.componentInstance.expanded).toBeTruthy();
|
||||
defaultProp = queryDom(fixture);
|
||||
exifProp = queryDom(fixture, 'EXIF');
|
||||
customProp = queryDom(fixture, 'CUSTOM');
|
||||
expect(defaultProp.componentInstance.expanded).toBeFalsy();
|
||||
expect(exifProp.componentInstance.expanded).toBeFalsy();
|
||||
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();
|
||||
|
||||
}));
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public canExpandProperties(): boolean {
|
||||
return !this.expanded || this.displayAspect === 'Properties';
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user