@@ -100,7 +100,13 @@ const threeStopGuide: PullRequestReviewGuide = {
100100 } ) ) ,
101101} ;
102102
103- function ChatBeside ( { composerKeys } : { composerKeys : string [ ] } ) {
103+ function ChatBeside ( {
104+ composerKeys,
105+ maximizedAway,
106+ } : {
107+ composerKeys : string [ ] ;
108+ maximizedAway : boolean ;
109+ } ) {
104110 useChatShortcuts ( {
105111 enabled : true ,
106112 keybindings : [ ] ,
@@ -128,10 +134,10 @@ function ChatBeside({ composerKeys }: { composerKeys: string[] }) {
128134 commands : { } ,
129135 fallback : ( ) => undefined ,
130136 } ) ;
131- return null ;
137+ return < div data-chat-column-maximized-away = { maximizedAway ? "true" : "false" } /> ;
132138}
133139
134- it ( "steps with J and K after a click on guide prose beside a chat" , async ( ) => {
140+ it ( "steps with J and K beside a chat, also after a stop button or while the chat is maximized away " , async ( ) => {
135141 vi . mocked ( useReviewGuideWriter ) . mockReturnValue ( {
136142 query : { isPending : false , error : null } as never ,
137143 data : { guide : threeStopGuide , run : null , currentHeadSha : "head" } ,
@@ -141,9 +147,9 @@ it("steps with J and K after a click on guide prose beside a chat", async () =>
141147 } ) ;
142148 const composerKeys : string [ ] = [ ] ;
143149
144- await using screen = await render (
150+ const tree = ( maximizedAway : boolean ) => (
145151 < >
146- < ChatBeside composerKeys = { composerKeys } />
152+ < ChatBeside composerKeys = { composerKeys } maximizedAway = { maximizedAway } />
147153 < PullRequestGuideTab
148154 environmentId = { EnvironmentId . make ( "environment" ) }
149155 reference = { reference }
@@ -158,11 +164,18 @@ it("steps with J and K after a click on guide prose beside a chat", async () =>
158164 onFinishReview = { null }
159165 onOpenFile = { ( ) => { } }
160166 />
161- </ > ,
167+ </ >
162168 ) ;
169+ await using screen = await render ( tree ( true ) ) ;
163170
164- await userEvent . click ( screen . getByText ( "Prose for the first stop." ) ) ;
165- await userEvent . keyboard ( "jj" ) ;
171+ await userEvent . keyboard ( "j" ) ;
172+ await expect . element ( screen . getByText ( "Prose for the second stop." ) ) . toBeVisible ( ) ;
173+ await screen . rerender ( tree ( false ) ) ;
174+ await userEvent . click ( screen . getByText ( "Prose for the second stop." ) ) ;
175+ await userEvent . keyboard ( "k" ) ;
176+ await expect . element ( screen . getByText ( "Prose for the first stop." ) ) . toBeVisible ( ) ;
177+ await userEvent . click ( screen . getByRole ( "button" , { name : "Next stop" } ) ) ;
178+ await userEvent . keyboard ( "j" ) ;
166179 await expect . element ( screen . getByText ( "Prose for the third stop." ) ) . toBeVisible ( ) ;
167180 await userEvent . keyboard ( "k" ) ;
168181 await expect . element ( screen . getByText ( "Prose for the second stop." ) ) . toBeVisible ( ) ;
0 commit comments