@@ -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,38 @@ describe('IgxGrid - Row Selection #grid', () => {
16711673 expect ( grid . getRowByIndex ( 1 ) . selected ) . toBeTruthy ( ) ;
16721674 expect ( grid . onRowSelectionChange . emit ) . toHaveBeenCalledTimes ( 6 ) ;
16731675 } ) ) ;
1676+
1677+ it ( 'Should select only filtered records' , fakeAsync ( ( ) => {
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+ tick ( ) ;
1695+
1696+ expect ( grid . rowList . length ) . toBe ( 9 ) ;
1697+ expect ( grid . selectedRows ( ) . length ) . toBe ( 9 ) ;
1698+ GridSelectionFunctions . verifyHeaderRowCheckboxState ( grid , true , false ) ;
1699+
1700+ grid . advancedFilteringExpressionsTree = null ;
1701+ fix . detectChanges ( ) ;
1702+ tick ( ) ;
1703+
1704+ expect ( grid . rowList . length ) . toBe ( 19 ) ;
1705+ expect ( grid . selectedRows ( ) . length ) . toBe ( 9 ) ;
1706+ GridSelectionFunctions . verifyHeaderRowCheckboxState ( grid , false , true ) ;
1707+ } ) ) ;
16741708 } ) ;
16751709
16761710 describe ( 'Integration with CRUD and transactions' , ( ) => {
0 commit comments