diff --git a/ng2-components/ng2-activiti-form/src/components/activiti-form.component.spec.ts b/ng2-components/ng2-activiti-form/src/components/activiti-form.component.spec.ts index 931c36ced2..3b11141f6c 100644 --- a/ng2-components/ng2-activiti-form/src/components/activiti-form.component.spec.ts +++ b/ng2-components/ng2-activiti-form/src/components/activiti-form.component.spec.ts @@ -60,12 +60,6 @@ describe('ActivitiForm', () => { expect(formComponent.setupMaterialComponents()).toBeFalsy(); }); - it('should start loading form on init', () => { - spyOn(formComponent, 'loadForm').and.stub(); - formComponent.ngOnInit(); - expect(formComponent.loadForm).toHaveBeenCalled(); - }); - it('should check form', () => { expect(formComponent.hasForm()).toBeFalsy(); formComponent.form = new FormModel(); @@ -732,8 +726,8 @@ describe('ActivitiForm', () => { spyOn(formComponent, 'loadFormFromActiviti').and.stub(); const nodeId = ''; - formComponent.nodeId = nodeId; - formComponent.ngOnInit(); + let change = new SimpleChange(null, nodeId, false); + formComponent.ngOnChanges({'nodeId' : change}); expect(nodeService.getNodeMetadata).toHaveBeenCalledWith(nodeId); expect(formComponent.loadFormFromActiviti).toHaveBeenCalled(); diff --git a/ng2-components/ng2-activiti-form/src/components/activiti-form.component.ts b/ng2-components/ng2-activiti-form/src/components/activiti-form.component.ts index 7aaf39ab70..a6ab9409d2 100644 --- a/ng2-components/ng2-activiti-form/src/components/activiti-form.component.ts +++ b/ng2-components/ng2-activiti-form/src/components/activiti-form.component.ts @@ -169,12 +169,6 @@ export class ActivitiForm implements OnInit, AfterViewChecked, OnChanges { this.formService.formContentClicked.subscribe((content: ContentLinkModel) => { this.formContentClicked.emit(content); }); - - if (this.nodeId) { - this.loadFormForEcmNode(); - } else { - this.loadForm(); - } } ngAfterViewChecked() { @@ -202,7 +196,7 @@ export class ActivitiForm implements OnInit, AfterViewChecked, OnChanges { let nodeId = changes['nodeId']; if (nodeId && nodeId.currentValue) { - this.loadFormForEcmNode(); + this.loadFormForEcmNode(nodeId.currentValue); return; } @@ -439,8 +433,8 @@ export class ActivitiForm implements OnInit, AfterViewChecked, OnChanges { this.onFormDataRefreshed(this.form); } - private loadFormForEcmNode(): void { - this.nodeService.getNodeMetadata(this.nodeId).subscribe(data => { + private loadFormForEcmNode(nodeId: string): void { + this.nodeService.getNodeMetadata(nodeId).subscribe(data => { this.data = data.metadata; this.loadFormFromActiviti(data.nodeType); }, diff --git a/ng2-components/ng2-activiti-form/src/components/adf-form-list.component.spec.ts b/ng2-components/ng2-activiti-form/src/components/adf-form-list.component.spec.ts index 8e2deab5af..f0e4624ec9 100644 --- a/ng2-components/ng2-activiti-form/src/components/adf-form-list.component.spec.ts +++ b/ng2-components/ng2-activiti-form/src/components/adf-form-list.component.spec.ts @@ -70,7 +70,7 @@ describe('TaskAttachmentList', () => { })); - fit('should show the forms as a list', async(() => { + it('should show the forms as a list', async(() => { spyOn(service, 'getForms').and.returnValue(Observable.of([ { name: 'FakeName-1', lastUpdatedByFullName: 'FakeUser-1', lastUpdated: '2017-01-02' }, { name: 'FakeName-2', lastUpdatedByFullName: 'FakeUser-2', lastUpdated: '2017-01-03' }