Skip to content

Commit 5868239

Browse files
astaevgedinakovarkaraivanov
authored
fix(filtering): Refine element class list search and add test #9333 (#9387)
* fix(filtering): Refine element class list search and add test Co-authored-by: Galina Edinakova <[email protected]> Co-authored-by: Radoslav Karaivanov <[email protected]>
1 parent 4147b7a commit 5868239

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ export class IgxGridFilteringRowComponent implements AfterViewInit {
465465
requestAnimationFrame(() => {
466466
const focusedElement = document.activeElement;
467467

468-
if (focusedElement.className === 'igx-chip__remove' || focusedElement.tagName === 'IGX-DAY-ITEM') {
468+
if (focusedElement.classList.contains('igx-chip__remove') || focusedElement.tagName === 'IGX-DAY-ITEM') {
469469
return;
470470
}
471471

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ import { ControlsFunction } from '../../test-utils/controls-functions.spec';
5050
import localeFR from '@angular/common/locales/fr';
5151
import { FormattedValuesFilteringStrategy } from '../../data-operations/filtering-strategy';
5252
import { IgxCalendarComponent } from '../../calendar/calendar.component';
53+
import { IgxInputGroupComponent } from '../../input-group/public_api';
5354

5455
const DEBOUNCETIME = 30;
5556
const FILTER_UI_ROW = 'igx-grid-filtering-row';
@@ -2181,6 +2182,28 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
21812182
const rows = GridFunctions.getRows(fix);
21822183
expect(rows.length).toEqual(2);
21832184
}));
2185+
2186+
it('Should remove pending chip via its close button #9333', fakeAsync(() => {
2187+
GridFunctions.clickFilterCellChipUI(fix, 'Downloads');
2188+
fix.detectChanges();
2189+
2190+
GridFunctions.typeValueInFilterRowInput('3', fix);
2191+
tick(DEBOUNCETIME);
2192+
const inputGroup = fix.debugElement.query(By.directive(IgxInputGroupComponent));
2193+
const filterRow = fix.debugElement.query(By.directive(IgxGridFilteringRowComponent));
2194+
const pendingChip = filterRow.queryAll(By.directive(IgxChipComponent))[0];
2195+
const chipCloseButton = pendingChip.query(By.css('div.igx-chip__remove')).nativeElement;
2196+
2197+
chipCloseButton.dispatchEvent(new Event('mousedown'));
2198+
inputGroup.nativeElement.dispatchEvent(new Event('focusout'));
2199+
chipCloseButton.dispatchEvent(new Event('mouseup'));
2200+
chipCloseButton.dispatchEvent(new Event('click'));
2201+
tick(DEBOUNCETIME);
2202+
fix.detectChanges();
2203+
2204+
const chips = filterRow.queryAll(By.directive(IgxChipComponent));
2205+
expect(chips.length).toEqual(0, 'No chips should be present');
2206+
}));
21842207
});
21852208

21862209
describe('Integration scenarios', () => {

0 commit comments

Comments
 (0)