Fixed unit tests after rebase

This commit is contained in:
Vito Albano
2023-12-22 14:41:13 +00:00
parent 00e12d8277
commit d1ecdb7a78
4 changed files with 20 additions and 14 deletions

View File

@@ -46,7 +46,7 @@
</adf-card-view>
</mat-expansion-panel>
<ng-container *ngIf="displayTags">
<ng-container *ngIf="displayTags">
<mat-expansion-panel hideToggle [(expanded)]="isTagPanelExpanded" class="adf-content-metadata-panel">
<mat-expansion-panel-header>
<adf-content-metadata-header [title]="'METADATA.BASIC.TAGS'" [expanded]="isTagPanelExpanded">

View File

@@ -42,6 +42,7 @@ import { MatDialogModule } from '@angular/material/dialog';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { MatSnackBarModule } from '@angular/material/snack-bar';
import { MatTooltipModule } from '@angular/material/tooltip';
import { MatProgressBarModule } from '@angular/material/progress-bar';
describe('ContentMetadataComponent', () => {
let component: ContentMetadataComponent;
@@ -55,6 +56,7 @@ describe('ContentMetadataComponent', () => {
let categoryService: CategoryService;
let getClassSpy: jasmine.Spy;
let notificationService: NotificationService;
let getGroupedPropertiesSpy: jasmine.Spy;
const preset = 'custom-preset';
@@ -155,6 +157,7 @@ describe('ContentMetadataComponent', () => {
HttpClientModule,
MatDialogModule,
MatSnackBarModule,
MatProgressBarModule,
MatTooltipModule,
PipeModule],
providers: [
@@ -209,6 +212,7 @@ describe('ContentMetadataComponent', () => {
component.node = node;
component.preset = preset;
spyOn(contentMetadataService, 'getContentTypeProperty').and.returnValue(of([]));
getGroupedPropertiesSpy = spyOn(contentMetadataService, 'getGroupedProperties');
getClassSpy = spyOn(classesApi, 'getClass');
fixture.detectChanges();
});
@@ -234,6 +238,7 @@ describe('ContentMetadataComponent', () => {
describe('Folder', () => {
it('should show the folder node', (done) => {
component.expanded = false;
getGroupedPropertiesSpy.and.returnValue(of([]));
fixture.detectChanges();
component.basicProperties$.subscribe(() => {
@@ -261,7 +266,7 @@ describe('ContentMetadataComponent', () => {
it('nodeAspectUpdate', fakeAsync(() => {
const fakeNode = { id: 'fake-minimal-node', aspectNames: ['ft:a', 'ft:b', 'ft:c'], name: 'fake-node' } as Node;
spyOn(contentMetadataService, 'getGroupedProperties').and.stub();
getGroupedPropertiesSpy.and.stub();
spyOn(contentMetadataService, 'getBasicProperties').and.stub();
updateService.updateNodeAspect(fakeNode);
@@ -719,7 +724,7 @@ describe('ContentMetadataComponent', () => {
});
it('should load the group properties on node change', () => {
spyOn(contentMetadataService, 'getGroupedProperties');
getGroupedPropertiesSpy;
component.ngOnChanges({ node: new SimpleChange(node, expectedNode, false) });
@@ -743,7 +748,7 @@ describe('ContentMetadataComponent', () => {
}
];
component.preset = presetConfig;
spyOn(contentMetadataService, 'getGroupedProperties');
getGroupedPropertiesSpy;
component.ngOnChanges({ node: new SimpleChange(node, expectedNode, false) });
@@ -754,7 +759,7 @@ describe('ContentMetadataComponent', () => {
const expectedProperties = [];
component.expanded = true;
spyOn(contentMetadataService, 'getGroupedProperties').and.returnValue(of([{ properties: expectedProperties } as any]));
getGroupedPropertiesSpy.and.returnValue(of([{ properties: expectedProperties } as any]));
spyOn(component, 'showGroup').and.returnValue(true);
component.ngOnChanges({ node: new SimpleChange(node, expectedNode, false) });
@@ -772,7 +777,7 @@ describe('ContentMetadataComponent', () => {
component.expanded = true;
component.displayEmpty = false;
spyOn(contentMetadataService, 'getGroupedProperties').and.returnValue(of([{ properties: [] } as any]));
getGroupedPropertiesSpy.and.returnValue(of([{ properties: [] } as any]));
spyOn(component, 'showGroup').and.returnValue(true);
component.ngOnChanges({ node: new SimpleChange(node, expectedNode, false) });
@@ -787,7 +792,7 @@ describe('ContentMetadataComponent', () => {
});
it('should hide card views group when the grouped properties are empty', async () => {
spyOn(contentMetadataService, 'getGroupedProperties').and.stub();
getGroupedPropertiesSpy.and.stub();
component.ngOnChanges({ node: new SimpleChange(node, expectedNode, false) });
@@ -800,7 +805,7 @@ describe('ContentMetadataComponent', () => {
it('should display card views group when there is at least one property that is not empty', async () => {
component.expanded = true;
spyOn(contentMetadataService, 'getGroupedProperties').and.stub();
getGroupedPropertiesSpy.and.stub();
component.ngOnChanges({ node: new SimpleChange(node, expectedNode, false) });
@@ -818,7 +823,7 @@ describe('ContentMetadataComponent', () => {
});
it('should revert changes for getGroupedProperties panel on cancel', () => {
spyOn(contentMetadataService, 'getGroupedProperties');
getGroupedPropertiesSpy;
component.ngOnChanges({ node: new SimpleChange(node, expectedNode, false) });
component.onCancelGroupEdit({} as CardViewGroup);
expect(contentMetadataService.getGroupedProperties).toHaveBeenCalledWith(expectedNode, 'custom-preset');
@@ -953,6 +958,7 @@ describe('ContentMetadataComponent', () => {
component.expanded = true;
component.preset = 'default';
getGroupedPropertiesSpy.and.callThrough();
});
it('should show Versionable with given content-metadata config', async () => {

View File

@@ -63,15 +63,15 @@
<div *ngIf="property.multivalued"
class="adf-property-field adf-dateitem-chip-list-container adf-dateitem-editable">
<mat-chip-list #chipList class="adf-textitem-chip-list">
<mat-chip
<mat-chip-listbox #chipList class="adf-textitem-chip-list">
<mat-chip-option
*ngFor="let propertyValue of property.displayValue; let idx = index"
[removable]="isEditable"
(removed)="removeValueFromList(idx)">
{{ propertyValue }}
<mat-icon *ngIf="isEditable" matChipRemove>cancel</mat-icon>
</mat-chip>
</mat-chip-list>
</mat-chip-option>
</mat-chip-listbox>
<div *ngIf="isEditable" class="adf-property-field adf-dateitem-editable-controls" (click)="showDatePicker()">
<input

View File

@@ -2,7 +2,7 @@
<div *ngSwitchDefault>
<mat-form-field class="adf-property-field adf-card-textitem-field"
[ngClass]="{'adf-property-read-only': !isEditable }"
[floatLabel]="'never'">
[floatLabel]="'always'">
<mat-label *ngIf="showProperty || isEditable" [attr.data-automation-id]="'card-textitem-label-' + property.key" class="adf-property-label"
[ngClass]="{
'adf-property-value-editable': editable,