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