mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 07:23:03 +00:00
Merge branch 'main' into regex-error-messages
This commit is contained in:
@@ -1,11 +1,14 @@
|
||||
import { inject, TestBed } from '@angular/core/testing';
|
||||
import {
|
||||
inject,
|
||||
TestBed,
|
||||
} from '@angular/core/testing';
|
||||
import {
|
||||
NG_ASYNC_VALIDATORS,
|
||||
NG_VALIDATORS,
|
||||
ReactiveFormsModule,
|
||||
UntypedFormArray,
|
||||
UntypedFormControl,
|
||||
UntypedFormGroup,
|
||||
NG_ASYNC_VALIDATORS,
|
||||
NG_VALIDATORS,
|
||||
ReactiveFormsModule
|
||||
} from '@angular/forms';
|
||||
import {
|
||||
DynamicCheckboxGroupModel,
|
||||
@@ -28,21 +31,29 @@ import {
|
||||
DynamicTextAreaModel,
|
||||
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';
|
||||
import { DynamicQualdropModel } from './ds-dynamic-form-ui/models/ds-dynamic-qualdrop.model';
|
||||
import { DynamicScrollableDropdownModel } from './ds-dynamic-form-ui/models/scrollable-dropdown/dynamic-scrollable-dropdown.model';
|
||||
import { DynamicRelationGroupModel } from './ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.model';
|
||||
import { DynamicLookupModel } from './ds-dynamic-form-ui/models/lookup/dynamic-lookup.model';
|
||||
import { DynamicDsDatePickerModel } from './ds-dynamic-form-ui/models/date-picker/date-picker.model';
|
||||
import { DynamicOneboxModel } from './ds-dynamic-form-ui/models/onebox/dynamic-onebox.model';
|
||||
import { DynamicListRadioGroupModel } from './ds-dynamic-form-ui/models/list/dynamic-list-radio-group.model';
|
||||
import { VocabularyOptions } from '../../../core/submission/vocabularies/models/vocabulary-options.model';
|
||||
import { FormFieldModel } from './models/form-field.model';
|
||||
|
||||
import { FormRowModel } from '../../../core/config/models/config-submission-form.model';
|
||||
import { SubmissionFormsModel } from '../../../core/config/models/config-submission-forms.model';
|
||||
import { FormBuilderService } from './form-builder.service';
|
||||
import { DynamicRowGroupModel } from './ds-dynamic-form-ui/models/ds-dynamic-row-group-model';
|
||||
import { ConfigurationDataService } from '../../../core/data/configuration-data.service';
|
||||
import { ConfigurationProperty } from '../../../core/shared/configuration-property.model';
|
||||
import { VocabularyOptions } from '../../../core/submission/vocabularies/models/vocabulary-options.model';
|
||||
import { createSuccessfulRemoteDataObject$ } from '../../remote-data.utils';
|
||||
import { DynamicDsDatePickerModel } from './ds-dynamic-form-ui/models/date-picker/date-picker.model';
|
||||
import { DynamicConcatModel } from './ds-dynamic-form-ui/models/ds-dynamic-concat.model';
|
||||
import { DsDynamicInputModel } from './ds-dynamic-form-ui/models/ds-dynamic-input.model';
|
||||
import { DynamicQualdropModel } from './ds-dynamic-form-ui/models/ds-dynamic-qualdrop.model';
|
||||
import { DynamicRowArrayModel } from './ds-dynamic-form-ui/models/ds-dynamic-row-array-model';
|
||||
import { DynamicRowGroupModel } from './ds-dynamic-form-ui/models/ds-dynamic-row-group-model';
|
||||
import { DynamicListCheckboxGroupModel } from './ds-dynamic-form-ui/models/list/dynamic-list-checkbox-group.model';
|
||||
import { DynamicListRadioGroupModel } from './ds-dynamic-form-ui/models/list/dynamic-list-radio-group.model';
|
||||
import { DynamicLookupModel } from './ds-dynamic-form-ui/models/lookup/dynamic-lookup.model';
|
||||
import { DynamicLookupNameModel } from './ds-dynamic-form-ui/models/lookup/dynamic-lookup-name.model';
|
||||
import { DynamicOneboxModel } from './ds-dynamic-form-ui/models/onebox/dynamic-onebox.model';
|
||||
import { DynamicRelationGroupModel } from './ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.model';
|
||||
import { DynamicScrollableDropdownModel } from './ds-dynamic-form-ui/models/scrollable-dropdown/dynamic-scrollable-dropdown.model';
|
||||
import { DynamicTagModel } from './ds-dynamic-form-ui/models/tag/dynamic-tag.model';
|
||||
import { FormBuilderService } from './form-builder.service';
|
||||
import { FormFieldModel } from './models/form-field.model';
|
||||
import { FormFieldMetadataValueObject } from './models/form-field-metadata-value.model';
|
||||
import { DynamicConcatModel } from './ds-dynamic-form-ui/models/ds-dynamic-concat.model';
|
||||
import { DynamicLookupNameModel } from './ds-dynamic-form-ui/models/lookup/dynamic-lookup-name.model';
|
||||
@@ -98,7 +109,7 @@ describe('FormBuilderService test suite', () => {
|
||||
|
||||
const vocabularyOptions: VocabularyOptions = {
|
||||
name: 'type_programme',
|
||||
closed: false
|
||||
closed: false,
|
||||
};
|
||||
|
||||
testModel = [
|
||||
@@ -109,22 +120,22 @@ describe('FormBuilderService test suite', () => {
|
||||
options: [
|
||||
{
|
||||
label: 'Option 1',
|
||||
value: 'option-1'
|
||||
value: 'option-1',
|
||||
},
|
||||
{
|
||||
label: 'Option 2',
|
||||
value: 'option-2'
|
||||
}
|
||||
value: 'option-2',
|
||||
},
|
||||
],
|
||||
value: 'option-3'
|
||||
}
|
||||
value: 'option-3',
|
||||
},
|
||||
),
|
||||
|
||||
new DynamicInputModel(
|
||||
{
|
||||
id: 'testInput',
|
||||
mask: '(000) 000-0000',
|
||||
}
|
||||
},
|
||||
),
|
||||
|
||||
new DynamicCheckboxGroupModel(
|
||||
@@ -134,17 +145,17 @@ describe('FormBuilderService test suite', () => {
|
||||
new DynamicCheckboxModel(
|
||||
{
|
||||
id: 'testCheckboxGroup1',
|
||||
value: true
|
||||
}
|
||||
value: true,
|
||||
},
|
||||
),
|
||||
new DynamicCheckboxModel(
|
||||
{
|
||||
id: 'testCheckboxGroup2',
|
||||
value: true
|
||||
}
|
||||
)
|
||||
]
|
||||
}
|
||||
value: true,
|
||||
},
|
||||
),
|
||||
],
|
||||
},
|
||||
),
|
||||
|
||||
new DynamicRadioGroupModel<string>(
|
||||
@@ -153,15 +164,15 @@ describe('FormBuilderService test suite', () => {
|
||||
options: [
|
||||
{
|
||||
label: 'Option 1',
|
||||
value: 'option-1'
|
||||
value: 'option-1',
|
||||
},
|
||||
{
|
||||
label: 'Option 2',
|
||||
value: 'option-2'
|
||||
}
|
||||
value: 'option-2',
|
||||
},
|
||||
],
|
||||
value: 'option-3'
|
||||
}
|
||||
value: 'option-3',
|
||||
},
|
||||
),
|
||||
|
||||
new DynamicTextAreaModel({ id: 'testTextArea' }),
|
||||
@@ -177,12 +188,12 @@ describe('FormBuilderService test suite', () => {
|
||||
new DynamicInputModel({ id: 'testFormArrayGroupInput' }),
|
||||
new DynamicFormArrayModel({
|
||||
id: 'testNestedFormArray', groupFactory: () => [
|
||||
new DynamicInputModel({ id: 'testNestedFormArrayGroupInput' })
|
||||
]
|
||||
})
|
||||
new DynamicInputModel({ id: 'testNestedFormArrayGroupInput' }),
|
||||
],
|
||||
}),
|
||||
];
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
),
|
||||
|
||||
new DynamicFormGroupModel(
|
||||
@@ -190,9 +201,9 @@ describe('FormBuilderService test suite', () => {
|
||||
id: 'testFormGroup',
|
||||
group: [
|
||||
new DynamicInputModel({ id: 'nestedTestInput' }),
|
||||
new DynamicTextAreaModel({ id: 'nestedTestTextArea' })
|
||||
]
|
||||
}
|
||||
new DynamicTextAreaModel({ id: 'nestedTestTextArea' }),
|
||||
],
|
||||
},
|
||||
),
|
||||
|
||||
new DynamicSliderModel({ id: 'testSlider' }),
|
||||
@@ -225,7 +236,7 @@ describe('FormBuilderService test suite', () => {
|
||||
repeatable: false,
|
||||
metadataFields: [],
|
||||
submissionId: '1234',
|
||||
hasSelectableMetadata: false
|
||||
hasSelectableMetadata: false,
|
||||
}),
|
||||
|
||||
new DynamicTagModel({
|
||||
@@ -233,7 +244,7 @@ describe('FormBuilderService test suite', () => {
|
||||
repeatable: false,
|
||||
metadataFields: [],
|
||||
submissionId: '1234',
|
||||
hasSelectableMetadata: false
|
||||
hasSelectableMetadata: false,
|
||||
}),
|
||||
|
||||
new DynamicListCheckboxGroupModel({
|
||||
@@ -266,9 +277,9 @@ describe('FormBuilderService test suite', () => {
|
||||
selectableMetadata: [{
|
||||
controlledVocabulary: 'RPAuthority',
|
||||
closed: false,
|
||||
metadata: 'dc.contributor.author'
|
||||
}]
|
||||
} as FormFieldModel]
|
||||
metadata: 'dc.contributor.author',
|
||||
}],
|
||||
} as FormFieldModel],
|
||||
} as FormRowModel, {
|
||||
fields: [{
|
||||
hints: 'Enter the affiliation of the author.',
|
||||
@@ -280,9 +291,9 @@ describe('FormBuilderService test suite', () => {
|
||||
selectableMetadata: [{
|
||||
controlledVocabulary: 'OUAuthority',
|
||||
closed: false,
|
||||
metadata: 'local.contributor.affiliation'
|
||||
}]
|
||||
} as FormFieldModel]
|
||||
metadata: 'local.contributor.affiliation',
|
||||
}],
|
||||
} as FormFieldModel],
|
||||
} as FormRowModel],
|
||||
mandatoryField: '',
|
||||
name: 'testRelationGroup',
|
||||
@@ -291,17 +302,17 @@ describe('FormBuilderService test suite', () => {
|
||||
submissionScope: '',
|
||||
repeatable: false,
|
||||
metadataFields: [],
|
||||
hasSelectableMetadata: true
|
||||
hasSelectableMetadata: true,
|
||||
}),
|
||||
|
||||
new DynamicDsDatePickerModel({ id: 'testDate', repeatable: false}),
|
||||
new DynamicDsDatePickerModel({ id: 'testDate', repeatable: false }),
|
||||
|
||||
new DynamicLookupModel({
|
||||
id: 'testLookup',
|
||||
repeatable: false,
|
||||
metadataFields: [],
|
||||
submissionId: '1234',
|
||||
hasSelectableMetadata: true
|
||||
hasSelectableMetadata: true,
|
||||
}),
|
||||
|
||||
new DynamicLookupNameModel({
|
||||
@@ -309,7 +320,7 @@ describe('FormBuilderService test suite', () => {
|
||||
repeatable: false,
|
||||
metadataFields: [],
|
||||
submissionId: '1234',
|
||||
hasSelectableMetadata: true
|
||||
hasSelectableMetadata: true,
|
||||
}),
|
||||
|
||||
new DynamicQualdropModel({ id: 'testCombobox', readOnly: false, required: false }),
|
||||
@@ -324,7 +335,7 @@ describe('FormBuilderService test suite', () => {
|
||||
isDraggable: true,
|
||||
groupFactory: () => {
|
||||
return [
|
||||
new DynamicInputModel({ id: 'testFormRowArrayGroupInput' })
|
||||
new DynamicInputModel({ id: 'testFormRowArrayGroupInput' }),
|
||||
];
|
||||
},
|
||||
required: false,
|
||||
@@ -332,7 +343,7 @@ describe('FormBuilderService test suite', () => {
|
||||
metadataFields: ['dc.contributor.author'],
|
||||
hasSelectableMetadata: true,
|
||||
showButtons: true,
|
||||
typeBindRelations: [{ match: 'VISIBLE', operator: 'OR', when: [{id: 'dc.type', value: 'Book' }]}]
|
||||
typeBindRelations: [{ match: 'VISIBLE', operator: 'OR', when: [{ id: 'dc.type', value: 'Book' }] }],
|
||||
},
|
||||
),
|
||||
|
||||
@@ -341,8 +352,8 @@ describe('FormBuilderService test suite', () => {
|
||||
group: [
|
||||
new DynamicInputModel({ id: 'testConcatGroup_CONCAT_FIRST_INPUT' }),
|
||||
new DynamicInputModel({ id: 'testConcatGroup_CONCAT_SECOND_INPUT' }),
|
||||
]
|
||||
} as any)
|
||||
],
|
||||
} as any),
|
||||
];
|
||||
|
||||
testFormConfiguration = {
|
||||
@@ -360,10 +371,10 @@ describe('FormBuilderService test suite', () => {
|
||||
{
|
||||
metadata: 'journal',
|
||||
controlledVocabulary: 'JOURNALAuthority',
|
||||
closed: false
|
||||
}
|
||||
closed: false,
|
||||
},
|
||||
],
|
||||
languageCodes: []
|
||||
languageCodes: [],
|
||||
} as FormFieldModel,
|
||||
{
|
||||
input: { type: 'onebox' },
|
||||
@@ -373,10 +384,10 @@ describe('FormBuilderService test suite', () => {
|
||||
hints: ' Enter issue number.',
|
||||
selectableMetadata: [
|
||||
{
|
||||
metadata: 'issue'
|
||||
}
|
||||
metadata: 'issue',
|
||||
},
|
||||
],
|
||||
languageCodes: []
|
||||
languageCodes: [],
|
||||
} as FormFieldModel,
|
||||
{
|
||||
input: { type: 'name' },
|
||||
@@ -386,12 +397,12 @@ describe('FormBuilderService test suite', () => {
|
||||
hints: 'Enter full name.',
|
||||
selectableMetadata: [
|
||||
{
|
||||
metadata: 'name'
|
||||
}
|
||||
metadata: 'name',
|
||||
},
|
||||
],
|
||||
languageCodes: []
|
||||
} as FormFieldModel
|
||||
]
|
||||
languageCodes: [],
|
||||
} as FormFieldModel,
|
||||
],
|
||||
} as FormRowModel,
|
||||
{
|
||||
fields: [
|
||||
@@ -411,8 +422,8 @@ describe('FormBuilderService test suite', () => {
|
||||
{ metadata: 'dc.identifier.isbn', label: 'ISBN' },
|
||||
{ metadata: 'dc.identifier.doi', label: 'DOI' },
|
||||
{ metadata: 'dc.identifier.pmid', label: 'PubMed ID' },
|
||||
{ metadata: 'dc.identifier.arxiv', label: 'arXiv' }
|
||||
]
|
||||
{ metadata: 'dc.identifier.arxiv', label: 'arXiv' },
|
||||
],
|
||||
}, {
|
||||
input: { type: 'onebox' },
|
||||
label: 'Publisher',
|
||||
@@ -421,12 +432,12 @@ describe('FormBuilderService test suite', () => {
|
||||
hints: 'Enter the name of the publisher of the previously issued instance of this item.',
|
||||
selectableMetadata: [
|
||||
{
|
||||
metadata: 'publisher'
|
||||
}
|
||||
metadata: 'publisher',
|
||||
},
|
||||
],
|
||||
languageCodes: []
|
||||
}
|
||||
]
|
||||
languageCodes: [],
|
||||
},
|
||||
],
|
||||
} as FormRowModel,
|
||||
{
|
||||
fields: [
|
||||
@@ -440,23 +451,23 @@ describe('FormBuilderService test suite', () => {
|
||||
{
|
||||
metadata: 'conference',
|
||||
controlledVocabulary: 'EVENTAuthority',
|
||||
closed: false
|
||||
}
|
||||
closed: false,
|
||||
},
|
||||
],
|
||||
languageCodes: []
|
||||
}
|
||||
]
|
||||
} as FormRowModel
|
||||
languageCodes: [],
|
||||
},
|
||||
],
|
||||
} as FormRowModel,
|
||||
],
|
||||
self: {
|
||||
href: 'testFormConfiguration.url'
|
||||
href: 'testFormConfiguration.url',
|
||||
},
|
||||
type: 'submissionform',
|
||||
_links: {
|
||||
self: {
|
||||
href: 'testFormConfiguration.url'
|
||||
}
|
||||
}
|
||||
href: 'testFormConfiguration.url',
|
||||
},
|
||||
},
|
||||
} as any;
|
||||
});
|
||||
|
||||
@@ -523,14 +534,14 @@ describe('FormBuilderService test suite', () => {
|
||||
((formModel[0] as DynamicRowGroupModel).get(1) as DsDynamicInputModel).value = 'test';
|
||||
|
||||
value = {
|
||||
issue: [new FormFieldMetadataValueObject('test')]
|
||||
issue: [new FormFieldMetadataValueObject('test')],
|
||||
};
|
||||
expect(service.getValueFromModel(formModel)).toEqual(value);
|
||||
|
||||
((formModel[2] as DynamicRowGroupModel).get(0) as DynamicOneboxModel).value = 'test one';
|
||||
value = {
|
||||
issue: [new FormFieldMetadataValueObject('test')],
|
||||
conference: [new FormFieldMetadataValueObject('test one')]
|
||||
conference: [new FormFieldMetadataValueObject('test one')],
|
||||
};
|
||||
expect(service.getValueFromModel(formModel)).toEqual(value);
|
||||
});
|
||||
|
Reference in New Issue
Block a user