AAE-33082 Fixing dropdown widget update value based on form rule (#11068)

This commit is contained in:
Ehsan Rezaei
2025-07-24 16:40:06 +02:00
committed by GitHub
parent 71df219f94
commit 19b69e024a
2 changed files with 16 additions and 0 deletions

View File

@@ -998,6 +998,21 @@ describe('DropdownCloudWidgetComponent', () => {
expect(widget.dropdownControl.value).toEqual({ id: 'testValue', name: '' });
});
it('should set dropdownControl value when form field value gets changed', () => {
widget.field = {
value: { id: 'Id_1', name: 'Label 1' },
options: [],
isVisible: true,
markAsValid: () => {}
} as FormFieldModel;
spyOn(widget.dropdownControl, 'setValue').and.callThrough();
widget.updateReactiveFormControl();
expect(widget.dropdownControl.setValue).toHaveBeenCalledWith({ id: 'Id_1', name: 'Label 1' }, { emitEvent: false });
expect(widget.dropdownControl.value).toEqual({ id: 'Id_1', name: 'Label 1' });
});
it('should set dropdownControl value without emitting events if is an object', () => {
widget.field = {
value: { id: 'testValueObj', name: 'testValueObjName' },

View File

@@ -137,6 +137,7 @@ export class DropdownCloudWidgetComponent extends WidgetComponent implements OnI
}
updateReactiveFormControl(): void {
this.setFormControlValue();
this.updateFormControlState();
this.handleErrors();
}