@@ -9,6 +9,7 @@ import { ColumnPinningPosition, RowPinningPosition } from '../common/enums';
99import { IPinningConfig } from '../common/grid.interface' ;
1010import { SampleTestData } from '../../test-utils/sample-test-data.spec' ;
1111import { GridFunctions } from '../../test-utils/grid-functions.spec' ;
12+ import { SortingDirection } from '../../data-operations/sorting-expression.interface' ;
1213import { IgxGridTransaction } from '../tree-grid' ;
1314import { IgxTransactionService } from '../../services' ;
1415
@@ -222,6 +223,26 @@ describe('Row Pinning #grid', () => {
222223 expect ( grid . getRowByIndex ( 0 ) . rowID ) . toBe ( fix . componentInstance . data [ 0 ] ) ;
223224 expect ( grid . getRowByIndex ( 1 ) . rowID ) . toBe ( fix . componentInstance . data [ 1 ] ) ;
224225 } ) ;
226+
227+ it ( 'should apply sorting to both pinned and unpinned rows.' , ( ) => {
228+ grid . getRowByIndex ( 1 ) . pin ( ) ;
229+ grid . getRowByIndex ( 5 ) . pin ( ) ;
230+ fix . detectChanges ( ) ;
231+
232+ expect ( grid . getRowByIndex ( 0 ) . rowID ) . toBe ( fix . componentInstance . data [ 1 ] ) ;
233+ expect ( grid . getRowByIndex ( 1 ) . rowID ) . toBe ( fix . componentInstance . data [ 5 ] ) ;
234+
235+ grid . sort ( { fieldName : 'ID' , dir : SortingDirection . Desc , ignoreCase : false } ) ;
236+ fix . detectChanges ( ) ;
237+
238+ // check pinned rows data is sorted
239+ expect ( grid . getRowByIndex ( 0 ) . rowID ) . toBe ( fix . componentInstance . data [ 5 ] ) ;
240+ expect ( grid . getRowByIndex ( 1 ) . rowID ) . toBe ( fix . componentInstance . data [ 1 ] ) ;
241+
242+ // check unpinned rows data is sorted
243+ const lastIndex = fix . componentInstance . data . length - 1 ;
244+ expect ( grid . getRowByIndex ( 2 ) . rowID ) . toBe ( fix . componentInstance . data [ lastIndex ] ) ;
245+ } ) ;
225246 } ) ;
226247 describe ( 'Row pinning with Master Detail View' , ( ) => {
227248 beforeEach ( fakeAsync ( ( ) => {
0 commit comments