@@ -11,6 +11,7 @@ import { wait } from '../../test-utils/ui-interactions.spec';
1111import { DefaultSortingStrategy } from '../../data-operations/sorting-strategy' ;
1212import { configureTestSuite } from '../../test-utils/configure-suite' ;
1313import { verifyLayoutHeadersAreAligned , verifyDOMMatchesLayoutSettings } from '../../test-utils/helper-utils.spec' ;
14+ import { ICellPosition } from '../common/events' ;
1415
1516
1617const GRID_COL_THEAD_TITLE_CLASS = 'igx-grid__th-title' ;
@@ -1174,6 +1175,33 @@ describe('IgxGrid - multi-row-layout #grid', () => {
11741175 expect ( col . hidden ) . toBe ( false ) ;
11751176 expect ( col . parent . hidden ) . toBe ( false ) ;
11761177 } ) ;
1178+
1179+ it ( 'should get the correct next and previous cell when in MRL scenario' , ( ) => {
1180+ const fixture = TestBed . createComponent ( ColumnLayoutTestComponent ) ;
1181+ fixture . componentInstance . colGroups = [ {
1182+ group : 'group1' ,
1183+ columns : [
1184+ { field : 'CompanyName' , rowStart : 1 , rowEnd : 2 , colStart : 3 , colEnd : 4 , dataType : 'number' , editable : true } ,
1185+ { field : 'ID' , rowStart : 1 , rowEnd : 2 , colStart : 1 , colEnd : 2 , dataType : 'number' , editable : false } ,
1186+ { field : 'ContactName' , rowStart : 1 , rowEnd : 2 , colStart : 2 , colEnd : 3 , dataType : 'string' , editable : false } ,
1187+ ]
1188+ } ] ;
1189+ const grid = fixture . componentInstance . grid ;
1190+ fixture . detectChanges ( ) ;
1191+ let pos : ICellPosition ;
1192+ pos = grid . getNextCell ( 0 , 1 , col => col . editable === true ) ;
1193+ expect ( pos . rowIndex ) . toEqual ( 0 ) ;
1194+ expect ( pos . visibleColumnIndex ) . toEqual ( 2 ) ;
1195+ pos = grid . getNextCell ( 0 , 2 , col => col . editable === true ) ;
1196+ expect ( pos . rowIndex ) . toEqual ( 1 ) ;
1197+ expect ( pos . visibleColumnIndex ) . toEqual ( 2 ) ;
1198+ pos = grid . getPreviousCell ( 1 , 2 ) ;
1199+ expect ( pos . rowIndex ) . toEqual ( 1 ) ;
1200+ expect ( pos . visibleColumnIndex ) . toEqual ( 1 ) ;
1201+ pos = grid . getPreviousCell ( 1 , 2 , col => col . editable === true ) ;
1202+ expect ( pos . rowIndex ) . toEqual ( 0 ) ;
1203+ expect ( pos . visibleColumnIndex ) . toEqual ( 2 ) ;
1204+ } ) ;
11771205} ) ;
11781206
11791207@Component ( {
@@ -1182,7 +1210,7 @@ describe('IgxGrid - multi-row-layout #grid', () => {
11821210 <igx-column-layout *ngFor='let group of colGroups'>
11831211 <igx-column *ngFor='let col of group.columns'
11841212 [rowStart]="col.rowStart" [colStart]="col.colStart" [width]='col.width'
1185- [colEnd]="col.colEnd" [rowEnd]="col.rowEnd" [field]='col.field'></igx-column>
1213+ [colEnd]="col.colEnd" [rowEnd]="col.rowEnd" [field]='col.field' [editable]='col.editable' ></igx-column>
11861214 </igx-column-layout>
11871215 </igx-grid>
11881216 `
0 commit comments