Skip to content

Commit

Permalink
test(grid): Adding test for filter chip selection #4967
Browse files Browse the repository at this point in the history
  • Loading branch information
astaev committed Jun 26, 2019
1 parent 10b516d commit 7b1a5eb
Showing 1 changed file with 30 additions and 0 deletions.
Expand Up @@ -1576,6 +1576,36 @@ describe('IgxGrid - Filtering actions', () => {
const datePicker = filterUIRow.query(By.css('igx-date-picker'));
expect(datePicker.componentInstance.mode).toBe('dropdown');
}));

it('Should commit the filter when click on filter chip', async () => {
const filterValue = 'a';
const filteringCells = fix.debugElement.queryAll(By.css(FILTER_UI_CELL));
filteringCells[1].query(By.css('igx-chip')).nativeElement.click();
fix.detectChanges();

const filterUIRow = fix.debugElement.query(By.css(FILTER_UI_ROW));
const input = filterUIRow.query(By.directive(IgxInputDirective));
sendInput(input, filterValue, fix);

const filterChip = filterUIRow.query(By.directive(IgxChipComponent));
expect(filterChip).toBeTruthy();
expect(filterChip.componentInstance.selected).toBeTruthy();

filterChip.nativeElement.dispatchEvent(new MouseEvent('click'));
fix.detectChanges();
await wait(16);
expect(filterChip.componentInstance.selected).toBeFalsy();

filterChip.nativeElement.dispatchEvent(new MouseEvent('click'));
fix.detectChanges();
await wait(16);
expect(filterChip.componentInstance.selected).toBeTruthy();

filterChip.nativeElement.dispatchEvent(new MouseEvent('click'));
fix.detectChanges();
await wait(16);
expect(filterChip.componentInstance.selected).toBeFalsy();
});
});

describe('IgxGrid - Filtering Row UI actions', () => {
Expand Down

0 comments on commit 7b1a5eb

Please sign in to comment.