@@ -9,6 +9,7 @@ import { ColumnPinningPosition, RowPinningPosition } from '../common/enums';
9
9
import { IPinningConfig } from '../common/grid.interface' ;
10
10
import { SampleTestData } from '../../test-utils/sample-test-data.spec' ;
11
11
import { GridFunctions } from '../../test-utils/grid-functions.spec' ;
12
+ import { SortingDirection } from '../../data-operations/sorting-expression.interface' ;
12
13
import { IgxGridTransaction } from '../tree-grid' ;
13
14
import { IgxTransactionService } from '../../services' ;
14
15
@@ -222,6 +223,26 @@ describe('Row Pinning #grid', () => {
222
223
expect ( grid . getRowByIndex ( 0 ) . rowID ) . toBe ( fix . componentInstance . data [ 0 ] ) ;
223
224
expect ( grid . getRowByIndex ( 1 ) . rowID ) . toBe ( fix . componentInstance . data [ 1 ] ) ;
224
225
} ) ;
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
+ } ) ;
225
246
} ) ;
226
247
describe ( 'Row pinning with Master Detail View' , ( ) => {
227
248
beforeEach ( fakeAsync ( ( ) => {
0 commit comments