mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-2492] Task without a form is not displayed when the assignment is preselected on APS (#3093)
* [ADF-2492] Task without a form is not displayed when assignment is preselected on APS * Fixed task without a form is not displayed when assignment is preselected on APS * * Added testcases for the recent changes
This commit is contained in:
committed by
Eugenio Romano
parent
a5055128b8
commit
c06cf28769
@@ -52,6 +52,41 @@ export let taskDetailsMock = new TaskDetailsModel({
|
||||
'memberOfCandidateGroup': false
|
||||
});
|
||||
|
||||
export let taskDetailsWithOutAssigneeMock = new TaskDetailsModel({
|
||||
'id': '91',
|
||||
'name': 'Request translation',
|
||||
'description': null,
|
||||
'category': null,
|
||||
'assignee': undefined,
|
||||
'created': '2016-11-03T15:25:42.749+0000',
|
||||
'dueDate': null,
|
||||
'endDate': null,
|
||||
'duration': null,
|
||||
'priority': 50,
|
||||
'parentTaskId': null,
|
||||
'parentTaskName': null,
|
||||
'processInstanceId': '86',
|
||||
'processInstanceName': null,
|
||||
'processDefinitionId': 'TranslationProcess:2:8',
|
||||
'processDefinitionName': 'Translation Process',
|
||||
'processDefinitionDescription': null,
|
||||
'processDefinitionKey': 'TranslationProcess',
|
||||
'processDefinitionCategory': 'http://www.activiti.org/processdef',
|
||||
'processDefinitionVersion': 2,
|
||||
'processDefinitionDeploymentId': '5',
|
||||
'formKey': '4',
|
||||
'processInstanceStartUserId': '1001',
|
||||
'initiatorCanCompleteTask': false,
|
||||
'adhocTaskCanBeReassigned': false,
|
||||
'taskDefinitionKey': 'sid-DDECD9E4-0299-433F-9193-C3D905C3EEBE',
|
||||
'executionId': '86',
|
||||
'involvedGroups': [],
|
||||
'involvedPeople': [],
|
||||
'memberOfCandidateUsers': false,
|
||||
'managerOfCandidateGroup': false,
|
||||
'memberOfCandidateGroup': false
|
||||
});
|
||||
|
||||
export let claimableTaskDetailsMock = new TaskDetailsModel({
|
||||
'id': '91',
|
||||
'name': 'Request translation',
|
||||
|
@@ -41,7 +41,7 @@
|
||||
<div empty-form><h3 class="adf-task-title">Please select a Task</h3></div>
|
||||
</adf-form>
|
||||
</div>
|
||||
<div *ngIf="!isAssigned()">
|
||||
<div *ngIf="!isAssigned()" id="claim-message-id">
|
||||
{{ 'ADF_TASK_LIST.DETAILS.MESSAGES.CLAIM' | translate }}
|
||||
</div>
|
||||
<button mat-raised-button class="activiti-task-details__action-button"
|
||||
|
@@ -26,7 +26,7 @@ import { CommentProcessService, LogService } from '@alfresco/adf-core';
|
||||
|
||||
import { PeopleProcessService, UserProcessModel, AuthenticationService } from '@alfresco/adf-core';
|
||||
import { TaskDetailsModel } from '../models/task-details.model';
|
||||
import { noDataMock, taskDetailsMock, taskFormMock, tasksMock } from '../../mock';
|
||||
import { noDataMock, taskDetailsMock, taskFormMock, tasksMock, taskDetailsWithOutAssigneeMock } from '../../mock';
|
||||
import { TaskListService } from './../services/tasklist.service';
|
||||
import { PeopleSearchComponent } from '../../people';
|
||||
import { TaskDetailsComponent } from './task-details.component';
|
||||
@@ -173,6 +173,24 @@ describe('TaskDetailsComponent', () => {
|
||||
});
|
||||
}));
|
||||
|
||||
it('should display the claim message when the task is not assigned', async(() => {
|
||||
component.taskDetails = taskDetailsWithOutAssigneeMock;
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
const claimMessage = fixture.nativeElement.querySelector('#claim-message-id');
|
||||
expect(claimMessage).toBeDefined();
|
||||
expect(claimMessage.innerText).toBe('ADF_TASK_LIST.DETAILS.MESSAGES.CLAIM');
|
||||
});
|
||||
}));
|
||||
|
||||
it('should not display the claim message when the task is assigned', async(() => {
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
const claimMessage = fixture.nativeElement.querySelector('#claim-message-id');
|
||||
expect(claimMessage).toBeNull();
|
||||
});
|
||||
}));
|
||||
|
||||
describe('change detection', () => {
|
||||
|
||||
let change = new SimpleChange('123', '456', true);
|
||||
|
@@ -289,7 +289,7 @@ export class TaskDetailsComponent implements OnInit, OnChanges {
|
||||
}
|
||||
|
||||
isAssignedToMe(): boolean {
|
||||
return this.taskDetails.assignee.email === this.authService.getBpmUsername();
|
||||
return this.isAssigned() ? this.taskDetails.assignee.email === this.authService.getBpmUsername() : false;
|
||||
}
|
||||
|
||||
isCompleteButtonEnabled(): boolean {
|
||||
|
Reference in New Issue
Block a user