@@ -12,6 +12,7 @@ import { GridFunctions, GRID_MRL_BLOCK } from '../../test-utils/grid-functions.s
1212import { CellType } from '../common/grid.interface' ;
1313import { IgxColumnLayoutComponent } from '../columns/column-layout.component' ;
1414import { IGridCellEventArgs , IgxColumnComponent } from '../public_api' ;
15+ import { IgxGridMRLNavigationService } from '../grid-mrl-navigation.service' ;
1516
1617const DEBOUNCE_TIME = 30 ;
1718const CELL_CSS_CLASS = '.igx-grid__td' ;
@@ -297,6 +298,40 @@ describe('IgxGrid Multi Row Layout - Keyboard navigation #grid', () => {
297298 GridFunctions . verifyGridContentActiveDescendant ( GridFunctions . getGridContent ( fix ) , cell . nativeElement . id ) ;
298299 } ) ;
299300
301+ it ( 'should not return an out of bounds row index when navigating down from the last layout row' , ( ) => {
302+ fix . componentInstance . data = SampleTestData . contactInfoDataFull ( ) . slice ( 0 , 10 ) ;
303+ fix . componentInstance . colGroups = [ {
304+ group : 'group1' ,
305+ columns : [
306+ { field : 'ID' , rowStart : 1 , colStart : 1 } ,
307+ { field : 'CompanyName' , rowStart : 1 , colStart : 2 } ,
308+ { field : 'ContactName' , rowStart : 1 , colStart : 3 } ,
309+ { field : 'ContactTitle' , rowStart : 1 , colStart : 4 } ,
310+ { field : 'Address' , rowStart : 1 , colStart : 5 } ,
311+ { field : 'City' , rowStart : 2 , colStart : 1 } ,
312+ { field : 'Region' , rowStart : 2 , colStart : 2 } ,
313+ { field : 'PostalCode' , rowStart : 2 , colStart : 3 } ,
314+ { field : 'Phone' , rowStart : 2 , colStart : 4 } ,
315+ { field : 'Fax' , rowStart : 2 , colStart : 5 }
316+ ]
317+ } ] ;
318+ fix . detectChanges ( ) ;
319+
320+ const grid = fix . componentInstance . grid ;
321+ const lastRowIndex = grid . dataView . length - 1 ;
322+ const navService = grid . navigation as IgxGridMRLNavigationService ;
323+ const col = grid . getColumnByName ( 'City' ) ;
324+ navService . setActiveNode ( {
325+ row : lastRowIndex ,
326+ column : col . visibleIndex ,
327+ layout : navService . layout ( col . visibleIndex )
328+ } ) ;
329+
330+ const nextPos = navService . getNextVerticalPosition ( ) ;
331+ expect ( nextPos . row ) . toBe ( lastRowIndex ) ;
332+ expect ( nextPos . column ) . toBe ( navService . activeNode . column ) ;
333+ } ) ;
334+
300335 it ( 'should navigate up correctly' , ( ) => {
301336 fix . componentInstance . colGroups = [ {
302337 group : 'group1' ,
0 commit comments