AAE-40741 Form rule Validate form doesn't do anything (#11788)

This commit is contained in:
David Olson
2026-05-20 14:19:14 +05:30
committed by Anamika Dey
parent 1d39216fc9
commit 905953e30e
14 changed files with 227 additions and 1 deletions
@@ -349,4 +349,42 @@ describe('DropdownWidgetComponent', () => {
});
});
});
describe('showAllValidationErrors', () => {
it('should mark dropdownControl as touched when showAllValidationErrors is true', () => {
const form = new FormModel();
widget.field = new FormFieldModel(form, {
id: 'dropdown-id',
name: 'dropdown-name',
type: FormFieldTypes.DROPDOWN,
required: true,
options: fakeOptionList
});
fixture.detectChanges();
expect(widget.dropdownControl.touched).toBe(false);
form.showAllValidationErrors = true;
widget.updateReactiveFormControl();
expect(widget.dropdownControl.touched).toBe(true);
});
it('should not mark dropdownControl as touched when showAllValidationErrors is false', () => {
const form = new FormModel();
widget.field = new FormFieldModel(form, {
id: 'dropdown-id',
name: 'dropdown-name',
type: FormFieldTypes.DROPDOWN,
required: true,
options: fakeOptionList
});
fixture.detectChanges();
form.showAllValidationErrors = false;
widget.updateReactiveFormControl();
expect(widget.dropdownControl.touched).toBe(false);
});
});
});
@@ -100,6 +100,9 @@ export class DropdownWidgetComponent extends WidgetComponent implements OnInit,
updateReactiveFormControl(): void {
this.updateFormControlState();
if (this.field?.form?.showAllValidationErrors) {
this.dropdownControl.markAsTouched();
}
this.handleErrors();
}