diff --git a/ng2-components/ng2-activiti-processlist/src/components/activiti-process-instance-details.component.spec.ts b/ng2-components/ng2-activiti-processlist/src/components/activiti-process-instance-details.component.spec.ts index d18a719465..85c45d4392 100644 --- a/ng2-components/ng2-activiti-processlist/src/components/activiti-process-instance-details.component.spec.ts +++ b/ng2-components/ng2-activiti-processlist/src/components/activiti-process-instance-details.component.spec.ts @@ -72,12 +72,6 @@ describe('ActivitiProcessInstanceDetails', () => { window['componentHandler'] = componentHandler; }); - it('should load task details when processInstanceId specified', () => { - component.processInstanceId = '123'; - fixture.detectChanges(); - expect(getProcessSpy).toHaveBeenCalled(); - }); - it('should not load task details when no processInstanceId is specified', () => { fixture.detectChanges(); expect(getProcessSpy).not.toHaveBeenCalled(); @@ -89,8 +83,8 @@ describe('ActivitiProcessInstanceDetails', () => { }); it('should display a header when the processInstanceId is provided', async(() => { - component.processInstanceId = '123'; fixture.detectChanges(); + component.ngOnChanges({ 'processInstanceId': new SimpleChange(null, '123') }); fixture.whenStable().then(() => { fixture.detectChanges(); let headerEl: DebugElement = fixture.debugElement.query(By.css('h2')); @@ -118,11 +112,6 @@ describe('ActivitiProcessInstanceDetails', () => { expect(getProcessSpy).toHaveBeenCalledWith('456'); }); - it('should reload tasks list when processInstanceId changed', () => { - component.ngOnChanges({ 'processInstanceId': change }); - expect(component.tasksList.load).toHaveBeenCalled(); - }); - it('should NOT fetch new process details when empty changeset made', () => { component.ngOnChanges({}); expect(getProcessSpy).not.toHaveBeenCalled(); diff --git a/ng2-components/ng2-activiti-processlist/src/components/activiti-process-instance-tasks.component.spec.ts b/ng2-components/ng2-activiti-processlist/src/components/activiti-process-instance-tasks.component.spec.ts index 8670f9bcba..bb80c1da69 100644 --- a/ng2-components/ng2-activiti-processlist/src/components/activiti-process-instance-tasks.component.spec.ts +++ b/ng2-components/ng2-activiti-processlist/src/components/activiti-process-instance-tasks.component.spec.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { DebugElement, NO_ERRORS_SCHEMA } from '@angular/core'; +import { DebugElement, NO_ERRORS_SCHEMA, SimpleChange } from '@angular/core'; import { ComponentFixture, TestBed, async } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { Observable } from 'rxjs/Rx'; @@ -52,7 +52,7 @@ describe('ActivitiProcessInstanceTasks', () => { { provide: AlfrescoTranslationService, useClass: TranslationMock }, ActivitiProcessService ], - schemas: [ NO_ERRORS_SCHEMA ] + schemas: [NO_ERRORS_SCHEMA] }).compileComponents(); })); @@ -103,16 +103,13 @@ describe('ActivitiProcessInstanceTasks', () => { expect(listEl).toBeNull(); }); - it('should call service to get tasks on init', () => { - component.processInstanceDetails = exampleProcessInstance; - fixture.detectChanges(); - expect(getProcessTasksSpy).toHaveBeenCalled(); - }); - it('should display active tasks', () => { - component.processInstanceDetails = exampleProcessInstance; + let change = new SimpleChange(null, exampleProcessInstance); fixture.detectChanges(); + component.ngOnChanges({ 'processInstanceDetails': change }); fixture.whenStable().then(() => { + fixture.detectChanges(); + component.ngOnChanges({ 'processInstanceDetails': change }); let listEl = fixture.debugElement.query(By.css('[data-automation-id="active-tasks"]')); expect(listEl).not.toBeNull(); expect(listEl.queryAll(By.css('li')).length).toBe(1); @@ -120,9 +117,11 @@ describe('ActivitiProcessInstanceTasks', () => { }); it('should display completed tasks', () => { - component.processInstanceDetails = exampleProcessInstance; + let change = new SimpleChange(null, exampleProcessInstance); fixture.detectChanges(); + component.ngOnChanges({ 'processInstanceDetails': change }); fixture.whenStable().then(() => { + fixture.detectChanges(); let listEl = fixture.debugElement.query(By.css('[data-automation-id="completed-tasks"]')); expect(listEl).not.toBeNull(); expect(listEl.queryAll(By.css('li')).length).toBe(1);