Skip to content

Commit ea3c0ee

Browse files
committed
Merge remote-tracking branch 'origin/master' into mdragnev/row-pinning-mdv
2 parents 9811af4 + 81ae277 commit ea3c0ee

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

projects/igniteui-angular/src/lib/grids/grid/row-pinning.spec.ts

+21
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { ColumnPinningPosition, RowPinningPosition } from '../common/enums';
99
import { IPinningConfig } from '../common/grid.interface';
1010
import { SampleTestData } from '../../test-utils/sample-test-data.spec';
1111
import { GridFunctions } from '../../test-utils/grid-functions.spec';
12+
import { SortingDirection } from '../../data-operations/sorting-expression.interface';
1213
import { IgxGridTransaction } from '../tree-grid';
1314
import { 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

Comments
 (0)