Skip to content

Commit

Permalink
fix(esf): add empty filter to filtering event
Browse files Browse the repository at this point in the history
  • Loading branch information
igdmdimitrov committed Oct 11, 2021
1 parent c8c3723 commit c1bdc45
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,10 @@ export class IgxFilteringService implements OnDestroy {
}
}

const emptyFilter = new FilteringExpressionsTree(null, field);
const onFilteringEventArgs: IFilteringEventArgs = {
owner: this.grid,
filteringExpressions: null,
filteringExpressions: emptyFilter,
cancel: false };

this.grid.filtering.emit(onFilteringEventArgs);
Expand All @@ -292,7 +293,6 @@ export class IgxFilteringService implements OnDestroy {
this.clear_filter(field);

// Wait for the change detection to update filtered data through the pipes and then emit the event.
const emptyFilter = new FilteringExpressionsTree(null, field);
requestAnimationFrame(() => this.grid.filteringDone.emit(emptyFilter));

if (field) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -485,9 +485,9 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
GridFunctions.clickFilterCellChip(fix, columnName);
GridFunctions.resetFilterRow(fix);

expect(grid.filtering.emit).toHaveBeenCalledWith({ owner: grid, cancel: false, filteringExpressions: null });
expect(grid.filtering.emit).toHaveBeenCalledTimes(2);
const emptyFilter = new FilteringExpressionsTree(null, columnName);
expect(grid.filtering.emit).toHaveBeenCalledWith({ owner: grid, cancel: false, filteringExpressions: emptyFilter });
expect(grid.filtering.emit).toHaveBeenCalledTimes(2);
expect(grid.filteringDone.emit).toHaveBeenCalledWith(emptyFilter);
expect(grid.filteringDone.emit).toHaveBeenCalledTimes(2);

Expand All @@ -513,9 +513,9 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
tick(100);
fix.detectChanges();

const args = { owner: grid, cancel: false, filteringExpressions: null };
expect(grid.filtering.emit).toHaveBeenCalledWith(args);
const emptyFilter = new FilteringExpressionsTree(null, columnName);
const args = { owner: grid, cancel: false, filteringExpressions: emptyFilter };
expect(grid.filtering.emit).toHaveBeenCalledWith(args);
expect(grid.filteringDone.emit).toHaveBeenCalledWith(emptyFilter);
}));

Expand Down Expand Up @@ -852,10 +852,10 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {

expect(grid.rowList.length).toEqual(8);

args.filteringExpressions = null;
const emptyFilter = new FilteringExpressionsTree(null, columnName);
args.filteringExpressions = emptyFilter;
expect(grid.filtering.emit).toHaveBeenCalledWith(args);
expect(grid.filtering.emit).toHaveBeenCalledTimes(2);
const emptyFilter = new FilteringExpressionsTree(null, columnName);
expect(grid.filteringDone.emit).toHaveBeenCalledWith(emptyFilter);
expect(grid.filteringDone.emit).toHaveBeenCalledTimes(2);
}));
Expand Down

0 comments on commit c1bdc45

Please sign in to comment.