@@ -19,6 +19,8 @@ import { GridFunctions, GridSelectionFunctions } from '../../test-utils/grid-fun
1919import { SampleTestData } from '../../test-utils/sample-test-data.spec' ;
2020import { GridSelectionMode } from '../common/enums' ;
2121import { IgxRowSelectorsModule } from '../igx-row-selectors.module' ;
22+ import { FilteringExpressionsTree } from '../../data-operations/filtering-expressions-tree' ;
23+ import { FilteringLogic } from '../../data-operations/filtering-expression.interface' ;
2224
2325const DEBOUNCETIME = 30 ;
2426
@@ -1671,6 +1673,40 @@ describe('IgxGrid - Row Selection #grid', () => {
16711673 expect ( grid . getRowByIndex ( 1 ) . selected ) . toBeTruthy ( ) ;
16721674 expect ( grid . onRowSelectionChange . emit ) . toHaveBeenCalledTimes ( 6 ) ;
16731675 } ) ) ;
1676+
1677+ fit ( 'Should select only filtered records' , async ( ) => {
1678+ grid . height = '1100px' ;
1679+ const tree = new FilteringExpressionsTree ( FilteringLogic . And ) ;
1680+ tree . filteringOperands . push ( {
1681+ fieldName : 'UnitsInStock' ,
1682+ searchVal : 0 ,
1683+ condition : IgxNumberFilteringOperand . instance ( ) . condition ( 'greaterThan' ) ,
1684+ } ) ;
1685+ tree . filteringOperands . push ( {
1686+ fieldName : 'ProductName' ,
1687+ searchVal : 'a' ,
1688+ condition : IgxStringFilteringOperand . instance ( ) . condition ( 'contains' ) ,
1689+ ignoreCase : true
1690+ } ) ;
1691+ grid . advancedFilteringExpressionsTree = tree ;
1692+ GridSelectionFunctions . headerCheckboxClick ( grid ) ;
1693+ fix . detectChanges ( ) ;
1694+ grid . cdr . detectChanges ( ) ;
1695+ await wait ( ) ;
1696+
1697+ expect ( grid . rowList . length ) . toBe ( 9 ) ;
1698+ expect ( grid . selectedRows ( ) . length ) . toBe ( 9 ) ;
1699+ GridSelectionFunctions . verifyHeaderRowCheckboxState ( grid , true , false ) ;
1700+
1701+ grid . advancedFilteringExpressionsTree = null ;
1702+ fix . detectChanges ( ) ;
1703+ grid . cdr . detectChanges ( ) ;
1704+ await wait ( ) ;
1705+
1706+ expect ( grid . rowList . length ) . toBe ( 19 ) ;
1707+ expect ( grid . selectedRows ( ) . length ) . toBe ( 9 ) ;
1708+ GridSelectionFunctions . verifyHeaderRowCheckboxState ( grid , false , true ) ;
1709+ } ) ;
16741710 } ) ;
16751711
16761712 describe ( 'Integration with CRUD and transactions' , ( ) => {
0 commit comments