[ADF-957] removed double call to load form (#2046)

This commit is contained in:
Vito
2017-07-05 09:29:22 -07:00
committed by Eugenio Romano
parent b32a023581
commit 846f3a8069
3 changed files with 6 additions and 18 deletions

View File

@@ -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 = '<id>';
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();

View File

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

View File

@@ -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' }