forked from hazza/dspace-angular
[TLC-254] lint and test fixes
This commit is contained in:
@@ -65,6 +65,7 @@ import { DsDynamicFormArrayComponent } from './models/array-group/dynamic-form-a
|
||||
import { DsDynamicFormGroupComponent } from './models/form-group/dynamic-form-group.component';
|
||||
import { DsDynamicRelationGroupComponent } from './models/relation-group/dynamic-relation-group.components';
|
||||
import { DsDatePickerInlineComponent } from './models/date-picker-inline/dynamic-date-picker-inline.component';
|
||||
import { DsDynamicTypeBindRelationService } from './ds-dynamic-type-bind-relation.service';
|
||||
import { RelationshipService } from '../../../../core/data/relationship.service';
|
||||
import { SelectableListService } from '../../../object-list/selectable-list/selectable-list.service';
|
||||
import { ItemDataService } from '../../../../core/data/item-data.service';
|
||||
@@ -79,6 +80,14 @@ import { SubmissionService } from '../../../../submission/submission.service';
|
||||
import { FormBuilderService } from '../form-builder.service';
|
||||
import { NgxMaskModule } from 'ngx-mask';
|
||||
|
||||
function getMockDsDynamicTypeBindRelationService(): DsDynamicTypeBindRelationService {
|
||||
return jasmine.createSpyObj('DsDynamicTypeBindRelationService', {
|
||||
getRelatedFormModel: jasmine.createSpy('getRelatedFormModel'),
|
||||
matchesCondition: jasmine.createSpy('matchesCondition'),
|
||||
subscribeRelations: jasmine.createSpy('subscribeRelations')
|
||||
});
|
||||
}
|
||||
|
||||
describe('DsDynamicFormControlContainerComponent test suite', () => {
|
||||
|
||||
const vocabularyOptions: VocabularyOptions = {
|
||||
@@ -205,6 +214,7 @@ describe('DsDynamicFormControlContainerComponent test suite', () => {
|
||||
providers: [
|
||||
DsDynamicFormControlContainerComponent,
|
||||
DynamicFormService,
|
||||
{ provide: DsDynamicTypeBindRelationService, useValue: getMockDsDynamicTypeBindRelationService() },
|
||||
{ provide: RelationshipService, useValue: {} },
|
||||
{ provide: SelectableListService, useValue: {} },
|
||||
{ provide: ItemDataService, useValue: {} },
|
||||
|
@@ -1,15 +1,15 @@
|
||||
import {
|
||||
DynamicFormControlLayout, DynamicFormControlModel,
|
||||
DynamicFormControlLayout,
|
||||
DynamicFormControlRelation,
|
||||
DynamicInputModel,
|
||||
DynamicInputModelConfig,
|
||||
serializable
|
||||
} from '@ng-dynamic-forms/core';
|
||||
import {BehaviorSubject, Subject} from 'rxjs';
|
||||
import {Subject} from 'rxjs';
|
||||
|
||||
import { LanguageCode } from '../../models/form-field-language-value.model';
|
||||
import { VocabularyOptions } from '../../../../../core/submission/vocabularies/models/vocabulary-options.model';
|
||||
import {hasValue, isEmpty, isNotUndefined} from '../../../../empty.util';
|
||||
import {hasValue} from '../../../../empty.util';
|
||||
import { FormFieldMetadataValueObject } from '../../models/form-field-metadata-value.model';
|
||||
import { RelationshipOptions } from '../../models/relationship-options.model';
|
||||
|
||||
|
@@ -15,7 +15,7 @@ import {
|
||||
DynamicEditorModel,
|
||||
DynamicFileUploadModel,
|
||||
DynamicFormArrayModel,
|
||||
DynamicFormControlModel, DynamicFormControlRelation,
|
||||
DynamicFormControlModel,
|
||||
DynamicFormGroupModel,
|
||||
DynamicFormValidationService,
|
||||
DynamicFormValueControlModel,
|
||||
@@ -26,7 +26,7 @@ import {
|
||||
DynamicSliderModel,
|
||||
DynamicSwitchModel,
|
||||
DynamicTextAreaModel,
|
||||
DynamicTimePickerModel, MATCH_VISIBLE, OR_OPERATOR
|
||||
DynamicTimePickerModel,
|
||||
} from '@ng-dynamic-forms/core';
|
||||
import { DynamicTagModel } from './ds-dynamic-form-ui/models/tag/dynamic-tag.model';
|
||||
import { DynamicListCheckboxGroupModel } from './ds-dynamic-form-ui/models/list/dynamic-list-checkbox-group.model';
|
||||
@@ -48,21 +48,12 @@ import { DynamicConcatModel } from './ds-dynamic-form-ui/models/ds-dynamic-conca
|
||||
import { DynamicLookupNameModel } from './ds-dynamic-form-ui/models/lookup/dynamic-lookup-name.model';
|
||||
import { DynamicRowArrayModel } from './ds-dynamic-form-ui/models/ds-dynamic-row-array-model';
|
||||
import { FormRowModel } from '../../../core/config/models/config-submission-form.model';
|
||||
import { DsDynamicTypeBindRelationService } from './ds-dynamic-form-ui/ds-dynamic-type-bind-relation.service';
|
||||
|
||||
describe('FormBuilderService test suite', () => {
|
||||
|
||||
let testModel: DynamicFormControlModel[];
|
||||
let testFormConfiguration: SubmissionFormsModel;
|
||||
let service: FormBuilderService;
|
||||
let typeBindRelationService: DsDynamicTypeBindRelationService;
|
||||
|
||||
function getMockDsDynamicTypeBindRelationService(): DsDynamicTypeBindRelationService {
|
||||
return jasmine.createSpyObj('DsDynamicTypeBindRelationService', {
|
||||
getRelatedFormModel: jasmine.createSpy('getRelatedFormModel'),
|
||||
matchesCondition: jasmine.createSpy('matchesCondition')
|
||||
});
|
||||
}
|
||||
|
||||
const submissionId = '1234';
|
||||
|
||||
@@ -80,7 +71,6 @@ describe('FormBuilderService test suite', () => {
|
||||
imports: [ReactiveFormsModule],
|
||||
providers: [
|
||||
{ provide: FormBuilderService, useClass: FormBuilderService },
|
||||
{ provide: DsDynamicTypeBindRelationService, useValue: getMockDsDynamicTypeBindRelationService() },
|
||||
{ provide: DynamicFormValidationService, useValue: {} },
|
||||
{ provide: NG_VALIDATORS, useValue: testValidator, multi: true },
|
||||
{ provide: NG_ASYNC_VALIDATORS, useValue: testAsyncValidator, multi: true }
|
||||
@@ -317,7 +307,7 @@ describe('FormBuilderService test suite', () => {
|
||||
metadataFields: ['dc.contributor.author'],
|
||||
hasSelectableMetadata: true,
|
||||
showButtons: true,
|
||||
typeBindRelations: typeBindRelationService.getTypeBindRelations(['Book'])
|
||||
typeBindRelations: [{ match: 'VISIBLE', operator: 'OR', when: [{id: 'dc.type', value: 'Book' }]}]
|
||||
},
|
||||
),
|
||||
];
|
||||
@@ -437,9 +427,8 @@ describe('FormBuilderService test suite', () => {
|
||||
} as any;
|
||||
});
|
||||
|
||||
beforeEach(inject([FormBuilderService, DsDynamicTypeBindRelationService], (formService: FormBuilderService, relationService: DsDynamicTypeBindRelationService) => {
|
||||
beforeEach(inject([FormBuilderService], (formService: FormBuilderService) => {
|
||||
service = formService;
|
||||
typeBindRelationService = relationService;
|
||||
}));
|
||||
|
||||
it('should find a dynamic form control model by id', () => {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { AbstractControl, FormArray, FormControl, FormGroup } from '@angular/forms';
|
||||
import { AbstractControl, FormControl, FormGroup } from '@angular/forms';
|
||||
|
||||
import {
|
||||
DYNAMIC_FORM_CONTROL_TYPE_ARRAY,
|
||||
@@ -27,8 +27,7 @@ import {
|
||||
isNotEmpty,
|
||||
isNotNull,
|
||||
isNotUndefined,
|
||||
isNull,
|
||||
isObjectEmpty
|
||||
isNull
|
||||
} from '../../empty.util';
|
||||
import { DynamicQualdropModel } from './ds-dynamic-form-ui/models/ds-dynamic-qualdrop.model';
|
||||
import { SubmissionFormsModel } from '../../../core/config/models/config-submission-forms.model';
|
||||
|
Reference in New Issue
Block a user