mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
AAE-39949 Fix error while deleting empty row in repeatable section (#11346)
This commit is contained in:
@@ -1467,6 +1467,23 @@ describe('FormFieldModel', () => {
|
||||
field.removeRow(0);
|
||||
expect(form.values[field.id]).toEqual(formValues.removeState);
|
||||
});
|
||||
|
||||
it('should call onFormFieldChanged if form values contains field id', () => {
|
||||
spyOn(field.form, 'onFormFieldChanged').and.callThrough();
|
||||
|
||||
field.removeRow(1);
|
||||
|
||||
expect(field.form.onFormFieldChanged).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should NOT call onFormFieldChanged if form values does NOT contain field id', () => {
|
||||
spyOn(field.form, 'onFormFieldChanged').and.callThrough();
|
||||
|
||||
field.form.values = {};
|
||||
field.removeRow(1);
|
||||
|
||||
expect(field.form.onFormFieldChanged).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('disabled state', () => {
|
||||
|
||||
@@ -487,6 +487,10 @@ export class FormFieldModel extends FormWidgetModel {
|
||||
this.rows.splice(index, 1);
|
||||
this.updateChildrenFieldsRowIndex();
|
||||
|
||||
if (!this.form.values[this.id]) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.form.values[this.id].splice(index, 1);
|
||||
this.form.onFormFieldChanged(this);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user