@@ -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' ;
1112
1213describe ( 'Row Pinning #grid' , ( ) => {
1314 const FIXED_ROW_CONTAINER = '.igx-grid__tr--pinned ' ;
@@ -216,6 +217,26 @@ describe('Row Pinning #grid', () => {
216217 expect ( grid . getRowByIndex ( 0 ) . rowID ) . toBe ( fix . componentInstance . data [ 0 ] ) ;
217218 expect ( grid . getRowByIndex ( 1 ) . rowID ) . toBe ( fix . componentInstance . data [ 1 ] ) ;
218219 } ) ;
220+
221+ it ( 'should apply sorting to both pinned and unpinned rows.' , ( ) => {
222+ grid . getRowByIndex ( 1 ) . pin ( ) ;
223+ grid . getRowByIndex ( 5 ) . pin ( ) ;
224+ fix . detectChanges ( ) ;
225+
226+ expect ( grid . getRowByIndex ( 0 ) . rowID ) . toBe ( fix . componentInstance . data [ 1 ] ) ;
227+ expect ( grid . getRowByIndex ( 1 ) . rowID ) . toBe ( fix . componentInstance . data [ 5 ] ) ;
228+
229+ grid . sort ( { fieldName : 'ID' , dir : SortingDirection . Desc , ignoreCase : false } ) ;
230+ fix . detectChanges ( ) ;
231+
232+ // check pinned rows data is sorted
233+ expect ( grid . getRowByIndex ( 0 ) . rowID ) . toBe ( fix . componentInstance . data [ 5 ] ) ;
234+ expect ( grid . getRowByIndex ( 1 ) . rowID ) . toBe ( fix . componentInstance . data [ 1 ] ) ;
235+
236+ // check unpinned rows data is sorted
237+ const lastIndex = fix . componentInstance . data . length - 1 ;
238+ expect ( grid . getRowByIndex ( 2 ) . rowID ) . toBe ( fix . componentInstance . data [ lastIndex ] ) ;
239+ } ) ;
219240 } ) ;
220241} ) ;
221242
0 commit comments