mirror of
https://github.com/sartography/cr-connect-bpmn.git
synced 2025-02-10 15:37:02 +00:00
wip - fix tests
This commit is contained in:
parent
10e138d497
commit
66e95c0f04
@ -114,7 +114,7 @@
|
|||||||
mat-mini-fab
|
mat-mini-fab
|
||||||
title="Move up"
|
title="Move up"
|
||||||
color="primary"
|
color="primary"
|
||||||
(click)="editCategoryDisplayOrder(cat, cat.id, 'up')"
|
(click)="editCategoryDisplayOrder(cat.id, 'up')"
|
||||||
>
|
>
|
||||||
<mat-icon>arrow_upward</mat-icon>
|
<mat-icon>arrow_upward</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
@ -123,7 +123,7 @@
|
|||||||
mat-mini-fab
|
mat-mini-fab
|
||||||
title="Move down"
|
title="Move down"
|
||||||
color="primary"
|
color="primary"
|
||||||
(click)="editCategoryDisplayOrder(cat, cat.id, 'down')"
|
(click)="editCategoryDisplayOrder(cat.id, 'down')"
|
||||||
>
|
>
|
||||||
<mat-icon>arrow_downward</mat-icon>
|
<mat-icon>arrow_downward</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
|
@ -391,24 +391,29 @@ describe('WorkflowSpecListComponent', () => {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deprecated - removed reorder and ability to directly edit display order
|
||||||
|
*
|
||||||
it('should edit category display order', () => {
|
it('should edit category display order', () => {
|
||||||
const _reorderSpy = spyOn((component as any), '_reorder').and.stub();
|
// const _reorderSpy = spyOn((component as any), '_reorder').and.stub();
|
||||||
const _updateCatDisplayOrdersSpy = spyOn((component as any), '_updateCatDisplayOrders').and.stub();
|
const _updateCatDisplayOrdersSpy = spyOn((component as any), '_updateCatDisplayOrders').and.stub();
|
||||||
|
|
||||||
component.editCategoryDisplayOrder(2, -1, mockWorkflowSpecCategories);
|
component.editCategoryDisplayOrder(2, -1, mockWorkflowSpecCategories);
|
||||||
expect(_reorderSpy).toHaveBeenCalled();
|
// expect(_reorderSpy).toHaveBeenCalled();
|
||||||
expect(_updateCatDisplayOrdersSpy).toHaveBeenCalled();
|
expect(_updateCatDisplayOrdersSpy).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
it('should edit workflow spec display order', () => {
|
it('should edit workflow spec display order', () => {
|
||||||
const _reorderSpy = spyOn((component as any), '_reorder').and.stub();
|
// const _reorderSpy = spyOn((component as any), '_reorder').and.stub();
|
||||||
const _updateSpecDisplayOrdersSpy = spyOn((component as any), '_updateSpecDisplayOrders').and.stub();
|
const _updateSpecDisplayOrdersSpy = spyOn((component as any), '_updateSpecDisplayOrders').and.stub();
|
||||||
|
|
||||||
component.editSpecDisplayOrder('few_things', -1, mockWorkflowSpecs);
|
component.editSpecDisplayOrder('few_things', -1, mockWorkflowSpecs);
|
||||||
expect(_reorderSpy).toHaveBeenCalled();
|
// expect(_reorderSpy).toHaveBeenCalled();
|
||||||
expect(_updateSpecDisplayOrdersSpy).toHaveBeenCalled();
|
expect(_updateSpecDisplayOrdersSpy).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
it('should reorder categories', () => {
|
it('should reorder categories', () => {
|
||||||
const snackBarSpy = spyOn((component as any).snackBar, 'open').and.stub();
|
const snackBarSpy = spyOn((component as any).snackBar, 'open').and.stub();
|
||||||
const moveUpSpy = spyOn(component, 'moveUp').and.callThrough();
|
const moveUpSpy = spyOn(component, 'moveUp').and.callThrough();
|
||||||
@ -437,6 +442,7 @@ describe('WorkflowSpecListComponent', () => {
|
|||||||
expect(moveDownSpy).toHaveBeenCalled();
|
expect(moveDownSpy).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
it('should reorder specs', () => {
|
it('should reorder specs', () => {
|
||||||
const snackBarSpy = spyOn((component as any).snackBar, 'open').and.stub();
|
const snackBarSpy = spyOn((component as any).snackBar, 'open').and.stub();
|
||||||
const moveUpSpy = spyOn(component, 'moveUp').and.callThrough();
|
const moveUpSpy = spyOn(component, 'moveUp').and.callThrough();
|
||||||
@ -468,23 +474,24 @@ describe('WorkflowSpecListComponent', () => {
|
|||||||
expect(moveUpSpy).not.toHaveBeenCalled();
|
expect(moveUpSpy).not.toHaveBeenCalled();
|
||||||
expect(moveDownSpy).toHaveBeenCalled();
|
expect(moveDownSpy).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
*/
|
||||||
|
|
||||||
it('should update all category display orders', () => {
|
it('should update all category display orders', () => {
|
||||||
const _loadWorkflowSpecCategoriesSpy = spyOn((component as any), '_loadWorkflowSpecCategories').and.stub();
|
const editCategoryDisplayOrderSpy = spyOn((component as any), 'editCategoryDisplayOrder').and.stub();
|
||||||
(component as any)._updateCatDisplayOrders(mockWorkflowSpecCategories);
|
|
||||||
|
|
||||||
mockWorkflowSpecCategories.forEach((spec, i) => {
|
mockWorkflowSpecCategories.forEach((cat, i) => {
|
||||||
const req = httpMock.expectOne(`apiRoot/workflow-specification-category/${spec.id}`);
|
let results = { param: 'direction', value: 'down' };
|
||||||
|
const req = httpMock.expectOne(`apiRoot/workflow-specification-category/${cat.id}/reorder?${results.param}=${results.value}`);
|
||||||
expect(req.request.method).toEqual('PUT');
|
expect(req.request.method).toEqual('PUT');
|
||||||
req.flush(mockWorkflowSpecCategories[i]);
|
req.flush(mockWorkflowSpecCategories[i]);
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(_loadWorkflowSpecCategoriesSpy).toHaveBeenCalled();
|
expect(editCategoryDisplayOrderSpy).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
/**
|
||||||
|
|
||||||
it('should update all spec display orders', () => {
|
it('should update all spec display orders', () => {
|
||||||
const _loadWorkflowSpecCategoriesSpy = spyOn((component as any), '_loadWorkflowSpecCategories').and.stub();
|
const _loadWorkflowSpecCategoriesSpy = spyOn((component as any), '_loadWorkflowSpecCategories').and.stub();
|
||||||
(component as any)._updateSpecDisplayOrders(mockWorkflowSpecs);
|
|
||||||
|
|
||||||
mockWorkflowSpecs.forEach((spec, i) => {
|
mockWorkflowSpecs.forEach((spec, i) => {
|
||||||
const req = httpMock.expectOne(`apiRoot/workflow-specification/${spec.id}`);
|
const req = httpMock.expectOne(`apiRoot/workflow-specification/${spec.id}`);
|
||||||
@ -494,6 +501,7 @@ describe('WorkflowSpecListComponent', () => {
|
|||||||
|
|
||||||
expect(_loadWorkflowSpecCategoriesSpy).toHaveBeenCalled();
|
expect(_loadWorkflowSpecCategoriesSpy).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,8 +7,8 @@ import {
|
|||||||
ApiErrorsComponent,
|
ApiErrorsComponent,
|
||||||
ApiService,
|
ApiService,
|
||||||
isNumberDefined,
|
isNumberDefined,
|
||||||
moveArrayElementDown,
|
// moveArrayElementDown,
|
||||||
moveArrayElementUp,
|
// moveArrayElementUp,
|
||||||
WorkflowSpec,
|
WorkflowSpec,
|
||||||
WorkflowSpecCategory,
|
WorkflowSpecCategory,
|
||||||
} from 'sartography-workflow-lib';
|
} from 'sartography-workflow-lib';
|
||||||
@ -52,8 +52,8 @@ export class WorkflowSpecListComponent implements OnInit {
|
|||||||
selectedCat: WorkflowSpecCategory;
|
selectedCat: WorkflowSpecCategory;
|
||||||
workflowSpecsByCategory: WorkflowSpecCategoryGroup[] = [];
|
workflowSpecsByCategory: WorkflowSpecCategoryGroup[] = [];
|
||||||
categories: WorkflowSpecCategory[];
|
categories: WorkflowSpecCategory[];
|
||||||
moveUp = moveArrayElementUp;
|
// moveUp = moveArrayElementUp;
|
||||||
moveDown = moveArrayElementDown;
|
// moveDown = moveArrayElementDown;
|
||||||
searchField: FormControl;
|
searchField: FormControl;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@ -222,12 +222,9 @@ export class WorkflowSpecListComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
editCategoryDisplayOrder(cat: WorkflowSpecCategoryGroup, catId: number, direction: string) {
|
editCategoryDisplayOrder(catId: number, direction: string) {
|
||||||
this.api.reorderWorkflowCategory(catId, direction).subscribe(cat_change => {
|
this.api.reorderWorkflowCategory(catId, direction).subscribe(cat_change => {
|
||||||
console.log('wfsbcat: ', this.workflowSpecsByCategory);
|
this.workflowSpecsByCategory = cat_change;
|
||||||
console.log('this.categories', this.categories);
|
|
||||||
console.log('changed is ', cat_change);
|
|
||||||
// this.workflowSpecsByCategory = cat_change;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user