11import { async , TestBed , fakeAsync } from '@angular/core/testing' ;
2- import { By } from '@angular/platform-browser' ;
32import { SortingDirection } from '../../data-operations/sorting-expression.interface' ;
43import { IgxGridComponent } from './grid.component' ;
54import { IgxGridModule } from './index' ;
65import { DefaultSortingStrategy , NoopSortingStrategy } from '../../data-operations/sorting-strategy' ;
76import { IgxGridCellComponent } from '../cell.component' ;
87import { configureTestSuite } from '../../test-utils/configure-suite' ;
9- import { IgxGridFilteringRowComponent } from '../filtering/base/grid-filtering-row.component' ;
10- import { IgxChipComponent } from '../../chips/chip.component' ;
118import { NoopAnimationsModule } from '@angular/platform-browser/animations' ;
129import { GridFunctions } from '../../test-utils/grid-functions.spec' ;
1310import { GridDeclaredColumnsComponent , SortByParityComponent } from '../../test-utils/grid-samples.spec' ;
14- import { ControlsFunction } from '../../test-utils/controls-functions.spec' ;
1511import { UIInteractions } from '../../test-utils/ui-interactions.spec' ;
1612
1713const SORTING_ICON_ASC_CONTENT = 'arrow_upward' ;
1814const 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-
2716describe ( '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