@@ -272,6 +272,25 @@ function buildSnapShotTimelineEntry(previewUrl?: string) {
272272}
273273
274274describe ( "MessagesTimeline" , ( ) => {
275+ it ( "renders previous and next controls with the minimap" , ( ) => {
276+ const first = buildUserTimelineEntry ( "First turn" ) ;
277+ const secondBase = buildUserTimelineEntry ( "Second turn" ) ;
278+ const second = {
279+ ...secondBase ,
280+ id : "entry-2" ,
281+ message : {
282+ ...secondBase . message ,
283+ id : MessageId . make ( "message-2" ) ,
284+ } ,
285+ } ;
286+ const markup = renderToStaticMarkup (
287+ < MessagesTimeline { ...buildProps ( ) } timelineEntries = { [ first , second ] } /> ,
288+ ) ;
289+
290+ expect ( markup ) . toContain ( 'aria-label="Previous turn"' ) ;
291+ expect ( markup ) . toContain ( 'aria-label="Next turn"' ) ;
292+ } ) ;
293+
275294 // Expanding history uses this suite's existing test renderer, deprecated in
276295 // React 19. Migrate these interaction tests together when a DOM test setup is added.
277296 it . each ( [ { } , { text : "Text-only answer" , file : "Answer with a file" } ] ) (
@@ -524,6 +543,7 @@ describe("MessagesTimeline", () => {
524543 const {
525544 resolveTimelineIsAtEnd,
526545 resolveTimelineMinimapHasPersistentGutter,
546+ resolveTimelineMinimapCurrentIndex,
527547 resolveTimelineMinimapHeightStyle,
528548 resolveTimelineMinimapHitStripWidth,
529549 resolveTimelineMinimapIndexFromPointer,
@@ -583,6 +603,35 @@ describe("MessagesTimeline", () => {
583603 pointerY : 999 ,
584604 } ) ,
585605 ) . toBe ( 100 ) ;
606+ expect (
607+ resolveTimelineMinimapCurrentIndex ( {
608+ scrollTop : 100 ,
609+ scrollBottom : 500 ,
610+ itemBounds : [
611+ { top : 80 , height : 20 } ,
612+ { top : 120 , height : 20 } ,
613+ { top : 220 , height : 20 } ,
614+ ] ,
615+ } ) ,
616+ ) . toBe ( 1 ) ;
617+ expect (
618+ resolveTimelineMinimapCurrentIndex ( {
619+ scrollTop : 150 ,
620+ scrollBottom : 200 ,
621+ itemBounds : [
622+ { top : 80 , height : 20 } ,
623+ { top : 120 , height : 20 } ,
624+ { top : 220 , height : 20 } ,
625+ ] ,
626+ } ) ,
627+ ) . toBe ( 1 ) ;
628+ expect (
629+ resolveTimelineMinimapCurrentIndex ( {
630+ scrollTop : 0 ,
631+ scrollBottom : 50 ,
632+ itemBounds : [ { top : 80 , height : 20 } ] ,
633+ } ) ,
634+ ) . toBeNull ( ) ;
586635 expect ( resolveTimelineMinimapHasPersistentGutter ( 832 ) ) . toBe ( false ) ;
587636 expect ( resolveTimelineMinimapHasPersistentGutter ( 863 ) ) . toBe ( false ) ;
588637 expect ( resolveTimelineMinimapHasPersistentGutter ( 864 ) ) . toBe ( true ) ;
0 commit comments