mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
Fixed unit tests after rebase
This commit is contained in:
@@ -46,7 +46,7 @@
|
|||||||
</adf-card-view>
|
</adf-card-view>
|
||||||
</mat-expansion-panel>
|
</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 hideToggle [(expanded)]="isTagPanelExpanded" class="adf-content-metadata-panel">
|
||||||
<mat-expansion-panel-header>
|
<mat-expansion-panel-header>
|
||||||
<adf-content-metadata-header [title]="'METADATA.BASIC.TAGS'" [expanded]="isTagPanelExpanded">
|
<adf-content-metadata-header [title]="'METADATA.BASIC.TAGS'" [expanded]="isTagPanelExpanded">
|
||||||
|
@@ -42,6 +42,7 @@ import { MatDialogModule } from '@angular/material/dialog';
|
|||||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||||
import { MatSnackBarModule } from '@angular/material/snack-bar';
|
import { MatSnackBarModule } from '@angular/material/snack-bar';
|
||||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||||
|
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
||||||
|
|
||||||
describe('ContentMetadataComponent', () => {
|
describe('ContentMetadataComponent', () => {
|
||||||
let component: ContentMetadataComponent;
|
let component: ContentMetadataComponent;
|
||||||
@@ -55,6 +56,7 @@ describe('ContentMetadataComponent', () => {
|
|||||||
let categoryService: CategoryService;
|
let categoryService: CategoryService;
|
||||||
let getClassSpy: jasmine.Spy;
|
let getClassSpy: jasmine.Spy;
|
||||||
let notificationService: NotificationService;
|
let notificationService: NotificationService;
|
||||||
|
let getGroupedPropertiesSpy: jasmine.Spy;
|
||||||
|
|
||||||
const preset = 'custom-preset';
|
const preset = 'custom-preset';
|
||||||
|
|
||||||
@@ -155,6 +157,7 @@ describe('ContentMetadataComponent', () => {
|
|||||||
HttpClientModule,
|
HttpClientModule,
|
||||||
MatDialogModule,
|
MatDialogModule,
|
||||||
MatSnackBarModule,
|
MatSnackBarModule,
|
||||||
|
MatProgressBarModule,
|
||||||
MatTooltipModule,
|
MatTooltipModule,
|
||||||
PipeModule],
|
PipeModule],
|
||||||
providers: [
|
providers: [
|
||||||
@@ -209,6 +212,7 @@ describe('ContentMetadataComponent', () => {
|
|||||||
component.node = node;
|
component.node = node;
|
||||||
component.preset = preset;
|
component.preset = preset;
|
||||||
spyOn(contentMetadataService, 'getContentTypeProperty').and.returnValue(of([]));
|
spyOn(contentMetadataService, 'getContentTypeProperty').and.returnValue(of([]));
|
||||||
|
getGroupedPropertiesSpy = spyOn(contentMetadataService, 'getGroupedProperties');
|
||||||
getClassSpy = spyOn(classesApi, 'getClass');
|
getClassSpy = spyOn(classesApi, 'getClass');
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
});
|
});
|
||||||
@@ -234,6 +238,7 @@ describe('ContentMetadataComponent', () => {
|
|||||||
describe('Folder', () => {
|
describe('Folder', () => {
|
||||||
it('should show the folder node', (done) => {
|
it('should show the folder node', (done) => {
|
||||||
component.expanded = false;
|
component.expanded = false;
|
||||||
|
getGroupedPropertiesSpy.and.returnValue(of([]));
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
|
||||||
component.basicProperties$.subscribe(() => {
|
component.basicProperties$.subscribe(() => {
|
||||||
@@ -261,7 +266,7 @@ describe('ContentMetadataComponent', () => {
|
|||||||
|
|
||||||
it('nodeAspectUpdate', fakeAsync(() => {
|
it('nodeAspectUpdate', fakeAsync(() => {
|
||||||
const fakeNode = { id: 'fake-minimal-node', aspectNames: ['ft:a', 'ft:b', 'ft:c'], name: 'fake-node' } as Node;
|
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();
|
spyOn(contentMetadataService, 'getBasicProperties').and.stub();
|
||||||
updateService.updateNodeAspect(fakeNode);
|
updateService.updateNodeAspect(fakeNode);
|
||||||
|
|
||||||
@@ -719,7 +724,7 @@ describe('ContentMetadataComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should load the group properties on node change', () => {
|
it('should load the group properties on node change', () => {
|
||||||
spyOn(contentMetadataService, 'getGroupedProperties');
|
getGroupedPropertiesSpy;
|
||||||
|
|
||||||
component.ngOnChanges({ node: new SimpleChange(node, expectedNode, false) });
|
component.ngOnChanges({ node: new SimpleChange(node, expectedNode, false) });
|
||||||
|
|
||||||
@@ -743,7 +748,7 @@ describe('ContentMetadataComponent', () => {
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
component.preset = presetConfig;
|
component.preset = presetConfig;
|
||||||
spyOn(contentMetadataService, 'getGroupedProperties');
|
getGroupedPropertiesSpy;
|
||||||
|
|
||||||
component.ngOnChanges({ node: new SimpleChange(node, expectedNode, false) });
|
component.ngOnChanges({ node: new SimpleChange(node, expectedNode, false) });
|
||||||
|
|
||||||
@@ -754,7 +759,7 @@ describe('ContentMetadataComponent', () => {
|
|||||||
const expectedProperties = [];
|
const expectedProperties = [];
|
||||||
component.expanded = true;
|
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);
|
spyOn(component, 'showGroup').and.returnValue(true);
|
||||||
|
|
||||||
component.ngOnChanges({ node: new SimpleChange(node, expectedNode, false) });
|
component.ngOnChanges({ node: new SimpleChange(node, expectedNode, false) });
|
||||||
@@ -772,7 +777,7 @@ describe('ContentMetadataComponent', () => {
|
|||||||
component.expanded = true;
|
component.expanded = true;
|
||||||
component.displayEmpty = false;
|
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);
|
spyOn(component, 'showGroup').and.returnValue(true);
|
||||||
|
|
||||||
component.ngOnChanges({ node: new SimpleChange(node, expectedNode, false) });
|
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 () => {
|
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) });
|
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 () => {
|
it('should display card views group when there is at least one property that is not empty', async () => {
|
||||||
component.expanded = true;
|
component.expanded = true;
|
||||||
spyOn(contentMetadataService, 'getGroupedProperties').and.stub();
|
getGroupedPropertiesSpy.and.stub();
|
||||||
|
|
||||||
component.ngOnChanges({ node: new SimpleChange(node, expectedNode, false) });
|
component.ngOnChanges({ node: new SimpleChange(node, expectedNode, false) });
|
||||||
|
|
||||||
@@ -818,7 +823,7 @@ describe('ContentMetadataComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should revert changes for getGroupedProperties panel on cancel', () => {
|
it('should revert changes for getGroupedProperties panel on cancel', () => {
|
||||||
spyOn(contentMetadataService, 'getGroupedProperties');
|
getGroupedPropertiesSpy;
|
||||||
component.ngOnChanges({ node: new SimpleChange(node, expectedNode, false) });
|
component.ngOnChanges({ node: new SimpleChange(node, expectedNode, false) });
|
||||||
component.onCancelGroupEdit({} as CardViewGroup);
|
component.onCancelGroupEdit({} as CardViewGroup);
|
||||||
expect(contentMetadataService.getGroupedProperties).toHaveBeenCalledWith(expectedNode, 'custom-preset');
|
expect(contentMetadataService.getGroupedProperties).toHaveBeenCalledWith(expectedNode, 'custom-preset');
|
||||||
@@ -953,6 +958,7 @@ describe('ContentMetadataComponent', () => {
|
|||||||
|
|
||||||
component.expanded = true;
|
component.expanded = true;
|
||||||
component.preset = 'default';
|
component.preset = 'default';
|
||||||
|
getGroupedPropertiesSpy.and.callThrough();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should show Versionable with given content-metadata config', async () => {
|
it('should show Versionable with given content-metadata config', async () => {
|
||||||
|
@@ -63,15 +63,15 @@
|
|||||||
|
|
||||||
<div *ngIf="property.multivalued"
|
<div *ngIf="property.multivalued"
|
||||||
class="adf-property-field adf-dateitem-chip-list-container adf-dateitem-editable">
|
class="adf-property-field adf-dateitem-chip-list-container adf-dateitem-editable">
|
||||||
<mat-chip-list #chipList class="adf-textitem-chip-list">
|
<mat-chip-listbox #chipList class="adf-textitem-chip-list">
|
||||||
<mat-chip
|
<mat-chip-option
|
||||||
*ngFor="let propertyValue of property.displayValue; let idx = index"
|
*ngFor="let propertyValue of property.displayValue; let idx = index"
|
||||||
[removable]="isEditable"
|
[removable]="isEditable"
|
||||||
(removed)="removeValueFromList(idx)">
|
(removed)="removeValueFromList(idx)">
|
||||||
{{ propertyValue }}
|
{{ propertyValue }}
|
||||||
<mat-icon *ngIf="isEditable" matChipRemove>cancel</mat-icon>
|
<mat-icon *ngIf="isEditable" matChipRemove>cancel</mat-icon>
|
||||||
</mat-chip>
|
</mat-chip-option>
|
||||||
</mat-chip-list>
|
</mat-chip-listbox>
|
||||||
|
|
||||||
<div *ngIf="isEditable" class="adf-property-field adf-dateitem-editable-controls" (click)="showDatePicker()">
|
<div *ngIf="isEditable" class="adf-property-field adf-dateitem-editable-controls" (click)="showDatePicker()">
|
||||||
<input
|
<input
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
<div *ngSwitchDefault>
|
<div *ngSwitchDefault>
|
||||||
<mat-form-field class="adf-property-field adf-card-textitem-field"
|
<mat-form-field class="adf-property-field adf-card-textitem-field"
|
||||||
[ngClass]="{'adf-property-read-only': !isEditable }"
|
[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"
|
<mat-label *ngIf="showProperty || isEditable" [attr.data-automation-id]="'card-textitem-label-' + property.key" class="adf-property-label"
|
||||||
[ngClass]="{
|
[ngClass]="{
|
||||||
'adf-property-value-editable': editable,
|
'adf-property-value-editable': editable,
|
||||||
|
Reference in New Issue
Block a user