AAE-39949 Fix error while deleting empty row in repeatable section (#11346)

This commit is contained in:
Diogo Bastos
2025-11-17 09:49:28 +00:00
committed by GitHub
parent 002c5b4bf7
commit ac3c30480b
2 changed files with 21 additions and 0 deletions
@@ -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);
}