diff --git a/docs/process-services-cloud/components/screen-cloud.component.md b/docs/process-services-cloud/components/screen-cloud.component.md index d6ea2ca683..05a24b7de0 100644 --- a/docs/process-services-cloud/components/screen-cloud.component.md +++ b/docs/process-services-cloud/components/screen-cloud.component.md @@ -60,10 +60,12 @@ export class YourService extends ScreenRenderingService { | appName | `string` | "" | App id to fetch corresponding form and values. | | canClaimTask | `boolean` | | Boolean informing if a task can be claimed. | | canUnclaimTask | `boolean` | | Boolean informing if a task can be unclaimed. | +| isNextTaskCheckboxChecked | `boolean` | false | Whether the `Open next task` checkbox is checked by default or not. | | processInstanceId | `string` | | Process Instance Id to fetch corresponding data. | | rootProcessInstanceId | `string` | | Root Process Instance Id to fetch corresponding data. | | readOnly | `boolean` | false | Toggle readonly state of the task. | | showCancelButton | `boolean` | true | Toggle rendering of the `Cancel` button. | +| showNextTaskCheckbox | `boolean` | false | Toggle rendering of the `Open next task` checkbox (controlled internally by parent component). | | screenId | `string` | | Screen id to create dynamic component | | taskId | `string` | | Task id to fetch corresponding form and values. | | taskName | `string` | | Name of the task. | diff --git a/docs/process-services-cloud/components/user-task-cloud.component.md b/docs/process-services-cloud/components/user-task-cloud.component.md index 2170128d4b..814f6a9aa5 100644 --- a/docs/process-services-cloud/components/user-task-cloud.component.md +++ b/docs/process-services-cloud/components/user-task-cloud.component.md @@ -40,7 +40,7 @@ Based on property taskDetails: TaskDetailsCloudModel shows a form or a screen. | readOnly | `boolean` | false | Toggle readonly state of the task. | | showCancelButton | `boolean` | true | Toggle rendering of the `Cancel` button. | | showCompleteButton | `boolean` | true | Toggle rendering of the `Complete` button. | -| showNextTaskCheckbox | `boolean` | false | Toggle rendering of the `Open next task` checkbox. | +| showSaveButton | `boolean` | true | Toggle rendering of the `Save` button. | | showTitle | `boolean` | true | Toggle rendering of the form title. | | showValidationIcon | `boolean` | true | Toggle rendering of the `Validation` icon. | | taskId | `string` | | Task id to fetch corresponding form and values. | diff --git a/lib/process-services-cloud/src/lib/screen/components/screen-cloud/screen-cloud.component.ts b/lib/process-services-cloud/src/lib/screen/components/screen-cloud/screen-cloud.component.ts index 19f1274f87..33a781f9c3 100644 --- a/lib/process-services-cloud/src/lib/screen/components/screen-cloud/screen-cloud.component.ts +++ b/lib/process-services-cloud/src/lib/screen/components/screen-cloud/screen-cloud.component.ts @@ -153,8 +153,8 @@ export class TaskScreenCloudComponent implements OnInit { if (this.rootProcessInstanceId && Object.prototype.hasOwnProperty.call(this.componentRef.instance, 'rootProcessInstanceId')) { this.componentRef.setInput('rootProcessInstanceId', this.rootProcessInstanceId); } - if (this.showNextTaskCheckbox && Object.prototype.hasOwnProperty.call(this.componentRef.instance, 'showNextTaskCheckbox')) { - this.componentRef.setInput('showNextTaskCheckbox', this.showNextTaskCheckbox); + if (Object.prototype.hasOwnProperty.call(this.componentRef.instance, 'showNextTaskCheckbox')) { + this.componentRef.setInput('showNextTaskCheckbox', true); } if (this.isNextTaskCheckboxChecked && Object.prototype.hasOwnProperty.call(this.componentRef.instance, 'isNextTaskCheckboxChecked')) { this.componentRef.setInput('isNextTaskCheckboxChecked', this.isNextTaskCheckboxChecked); diff --git a/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud/user-task-cloud.component.html b/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud/user-task-cloud.component.html index 8804d4d8c1..08730c0757 100644 --- a/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud/user-task-cloud.component.html +++ b/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud/user-task-cloud.component.html @@ -42,7 +42,7 @@ [showCancelButton]="showCancelButton" [taskName]="taskDetails.name" [taskId]="taskId" - [showNextTaskCheckbox]="showNextTaskCheckbox && canCompleteTask()" + [showNextTaskCheckbox]="canCompleteTask()" [isNextTaskCheckboxChecked]="isNextTaskCheckboxChecked" (cancelTask)="onCancelClick()" (claimTask)="onClaimTask()" diff --git a/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud/user-task-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud/user-task-cloud.component.spec.ts index 864e99364c..b881f43f64 100644 --- a/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud/user-task-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud/user-task-cloud.component.spec.ts @@ -514,7 +514,7 @@ describe('UserTaskCloudComponent', () => { expect(noFormTemplateTitleText).toBe(''); }); - it('should allow controlling [open next task] checkbox visibility', () => { + it('should show [open next task] checkbox based on canCompleteTask result', () => { taskDetails.formKey = 'my-screen'; component.taskDetails = { ...taskDetails }; component.getTaskType(); @@ -531,66 +531,14 @@ describe('UserTaskCloudComponent', () => { return screenComponent.showNextTaskCheckbox; }; - const prepareTestCase = (testCase: { - showNextTaskCheckbox: boolean; - showCompleteButton: boolean; - readOnly: boolean; - canCompleteTask: boolean; - }): void => { - component.showNextTaskCheckbox = testCase.showNextTaskCheckbox; - component.showCompleteButton = testCase.showCompleteButton; - component.readOnly = testCase.readOnly; - spy.calls.reset(); - spy.and.returnValue(testCase.canCompleteTask); - fixture.detectChanges(); - }; - - prepareTestCase({ showNextTaskCheckbox: false, showCompleteButton: false, readOnly: false, canCompleteTask: false }); + // Test case: canCompleteTask returns false + spy.and.returnValue(false); + fixture.detectChanges(); expect(isCheckboxShown()).toBeFalse(); - prepareTestCase({ showNextTaskCheckbox: false, showCompleteButton: false, readOnly: false, canCompleteTask: true }); - expect(isCheckboxShown()).toBeFalse(); - - prepareTestCase({ showNextTaskCheckbox: false, showCompleteButton: false, readOnly: true, canCompleteTask: false }); - expect(isCheckboxShown()).toBeFalse(); - - prepareTestCase({ showNextTaskCheckbox: false, showCompleteButton: false, readOnly: true, canCompleteTask: true }); - expect(isCheckboxShown()).toBeFalse(); - - prepareTestCase({ showNextTaskCheckbox: false, showCompleteButton: true, readOnly: false, canCompleteTask: false }); - expect(isCheckboxShown()).toBeFalse(); - - prepareTestCase({ showNextTaskCheckbox: false, showCompleteButton: true, readOnly: false, canCompleteTask: true }); - expect(isCheckboxShown()).toBeFalse(); - - prepareTestCase({ showNextTaskCheckbox: false, showCompleteButton: true, readOnly: true, canCompleteTask: false }); - expect(isCheckboxShown()).toBeFalse(); - - prepareTestCase({ showNextTaskCheckbox: false, showCompleteButton: true, readOnly: true, canCompleteTask: true }); - expect(isCheckboxShown()).toBeFalse(); - - prepareTestCase({ showNextTaskCheckbox: true, showCompleteButton: false, readOnly: false, canCompleteTask: false }); - expect(isCheckboxShown()).toBeFalse(); - - prepareTestCase({ showNextTaskCheckbox: true, showCompleteButton: false, readOnly: false, canCompleteTask: true }); - expect(isCheckboxShown()).toBeFalse(); - - prepareTestCase({ showNextTaskCheckbox: true, showCompleteButton: false, readOnly: true, canCompleteTask: false }); - expect(isCheckboxShown()).toBeFalse(); - - prepareTestCase({ showNextTaskCheckbox: true, showCompleteButton: false, readOnly: true, canCompleteTask: true }); - expect(isCheckboxShown()).toBeFalse(); - - prepareTestCase({ showNextTaskCheckbox: true, showCompleteButton: true, readOnly: true, canCompleteTask: false }); - expect(isCheckboxShown()).toBeFalse(); - - prepareTestCase({ showNextTaskCheckbox: true, showCompleteButton: true, readOnly: true, canCompleteTask: true }); - expect(isCheckboxShown()).toBeFalse(); - - prepareTestCase({ showNextTaskCheckbox: true, showCompleteButton: true, readOnly: false, canCompleteTask: false }); - expect(isCheckboxShown()).toBeFalse(); - - prepareTestCase({ showNextTaskCheckbox: true, showCompleteButton: true, readOnly: false, canCompleteTask: true }); + // Test case: canCompleteTask returns true + spy.and.returnValue(true); + fixture.detectChanges(); expect(isCheckboxShown()).toBeTrue(); }); diff --git a/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud/user-task-cloud.component.ts b/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud/user-task-cloud.component.ts index b0ae951e4b..d030a0bda3 100644 --- a/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud/user-task-cloud.component.ts +++ b/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud/user-task-cloud.component.ts @@ -112,10 +112,6 @@ export class UserTaskCloudComponent implements OnInit, OnChanges { @Input() customSaveButtonText: string = ''; - /** Toggle rendering of the `Open next task` checkbox (for screens only). */ - @Input() - showNextTaskCheckbox = false; - /** Whether the `Open next task` checkbox is checked by default or not. */ @Input() isNextTaskCheckboxChecked = false;