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