@@ -8,6 +8,7 @@ import { configureTestSuite } from '../../test-utils/configure-suite';
8
8
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
+ import { SortingDirection } from '../../data-operations/sorting-expression.interface' ;
11
12
12
13
describe ( 'Row Pinning #grid' , ( ) => {
13
14
const FIXED_ROW_CONTAINER = '.igx-grid__tr--pinned ' ;
@@ -216,6 +217,26 @@ describe('Row Pinning #grid', () => {
216
217
expect ( grid . getRowByIndex ( 0 ) . rowID ) . toBe ( fix . componentInstance . data [ 0 ] ) ;
217
218
expect ( grid . getRowByIndex ( 1 ) . rowID ) . toBe ( fix . componentInstance . data [ 1 ] ) ;
218
219
} ) ;
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
+ } ) ;
219
240
} ) ;
220
241
} ) ;
221
242
0 commit comments