Skip to content

Commit 193471c

Browse files
authored
Merge branch 'master' into BPenkov/navigation-drawer-API
2 parents aa2bf56 + 250bd27 commit 193471c

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

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

+35
Original file line numberDiff line numberDiff line change
@@ -1190,6 +1190,41 @@ describe('IgxGrid - Filtering actions', () => {
11901190

11911191
expect(grid.onFilteringDone.emit).toHaveBeenCalledWith(args);
11921192
});
1193+
1194+
it('When filter column with value 0 and dataType number, filtering icon class indicator should be applied', ((done) => {
1195+
const fix = TestBed.createComponent(IgxGridFilteringComponent);
1196+
fix.detectChanges();
1197+
1198+
const grid = fix.componentInstance.grid;
1199+
const gridheaders = fix.debugElement.queryAll(By.css('igx-grid-header'));
1200+
const headerOfTypeNumber = gridheaders.find(gh => gh.nativeElement.classList.contains('igx-grid__th--number'));
1201+
const filterUiContainer = headerOfTypeNumber.query(By.css(FILTER_UI_CONTAINER));
1202+
const filterIcon = filterUiContainer.query(By.css('igx-icon'));
1203+
const gridFilteringToggle = filterUiContainer.query(By.css('.igx-filtering__toggle'));
1204+
const input = filterUiContainer.query(By.directive(IgxInputDirective));
1205+
1206+
fix.whenStable().then(() => {
1207+
filterIcon.nativeElement.click();
1208+
return fix.whenStable();
1209+
}).then(() => {
1210+
fix.detectChanges();
1211+
sendInput(input, 0, fix);
1212+
return fix.whenStable();
1213+
}).then(() => {
1214+
expect(gridFilteringToggle.nativeElement.classList.contains('igx-filtering__toggle--active')).toBeTruthy();
1215+
return fix.whenStable();
1216+
}).then(() => {
1217+
fix.detectChanges();
1218+
grid.nativeElement.click();
1219+
return fix.whenStable();
1220+
}).then(() => {
1221+
fix.detectChanges();
1222+
setTimeout(() => {
1223+
expect(gridFilteringToggle.nativeElement.classList.contains('igx-filtering__toggle--filtered')).toBeTruthy();
1224+
done();
1225+
}, 500);
1226+
});
1227+
}));
11931228
});
11941229

11951230
export class CustomFilter extends IgxFilteringOperand {

projects/igniteui-angular/src/lib/grid/grid-filtering.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ export class IgxGridFilterComponent implements IGridBus, OnInit, OnDestroy, DoCh
287287
this._value = expr.searchVal;
288288
this._filterCondition = expr.condition.name;
289289

290-
if (!this.unaryCondition && !this._value) {
290+
if (!this.unaryCondition && !this._value && this._value !== 0) {
291291
return false;
292292
}
293293
return true;

0 commit comments

Comments
 (0)