From 14768bcdb385d1e5ef18a6852391f79d78e619d1 Mon Sep 17 00:00:00 2001 From: hrynko Date: Wed, 19 Aug 2020 11:49:53 +0300 Subject: [PATCH] fix(lib): fixed control value reset --- .../select-country/src/lib/mat-select-country.component.spec.ts | 2 +- .../select-country/src/lib/mat-select-country.component.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/angular-material-extensions/select-country/src/lib/mat-select-country.component.spec.ts b/projects/angular-material-extensions/select-country/src/lib/mat-select-country.component.spec.ts index e8cd8aa..c2d3515 100644 --- a/projects/angular-material-extensions/select-country/src/lib/mat-select-country.component.spec.ts +++ b/projects/angular-material-extensions/select-country/src/lib/mat-select-country.component.spec.ts @@ -93,7 +93,7 @@ describe('SelectCountryComponent', () => { country: new SimpleChange(undefined, 'de', true) }); - await fixture.whenStable(); + fixture.detectChanges(); expect(inputElement.value).toMatch('Germany'); }); diff --git a/projects/angular-material-extensions/select-country/src/lib/mat-select-country.component.ts b/projects/angular-material-extensions/select-country/src/lib/mat-select-country.component.ts index 5a5fe07..127e202 100644 --- a/projects/angular-material-extensions/select-country/src/lib/mat-select-country.component.ts +++ b/projects/angular-material-extensions/select-country/src/lib/mat-select-country.component.ts @@ -101,7 +101,7 @@ export class MatSelectCountryComponent implements OnInit, OnChanges, ControlValu } onBlur() { - if (this.value || !this.nullable) { + if (this.countryFormControl.value || !this.nullable) { this.countryFormControl.setValue( this.value ? this.value.name : '' );