From 913c94fd99a8ab0660e90e28963ee60302a8e5d4 Mon Sep 17 00:00:00 2001 From: sashaqred Date: Mon, 26 Sep 2022 19:14:09 +0400 Subject: [PATCH] test: fix select with autocomplete tests --- .../select-with-autocomplete.spec.ts | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/framework/theme/components/select-with-autocomplete/select-with-autocomplete.spec.ts b/src/framework/theme/components/select-with-autocomplete/select-with-autocomplete.spec.ts index 33996c0f06..f1924efe28 100644 --- a/src/framework/theme/components/select-with-autocomplete/select-with-autocomplete.spec.ts +++ b/src/framework/theme/components/select-with-autocomplete/select-with-autocomplete.spec.ts @@ -5,7 +5,7 @@ */ import { Component, ElementRef, EventEmitter, Input, Output, QueryList, ViewChild, ViewChildren } from '@angular/core'; -import { ComponentFixture, fakeAsync, flush, TestBed } from '@angular/core/testing'; +import { ComponentFixture, discardPeriodicTasks, fakeAsync, flush, TestBed } from '@angular/core/testing'; import { FormControl, FormsModule, ReactiveFormsModule } from '@angular/forms'; import { By } from '@angular/platform-browser'; import { RouterTestingModule } from '@angular/router/testing'; @@ -711,7 +711,7 @@ describe('Component: NbSelectComponent', () => { })); }); -describe('NbSelectComponent - falsy values', () => { +describe('NbSelectWithAutocompleteComponent - falsy values', () => { let fixture: ComponentFixture; let testComponent: NbSelectWithFalsyOptionValuesComponent; let select: NbSelectComponent; @@ -736,6 +736,7 @@ describe('NbSelectComponent - falsy values', () => { testComponent.noValueOption.onClick(eventMock); fixture.detectChanges(); + flush(); expect(select.selectionModel.length).toEqual(0); })); @@ -746,6 +747,7 @@ describe('NbSelectComponent - falsy values', () => { testComponent.nullOption.onClick(eventMock); fixture.detectChanges(); + flush(); expect(select.selectionModel.length).toEqual(0); })); @@ -756,6 +758,7 @@ describe('NbSelectComponent - falsy values', () => { testComponent.undefinedOption.onClick(eventMock); fixture.detectChanges(); + flush(); expect(select.selectionModel.length).toEqual(0); })); @@ -766,6 +769,7 @@ describe('NbSelectComponent - falsy values', () => { testComponent.falseOption.onClick(eventMock); fixture.detectChanges(); + flush(); expect(select.selectionModel.length).toEqual(1); })); @@ -776,6 +780,7 @@ describe('NbSelectComponent - falsy values', () => { testComponent.zeroOption.onClick(eventMock); fixture.detectChanges(); + flush(); expect(select.selectionModel.length).toEqual(1); })); @@ -786,6 +791,7 @@ describe('NbSelectComponent - falsy values', () => { testComponent.emptyStringOption.onClick(eventMock); fixture.detectChanges(); + flush(); expect(select.selectionModel.length).toEqual(1); })); @@ -796,6 +802,7 @@ describe('NbSelectComponent - falsy values', () => { testComponent.nanOption.onClick(eventMock); fixture.detectChanges(); + flush(); expect(select.selectionModel.length).toEqual(1); })); @@ -849,7 +856,7 @@ describe('NbSelectComponent - falsy values', () => { })); }); -describe('NbSelectComponent - Triggers', () => { +describe('NbSelectWithAutocompleteComponent - Triggers', () => { let fixture: ComponentFixture; let selectComponent: NbSelectComponent; let triggerBuilderStub; @@ -914,7 +921,7 @@ describe('NbSelectComponent - Triggers', () => { })); }); -describe('NbSelectComponent - Key manager', () => { +describe('NbSelectWithAutocompleteComponent - Key manager', () => { let fixture: ComponentFixture; let selectComponent: NbSelectComponent; let tabOutStub: Subject; @@ -1247,8 +1254,8 @@ describe('NbSelect - dynamic options', () => { @@ -1289,7 +1296,7 @@ describe('NbSelect - experimental search', () => { }); it("should update search input and don't emit filterChange when value of select is changed", fakeAsync(() => { - const searchInput = testComponent.selectComponent.optionSearchInput.nativeElement; + const searchInput = testComponent.selectComponent.optionsAutocompleteInput.nativeElement; expect(searchInput.value).toEqual(''); expect(testComponent.filterValue).toEqual('');