mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-08 18:44:14 +00:00
[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 { DsDynamicFormGroupComponent } from './models/form-group/dynamic-form-group.component';
|
||||||
import { DsDynamicRelationGroupComponent } from './models/relation-group/dynamic-relation-group.components';
|
import { DsDynamicRelationGroupComponent } from './models/relation-group/dynamic-relation-group.components';
|
||||||
import { DsDatePickerInlineComponent } from './models/date-picker-inline/dynamic-date-picker-inline.component';
|
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 { RelationshipService } from '../../../../core/data/relationship.service';
|
||||||
import { SelectableListService } from '../../../object-list/selectable-list/selectable-list.service';
|
import { SelectableListService } from '../../../object-list/selectable-list/selectable-list.service';
|
||||||
import { ItemDataService } from '../../../../core/data/item-data.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 { FormBuilderService } from '../form-builder.service';
|
||||||
import { NgxMaskModule } from 'ngx-mask';
|
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', () => {
|
describe('DsDynamicFormControlContainerComponent test suite', () => {
|
||||||
|
|
||||||
const vocabularyOptions: VocabularyOptions = {
|
const vocabularyOptions: VocabularyOptions = {
|
||||||
@@ -205,6 +214,7 @@ describe('DsDynamicFormControlContainerComponent test suite', () => {
|
|||||||
providers: [
|
providers: [
|
||||||
DsDynamicFormControlContainerComponent,
|
DsDynamicFormControlContainerComponent,
|
||||||
DynamicFormService,
|
DynamicFormService,
|
||||||
|
{ provide: DsDynamicTypeBindRelationService, useValue: getMockDsDynamicTypeBindRelationService() },
|
||||||
{ provide: RelationshipService, useValue: {} },
|
{ provide: RelationshipService, useValue: {} },
|
||||||
{ provide: SelectableListService, useValue: {} },
|
{ provide: SelectableListService, useValue: {} },
|
||||||
{ provide: ItemDataService, useValue: {} },
|
{ provide: ItemDataService, useValue: {} },
|
||||||
|
@@ -1,15 +1,15 @@
|
|||||||
import {
|
import {
|
||||||
DynamicFormControlLayout, DynamicFormControlModel,
|
DynamicFormControlLayout,
|
||||||
DynamicFormControlRelation,
|
DynamicFormControlRelation,
|
||||||
DynamicInputModel,
|
DynamicInputModel,
|
||||||
DynamicInputModelConfig,
|
DynamicInputModelConfig,
|
||||||
serializable
|
serializable
|
||||||
} from '@ng-dynamic-forms/core';
|
} from '@ng-dynamic-forms/core';
|
||||||
import {BehaviorSubject, Subject} from 'rxjs';
|
import {Subject} from 'rxjs';
|
||||||
|
|
||||||
import { LanguageCode } from '../../models/form-field-language-value.model';
|
import { LanguageCode } from '../../models/form-field-language-value.model';
|
||||||
import { VocabularyOptions } from '../../../../../core/submission/vocabularies/models/vocabulary-options.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 { FormFieldMetadataValueObject } from '../../models/form-field-metadata-value.model';
|
||||||
import { RelationshipOptions } from '../../models/relationship-options.model';
|
import { RelationshipOptions } from '../../models/relationship-options.model';
|
||||||
|
|
||||||
|
@@ -15,7 +15,7 @@ import {
|
|||||||
DynamicEditorModel,
|
DynamicEditorModel,
|
||||||
DynamicFileUploadModel,
|
DynamicFileUploadModel,
|
||||||
DynamicFormArrayModel,
|
DynamicFormArrayModel,
|
||||||
DynamicFormControlModel, DynamicFormControlRelation,
|
DynamicFormControlModel,
|
||||||
DynamicFormGroupModel,
|
DynamicFormGroupModel,
|
||||||
DynamicFormValidationService,
|
DynamicFormValidationService,
|
||||||
DynamicFormValueControlModel,
|
DynamicFormValueControlModel,
|
||||||
@@ -26,7 +26,7 @@ import {
|
|||||||
DynamicSliderModel,
|
DynamicSliderModel,
|
||||||
DynamicSwitchModel,
|
DynamicSwitchModel,
|
||||||
DynamicTextAreaModel,
|
DynamicTextAreaModel,
|
||||||
DynamicTimePickerModel, MATCH_VISIBLE, OR_OPERATOR
|
DynamicTimePickerModel,
|
||||||
} from '@ng-dynamic-forms/core';
|
} from '@ng-dynamic-forms/core';
|
||||||
import { DynamicTagModel } from './ds-dynamic-form-ui/models/tag/dynamic-tag.model';
|
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';
|
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 { 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 { DynamicRowArrayModel } from './ds-dynamic-form-ui/models/ds-dynamic-row-array-model';
|
||||||
import { FormRowModel } from '../../../core/config/models/config-submission-form.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', () => {
|
describe('FormBuilderService test suite', () => {
|
||||||
|
|
||||||
let testModel: DynamicFormControlModel[];
|
let testModel: DynamicFormControlModel[];
|
||||||
let testFormConfiguration: SubmissionFormsModel;
|
let testFormConfiguration: SubmissionFormsModel;
|
||||||
let service: FormBuilderService;
|
let service: FormBuilderService;
|
||||||
let typeBindRelationService: DsDynamicTypeBindRelationService;
|
|
||||||
|
|
||||||
function getMockDsDynamicTypeBindRelationService(): DsDynamicTypeBindRelationService {
|
|
||||||
return jasmine.createSpyObj('DsDynamicTypeBindRelationService', {
|
|
||||||
getRelatedFormModel: jasmine.createSpy('getRelatedFormModel'),
|
|
||||||
matchesCondition: jasmine.createSpy('matchesCondition')
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const submissionId = '1234';
|
const submissionId = '1234';
|
||||||
|
|
||||||
@@ -80,7 +71,6 @@ describe('FormBuilderService test suite', () => {
|
|||||||
imports: [ReactiveFormsModule],
|
imports: [ReactiveFormsModule],
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: FormBuilderService, useClass: FormBuilderService },
|
{ provide: FormBuilderService, useClass: FormBuilderService },
|
||||||
{ provide: DsDynamicTypeBindRelationService, useValue: getMockDsDynamicTypeBindRelationService() },
|
|
||||||
{ provide: DynamicFormValidationService, useValue: {} },
|
{ provide: DynamicFormValidationService, useValue: {} },
|
||||||
{ provide: NG_VALIDATORS, useValue: testValidator, multi: true },
|
{ provide: NG_VALIDATORS, useValue: testValidator, multi: true },
|
||||||
{ provide: NG_ASYNC_VALIDATORS, useValue: testAsyncValidator, multi: true }
|
{ provide: NG_ASYNC_VALIDATORS, useValue: testAsyncValidator, multi: true }
|
||||||
@@ -317,7 +307,7 @@ describe('FormBuilderService test suite', () => {
|
|||||||
metadataFields: ['dc.contributor.author'],
|
metadataFields: ['dc.contributor.author'],
|
||||||
hasSelectableMetadata: true,
|
hasSelectableMetadata: true,
|
||||||
showButtons: 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;
|
} as any;
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(inject([FormBuilderService, DsDynamicTypeBindRelationService], (formService: FormBuilderService, relationService: DsDynamicTypeBindRelationService) => {
|
beforeEach(inject([FormBuilderService], (formService: FormBuilderService) => {
|
||||||
service = formService;
|
service = formService;
|
||||||
typeBindRelationService = relationService;
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should find a dynamic form control model by id', () => {
|
it('should find a dynamic form control model by id', () => {
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { AbstractControl, FormArray, FormControl, FormGroup } from '@angular/forms';
|
import { AbstractControl, FormControl, FormGroup } from '@angular/forms';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
DYNAMIC_FORM_CONTROL_TYPE_ARRAY,
|
DYNAMIC_FORM_CONTROL_TYPE_ARRAY,
|
||||||
@@ -27,8 +27,7 @@ import {
|
|||||||
isNotEmpty,
|
isNotEmpty,
|
||||||
isNotNull,
|
isNotNull,
|
||||||
isNotUndefined,
|
isNotUndefined,
|
||||||
isNull,
|
isNull
|
||||||
isObjectEmpty
|
|
||||||
} from '../../empty.util';
|
} from '../../empty.util';
|
||||||
import { DynamicQualdropModel } from './ds-dynamic-form-ui/models/ds-dynamic-qualdrop.model';
|
import { DynamicQualdropModel } from './ds-dynamic-form-ui/models/ds-dynamic-qualdrop.model';
|
||||||
import { SubmissionFormsModel } from '../../../core/config/models/config-submission-forms.model';
|
import { SubmissionFormsModel } from '../../../core/config/models/config-submission-forms.model';
|
||||||
|
Reference in New Issue
Block a user