mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
Fixed unit tests after rebase
This commit is contained in:
parent
a0a7edb806
commit
0ee367aaaf
@ -56,26 +56,18 @@
|
|||||||
</adf-card-view>
|
</adf-card-view>
|
||||||
</mat-expansion-panel>
|
</mat-expansion-panel>
|
||||||
|
|
||||||
<ng-container *ngIf="displayTags">
|
<ng-container *ngIf="displayTags">
|
||||||
<mat-expansion-panel
|
<mat-expansion-panel hideToggle [(expanded)]="isTagPanelExpanded" class="adf-content-metadata-panel">
|
||||||
hideToggle
|
<mat-expansion-panel-header class="adf-metadata-properties-header"
|
||||||
[expanded]="currentPanel.panelTitle === DefaultPanels.TAGS && currentPanel.expanded"
|
[class.adf-metadata-properties-header-expanded]='isTagPanelExpanded'>
|
||||||
(opened)="expandPanel(DefaultPanels.TAGS)"
|
<adf-content-metadata-header [title]="'METADATA.BASIC.TAGS'" [expanded]="isTagPanelExpanded">
|
||||||
(closed)="closePanel(DefaultPanels.TAGS)"
|
<button *ngIf="canEditTags"
|
||||||
class="adf-content-metadata-panel"
|
mat-icon-button
|
||||||
data-automation-id="adf-content-metadata-tags-panel">
|
(click)="onToggleTagsEdit($event)"
|
||||||
<mat-expansion-panel-header
|
[attr.title]="'CORE.METADATA.ACTIONS.EDIT' | translate"
|
||||||
class="adf-metadata-properties-header"
|
[attr.aria-label]="'CORE.METADATA.ACCESSIBILITY.EDIT' | translate"
|
||||||
[class.adf-metadata-properties-header-expanded]="currentPanel.panelTitle === DefaultPanels.TAGS && currentPanel.expanded">
|
data-automation-id="showing-tag-input-button"
|
||||||
<adf-content-metadata-header [title]="'METADATA.BASIC.TAGS'" [expanded]="currentPanel.panelTitle === DefaultPanels.TAGS && currentPanel.expanded">
|
class="adf-edit-icon-buttons">
|
||||||
<button
|
|
||||||
*ngIf="!readOnly && !isPanelEditing(DefaultPanels.TAGS)"
|
|
||||||
mat-icon-button
|
|
||||||
(click)="toggleGroupEditing(DefaultPanels.TAGS, $event)"
|
|
||||||
[attr.title]="'CORE.METADATA.ACTIONS.EDIT' | translate"
|
|
||||||
[attr.aria-label]="'CORE.METADATA.ACCESSIBILITY.EDIT' | translate"
|
|
||||||
data-automation-id="showing-tag-input-button"
|
|
||||||
class="adf-edit-icon-buttons">
|
|
||||||
<mat-icon>mode_edit</mat-icon>
|
<mat-icon>mode_edit</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
<div *ngIf="isPanelEditing(DefaultPanels.TAGS)" class="adf-metadata-action-buttons">
|
<div *ngIf="isPanelEditing(DefaultPanels.TAGS)" class="adf-metadata-action-buttons">
|
||||||
|
@ -41,6 +41,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;
|
||||||
@ -54,6 +55,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';
|
||||||
|
|
||||||
@ -168,6 +170,7 @@ describe('ContentMetadataComponent', () => {
|
|||||||
HttpClientModule,
|
HttpClientModule,
|
||||||
MatDialogModule,
|
MatDialogModule,
|
||||||
MatSnackBarModule,
|
MatSnackBarModule,
|
||||||
|
MatProgressBarModule,
|
||||||
MatTooltipModule,
|
MatTooltipModule,
|
||||||
PipeModule],
|
PipeModule],
|
||||||
providers: [
|
providers: [
|
||||||
@ -222,6 +225,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();
|
||||||
});
|
});
|
||||||
@ -243,6 +247,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(() => {
|
||||||
@ -270,7 +275,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);
|
||||||
|
|
||||||
@ -697,7 +702,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) });
|
||||||
|
|
||||||
@ -721,7 +726,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) });
|
||||||
|
|
||||||
@ -732,7 +737,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) });
|
||||||
@ -746,7 +751,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) });
|
||||||
@ -757,7 +762,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) });
|
||||||
|
|
||||||
@ -770,7 +775,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) });
|
||||||
|
|
||||||
@ -960,6 +965,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 () => {
|
||||||
|
@ -76,15 +76,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
|
<div
|
||||||
*ngIf="isEditable"
|
*ngIf="isEditable"
|
||||||
|
@ -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,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user