Skip to content

Commit 0647785

Browse files
authored
Merge branch 'master' into sstoychev/ref-int-tests
2 parents d1697f9 + 50d0b08 commit 0647785

File tree

1 file changed

+16
-25
lines changed

1 file changed

+16
-25
lines changed

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

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,18 @@
11
import { async, TestBed, fakeAsync } from '@angular/core/testing';
2-
import { By } from '@angular/platform-browser';
32
import { SortingDirection } from '../../data-operations/sorting-expression.interface';
43
import { IgxGridComponent } from './grid.component';
54
import { IgxGridModule } from './index';
65
import { DefaultSortingStrategy, NoopSortingStrategy } from '../../data-operations/sorting-strategy';
76
import { IgxGridCellComponent } from '../cell.component';
87
import { configureTestSuite } from '../../test-utils/configure-suite';
9-
import { IgxGridFilteringRowComponent } from '../filtering/base/grid-filtering-row.component';
10-
import { IgxChipComponent } from '../../chips/chip.component';
118
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
129
import { GridFunctions } from '../../test-utils/grid-functions.spec';
1310
import { GridDeclaredColumnsComponent, SortByParityComponent } from '../../test-utils/grid-samples.spec';
14-
import { ControlsFunction } from '../../test-utils/controls-functions.spec';
1511
import { UIInteractions } from '../../test-utils/ui-interactions.spec';
1612

1713
const SORTING_ICON_ASC_CONTENT = 'arrow_upward';
1814
const SORTING_ICON_DESC_CONTENT = 'arrow_downward';
1915

