Skip to content

Commit

Permalink
fix(process): ensure layoutset is added when adding signing task (#13934
Browse files Browse the repository at this point in the history
)
  • Loading branch information
nkylstad authored Oct 28, 2024
1 parent dae7a6b commit 34fd4d4
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ describe('OnProcessTaskAddHandler', () => {
expect(mutateApplicationPolicyMock).toHaveBeenCalledWith(expectedResponse);
});

it('should add datatype when signing task is added', () => {
it('should add layoutset and datatype when signing task is added', () => {
const onProcessTaskAddHandler = createOnProcessTaskHandler();

const taskMetadata: OnProcessTaskEvent = {
Expand All @@ -128,11 +128,19 @@ describe('OnProcessTaskAddHandler', () => {

onProcessTaskAddHandler.handleOnProcessTaskAdd(taskMetadata);

expect(addLayoutSetMock).toHaveBeenCalledWith({
layoutSetConfig: {
id: 'testElementId',
tasks: ['testElementId'],
},
layoutSetIdToUpdate: 'testElementId',
taskType: 'signing',
});

expect(addDataTypeToAppMetadataMock).toHaveBeenCalledWith({
dataTypeId: 'signatureInformation-1234',
taskId: 'testElementId',
});
expect(addLayoutSetMock).not.toHaveBeenCalled();
expect(mutateApplicationPolicyMock).not.toHaveBeenCalled();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,12 @@ export class OnProcessTaskAddHandler {
}

/**
* Adds a dataType to the added signing task
* Adds a dataType and layoutset to the added signing task
* @param taskMetadata
* @private
*/
private handleSigningTaskAdd(taskMetadata: OnProcessTaskEvent): void {
this.addLayoutSet(this.createLayoutSetConfig(taskMetadata));
const studioModeler = new StudioModeler(taskMetadata.taskEvent.element as any);
const dataTypeId = studioModeler.getDataTypeIdFromBusinessObject(
taskMetadata.taskType,
Expand Down
6 changes: 5 additions & 1 deletion frontend/packages/process-editor/src/hooks/useBpmnEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ export const useBpmnEditor = (): UseBpmnViewerResult => {
taskEvent,
taskType: bpmnDetails.taskType,
});
if (bpmnDetails.taskType === 'data' || bpmnDetails.taskType === 'payment')
if (
bpmnDetails.taskType === 'data' ||
bpmnDetails.taskType === 'payment' ||
bpmnDetails.taskType === 'signing'
)
addAction(bpmnDetails.id);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ const addNewSigningTaskToProcessEditor = async (page: Page): Promise<string> =>
extraMovingDistanceX,
extraMovingDistanceY,
);
await processEditorPage.skipRecommendedTask();
await processEditorPage.waitForTaskToBeVisibleInConfigPanel(signingTask);

return signingTask;
Expand Down

0 comments on commit 34fd4d4

Please sign in to comment.