@@ -1149,7 +1149,7 @@ describe('Tree', () => {
1149
1149
expect ( cell ) . toHaveAttribute ( 'aria-colindex' , '1' ) ;
1150
1150
} ) ;
1151
1151
1152
- it ( 'should focus the load more row when using ArrowDown/ArrowUp' , async ( ) => {
1152
+ it ( 'should not focus the load more row when using ArrowDown/ArrowUp' , async ( ) => {
1153
1153
let { getAllByRole} = render ( < LoadingMoreTree isLoading /> ) ;
1154
1154
1155
1155
let rows = getAllByRole ( 'row' ) ;
@@ -1158,18 +1158,19 @@ describe('Tree', () => {
1158
1158
1159
1159
await user . tab ( ) ;
1160
1160
expect ( document . activeElement ) . toBe ( rows [ 0 ] ) ;
1161
- for ( let i = 1 ; i < 8 ; i ++ ) {
1161
+ for ( let i = 0 ; i < 5 ; i ++ ) {
1162
1162
await user . keyboard ( '{ArrowDown}' ) ;
1163
- expect ( document . activeElement ) . toBe ( rows [ i ] ) ;
1164
1163
}
1164
+ expect ( document . activeElement ) . toBe ( rows [ 5 ] ) ;
1165
1165
1166
- for ( let i = 6 ; i >= 0 ; i -- ) {
1167
- await user . keyboard ( '{ArrowUp}' ) ;
1168
- expect ( document . activeElement ) . toBe ( rows [ i ] ) ;
1169
- }
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 ] ) ;
1170
1171
} ) ;
1171
1172
1172
- it ( 'should focus the load more row when using End' , async ( ) => {
1173
+ it ( 'should not focus the load more row when using End' , async ( ) => {
1173
1174
let { getAllByRole} = render ( < LoadingMoreTree isLoading /> ) ;
1174
1175
1175
1176
let rows = getAllByRole ( 'row' ) ;
@@ -1179,14 +1180,14 @@ describe('Tree', () => {
1179
1180
await user . tab ( ) ;
1180
1181
expect ( document . activeElement ) . toBe ( rows [ 0 ] ) ;
1181
1182
await user . keyboard ( '{End}' ) ;
1182
- expect ( document . activeElement ) . toBe ( rows [ 21 ] ) ;
1183
+ expect ( document . activeElement ) . toBe ( rows [ 20 ] ) ;
1183
1184
1184
1185
// Check that it didn't shift the focusedkey to the loader key even if DOM focus didn't shift to the loader
1185
1186
await user . keyboard ( '{ArrowUp}' ) ;
1186
- expect ( document . activeElement ) . toBe ( rows [ 20 ] ) ;
1187
+ expect ( document . activeElement ) . toBe ( rows [ 19 ] ) ;
1187
1188
} ) ;
1188
1189
1189
- it ( 'should focus the load more row when using PageDown' , async ( ) => {
1190
+ it ( 'should not focus the load more row when using PageDown' , async ( ) => {
1190
1191
let { getAllByRole} = render ( < LoadingMoreTree isLoading /> ) ;
1191
1192
1192
1193
let rows = getAllByRole ( 'row' ) ;
@@ -1196,11 +1197,11 @@ describe('Tree', () => {
1196
1197
await user . tab ( ) ;
1197
1198
expect ( document . activeElement ) . toBe ( rows [ 0 ] ) ;
1198
1199
await user . keyboard ( '{PageDown}' ) ;
1199
- expect ( document . activeElement ) . toBe ( rows [ 21 ] ) ;
1200
+ expect ( document . activeElement ) . toBe ( rows [ 20 ] ) ;
1200
1201
1201
1202
// Check that it didn't shift the focusedkey to the loader key even if DOM focus didn't shift to the loader
1202
1203
await user . keyboard ( '{ArrowUp}' ) ;
1203
- expect ( document . activeElement ) . toBe ( rows [ 20 ] ) ;
1204
+ expect ( document . activeElement ) . toBe ( rows [ 19 ] ) ;
1204
1205
} ) ;
1205
1206
1206
1207
it ( 'should not render no results state and the loader at the same time' , ( ) => {
0 commit comments