diff --git a/lib/process-services/task-list/components/no-task-detail-template.directive.spec.ts b/lib/process-services/task-list/components/no-task-detail-template.directive.spec.ts index f74a7785c2..d1d1ac1775 100644 --- a/lib/process-services/task-list/components/no-task-detail-template.directive.spec.ts +++ b/lib/process-services/task-list/components/no-task-detail-template.directive.spec.ts @@ -17,15 +17,19 @@ import { NoTaskDetailsTemplateDirective } from './no-task-detail-template.directive'; import { TaskDetailsComponent } from './task-details.component'; -import { FormRenderingService } from '@alfresco/adf-core'; +import { FormRenderingService, AuthenticationService } from '@alfresco/adf-core'; +import { Observable } from 'rxjs/Observable'; describe('NoTaskDetailsTemplateDirective', () => { let component: NoTaskDetailsTemplateDirective; let detailsComponent: TaskDetailsComponent; + let authService: AuthenticationService; beforeEach(() => { - detailsComponent = new TaskDetailsComponent(null, null, null, new FormRenderingService(), null, null, null); + authService = new AuthenticationService(null, null, null, null); + spyOn(authService, 'getBpmLoggedUser').and.returnValue(Observable.of({ email: 'fake-email'})); + detailsComponent = new TaskDetailsComponent(null, authService, null, new FormRenderingService(), null, null, null); component = new NoTaskDetailsTemplateDirective(detailsComponent); }); diff --git a/lib/process-services/task-list/components/task-details.component.ts b/lib/process-services/task-list/components/task-details.component.ts index b3c121c3ce..a9e019eb59 100644 --- a/lib/process-services/task-list/components/task-details.component.ts +++ b/lib/process-services/task-list/components/task-details.component.ts @@ -195,6 +195,9 @@ export class TaskDetailsComponent implements OnInit, OnChanges { this.formRenderingService.setComponentTypeResolver('select-folder', () => AttachFolderWidgetComponent, true); this.formRenderingService.setComponentTypeResolver('upload', () => AttachFileWidgetComponent, true); this.peopleSearch = new Observable(observer => this.peopleSearchObserver = observer).share(); + this.authService.getBpmLoggedUser().subscribe((user: UserRepresentation) => { + this.currentLoggedUser = user; + }); } ngOnInit() { @@ -204,10 +207,6 @@ export class TaskDetailsComponent implements OnInit, OnChanges { this.cardViewUpdateService.itemUpdated$.subscribe(this.updateTaskDetails.bind(this)); this.cardViewUpdateService.itemClicked$.subscribe(this.clickTaskDetails.bind(this)); - - this.authService.getBpmLoggedUser().subscribe((user: UserRepresentation) => { - this.currentLoggedUser = user; - }); } ngOnChanges(changes: SimpleChanges): void {