@@ -1124,7 +1124,7 @@ describe('Tree', () => {
11241124 expect ( cell ) . toHaveAttribute ( 'aria-colindex' , '1' ) ;
11251125 } ) ;
11261126
1127- it ( 'should not focus the load more row when using ArrowDown/ArrowUp' , async ( ) => {
1127+ it ( 'should focus the load more row when using ArrowDown/ArrowUp' , async ( ) => {
11281128 let { getAllByRole} = render ( < LoadingMoreTree isLoading /> ) ;
11291129
11301130 let rows = getAllByRole ( 'row' ) ;
@@ -1133,19 +1133,18 @@ describe('Tree', () => {
11331133
11341134 await user . tab ( ) ;
11351135 expect ( document . activeElement ) . toBe ( rows [ 0 ] ) ;
1136- for ( let i = 0 ; i < 5 ; i ++ ) {
1136+ for ( let i = 1 ; i < 8 ; i ++ ) {
11371137 await user . keyboard ( '{ArrowDown}' ) ;
1138+ expect ( document . activeElement ) . toBe ( rows [ i ] ) ;
11381139 }
1139- expect ( document . activeElement ) . toBe ( rows [ 5 ] ) ;
11401140
1141- await user . keyboard ( '{ArrowDown}' ) ;
1142- expect ( document . activeElement ) . toBe ( rows [ 7 ] ) ;
1143-
1144- await user . keyboard ( '{ArrowUp}' ) ;
1145- expect ( document . activeElement ) . toBe ( rows [ 5 ] ) ;
1141+ for ( let i = 6 ; i >= 0 ; i -- ) {
1142+ await user . keyboard ( '{ArrowUp}' ) ;
1143+ expect ( document . activeElement ) . toBe ( rows [ i ] ) ;
1144+ }
11461145 } ) ;
11471146
1148- it ( 'should not focus the load more row when using End' , async ( ) => {
1147+ it ( 'should focus the load more row when using End' , async ( ) => {
11491148 let { getAllByRole} = render ( < LoadingMoreTree isLoading /> ) ;
11501149
11511150 let rows = getAllByRole ( 'row' ) ;
@@ -1155,14 +1154,14 @@ describe('Tree', () => {
11551154 await user . tab ( ) ;
11561155 expect ( document . activeElement ) . toBe ( rows [ 0 ] ) ;
11571156 await user . keyboard ( '{End}' ) ;
1158- expect ( document . activeElement ) . toBe ( rows [ 20 ] ) ;
1157+ expect ( document . activeElement ) . toBe ( rows [ 21 ] ) ;
11591158
11601159 // Check that it didn't shift the focusedkey to the loader key even if DOM focus didn't shift to the loader
11611160 await user . keyboard ( '{ArrowUp}' ) ;
1162- expect ( document . activeElement ) . toBe ( rows [ 19 ] ) ;
1161+ expect ( document . activeElement ) . toBe ( rows [ 20 ] ) ;
11631162 } ) ;
11641163
1165- it ( 'should not focus the load more row when using PageDown' , async ( ) => {
1164+ it ( 'should focus the load more row when using PageDown' , async ( ) => {
11661165 let { getAllByRole} = render ( < LoadingMoreTree isLoading /> ) ;
11671166
11681167 let rows = getAllByRole ( 'row' ) ;
@@ -1172,11 +1171,11 @@ describe('Tree', () => {
11721171 await user . tab ( ) ;
11731172 expect ( document . activeElement ) . toBe ( rows [ 0 ] ) ;
11741173 await user . keyboard ( '{PageDown}' ) ;
1175- expect ( document . activeElement ) . toBe ( rows [ 20 ] ) ;
1174+ expect ( document . activeElement ) . toBe ( rows [ 21 ] ) ;
11761175
11771176 // Check that it didn't shift the focusedkey to the loader key even if DOM focus didn't shift to the loader
11781177 await user . keyboard ( '{ArrowUp}' ) ;
1179- expect ( document . activeElement ) . toBe ( rows [ 19 ] ) ;
1178+ expect ( document . activeElement ) . toBe ( rows [ 20 ] ) ;
11801179 } ) ;
11811180
11821181 it ( 'should not render no results state and the loader at the same time' , ( ) => {
0 commit comments