Skip to content

Commit 34d9ee6

Browse files
authored
Merge pull request #5744 from IgniteUI/ddincheva/fixIssue5551-master
Should not throw error when you filter data column
2 parents ef561fc + 9e54026 commit 34d9ee6

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

projects/igniteui-angular/src/lib/data-operations/filtering-condition.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,7 @@ export class IgxDateFilteringOperand extends IgxFilteringOperand {
390390
}
391391

392392
protected findValueInSet(target: any, searchVal: Set<any>) {
393+
if (!target) { return false; }
393394
return searchVal.has(new Date(target.getFullYear(), target.getMonth(), target.getDate()).toISOString());
394395
}
395396
}

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4843,6 +4843,34 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {
48434843
new Set(['Ignite UI for Angular', 'Ignite UI for JavaScript', 'NetAdvantage']));
48444844
}));
48454845

4846+
it('Should not throw error when selecting more than two values and column dataType is date.', fakeAsync(() => {
4847+
fix.detectChanges();
4848+
4849+
const headers: DebugElement[] = fix.debugElement.queryAll(By.directive(IgxGridHeaderGroupComponent));
4850+
const headerResArea = headers[4].children[0].nativeElement;
4851+
4852+
const filterIcon = headerResArea.querySelector('.igx-excel-filter__icon');
4853+
filterIcon.click();
4854+
fix.detectChanges();
4855+
4856+
const excelMenu = grid.nativeElement.querySelector('.igx-excel-filter__menu');
4857+
const checkbox = excelMenu.querySelectorAll('.igx-checkbox__input');
4858+
const applyButton = excelMenu.querySelector('.igx-button--raised');
4859+
4860+
checkbox[0].click(); // Select All
4861+
tick();
4862+
fix.detectChanges();
4863+
4864+
checkbox[2].click();
4865+
checkbox[3].click();
4866+
checkbox[4].click();
4867+
checkbox[6].click();
4868+
tick();
4869+
fix.detectChanges();
4870+
4871+
expect(() => { applyButton.click(); }).not.toThrowError();
4872+
}));
4873+
48464874
it('Should generate "in" and "empty" conditions when selecting more than two values including (Blanks).', fakeAsync(() => {
48474875
fix.detectChanges();
48484876

0 commit comments

Comments
 (0)