@@ -19,6 +19,8 @@ import { GridFunctions, GridSelectionFunctions } from '../../test-utils/grid-fun
19
19
import { SampleTestData } from '../../test-utils/sample-test-data.spec' ;
20
20
import { GridSelectionMode } from '../common/enums' ;
21
21
import { IgxGridSelectionModule } from '../selection/selection.module' ;
22
+ import { FilteringExpressionsTree } from '../../data-operations/filtering-expressions-tree' ;
23
+ import { FilteringLogic } from '../../data-operations/filtering-expression.interface' ;
22
24
23
25
const DEBOUNCETIME = 30 ;
24
26
@@ -1671,6 +1673,38 @@ describe('IgxGrid - Row Selection #grid', () => {
1671
1673
expect ( grid . getRowByIndex ( 1 ) . selected ) . toBeTruthy ( ) ;
1672
1674
expect ( grid . onRowSelectionChange . emit ) . toHaveBeenCalledTimes ( 6 ) ;
1673
1675
} ) ) ;
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
+ } ) ) ;
1674
1708
} ) ;
1675
1709
1676
1710
describe ( 'Integration with CRUD and transactions' , ( ) => {
0 commit comments