Skip to content

Commit

Permalink
Merge pull request #15216 from IgniteUI/gedinakova/fix-clear-filter-1…
Browse files Browse the repository at this point in the history
…5193-19.0

Clear selected condition when clearing the filters #15193
  • Loading branch information
ChronosSF authored Jan 13, 2025
2 parents 316a63a + 2e3c44d commit dcc1040
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ export class IgxExcelStyleCustomDialogComponent implements AfterViewInit {

public onClearButtonClick() {
this.filteringService.clearFilter(this.column.field);
this.selectedOperator = null;
this.createInitialExpressionUIElement();
this.cdr.detectChanges();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6273,6 +6273,41 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {
['Select All', '1:00:00 AM', '12:00:00 PM', '11:00:00 PM'],
[true, true, true, true]);
}));

it('should clear all filters in the custom dialog when clicking "Clear Filter" button', fakeAsync(() => {
GridFunctions.clickExcelFilterIcon(fix, 'ReleaseDate');
tick(100);
fix.detectChanges();

GridFunctions.clickExcelFilterCascadeButton(fix);
tick();
fix.detectChanges();

GridFunctions.clickOperatorFromCascadeMenu(fix, 5);
tick();
fix.detectChanges();

const expressions = GridFunctions.getExcelCustomFilteringDateExpressions(fix);
const lastExpression = expressions[expressions.length - 1];
(lastExpression.querySelector('igx-select').querySelector('igx-input-group') as HTMLElement).click();
tick();
fix.detectChanges();
const dropdownList = fix.debugElement.query(By.css('div.igx-drop-down__list.igx-toggle'));

const todayItem = dropdownList.children[0].children.find(item => item.nativeElement?.innerText === 'Today');
todayItem.nativeElement.click();
tick();
fix.detectChanges();

GridFunctions.clickClearFilterExcelStyleCustomFiltering(fix);
tick();
fix.detectChanges();

GridFunctions.getExcelCustomFilteringDateExpressions(fix).forEach(expr => {
const input = expr.children[0].querySelector('input');
expect(input.value).toBe('');
});
}));
});

describe('Templates: ', () => {
Expand Down

0 comments on commit dcc1040

Please sign in to comment.