Skip to content

Commit

Permalink
fix(select): campo reseta valor para nulo usando formulário reativo
Browse files Browse the repository at this point in the history
campo reseta valor para nulo usando formulário reativo.

Fixes DTHFUI-8377
  • Loading branch information
anliben committed Mar 11, 2024
1 parent 1dd5ac9 commit c91e816
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,10 +323,10 @@ export class PoSelectComponent extends PoFieldValidateModel<any> 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;
Expand Down

0 comments on commit c91e816

Please sign in to comment.