@@ -13,13 +13,6 @@ import { UIInteractions } from '../../test-utils/ui-interactions.spec';
1313const SORTING_ICON_ASC_CONTENT = 'arrow_upward' ;
1414const SORTING_ICON_DESC_CONTENT = 'arrow_downward' ;
1515
16-
17- function getCurrentCellFromGrid ( grid , rowIndex , cellIndex ) {
18- const gridRow = grid . rowList . toArray ( ) [ rowIndex ] ;
19- const gridCell = gridRow . cells . toArray ( ) [ cellIndex ] ;
20- return gridCell ;
21- }
22-
2316describe ( 'IgxGrid - Grid Sorting #grid' , ( ) => {
2417
2518 configureTestSuite ( ) ;
@@ -246,13 +239,13 @@ describe('IgxGrid - Grid Sorting #grid', () => {
246239 GridFunctions . clickColumnHeaderUI ( 'ID' , fixture ) ;
247240 fixture . detectChanges ( ) ;
248241
249- const firstRowFirstCell = getCurrentCellFromGrid ( grid , 0 , 0 ) ;
250- const firstRowSecondCell = getCurrentCellFromGrid ( grid , 0 , 1 ) ;
242+ const firstRowFirstCell = GridFunctions . getCurrentCellFromGrid ( grid , 0 , 0 ) ;
243+ const firstRowSecondCell = GridFunctions . getCurrentCellFromGrid ( grid , 0 , 1 ) ;
251244 expect ( GridFunctions . getValueFromCellElement ( firstRowSecondCell ) ) . toEqual ( 'Brad' ) ;
252245 expect ( GridFunctions . getValueFromCellElement ( firstRowFirstCell ) ) . toEqual ( '1' ) ;
253246
254- const lastRowFirstCell = getCurrentCellFromGrid ( grid , grid . data . length - 1 , 0 ) ;
255- const lastRowSecondCell = getCurrentCellFromGrid ( grid , grid . data . length - 1 , 1 ) ;
247+ const lastRowFirstCell = GridFunctions . getCurrentCellFromGrid ( grid , grid . data . length - 1 , 0 ) ;
248+ const lastRowSecondCell = GridFunctions . getCurrentCellFromGrid ( grid , grid . data . length - 1 , 1 ) ;
256249 expect ( GridFunctions . getValueFromCellElement ( lastRowFirstCell ) ) . toEqual ( '7' ) ;
257250 expect ( GridFunctions . getValueFromCellElement ( lastRowSecondCell ) ) . toEqual ( 'Rick' ) ;
258251 } ) ;
@@ -264,13 +257,13 @@ describe('IgxGrid - Grid Sorting #grid', () => {
264257 GridFunctions . clickColumnHeaderUI ( 'ID' , fixture ) ;
265258 fixture . detectChanges ( ) ;
266259
267- const firstRowFirstCell = getCurrentCellFromGrid ( grid , 0 , 0 ) ;
268- const firstRowSecondCell = getCurrentCellFromGrid ( grid , 0 , 1 ) ;
260+ const firstRowFirstCell = GridFunctions . getCurrentCellFromGrid ( grid , 0 , 0 ) ;
261+ const firstRowSecondCell = GridFunctions . getCurrentCellFromGrid ( grid , 0 , 1 ) ;
269262 expect ( GridFunctions . getValueFromCellElement ( firstRowFirstCell ) ) . toEqual ( '7' ) ;
270263 expect ( GridFunctions . getValueFromCellElement ( firstRowSecondCell ) ) . toEqual ( 'Rick' ) ;
271264
272- const lastRowFirstCell = getCurrentCellFromGrid ( grid , grid . data . length - 1 , 0 ) ;
273- const lastRowSecondCell = getCurrentCellFromGrid ( grid , grid . data . length - 1 , 1 ) ;
265+ const lastRowFirstCell = GridFunctions . getCurrentCellFromGrid ( grid , grid . data . length - 1 , 0 ) ;
266+ const lastRowSecondCell = GridFunctions . getCurrentCellFromGrid ( grid , grid . data . length - 1 , 1 ) ;
274267 expect ( GridFunctions . getValueFromCellElement ( lastRowFirstCell ) ) . toEqual ( '1' ) ;
275268 expect ( GridFunctions . getValueFromCellElement ( lastRowSecondCell ) ) . toEqual ( 'Brad' ) ;
276269 } ) ;
@@ -284,10 +277,10 @@ describe('IgxGrid - Grid Sorting #grid', () => {
284277 GridFunctions . clickColumnHeaderUI ( 'ID' , fixture ) ;
285278 fixture . detectChanges ( ) ;
286279
287- const firstRowSecondCell = getCurrentCellFromGrid ( grid , 0 , 1 ) ;
280+ const firstRowSecondCell = GridFunctions . getCurrentCellFromGrid ( grid , 0 , 1 ) ;
288281 expect ( GridFunctions . getValueFromCellElement ( firstRowSecondCell ) ) . toEqual ( 'Jane' ) ;
289282
290- const lastRowSecondCell = getCurrentCellFromGrid ( grid , grid . data . length - 1 , 1 ) ;
283+ const lastRowSecondCell = GridFunctions . getCurrentCellFromGrid ( grid , grid . data . length - 1 , 1 ) ;
291284 expect ( GridFunctions . getValueFromCellElement ( lastRowSecondCell ) ) . toEqual ( 'Connor' ) ;
292285
293286 } ) ;
@@ -350,15 +343,15 @@ describe('IgxGrid - Grid Sorting #grid', () => {
350343 fixture . detectChanges ( ) ;
351344
352345 // Verify that the grid is NOT sorted.
353- expect ( GridFunctions . getValueFromCellElement ( getCurrentCellFromGrid ( grid , 0 , 1 ) ) ) . toEqual ( 'Jane' ) ;
354- expect ( GridFunctions . getValueFromCellElement ( getCurrentCellFromGrid ( grid , grid . data . length - 1 , 1 ) ) ) . toEqual ( 'Connor' ) ;
346+ expect ( GridFunctions . getValueFromCellElement ( GridFunctions . getCurrentCellFromGrid ( grid , 0 , 1 ) ) ) . toEqual ( 'Jane' ) ;
347+ expect ( GridFunctions . getValueFromCellElement ( GridFunctions . getCurrentCellFromGrid ( grid , grid . data . length - 1 , 1 ) ) ) . toEqual ( 'Connor' ) ;
355348
356349 GridFunctions . clickHeaderSortIcon ( firstHeaderCell ) ;
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+ expect ( GridFunctions . getValueFromCellElement ( GridFunctions . getCurrentCellFromGrid ( grid , grid . data . length - 1 , 1 ) ) ) . toEqual ( 'Connor' ) ;
362355 } ) ;
363356 } ) ;
364357} ) ;
0 commit comments