mirror of
https://github.com/sartography/cr-connect-bpmn.git
synced 2025-02-17 10:57:17 +00:00
Checks if id is defined before updating.
This commit is contained in:
parent
8d98b78eb7
commit
9544b7e730
@ -223,7 +223,7 @@ describe('WorkflowSpecListComponent', () => {
|
|||||||
const _addWorkflowSpecCategorySpy = spyOn((component as any), '_addWorkflowSpecCategory').and.stub();
|
const _addWorkflowSpecCategorySpy = spyOn((component as any), '_addWorkflowSpecCategory').and.stub();
|
||||||
const _updateWorkflowSpecCategorySpy = spyOn((component as any), '_updateWorkflowSpecCategory').and.stub();
|
const _updateWorkflowSpecCategorySpy = spyOn((component as any), '_updateWorkflowSpecCategory').and.stub();
|
||||||
|
|
||||||
component.selectedSpec = undefined;
|
component.selectedCat = undefined;
|
||||||
(component as any)._upsertWorkflowSpecCategory(mockWorkflowSpecCategory1 as WorkflowSpecCategoryDialogData);
|
(component as any)._upsertWorkflowSpecCategory(mockWorkflowSpecCategory1 as WorkflowSpecCategoryDialogData);
|
||||||
expect(_addWorkflowSpecCategorySpy).toHaveBeenCalled();
|
expect(_addWorkflowSpecCategorySpy).toHaveBeenCalled();
|
||||||
expect(_updateWorkflowSpecCategorySpy).not.toHaveBeenCalled();
|
expect(_updateWorkflowSpecCategorySpy).not.toHaveBeenCalled();
|
||||||
|
@ -172,7 +172,7 @@ export class WorkflowSpecListComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _upsertWorkflowSpecCategory(data: WorkflowSpecCategoryDialogData) {
|
private _upsertWorkflowSpecCategory(data: WorkflowSpecCategoryDialogData) {
|
||||||
if (data.id && data.name && data.display_name) {
|
if (isNumberDefined(data.id) && data.name && data.display_name) {
|
||||||
|
|
||||||
// Save old workflow spec id, in case it's changed
|
// Save old workflow spec id, in case it's changed
|
||||||
const catId = this.selectedCat ? this.selectedCat.id : undefined;
|
const catId = this.selectedCat ? this.selectedCat.id : undefined;
|
||||||
@ -183,7 +183,7 @@ export class WorkflowSpecListComponent implements OnInit {
|
|||||||
display_name: data.display_name,
|
display_name: data.display_name,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (catId) {
|
if (isNumberDefined(catId)) {
|
||||||
this._updateWorkflowSpecCategory(catId, newCat);
|
this._updateWorkflowSpecCategory(catId, newCat);
|
||||||
} else {
|
} else {
|
||||||
this._addWorkflowSpecCategory(newCat);
|
this._addWorkflowSpecCategory(newCat);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user