* fixing the existing behavior

This commit is contained in:
dhrn
2019-04-24 12:30:52 +05:30
parent 374da200d2
commit 9866cf4d1d
4 changed files with 25 additions and 27 deletions

View File

@@ -135,7 +135,7 @@ describe('CardView Component - properties', () => {
metadataViewPage.clickOnInformationButton();
metadataViewPage.checkMetadataGroupIsNotExpand('EXIF');
metadataViewPage.checkMetadataGroupIsExpand('properties');
metadataViewPage.checkMetadataGroupIsNotExpand('properties');
metadataViewPage.clickMetadataGroup('properties');

View File

@@ -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>

View File

@@ -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();
}));
});
});

View File

@@ -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';
}
}