Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(select): campo reseta valor para nulo usando formulário reativo #1988

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading