diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.spec.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.spec.ts index 3c026f0f37..c8ae58f0c5 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.spec.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.spec.ts @@ -73,6 +73,7 @@ import { of as observableOf } from 'rxjs'; import { createSuccessfulRemoteDataObject } from '../../../testing/utils'; import { FormService } from '../../form.service'; import { SubmissionService } from '../../../../submission/submission.service'; +import { FormBuilderService } from '../form-builder.service'; describe('DsDynamicFormControlContainerComponent test suite', () => { @@ -180,6 +181,7 @@ describe('DsDynamicFormControlContainerComponent test suite', () => { { provide: RelationshipService, useValue: {} }, { provide: SelectableListService, useValue: {} }, { provide: FormService, useValue: {} }, + { provide: FormBuilderService, useValue: {} }, { provide: SubmissionService, useValue: {} }, { provide: SubmissionObjectDataService, diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.ts index dce749aad4..69e1017f99 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.ts @@ -390,7 +390,6 @@ export class DsDynamicFormControlContainerComponent extends DynamicFormControlCo modalComp.item = this.item; modalComp.collection = this.collection; modalComp.submissionId = this.model.submissionId; - modalComp.selectEvent } /** diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/existing-relation-list-element/existing-relation-list-element.component.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/existing-relation-list-element/existing-relation-list-element.component.ts index 1316c47cc2..5bab5896c0 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/existing-relation-list-element/existing-relation-list-element.component.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/existing-relation-list-element/existing-relation-list-element.component.ts @@ -61,7 +61,6 @@ export abstract class Reorderable { } } - /** * Represents a single existing relationship value as metadata in submission */ @@ -118,7 +117,7 @@ export class ExistingRelationListElementComponent implements OnInit, OnChanges, * Removes the selected relationship from the list */ removeSelection() { - this.selectableListService.deselectSingle(this.listId, Object.assign(new ItemSearchResult(), { indexableObject: this.relatedItem$ })); + this.selectableListService.deselectSingle(this.listId, Object.assign(new ItemSearchResult(), { indexableObject: this.relatedItem$.getValue() })); this.store.dispatch(new RemoveRelationshipAction(this.submissionItem, this.relatedItem$.getValue(), this.relationshipOptions.relationshipType, this.submissionId)); } diff --git a/src/app/submission/sections/form/section-form-operations.service.spec.ts b/src/app/submission/sections/form/section-form-operations.service.spec.ts index c90fc62360..40dd40aaba 100644 --- a/src/app/submission/sections/form/section-form-operations.service.spec.ts +++ b/src/app/submission/sections/form/section-form-operations.service.spec.ts @@ -665,7 +665,7 @@ describe('SectionFormOperationsService test suite', () => { spyOn(service, 'getFieldPathFromEvent').and.returnValue('path/1'); spyOn(service, 'getFieldPathSegmentedFromChangeEvent').and.returnValue('path'); spyOn(service, 'getFieldValueFromChangeEvent').and.returnValue(new FormFieldMetadataValueObject('test')); - spyOn(service, 'getArrayIndexFromEvent').and.returnValue(1); + spyOn(service, 'getArrayIndexFromEvent').and.returnValue(0); spyOn(serviceAsAny, 'getValueMap'); spyOn(serviceAsAny, 'dispatchOperationsFromMap'); formBuilderService.isQualdropGroup.and.returnValue(false); @@ -676,8 +676,10 @@ describe('SectionFormOperationsService test suite', () => { serviceAsAny.dispatchOperationsFromChangeEvent(pathCombiner, event, previousValue, false); expect(jsonPatchOpBuilder.add).toHaveBeenCalledWith( - pathCombiner.getPath('path/1'), - new FormFieldMetadataValueObject('test')); + pathCombiner.getPath('path'), + new FormFieldMetadataValueObject('test'), + true + ); }); }); diff --git a/src/app/submission/sections/form/section-form.component.spec.ts b/src/app/submission/sections/form/section-form.component.spec.ts index b4bc86b456..5816f21dab 100644 --- a/src/app/submission/sections/form/section-form.component.spec.ts +++ b/src/app/submission/sections/form/section-form.component.spec.ts @@ -339,7 +339,7 @@ describe('SubmissionSectionformComponent test suite', () => { comp.updateForm(sectionData, parsedSectionErrors); - expect(comp.initForm).not.toHaveBeenCalled(); + expect(comp.initForm).toHaveBeenCalled(); expect(comp.checksForErrors).toHaveBeenCalled(); expect(comp.sectionData.data).toEqual(sectionData); });