mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
[ADF-4795] The form is editable after completing the task in APS (#4979)
* [ADF-4795] Form should not be editable when a task is completed * add unit test
This commit is contained in:
parent
e8f179e84d
commit
deca68e5b2
@ -292,6 +292,21 @@ describe('TaskHeaderComponent', () => {
|
|||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
it('should set clickable to false if the task has already completed', async(() => {
|
||||||
|
component.taskDetails.endDate = new Date('05/05/2002');
|
||||||
|
component.formName = 'test form';
|
||||||
|
component.refreshData();
|
||||||
|
fixture.detectChanges();
|
||||||
|
|
||||||
|
fixture.whenStable().then(() => {
|
||||||
|
const clickableForm = fixture.debugElement.query(By.css('[data-automation-id="header-formName"] .adf-textitem-clickable-value'));
|
||||||
|
expect(clickableForm).toBeNull();
|
||||||
|
|
||||||
|
const readOnlyForm = fixture.debugElement.query(By.css('[data-automation-id="header-formName"] .adf-textitem-ellipsis'));
|
||||||
|
expect(readOnlyForm.nativeElement.innerText).toBe('test form');
|
||||||
|
});
|
||||||
|
}));
|
||||||
|
|
||||||
it('should display the default parent value if is undefined', async(() => {
|
it('should display the default parent value if is undefined', async(() => {
|
||||||
component.taskDetails.processInstanceId = null;
|
component.taskDetails.processInstanceId = null;
|
||||||
component.refreshData();
|
component.refreshData();
|
||||||
|
@ -190,7 +190,7 @@ export class TaskHeaderComponent implements OnChanges, OnInit {
|
|||||||
value: this.formName,
|
value: this.formName,
|
||||||
key: 'formName',
|
key: 'formName',
|
||||||
default: this.translationService.instant('ADF_TASK_LIST.PROPERTIES.FORM_NAME_DEFAULT'),
|
default: this.translationService.instant('ADF_TASK_LIST.PROPERTIES.FORM_NAME_DEFAULT'),
|
||||||
clickable: !!this.formName,
|
clickable: this.isFormClickable(),
|
||||||
icon: 'create'
|
icon: 'create'
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@ -311,6 +311,10 @@ export class TaskHeaderComponent implements OnChanges, OnInit {
|
|||||||
return this.taskDetails && !!this.taskDetails.endDate;
|
return this.taskDetails && !!this.taskDetails.endDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isFormClickable(): boolean {
|
||||||
|
return !!this.formName && !this.isCompleted();
|
||||||
|
}
|
||||||
|
|
||||||
getTaskDuration(): string {
|
getTaskDuration(): string {
|
||||||
return this.taskDetails.duration ? `${this.taskDetails.duration} ms` : '';
|
return this.taskDetails.duration ? `${this.taskDetails.duration} ms` : '';
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user