From c91e8165a594c94dc75b00035ab260422ebf7195 Mon Sep 17 00:00:00 2001 From: anliben Date: Mon, 11 Mar 2024 11:34:16 -0300 Subject: [PATCH] =?UTF-8?q?fix(select):=20campo=20reseta=20valor=20para=20?= =?UTF-8?q?nulo=20usando=20formul=C3=A1rio=20reativo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit campo reseta valor para nulo usando formulário reativo. Fixes DTHFUI-8377 --- .../po-field/po-select/po-select.component.spec.ts | 4 ++-- .../components/po-field/po-select/po-select.component.ts | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/projects/ui/src/lib/components/po-field/po-select/po-select.component.spec.ts b/projects/ui/src/lib/components/po-field/po-select/po-select.component.spec.ts index bbda031dc..17827544a 100644 --- a/projects/ui/src/lib/components/po-field/po-select/po-select.component.spec.ts +++ b/projects/ui/src/lib/components/po-field/po-select/po-select.component.spec.ts @@ -254,14 +254,14 @@ describe('PoSelectComponent:', () => { component.selectedValue = 'payment'; component.options.length = 0; component.writeValue(undefined); - expect(component.selectedValue).toBeUndefined(); + expect(component.selectedValue).toBeNull(); }); it('writeValue: should define selectedValue with undefined and doesn`t call setScrollPosition if optionsFound is false', () => { component.selectedValue = 'payment'; component.writeValue('value invalid'); - expect(component.selectedValue).toBeUndefined(); + expect(component.selectedValue).toBeNull(); }); it('writeValue: should set property values and call `setScrollPosition` if is a valid option', () => { diff --git a/projects/ui/src/lib/components/po-field/po-select/po-select.component.ts b/projects/ui/src/lib/components/po-field/po-select/po-select.component.ts index d6986d242..48ec6e3da 100644 --- a/projects/ui/src/lib/components/po-field/po-select/po-select.component.ts +++ b/projects/ui/src/lib/components/po-field/po-select/po-select.component.ts @@ -323,10 +323,10 @@ export class PoSelectComponent extends PoFieldValidateModel implements OnCh this.selectedValue = optionFound[this.fieldValue]; this.displayValue = optionFound[this.fieldLabel]; } else if (validValue(this.selectedValue)) { - this.selectElement.nativeElement.value = undefined; - this.updateModel(undefined); - this.selectedValue = undefined; - this.displayValue = undefined; + this.selectElement.nativeElement.value = null; + this.updateModel(null); + this.selectedValue = null; + this.displayValue = null; } this.modelValue = value;