mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-09-10 14:11:42 +00:00
Revert the changes
This commit is contained in:
@@ -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. |
|
||||
| showSaveButton | `boolean` | true | Toggle rendering of the `Save` button. |
|
||||
| showNextTaskCheckbox | `boolean` | false | Toggle rendering of the `Open next task` checkbox. |
|
||||
| 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. |
|
||||
|
@@ -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 (Object.prototype.hasOwnProperty.call(this.componentRef.instance, 'showNextTaskCheckbox')) {
|
||||
this.componentRef.setInput('showNextTaskCheckbox', true);
|
||||
if (this.showNextTaskCheckbox && Object.prototype.hasOwnProperty.call(this.componentRef.instance, 'showNextTaskCheckbox')) {
|
||||
this.componentRef.setInput('showNextTaskCheckbox', this.showNextTaskCheckbox);
|
||||
}
|
||||
if (this.isNextTaskCheckboxChecked && Object.prototype.hasOwnProperty.call(this.componentRef.instance, 'isNextTaskCheckboxChecked')) {
|
||||
this.componentRef.setInput('isNextTaskCheckboxChecked', this.isNextTaskCheckboxChecked);
|
||||
|
@@ -42,7 +42,7 @@
|
||||
[showCancelButton]="showCancelButton"
|
||||
[taskName]="taskDetails.name"
|
||||
[taskId]="taskId"
|
||||
[showNextTaskCheckbox]="canCompleteTask()"
|
||||
[showNextTaskCheckbox]="showNextTaskCheckbox && canCompleteTask()"
|
||||
[isNextTaskCheckboxChecked]="isNextTaskCheckboxChecked"
|
||||
(cancelTask)="onCancelClick()"
|
||||
(claimTask)="onClaimTask()"
|
||||
|
@@ -514,7 +514,7 @@ describe('UserTaskCloudComponent', () => {
|
||||
expect(noFormTemplateTitleText).toBe('');
|
||||
});
|
||||
|
||||
it('should show [open next task] checkbox based on canCompleteTask result', () => {
|
||||
it('should allow controlling [open next task] checkbox visibility', () => {
|
||||
taskDetails.formKey = 'my-screen';
|
||||
component.taskDetails = { ...taskDetails };
|
||||
component.getTaskType();
|
||||
@@ -531,14 +531,66 @@ describe('UserTaskCloudComponent', () => {
|
||||
return screenComponent.showNextTaskCheckbox;
|
||||
};
|
||||
|
||||
// Test case: canCompleteTask returns false
|
||||
spy.and.returnValue(false);
|
||||
fixture.detectChanges();
|
||||
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 });
|
||||
expect(isCheckboxShown()).toBeFalse();
|
||||
|
||||
// Test case: canCompleteTask returns true
|
||||
spy.and.returnValue(true);
|
||||
fixture.detectChanges();
|
||||
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 });
|
||||
expect(isCheckboxShown()).toBeTrue();
|
||||
});
|
||||
|
||||
|
@@ -112,6 +112,10 @@ 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;
|
||||
|
Reference in New Issue
Block a user