[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:
siva kumar
2018-03-20 06:30:23 +05:30
committed by Eugenio Romano
parent a5055128b8
commit c06cf28769
4 changed files with 56 additions and 3 deletions

View File

@@ -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"

View File

@@ -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);

View File

@@ -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 {