@@ -122,6 +122,35 @@ function createWrapBootstrap(): AppBootstrap {
122122 } ;
123123}
124124
125+ function createFileScrollBootstrap ( ) : AppBootstrap {
126+ const files = [ "alpha" , "beta" , "gamma" , "delta" , "epsilon" , "zeta" ] . map ( ( name , index ) =>
127+ createDiffFile (
128+ name ,
129+ `${ name } .ts` ,
130+ `export const ${ name } Marker = ${ index + 1 } ;\n` ,
131+ `export const ${ name } Marker = ${ index + 2 } ;\nexport const ${ name } Added = true;\n` ,
132+ ) ,
133+ ) ;
134+
135+ return {
136+ input : {
137+ kind : "git" ,
138+ staged : false ,
139+ options : {
140+ mode : "auto" ,
141+ } ,
142+ } ,
143+ changeset : {
144+ id : "changeset:app-file-scroll" ,
145+ sourceLabel : "repo" ,
146+ title : "repo working tree" ,
147+ files,
148+ } ,
149+ initialMode : "auto" ,
150+ initialTheme : "midnight" ,
151+ } ;
152+ }
153+
125154
126155async function flush ( setup : Awaited < ReturnType < typeof testRender > > ) {
127156 await act ( async ( ) => {
@@ -189,7 +218,7 @@ describe("App interactions", () => {
189218 frame = setup . captureCharFrame ( ) ;
190219 expect ( frame ) . toContain ( "this is a very" ) ;
191220 expect ( frame ) . toContain ( "long wrapped line" ) ;
192- expect ( frame ) . toContain ( "rendering coverage" ) ;
221+ expect ( frame ) . toContain ( "coverage" ) ;
193222 } finally {
194223 await act ( async ( ) => {
195224 setup . renderer . destroy ( ) ;
@@ -268,6 +297,36 @@ describe("App interactions", () => {
268297 }
269298 } ) ;
270299
300+ test ( "arrow-key file navigation scrolls the review pane to the selected file hunk" , async ( ) => {
301+ const setup = await testRender ( < App bootstrap = { createFileScrollBootstrap ( ) } /> , { width : 280 , height : 12 } ) ;
302+
303+ try {
304+ await flush ( setup ) ;
305+
306+ for ( let index = 0 ; index < 4 ; index += 1 ) {
307+ await act ( async ( ) => {
308+ await setup . mockInput . pressArrow ( "down" ) ;
309+ } ) ;
310+ await flush ( setup ) ;
311+ }
312+
313+ await act ( async ( ) => {
314+ await Bun . sleep ( 80 ) ;
315+ await setup . renderOnce ( ) ;
316+ } ) ;
317+
318+ const frame = setup . captureCharFrame ( ) ;
319+ expect ( frame ) . toContain ( "M epsilon.ts" ) ;
320+ expect ( frame ) . toContain ( "epsilon.ts" ) ;
321+ expect ( frame ) . toContain ( "▌@@ -1,1 +1,2 @@" ) ;
322+ expect ( frame ) . not . toContain ( "alphaMarker" ) ;
323+ } finally {
324+ await act ( async ( ) => {
325+ setup . renderer . destroy ( ) ;
326+ } ) ;
327+ }
328+ } ) ;
329+
271330 test ( "filter focus accepts typed input and narrows the visible file set" , async ( ) => {
272331 const setup = await testRender ( < App bootstrap = { createBootstrap ( ) } /> , { width : 240 , height : 24 } ) ;
273332
0 commit comments