Skip to content

Commit 7746411

Browse files
committed
test(adv-filtering): operator line enter #5496
1 parent 5723015 commit 7746411

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

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

+43
Original file line numberDiff line numberDiff line change
@@ -2357,6 +2357,49 @@ describe('IgxGrid - Advanced Filtering', () => {
23572357
expect(GridFunctions.getAdvancedFilteringTreeChildItems(rootGroup, false).length).toBe(1);
23582358
expect(GridFunctions.getAdvancedFilteringTreeChildExpressions(rootGroup, true).length).toBe(1);
23592359
}));
2360+
2361+
it('Should select/deselect all child conditions and groups when pressing \'Enter\' on a group\'s operator line.',
2362+
fakeAsync(() => {
2363+
// Apply advanced filter through API.
2364+
const tree = new FilteringExpressionsTree(FilteringLogic.And);
2365+
tree.filteringOperands.push({
2366+
fieldName: 'Downloads', searchVal: 100, condition: IgxNumberFilteringOperand.instance().condition('greaterThan')
2367+
});
2368+
const orTree = new FilteringExpressionsTree(FilteringLogic.Or);
2369+
orTree.filteringOperands.push({
2370+
fieldName: 'ProductName', searchVal: 'angular', condition: IgxStringFilteringOperand.instance().condition('contains'),
2371+
ignoreCase: true
2372+
});
2373+
orTree.filteringOperands.push({
2374+
fieldName: 'ProductName', searchVal: 'script', condition: IgxStringFilteringOperand.instance().condition('contains'),
2375+
ignoreCase: true
2376+
});
2377+
tree.filteringOperands.push(orTree);
2378+
grid.advancedFilteringExpressionsTree = tree;
2379+
fix.detectChanges();
2380+
2381+
// Open Advanced Filtering dialog.
2382+
GridFunctions.clickAdvancedFilteringButton(fix);
2383+
fix.detectChanges();
2384+
2385+
// Press 'Enter' on the root group's operator line
2386+
// and verify that the root group and all of its children become selected.
2387+
let rootOperatorLine = GridFunctions.getAdvancedFilteringTreeRootGroupOperatorLine(fix);
2388+
UIInteractions.simulateKeyDownEvent(rootOperatorLine, 'Enter');
2389+
tick(200);
2390+
fix.detectChanges();
2391+
verifyChildrenSelection(GridFunctions.getAdvancedFilteringExpressionsContainer(fix), true);
2392+
verifyContextMenuVisibility(fix, true);
2393+
2394+
// Press 'Enter' on the root group's operator line again
2395+
// and verify that the root group and all of its children become unselected.
2396+
rootOperatorLine = GridFunctions.getAdvancedFilteringTreeRootGroupOperatorLine(fix);
2397+
UIInteractions.simulateKeyDownEvent(rootOperatorLine, 'Enter');
2398+
tick(200);
2399+
fix.detectChanges();
2400+
verifyChildrenSelection(GridFunctions.getAdvancedFilteringExpressionsContainer(fix), false);
2401+
verifyContextMenuVisibility(fix, false);
2402+
}));
23602403
});
23612404

23622405
describe('Localization', () => {

0 commit comments

Comments
 (0)