mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
fixed strange test issue
This commit is contained in:
@@ -322,7 +322,9 @@ export class DsDynamicFormControlContainerComponent extends DynamicFormControlCo
|
||||
size: 'lg'
|
||||
});
|
||||
const modalComp = this.modalRef.componentInstance;
|
||||
modalComp.query = this.model.value.value;
|
||||
if (hasValue(this.model.value)) {
|
||||
modalComp.query = this.model.value.value;
|
||||
}
|
||||
modalComp.repeatable = this.model.repeatable;
|
||||
modalComp.listId = this.listId;
|
||||
modalComp.relationshipOptions = this.model.relationship;
|
||||
|
@@ -37,7 +37,6 @@ export class DynamicConcatModel extends DynamicFormGroupModel {
|
||||
constructor(config: DynamicConcatModelConfig, layout?: DynamicFormControlLayout) {
|
||||
|
||||
super(config, layout);
|
||||
console.log(config);
|
||||
this.separator = config.separator + ' ';
|
||||
this.relationship = config.relationship;
|
||||
this.repeatable = config.repeatable;
|
||||
@@ -60,7 +59,7 @@ export class DynamicConcatModel extends DynamicFormGroupModel {
|
||||
} else if (isNotEmpty(secondValue) && isNotEmpty(secondValue.value)) {
|
||||
return Object.assign(new FormFieldMetadataValueObject(), secondValue);
|
||||
} else {
|
||||
return new FormFieldMetadataValueObject();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -435,12 +435,13 @@ describe('FormBuilderService test suite', () => {
|
||||
expect((formModel[2] as DynamicRowGroupModel).get(0) instanceof DynamicTypeaheadModel).toBe(true);
|
||||
});
|
||||
|
||||
it('should return form\'s fields value from form model', () => {
|
||||
fit('should return form\'s fields value from form model', () => {
|
||||
const formModel = service.modelFromConfiguration(submissionId, testFormConfiguration, 'testScopeUUID');
|
||||
let value = {} as any;
|
||||
let value = {} as any;
|
||||
|
||||
console.log(service.getValueFromModel(formModel));
|
||||
expect(service.getValueFromModel(formModel)).toEqual(value);
|
||||
|
||||
console.log('first test');
|
||||
((formModel[0] as DynamicRowGroupModel).get(1) as DsDynamicInputModel).valueUpdates.next('test');
|
||||
|
||||
value = {
|
||||
|
@@ -124,7 +124,6 @@ export class FormBuilderService extends DynamicFormService {
|
||||
|
||||
const iterateControlModels = (findGroupModel: DynamicFormControlModel[], controlModelIndex: number = 0): void => {
|
||||
let iterateResult = Object.create({});
|
||||
|
||||
// Iterate over all group's controls
|
||||
for (const controlModel of findGroupModel) {
|
||||
|
||||
@@ -140,6 +139,7 @@ export class FormBuilderService extends DynamicFormService {
|
||||
|
||||
if (this.isRowArrayGroup(controlModel)) {
|
||||
for (const arrayItemModel of (controlModel as DynamicRowArrayModel).groups) {
|
||||
|
||||
iterateResult = mergeWith(iterateResult, iterateControlModels(arrayItemModel.group, arrayItemModel.index), customizer);
|
||||
}
|
||||
continue;
|
||||
@@ -147,6 +147,8 @@ export class FormBuilderService extends DynamicFormService {
|
||||
|
||||
if (this.isArrayGroup(controlModel)) {
|
||||
iterateResult[controlModel.name] = [];
|
||||
console.log((controlModel as DynamicFormArrayModel).groups);
|
||||
|
||||
for (const arrayItemModel of (controlModel as DynamicFormArrayModel).groups) {
|
||||
iterateResult[controlModel.name].push(iterateControlModels(arrayItemModel.group, arrayItemModel.index));
|
||||
}
|
||||
@@ -197,7 +199,6 @@ export class FormBuilderService extends DynamicFormService {
|
||||
|
||||
return iterateResult;
|
||||
};
|
||||
|
||||
result = iterateControlModels(groupModel);
|
||||
|
||||
return result;
|
||||
|
Reference in New Issue
Block a user