20-
21-
function getCurrentCellFromGrid(grid, rowIndex, cellIndex) {
22-
const gridRow = grid.rowList.toArray()[rowIndex];
23-
const gridCell = gridRow.cells.toArray()[cellIndex];
24-
return gridCell;
25-
}
26-
2716
describe('IgxGrid - Grid Sorting #grid', () => {
2817

2918
configureTestSuite();
@@ -251,13 +240,13 @@ describe('IgxGrid - Grid Sorting #grid', () => {
251240
GridFunctions.clickHeaderSortIcon(firstHeaderCell);
252241
fixture.detectChanges();
253242

254-
const firstRowFirstCell = getCurrentCellFromGrid(grid, 0, 0);
255-
const firstRowSecondCell = getCurrentCellFromGrid(grid, 0, 1);
243+
const firstRowFirstCell = GridFunctions.getCurrentCellFromGrid(grid, 0, 0);
244+
const firstRowSecondCell = GridFunctions.getCurrentCellFromGrid(grid, 0, 1);
256245
expect(GridFunctions.getValueFromCellElement(firstRowSecondCell)).toEqual('Brad');
257246
expect(GridFunctions.getValueFromCellElement(firstRowFirstCell)).toEqual('1');
258247

259-
const lastRowFirstCell = getCurrentCellFromGrid(grid, grid.data.length - 1, 0);
260-
const lastRowSecondCell = getCurrentCellFromGrid(grid, grid.data.length - 1, 1);
248+
const lastRowFirstCell = GridFunctions.getCurrentCellFromGrid(grid, grid.data.length - 1, 0);
249+
const lastRowSecondCell = GridFunctions.getCurrentCellFromGrid(grid, grid.data.length - 1, 1);
261250
expect(GridFunctions.getValueFromCellElement(lastRowFirstCell)).toEqual('7');
262251
expect(GridFunctions.getValueFromCellElement(lastRowSecondCell)).toEqual('Rick');
263252
});
@@ -270,13 +259,13 @@ describe('IgxGrid - Grid Sorting #grid', () => {
270259
GridFunctions.clickHeaderSortIcon(firstHeaderCell);
271260
fixture.detectChanges();
272261

273-
const firstRowFirstCell = getCurrentCellFromGrid(grid, 0, 0);
274-
const firstRowSecondCell = getCurrentCellFromGrid(grid, 0, 1);
262+
const firstRowFirstCell = GridFunctions.getCurrentCellFromGrid(grid, 0, 0);
263+
const firstRowSecondCell = GridFunctions.getCurrentCellFromGrid(grid, 0, 1);
275264
expect(GridFunctions.getValueFromCellElement(firstRowFirstCell)).toEqual('7');
276265
expect(GridFunctions.getValueFromCellElement(firstRowSecondCell)).toEqual('Rick');
277266

278-
const lastRowFirstCell = getCurrentCellFromGrid(grid, grid.data.length - 1, 0);
279-
const lastRowSecondCell = getCurrentCellFromGrid(grid, grid.data.length - 1, 1);
267+
const lastRowFirstCell = GridFunctions.getCurrentCellFromGrid(grid, grid.data.length - 1, 0);
268+
const lastRowSecondCell = GridFunctions.getCurrentCellFromGrid(grid, grid.data.length - 1, 1);
280269
expect(GridFunctions.getValueFromCellElement(lastRowFirstCell)).toEqual('1');
281270
expect(GridFunctions.getValueFromCellElement(lastRowSecondCell)).toEqual('Brad');
282271
});
@@ -291,10 +280,10 @@ describe('IgxGrid - Grid Sorting #grid', () => {
291280
GridFunctions.clickHeaderSortIcon(firstHeaderCell);
292281
fixture.detectChanges();
293282

294-
const firstRowSecondCell = getCurrentCellFromGrid(grid, 0, 1);
283+
const firstRowSecondCell = GridFunctions.getCurrentCellFromGrid(grid, 0, 1);
295284
expect(GridFunctions.getValueFromCellElement(firstRowSecondCell)).toEqual('Jane');
296285

297-
const lastRowSecondCell = getCurrentCellFromGrid(grid, grid.data.length - 1, 1);
286+
const lastRowSecondCell = GridFunctions.getCurrentCellFromGrid(grid, grid.data.length - 1, 1);
298287
expect(GridFunctions.getValueFromCellElement(lastRowSecondCell)).toEqual('Connor');
299288

300289
});
@@ -357,15 +346,17 @@ describe('IgxGrid - Grid Sorting #grid', () => {
357346
fixture.detectChanges();
358347

359348
// Verify that the grid is NOT sorted.
360-
expect(GridFunctions.getValueFromCellElement(getCurrentCellFromGrid(grid, 0, 1))).toEqual('Jane');
361-
expect(GridFunctions.getValueFromCellElement(getCurrentCellFromGrid(grid, grid.data.length - 1, 1))).toEqual('Connor');
349+
expect(GridFunctions.getValueFromCellElement(GridFunctions.getCurrentCellFromGrid(grid, 0, 1))).toEqual('Jane');
350+
// tslint:disable-next-line: max-line-length
351+
expect(GridFunctions.getValueFromCellElement(GridFunctions.getCurrentCellFromGrid(grid, grid.data.length - 1, 1))).toEqual('Connor');
362352

363353
GridFunctions.clickHeaderSortIcon(firstHeaderCell);
364354
fixture.detectChanges();
365355

366356
// Verify that the grid is NOT sorted.
367-
expect(GridFunctions.getValueFromCellElement(getCurrentCellFromGrid(grid, 0, 1))).toEqual('Jane');
368-
expect(GridFunctions.getValueFromCellElement(getCurrentCellFromGrid(grid, grid.data.length - 1, 1))).toEqual('Connor');
357+
expect(GridFunctions.getValueFromCellElement(GridFunctions.getCurrentCellFromGrid(grid, 0, 1))).toEqual('Jane');
358+
// tslint:disable-next-line: max-line-length
359+
expect(GridFunctions.getValueFromCellElement(GridFunctions.getCurrentCellFromGrid(grid, grid.data.length - 1, 1))).toEqual('Connor');
369360
});
370361
});
371362
});

0 commit comments

Comments
 (0)