@@ -17,13 +17,6 @@ import { UIInteractions } from '../../test-utils/ui-interactions.spec';
1717const SORTING_ICON_ASC_CONTENT = 'arrow_upward' ;
1818const SORTING_ICON_DESC_CONTENT = 'arrow_downward' ;
1919
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-
2720describe ( 'IgxGrid - Grid Sorting #grid' , ( ) => {
2821
2922 configureTestSuite ( ) ;
@@ -251,13 +244,13 @@ describe('IgxGrid - Grid Sorting #grid', () => {
251244 GridFunctions . clickHeaderSortIcon ( firstHeaderCell ) ;
252245 fixture . detectChanges ( ) ;
253246
254- const firstRowFirstCell = getCurrentCellFromGrid ( grid , 0 , 0 ) ;
255- const firstRowSecondCell = getCurrentCellFromGrid ( grid , 0 , 1 ) ;
247+ const firstRowFirstCell = GridFunctions . getCurrentCellFromGrid ( grid , 0 , 0 ) ;
248+ const firstRowSecondCell = GridFunctions . getCurrentCellFromGrid ( grid , 0 , 1 ) ;
256249 expect ( GridFunctions . getValueFromCellElement ( firstRowSecondCell ) ) . toEqual ( 'Brad' ) ;
257250 expect ( GridFunctions . getValueFromCellElement ( firstRowFirstCell ) ) . toEqual ( '1' ) ;
258251
259- const lastRowFirstCell = getCurrentCellFromGrid ( grid , grid . data . length - 1 , 0 ) ;
260- const lastRowSecondCell = getCurrentCellFromGrid ( grid , grid . data . length - 1 , 1 ) ;
252+ const lastRowFirstCell = GridFunctions . getCurrentCellFromGrid ( grid , grid . data . length - 1 , 0 ) ;
253+ const lastRowSecondCell = GridFunctions . getCurrentCellFromGrid ( grid , grid . data . length - 1 , 1 ) ;
261254 expect ( GridFunctions . getValueFromCellElement ( lastRowFirstCell ) ) . toEqual ( '7' ) ;
262255 expect ( GridFunctions . getValueFromCellElement ( lastRowSecondCell ) ) . toEqual ( 'Rick' ) ;
263256 } ) ;
@@ -270,13 +263,13 @@ describe('IgxGrid - Grid Sorting #grid', () => {
270263 GridFunctions . clickHeaderSortIcon ( firstHeaderCell ) ;
271264 fixture . detectChanges ( ) ;
272265
273- const firstRowFirstCell = getCurrentCellFromGrid ( grid , 0 , 0 ) ;
274- const firstRowSecondCell = getCurrentCellFromGrid ( grid , 0 , 1 ) ;
266+ const firstRowFirstCell = GridFunctions . getCurrentCellFromGrid ( grid , 0 , 0 ) ;
267+ const firstRowSecondCell = GridFunctions . getCurrentCellFromGrid ( grid , 0 , 1 ) ;
275268 expect ( GridFunctions . getValueFromCellElement ( firstRowFirstCell ) ) . toEqual ( '7' ) ;
276269 expect ( GridFunctions . getValueFromCellElement ( firstRowSecondCell ) ) . toEqual ( 'Rick' ) ;
277270
278- const lastRowFirstCell = getCurrentCellFromGrid ( grid , grid . data . length - 1 , 0 ) ;
279- const lastRowSecondCell = getCurrentCellFromGrid ( grid , grid . data . length - 1 , 1 ) ;
271+ const lastRowFirstCell = GridFunctions . getCurrentCellFromGrid ( grid , grid . data . length - 1 , 0 ) ;
272+ const lastRowSecondCell = GridFunctions . getCurrentCellFromGrid ( grid , grid . data . length - 1 , 1 ) ;
280273 expect ( GridFunctions . getValueFromCellElement ( lastRowFirstCell ) ) . toEqual ( '1' ) ;
281274 expect ( GridFunctions . getValueFromCellElement ( lastRowSecondCell ) ) . toEqual ( 'Brad' ) ;
282275 } ) ;
@@ -291,10 +284,10 @@ describe('IgxGrid - Grid Sorting #grid', () => {
291284 GridFunctions . clickHeaderSortIcon ( firstHeaderCell ) ;
292285 fixture . detectChanges ( ) ;
293286
294- const firstRowSecondCell = getCurrentCellFromGrid ( grid , 0 , 1 ) ;
287+ const firstRowSecondCell = GridFunctions . getCurrentCellFromGrid ( grid , 0 , 1 ) ;
295288 expect ( GridFunctions . getValueFromCellElement ( firstRowSecondCell ) ) . toEqual ( 'Jane' ) ;
296289
297- const lastRowSecondCell = getCurrentCellFromGrid ( grid , grid . data . length - 1 , 1 ) ;
290+ const lastRowSecondCell = GridFunctions . getCurrentCellFromGrid ( grid , grid . data . length - 1 , 1 ) ;
298291 expect ( GridFunctions . getValueFromCellElement ( lastRowSecondCell ) ) . toEqual ( 'Connor' ) ;
299292
300293 } ) ;
@@ -357,15 +350,17 @@ describe('IgxGrid - Grid Sorting #grid', () => {
357350 fixture . detectChanges ( ) ;
358351
359352 // 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' ) ;
353+ expect ( GridFunctions . getValueFromCellElement ( GridFunctions . getCurrentCellFromGrid ( grid , 0 , 1 ) ) ) . toEqual ( 'Jane' ) ;
354+ // tslint:disable-next-line: max-line-length
355+ expect ( GridFunctions . getValueFromCellElement ( GridFunctions . getCurrentCellFromGrid ( grid , grid . data . length - 1 , 1 ) ) ) . toEqual ( 'Connor' ) ;
362356
363357 GridFunctions . clickHeaderSortIcon ( firstHeaderCell ) ;
364358 fixture . detectChanges ( ) ;
365359
366360 // 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' ) ;
361+ expect ( GridFunctions . getValueFromCellElement ( GridFunctions . getCurrentCellFromGrid ( grid , 0 , 1 ) ) ) . toEqual ( 'Jane' ) ;
362+ // tslint:disable-next-line: max-line-length
363+ expect ( GridFunctions . getValueFromCellElement ( GridFunctions . getCurrentCellFromGrid ( grid , grid . data . length - 1 , 1 ) ) ) . toEqual ( 'Connor' ) ;
369364 } ) ;
370365 } ) ;
371366} ) ;
0 commit comments