Skip to content

Commit 67910c3

Browse files
author
Borislav Kulov
committed
fix(filtering): Fix async issue in test (#2995)
1 parent e1fda82 commit 67910c3

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

projects/igniteui-angular/src/lib/grids/grid/grid-filtering-ui.spec.ts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,7 +1180,7 @@ describe('IgxGrid - Filtering actions', () => {
11801180
expect(grid.rowList.length).toEqual(7);
11811181
}));
11821182

1183-
it('UI - should correctly filter date column by \'after\' filtering conditions', fakeAsync(() => {
1183+
it('UI - should correctly filter date column by \'after\' filtering conditions', async() => {
11841184
const fix = TestBed.createComponent(IgxGridFilteringComponent);
11851185
fix.detectChanges();
11861186

@@ -1194,30 +1194,38 @@ describe('IgxGrid - Filtering actions', () => {
11941194
const input = filterUIRow.query(By.directive(IgxInputDirective));
11951195

11961196
filterIcon.nativeElement.click();
1197-
tick();
11981197
fix.detectChanges();
1198+
await wait();
11991199

12001200
verifyFilterUIPosition(filterIcon, grid);
12011201

12021202
const ddList = fix.debugElement.query(By.css('div.igx-drop-down__list.igx-toggle'));
1203-
GridFunctions.selectFilteringCondition('After', ddList);
1203+
const ddItems = ddList.nativeElement.children;
1204+
let i;
1205+
for (i = 0; i < ddItems.length; i++) {
1206+
if (ddItems[i].textContent === 'After') {
1207+
ddItems[i].click();
1208+
await wait(100);
1209+
return;
1210+
}
1211+
}
12041212

12051213
input.nativeElement.click();
1206-
tick(100);
12071214
fix.detectChanges();
1215+
await wait(100);
12081216

12091217
const calendar = fix.debugElement.query(By.css('igx-calendar'));
12101218
const currentDay = calendar.query(By.css('span.igx-calendar__date--current'));
12111219
currentDay.nativeElement.click();
1212-
flush();
12131220
fix.detectChanges();
1221+
await wait();
12141222

12151223
input.nativeElement.dispatchEvent(new Event('change'));
1216-
tick();
12171224
fix.detectChanges();
1225+
await wait();
12181226

12191227
expect(grid.rowList.length).toEqual(3);
1220-
}));
1228+
});
12211229

12221230
it('UI - should correctly filter date column by \'before\' filtering conditions', fakeAsync(() => {
12231231
const fix = TestBed.createComponent(IgxGridFilteringComponent);

0 commit comments

Comments
 (0)