@@ -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' ;
1314
@@ -220,6 +221,26 @@ describe('Row Pinning #grid', () => {
220221 expect ( grid . getRowByIndex ( 0 ) . rowID ) . toBe ( fix . componentInstance . data [ 0 ] ) ;
221222 expect ( grid . getRowByIndex ( 1 ) . rowID ) . toBe ( fix . componentInstance . data [ 1 ] ) ;
222223 } ) ;
224+
225+ it ( 'should apply sorting to both pinned and unpinned rows.' , ( ) => {
226+ grid . getRowByIndex ( 1 ) . pin ( ) ;
227+ grid . getRowByIndex ( 5 ) . pin ( ) ;
228+ fix . detectChanges ( ) ;
229+
230+ expect ( grid . getRowByIndex ( 0 ) . rowID ) . toBe ( fix . componentInstance . data [ 1 ] ) ;
231+ expect ( grid . getRowByIndex ( 1 ) . rowID ) . toBe ( fix . componentInstance . data [ 5 ] ) ;
232+
233+ grid . sort ( { fieldName : 'ID' , dir : SortingDirection . Desc , ignoreCase : false } ) ;
234+ fix . detectChanges ( ) ;
235+
236+ // check pinned rows data is sorted
237+ expect ( grid . getRowByIndex ( 0 ) . rowID ) . toBe ( fix . componentInstance . data [ 5 ] ) ;
238+ expect ( grid . getRowByIndex ( 1 ) . rowID ) . toBe ( fix . componentInstance . data [ 1 ] ) ;
239+
240+ // check unpinned rows data is sorted
241+ const lastIndex = fix . componentInstance . data . length - 1 ;
242+ expect ( grid . getRowByIndex ( 2 ) . rowID ) . toBe ( fix . componentInstance . data [ lastIndex ] ) ;
243+ } ) ;
223244 } ) ;
224245
225246 describe ( ' Editing ' , ( ) => {
0 commit comments