Skip to content

Commit 315a798

Browse files
committed
chore(*): add unit test to cover the scenario
1 parent b5c713d commit 315a798

File tree

1 file changed

+43
-1
lines changed

1 file changed

+43
-1
lines changed

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

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4369,6 +4369,49 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {
43694369
expect(listItems[3].innerText).toBe('custoM', 'incorrect list item label');
43704370
expect(listItems[4].innerText).toBe('custom', 'incorrect list item label');
43714371
}));
4372+
4373+
it('Should clear search criteria when selecting clear column filters option.', fakeAsync(() => {
4374+
GridFunctions.clickExcelFilterIconFromCode(fix, grid, 'ProductName');
4375+
4376+
let checkboxes: any = Array.from(GridFunctions.getExcelStyleFilteringCheckboxes(fix));
4377+
4378+
tick(100);
4379+
fix.detectChanges();
4380+
4381+
checkboxes[0].click();
4382+
tick();
4383+
fix.detectChanges();
4384+
4385+
checkboxes[2].click();
4386+
tick();
4387+
fix.detectChanges();
4388+
4389+
GridFunctions.clickApplyExcelStyleFiltering(fix);
4390+
tick(100);
4391+
fix.detectChanges();
4392+
4393+
expect(grid.filteredData.length).toEqual(1);
4394+
4395+
GridFunctions.clickExcelFilterIconFromCode(fix, grid, 'ProductName');
4396+
4397+
let inputNativeElement = GridFunctions.getExcelStyleSearchComponentInput(fix);
4398+
UIInteractions.clickAndSendInputElementValue(inputNativeElement, 'Net', fix);
4399+
4400+
const listItems = GridFunctions.getExcelStyleSearchComponentListItems(fix);
4401+
expect(listItems.length).toBe(2, 'incorrect rendered list items count');
4402+
4403+
GridFunctions.clickClearFilterInExcelStyleFiltering(fix);
4404+
fix.detectChanges();
4405+
flush();
4406+
4407+
expect(grid.filteredData).toBeNull();
4408+
4409+
inputNativeElement = GridFunctions.getExcelStyleSearchComponentInput(fix);
4410+
expect(inputNativeElement.value).toBe('', 'search criteria is not cleared');
4411+
4412+
checkboxes = Array.from(GridFunctions.getExcelStyleFilteringCheckboxes(fix));
4413+
expect(checkboxes.every(ch => ch.checked)).toBeTrue();
4414+
}));
43724415
});
43734416

43744417
describe(null, () => {
@@ -4616,7 +4659,6 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {
46164659
GridSelectionFunctions.verifyColumnAndCellsSelected(columnId, false);
46174660

46184661
});
4619-
46204662
});
46214663
});
46224664

0 commit comments

Comments
 (0)