TSK-1221: Added test for copy
TSK-1221: Added copy functionality to classifications
This commit is contained in:
parent
b0dc2663e5
commit
7abb9b4c2f
|
@ -12,7 +12,7 @@
|
|||
<button type="button" (click)="onRestore()" class="btn btn-default" data-toggle="tooltip" title="Restore Previous Version">
|
||||
<span class="material-icons md-20 blue">restore</span>
|
||||
</button>
|
||||
<button type="button" (click)="onCopy()" data-toggle="tooltip" title="Copy" class="btn btn-default">
|
||||
<button type="button" (click)="onCopy()" data-toggle="tooltip" title="Copy" class="btn btn-default" id="copyButton">
|
||||
<span class="material-icons md-20 green-blue">content_copy</span>
|
||||
</button>
|
||||
<button type="button" (click)="removeClassification()" data-toggle="tooltip" title="Delete" class="btn btn-default">
|
||||
|
|
|
@ -72,7 +72,31 @@ describe('ClassificationDetailsComponent', () => {
|
|||
classificationsService = testBed.get(ClassificationsService);
|
||||
spyOn(classificationsService, 'getClassifications').and.returnValue(of(treeNodes));
|
||||
spyOn(classificationsService, 'deleteClassification').and.returnValue(of(true));
|
||||
component.classification = new ClassificationDefinition('id1');
|
||||
component.classification = {
|
||||
classificationId: 'CLI:100000000000000000000000000000000002',
|
||||
key: 'L10303',
|
||||
applicationEntryPoint: '',
|
||||
category: 'EXTERNAL',
|
||||
domain: 'DOMAIN_A',
|
||||
name: 'Beratungsprotokoll',
|
||||
parentId: '',
|
||||
parentKey: '',
|
||||
priority: 101,
|
||||
serviceLevel: 'P1D',
|
||||
type: 'TASK',
|
||||
custom1: 'VNR,RVNR,KOLVNR, ANR',
|
||||
custom2: '',
|
||||
custom3: '',
|
||||
custom4: '',
|
||||
custom5: '',
|
||||
custom6: '',
|
||||
custom7: '',
|
||||
custom8: '',
|
||||
isValidInDomain: true,
|
||||
created: '2020-06-22T12:51:31.164Z',
|
||||
modified: '2020-06-22T12:51:31.164Z',
|
||||
description: 'Beratungsprotokoll'
|
||||
};
|
||||
component.classification._links = new LinksClassification({ self: '' });
|
||||
fixture.detectChanges();
|
||||
done();
|
||||
|
@ -83,4 +107,16 @@ describe('ClassificationDetailsComponent', () => {
|
|||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should copy the classification without its key', async done => {
|
||||
const startClassification = { ...component.classification };
|
||||
const copyButton = fixture.debugElement.nativeElement.querySelector('#copyButton');
|
||||
copyButton.click();
|
||||
fixture.detectChanges();
|
||||
expect(component.classification.name).toEqual(startClassification.name);
|
||||
expect(component.classification.classificationId).toEqual(startClassification.classificationId);
|
||||
expect(component.classification.key).toBeNull();
|
||||
expect(fixture.debugElement.nativeElement.querySelector('#classification-key').disabled).toEqual(false);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -128,7 +128,7 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy {
|
|||
} else {
|
||||
this.store.dispatch(
|
||||
new RestoreSelectedClassification(this.classification.classificationId)
|
||||
).pipe(take(1)).subscribe(ctx => {
|
||||
).pipe(take(1)).subscribe(() => {
|
||||
this.notificationsService.showToast(NOTIFICATION_TYPES.INFO_ALERT);
|
||||
});
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy {
|
|||
|
||||
onCopy() {
|
||||
this.store.dispatch(new SetActiveAction(ACTION.COPY));
|
||||
this.classification.key = '';
|
||||
this.classification.key = null;
|
||||
}
|
||||
|
||||
selectCategory(category: string) {
|
||||
|
@ -214,6 +214,9 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy {
|
|||
|
||||
private fillClassificationInformation(classificationSelected: ClassificationDefinition) {
|
||||
this.classification = { ...classificationSelected };
|
||||
if (this.action === ACTION.COPY) {
|
||||
this.classification.key = null;
|
||||
}
|
||||
}
|
||||
|
||||
private removeClassificationConfirmation() {
|
||||
|
|
Loading…
Reference in New Issue