@@ -1192,6 +1192,52 @@ describe('IgxHierarchicalGrid Smaller Child Navigation #hGrid', () => {
11921192 expect ( secondChildCell . focused ) . toBe ( true ) ;
11931193 } ) ) ;
11941194} ) ;
1195+ describe ( 'IgxHierarchicalGrid Specific Scenarios Navigation' , ( ) => {
1196+ configureTestSuite ( ) ;
1197+ let fixture ;
1198+ let hierarchicalGrid : IgxHierarchicalGridComponent ;
1199+ beforeEach ( async ( ( ) => {
1200+ TestBed . configureTestingModule ( {
1201+ declarations : [
1202+ IgxHierarchicalGridSpecificScenarioComponent
1203+ ] ,
1204+ imports : [
1205+ NoopAnimationsModule , IgxHierarchicalGridModule ]
1206+ } ) . compileComponents ( ) ;
1207+ } ) ) ;
1208+ beforeEach ( async ( ( ) => {
1209+ fixture = TestBed . createComponent ( IgxHierarchicalGridSpecificScenarioComponent ) ;
1210+ fixture . detectChanges ( ) ;
1211+ hierarchicalGrid = fixture . componentInstance . hgrid ;
1212+ setupHierarchicalGridScrollDetection ( fixture , hierarchicalGrid ) ;
1213+ } ) ) ;
1214+
1215+ fit ( "should navigate to the first cell of next row using Tab from last cell in the row above when the first row is expanded" , ( async ( ) => {
1216+ const row = hierarchicalGrid . getRowByIndex ( 0 ) ;
1217+ ( row as IgxHierarchicalRowComponent ) . toggle ( ) ;
1218+ await wait ( 100 ) ;
1219+ fixture . detectChanges ( ) ;
1220+
1221+ const cell = hierarchicalGrid . getCellByColumn ( 2 , 'ProductName' ) ;
1222+ cell . nativeElement . focus ( ) ;
1223+ await wait ( 100 ) ;
1224+ fixture . detectChanges ( ) ;
1225+
1226+ const keyboardEvent = new KeyboardEvent ( 'keydown' , {
1227+ key : 'Tab'
1228+ } )
1229+ cell . dispatchEvent ( keyboardEvent ) ;
1230+ await wait ( 100 ) ;
1231+ fixture . detectChanges ( ) ;
1232+
1233+ const currentCell = hierarchicalGrid . getCellByColumn ( 3 , 'ID' ) ;
1234+ expect ( currentCell . focused ) . toBe ( true ) ;
1235+ expect ( currentCell . rowIndex ) . toBe ( 3 ) ;
1236+
1237+
1238+ } ) ) ;
1239+
1240+ } ) ;
11951241
11961242@Component ( {
11971243 template : `
@@ -1289,3 +1335,31 @@ export class IgxHierarchicalGridMultiLayoutComponent extends IgxHierarchicalGrid
12891335 </igx-hierarchical-grid>`
12901336} )
12911337export class IgxHierarchicalGridSmallerChildComponent extends IgxHierarchicalGridTestBaseComponent { }
1338+
1339+ @Component ( {
1340+ template : `
1341+ <igx-hierarchical-grid #grid1 [height]="'400px'" [width]="'500px'" [data]="data" [autoGenerate]="true"
1342+ [expandChildren]='false' #hierarchicalGrid>
1343+ <igx-row-island [key]="'childData'" [autoGenerate]="true" [expandChildren]='true' [height]="'200px'" #rowIsland>
1344+ </igx-row-island>
1345+ </igx-hierarchical-grid>`
1346+ } )
1347+ export class IgxHierarchicalGridSpecificScenarioComponent extends IgxHierarchicalGridTestBaseComponent {
1348+ constructor ( ) {
1349+ super ( ) ;
1350+ this . data = this . generateData ( 20 , 2 ) ;
1351+ }
1352+ generateData ( count : number , level : number ) {
1353+ const prods = [ ] ;
1354+ const currLevel = level ;
1355+ let children ;
1356+ for ( let i = 0 ; i < count ; i ++ ) {
1357+ if ( level > 0 ) {
1358+ children = this . generateData ( count / 2 , currLevel - 1 ) ;
1359+ }
1360+ prods . push ( {
1361+ ID : i , ProductName : 'Product: A' + i , childData : children } ) ;
1362+ }
1363+ return prods ;
1364+ }
1365+ }
0 commit comments