@@ -930,49 +930,76 @@ describe('IgxHierarchicalGrid Multi-layout Navigation', () => {
930
930
hierarchicalGrid = fixture . componentInstance . hgrid ;
931
931
setupHierarchicalGridScrollDetection ( fixture , hierarchicalGrid ) ;
932
932
} ) ) ;
933
- it ( 'should allow navigating up/down between sibling child grids.' , ( async ( ) => {
933
+
934
+ it ( 'should allow navigating up between sibling child grids.' , ( async ( ) => {
934
935
hierarchicalGrid . verticalScrollContainer . scrollTo ( 2 ) ;
935
936
await wait ( 100 ) ;
936
937
fixture . detectChanges ( ) ;
937
938
const child1 = hierarchicalGrid . hgridAPI . getChildGrids ( false ) [ 0 ] ;
938
939
const child2 = hierarchicalGrid . hgridAPI . getChildGrids ( false ) [ 4 ] ;
939
940
940
941
const child2Cell = child2 . dataRowList . toArray ( ) [ 0 ] . cells . toArray ( ) [ 0 ] ;
941
- child2Cell . nativeElement . focus ( ) ;
942
- await wait ( 100 ) ;
943
- fixture . detectChanges ( ) ;
944
-
945
- let keyboardEvent = new KeyboardEvent ( 'keydown' , {
942
+ const keyboardEvent = new KeyboardEvent ( 'keydown' , {
946
943
code : 'ArrowUp' ,
947
944
key : 'ArrowUp'
948
945
} ) ;
949
946
child2Cell . dispatchEvent ( keyboardEvent ) ;
947
+ fixture . detectChanges ( ) ;
950
948
await wait ( 100 ) ;
951
949
fixture . detectChanges ( ) ;
952
950
const lastCellPrevRI = child1 . dataRowList . toArray ( ) [ 1 ] . cells . toArray ( ) [ 0 ] ;
953
951
954
952
expect ( lastCellPrevRI . selected ) . toBe ( true ) ;
955
- expect ( lastCellPrevRI . focused ) . toBe ( true ) ;
956
953
expect ( lastCellPrevRI . rowIndex ) . toBe ( 9 ) ;
954
+ } ) ) ;
955
+ it ( 'should allow navigating down between sibling child grids.' , ( async ( ) => {
956
+ hierarchicalGrid . verticalScrollContainer . scrollTo ( 2 ) ;
957
+ await wait ( 100 ) ;
958
+ fixture . detectChanges ( ) ;
959
+ const child1 = hierarchicalGrid . hgridAPI . getChildGrids ( false ) [ 0 ] ;
960
+ const child2 = hierarchicalGrid . hgridAPI . getChildGrids ( false ) [ 4 ] ;
957
961
958
- keyboardEvent = new KeyboardEvent ( 'keydown' , {
962
+ child1 . verticalScrollContainer . scrollTo ( child1 . verticalScrollContainer . igxForOf . length - 1 ) ;
963
+ await wait ( 100 ) ;
964
+ fixture . detectChanges ( ) ;
965
+
966
+ const keyboardEvent = new KeyboardEvent ( 'keydown' , {
959
967
code : 'ArrowDown' ,
960
968
key : 'ArrowDown'
961
969
} ) ;
970
+ const child2Cell = child2 . dataRowList . toArray ( ) [ 0 ] . cells . toArray ( ) [ 0 ] ;
971
+ const lastCellPrevRI = child1 . dataRowList . toArray ( ) [ 1 ] . cells . toArray ( ) [ 0 ] ;
962
972
lastCellPrevRI . dispatchEvent ( keyboardEvent ) ;
973
+ fixture . detectChanges ( ) ;
963
974
await wait ( 100 ) ;
964
975
fixture . detectChanges ( ) ;
965
976
expect ( child2Cell . selected ) . toBe ( true ) ;
966
977
} ) ) ;
967
- it ( 'should allow navigating with Tab/Shift+Tab between sibling child grids.' , ( async ( ) => {
978
+
979
+ it ( 'should allow navigating with Tab between sibling child grids.' , ( async ( ) => {
968
980
const child1 = hierarchicalGrid . hgridAPI . getChildGrids ( false ) [ 0 ] ;
969
981
const child2 = hierarchicalGrid . hgridAPI . getChildGrids ( false ) [ 4 ] ;
970
982
971
- const child2Cell = child2 . dataRowList . toArray ( ) [ 0 ] . cells . toArray ( ) [ 0 ] ;
972
- child2Cell . nativeElement . focus ( ) ;
973
- await wait ( 240 ) ;
983
+ child1 . verticalScrollContainer . scrollTo ( child1 . verticalScrollContainer . igxForOf . length - 1 ) ;
984
+ await wait ( 100 ) ;
974
985
fixture . detectChanges ( ) ;
986
+ const rowVirt = child1 . dataRowList . toArray ( ) [ 0 ] . virtDirRow ;
987
+ rowVirt . scrollTo ( rowVirt . igxForOf . length - 1 ) ;
988
+ await wait ( 100 ) ;
989
+ fixture . detectChanges ( ) ;
990
+ const child1Cell = child1 . getCellByColumn ( 9 , 'childData' ) ;
991
+ const child2Cell = child2 . dataRowList . toArray ( ) [ 0 ] . cells . toArray ( ) [ 0 ] ;
992
+ // Tab from last cell in 1st child
993
+ child1Cell . nativeElement . dispatchEvent ( new KeyboardEvent ( 'keydown' , { key : 'Tab' } ) ) ;
994
+ await wait ( 100 ) ;
995
+ fixture . detectChanges ( ) ;
996
+ expect ( child2Cell . selected ) . toBe ( true ) ;
997
+ } ) ) ;
998
+ it ( 'should allow navigating with Shift+Tab between sibling child grids.' , ( async ( ) => {
999
+ const child1 = hierarchicalGrid . hgridAPI . getChildGrids ( false ) [ 0 ] ;
1000
+ const child2 = hierarchicalGrid . hgridAPI . getChildGrids ( false ) [ 4 ] ;
975
1001
1002
+ const child2Cell = child2 . dataRowList . toArray ( ) [ 0 ] . cells . toArray ( ) [ 0 ] ;
976
1003
// Shift + Tab from 2nd child
977
1004
child2Cell . nativeElement . dispatchEvent ( new KeyboardEvent ( 'keydown' , { key : 'Tab' , shiftKey : true } ) ) ;
978
1005
await wait ( 240 ) ;
@@ -983,13 +1010,6 @@ describe('IgxHierarchicalGrid Multi-layout Navigation', () => {
983
1010
expect ( child1Cell . selected ) . toBe ( true ) ;
984
1011
expect ( child1Cell . rowIndex ) . toBe ( 9 ) ;
985
1012
expect ( child1Cell . columnIndex ) . toBe ( 6 ) ;
986
-
987
- // Tab from last cell in 1st child
988
- child1Cell . nativeElement . dispatchEvent ( new KeyboardEvent ( 'keydown' , { key : 'Tab' } ) ) ;
989
- await wait ( 100 ) ;
990
- fixture . detectChanges ( ) ;
991
-
992
- expect ( child2Cell . selected ) . toBe ( true ) ;
993
1013
} ) ) ;
994
1014
it ( 'should navigate up from parent row to the correct child sibling.' , ( async ( ) => {
995
1015
const parentCell = hierarchicalGrid . dataRowList . toArray ( ) [ 1 ] . cells . toArray ( ) [ 0 ] ;
0 commit comments