@@ -1149,7 +1149,7 @@ describe('Tree', () => {
11491149 expect ( cell ) . toHaveAttribute ( 'aria-colindex' , '1' ) ;
11501150 } ) ;
11511151
1152- it ( 'should not focus the load more row when using ArrowDown/ArrowUp' , async ( ) => {
1152+ it ( 'should focus the load more row when using ArrowDown/ArrowUp' , async ( ) => {
11531153 let { getAllByRole} = render ( < LoadingMoreTree isLoading /> ) ;
11541154
11551155 let rows = getAllByRole ( 'row' ) ;
@@ -1158,19 +1158,18 @@ describe('Tree', () => {
11581158
11591159 await user . tab ( ) ;
11601160 expect ( document . activeElement ) . toBe ( rows [ 0 ] ) ;
1161- for ( let i = 0 ; i < 5 ; i ++ ) {
1161+ for ( let i = 1 ; i < 8 ; i ++ ) {
11621162 await user . keyboard ( '{ArrowDown}' ) ;
1163+ expect ( document . activeElement ) . toBe ( rows [ i ] ) ;
11631164 }
1164- expect ( document . activeElement ) . toBe ( rows [ 5 ] ) ;
11651165
1166- await user . keyboard ( '{ArrowDown}' ) ;
1167- expect ( document . activeElement ) . toBe ( rows [ 7 ] ) ;
1168-
1169- await user . keyboard ( '{ArrowUp}' ) ;
1170- expect ( document . activeElement ) . toBe ( rows [ 5 ] ) ;
1166+ for ( let i = 6 ; i >= 0 ; i -- ) {
1167+ await user . keyboard ( '{ArrowUp}' ) ;
1168+ expect ( document . activeElement ) . toBe ( rows [ i ] ) ;
1169+ }
11711170 } ) ;
11721171
1173- it ( 'should not focus the load more row when using End' , async ( ) => {
1172+ it ( 'should focus the load more row when using End' , async ( ) => {
11741173 let { getAllByRole} = render ( < LoadingMoreTree isLoading /> ) ;
11751174
11761175 let rows = getAllByRole ( 'row' ) ;
@@ -1180,14 +1179,14 @@ describe('Tree', () => {
11801179 await user . tab ( ) ;
11811180 expect ( document . activeElement ) . toBe ( rows [ 0 ] ) ;
11821181 await user . keyboard ( '{End}' ) ;
1183- expect ( document . activeElement ) . toBe ( rows [ 20 ] ) ;
1182+ expect ( document . activeElement ) . toBe ( rows [ 21 ] ) ;
11841183
11851184 // Check that it didn't shift the focusedkey to the loader key even if DOM focus didn't shift to the loader
11861185 await user . keyboard ( '{ArrowUp}' ) ;
1187- expect ( document . activeElement ) . toBe ( rows [ 19 ] ) ;
1186+ expect ( document . activeElement ) . toBe ( rows [ 20 ] ) ;
11881187 } ) ;
11891188
1190- it ( 'should not focus the load more row when using PageDown' , async ( ) => {
1189+ it ( 'should focus the load more row when using PageDown' , async ( ) => {
11911190 let { getAllByRole} = render ( < LoadingMoreTree isLoading /> ) ;
11921191
11931192 let rows = getAllByRole ( 'row' ) ;
@@ -1197,11 +1196,11 @@ describe('Tree', () => {
11971196 await user . tab ( ) ;
11981197 expect ( document . activeElement ) . toBe ( rows [ 0 ] ) ;
11991198 await user . keyboard ( '{PageDown}' ) ;
1200- expect ( document . activeElement ) . toBe ( rows [ 20 ] ) ;
1199+ expect ( document . activeElement ) . toBe ( rows [ 21 ] ) ;
12011200
12021201 // Check that it didn't shift the focusedkey to the loader key even if DOM focus didn't shift to the loader
12031202 await user . keyboard ( '{ArrowUp}' ) ;
1204- expect ( document . activeElement ) . toBe ( rows [ 19 ] ) ;
1203+ expect ( document . activeElement ) . toBe ( rows [ 20 ] ) ;
12051204 } ) ;
12061205
12071206 it ( 'should not render no results state and the loader at the same time' , ( ) => {
0 commit comments