Skip to content

Commit 72d224a

Browse files
committed
test(filtering): Replace try/catch with toThrow #5304
1 parent 3130fd8 commit 72d224a

File tree

1 file changed

+13
-17
lines changed

1 file changed

+13
-17
lines changed

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

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3277,7 +3277,7 @@ describe('IgxGrid - Filtering Row UI actions', () => {
32773277
GridFunctions.typeValueInFilterRowInput('o', fix);
32783278
await wait(16);
32793279
GridFunctions.submitFilterRowInput(fix);
3280-
await wait(100);
3280+
await wait(200);
32813281

32823282
verifyMultipleChipsVisibility(fix, [false, false, false, true]);
32833283
const filterUIRow = fix.debugElement.query(By.css(FILTER_UI_ROW));
@@ -3291,30 +3291,26 @@ describe('IgxGrid - Filtering Row UI actions', () => {
32913291
expect(rightArrowButton).toBeTruthy('Right scroll arrow should be visible');
32923292
expect(grid.rowList.length).toBe(2);
32933293

3294-
try {
3295-
GridFunctions.removeFilterChipByIndex(3, filterUIRow);
3296-
await wait(300);
3297-
fix.detectChanges();
3294+
let chipToRemove = filterUIRow.componentInstance.expressionsList[3];
3295+
expect(() => { filterUIRow.componentInstance.onChipRemoved(null, chipToRemove); })
3296+
.not.toThrowError(/\'id\' of undefined/);
3297+
await wait(200);
3298+
fix.detectChanges();
32983299

3299-
verifyMultipleChipsVisibility(fix, [false, true, false]);
3300-
chips = filterUIRow.queryAll(By.directive(IgxChipComponent));
3301-
expect(chips.length).toBe(3);
3302-
} catch (ex) {
3303-
expect(ex).toBeNull('Error deleting the last chip');
3304-
}
3300+
verifyMultipleChipsVisibility(fix, [false, true, false]);
3301+
chips = filterUIRow.queryAll(By.directive(IgxChipComponent));
3302+
expect(chips.length).toBe(3);
33053303

3306-
try {
3307-
GridFunctions.removeFilterChipByIndex(2, filterUIRow);
3308-
await wait(300);
3304+
chipToRemove = filterUIRow.componentInstance.expressionsList[2];
3305+
expect(() => { filterUIRow.componentInstance.onChipRemoved(null, chipToRemove); })
3306+
.not.toThrowError(/\'id\' of undefined/);
3307+
await wait(200);
33093308
fix.detectChanges();
33103309

33113310
verifyMultipleChipsVisibility(fix, [true, false]);
33123311
chips = filterUIRow.queryAll(By.directive(IgxChipComponent));
33133312
expect(chips.length).toBe(2);
33143313
expect(grid.rowList.length).toBe(3);
3315-
} catch (ex) {
3316-
expect(ex).toBeNull('Error deleting the last chip');
3317-
}
33183314
}));
33193315
});
33203316

0 commit comments

Comments
 (0)