mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[7094] Fix empty save people groups (#7137)
* fix empty save people groups * fix
This commit is contained in:
@@ -612,6 +612,31 @@ describe('FormFieldModel', () => {
|
|||||||
expect(form.values['dropdown_field'].name).toEqual('Option 1');
|
expect(form.values['dropdown_field'].name).toEqual('Option 1');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should parse and resolve people null value as null', () => {
|
||||||
|
const field = new FormFieldModel(new FormModel(), {
|
||||||
|
type: FormFieldTypes.PEOPLE,
|
||||||
|
value: null
|
||||||
|
});
|
||||||
|
|
||||||
|
field.updateForm();
|
||||||
|
|
||||||
|
expect(field.value).toBe(null);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should parse and resolve people undefined value as null', () => {
|
||||||
|
const field = new FormFieldModel(new FormModel(), {
|
||||||
|
fieldType: 'HeaderFieldtype',
|
||||||
|
id: 'people_field',
|
||||||
|
name: 'people',
|
||||||
|
type: FormFieldTypes.PEOPLE,
|
||||||
|
value: undefined
|
||||||
|
});
|
||||||
|
|
||||||
|
field.updateForm();
|
||||||
|
|
||||||
|
expect(field.value).toBe(null);
|
||||||
|
});
|
||||||
|
|
||||||
describe('variables', () => {
|
describe('variables', () => {
|
||||||
|
|
||||||
let form: FormModel;
|
let form: FormModel;
|
||||||
@@ -680,5 +705,6 @@ describe('FormFieldModel', () => {
|
|||||||
|
|
||||||
expect(field.value).toBe('default hello');
|
expect(field.value).toBe('default hello');
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -268,7 +268,7 @@ export class FormFieldModel extends FormWidgetModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
parseValue(json: any): any {
|
parseValue(json: any): any {
|
||||||
let value = json.hasOwnProperty('value') ? json.value : null;
|
let value = json.hasOwnProperty('value') && json.value !== undefined ? json.value : null;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This is needed due to Activiti issue related to reading dropdown values as value string
|
This is needed due to Activiti issue related to reading dropdown values as value string
|
||||||
@@ -408,10 +408,10 @@ export class FormFieldModel extends FormWidgetModel {
|
|||||||
this.form.values[this.id] = (this.value !== null && this.value !== undefined) ? this.value : false;
|
this.form.values[this.id] = (this.value !== null && this.value !== undefined) ? this.value : false;
|
||||||
break;
|
break;
|
||||||
case FormFieldTypes.PEOPLE:
|
case FormFieldTypes.PEOPLE:
|
||||||
this.form.values[this.id] = (this.value !== null && this.value !== undefined) ? this.value : [];
|
this.form.values[this.id] = this.value ? this.value : null;
|
||||||
break;
|
break;
|
||||||
case FormFieldTypes.FUNCTIONAL_GROUP:
|
case FormFieldTypes.FUNCTIONAL_GROUP:
|
||||||
this.form.values[this.id] = (this.value !== null && this.value !== undefined) ? this.value : [];
|
this.form.values[this.id] = this.value ? this.value : null;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (!FormFieldTypes.isReadOnlyType(this.type) && !this.isInvalidFieldType(this.type)) {
|
if (!FormFieldTypes.isReadOnlyType(this.type) && !this.isInvalidFieldType(this.type)) {
|
||||||
|
Reference in New Issue
Block a user