@@ -8,6 +8,7 @@ import { configureTestSuite } from '../../test-utils/configure-suite';
88import { ColumnPinningPosition , RowPinningPosition } from '../common/enums' ;
99import { IPinningConfig } from '../common/grid.interface' ;
1010import { SampleTestData } from '../../test-utils/sample-test-data.spec' ;
11+ import { SortingDirection } from '../../data-operations/sorting-expression.interface' ;
1112import { IgxGridTransaction } from '../tree-grid' ;
1213import { IgxTransactionService } from '../../services' ;
1314import { IgxStringFilteringOperand } from '../../data-operations/filtering-condition' ;
@@ -283,6 +284,26 @@ describe('Row Pinning #grid', () => {
283284 expect ( gridFilterData [ 0 ] . ID ) . toBe ( 'BLAUS' ) ;
284285 expect ( gridFilterData [ 1 ] . ID ) . toBe ( 'BERGS' ) ;
285286 } ) ;
287+
288+ it ( 'should apply sorting to both pinned and unpinned rows.' , ( ) => {
289+ grid . getRowByIndex ( 1 ) . pin ( ) ;
290+ grid . getRowByIndex ( 5 ) . pin ( ) ;
291+ fix . detectChanges ( ) ;
292+
293+ expect ( grid . getRowByIndex ( 0 ) . rowID ) . toBe ( fix . componentInstance . data [ 1 ] ) ;
294+ expect ( grid . getRowByIndex ( 1 ) . rowID ) . toBe ( fix . componentInstance . data [ 5 ] ) ;
295+
296+ grid . sort ( { fieldName : 'ID' , dir : SortingDirection . Desc , ignoreCase : false } ) ;
297+ fix . detectChanges ( ) ;
298+
299+ // check pinned rows data is sorted
300+ expect ( grid . getRowByIndex ( 0 ) . rowID ) . toBe ( fix . componentInstance . data [ 5 ] ) ;
301+ expect ( grid . getRowByIndex ( 1 ) . rowID ) . toBe ( fix . componentInstance . data [ 1 ] ) ;
302+
303+ // check unpinned rows data is sorted
304+ const lastIndex = fix . componentInstance . data . length - 1 ;
305+ expect ( grid . getRowByIndex ( 2 ) . rowID ) . toBe ( fix . componentInstance . data [ lastIndex ] ) ;
306+ } ) ;
286307 } ) ;
287308
288309 describe ( ' Editing ' , ( ) => {
0 commit comments