@@ -558,4 +558,38 @@ describe('search prompt', () => {
558558 events . keypress ( 'enter' ) ;
559559 await expect ( answer ) . resolves . toEqual ( 'QC' ) ;
560560 } ) ;
561+
562+ it ( 'supports custom instructions' , async ( ) => {
563+ const { answer, events, getScreen } = await render ( search , {
564+ message : 'Select a Canadian province' ,
565+ source : getListSearch ( PROVINCES ) ,
566+ pageSize : 3 ,
567+ instructions : {
568+ navigation : 'Utiliser les flèches directionnelles' ,
569+ pager : 'Utiliser les flèches pour révéler plus de choix' ,
570+ } ,
571+ } ) ;
572+
573+ // Test custom pager instruction when results exceed pageSize
574+ expect ( getScreen ( ) ) . toMatchInlineSnapshot ( `
575+ "? Select a Canadian province
576+ ❯ Alberta
577+ British Columbia
578+ Manitoba
579+ (Utiliser les flèches pour révéler plus de choix)"
580+ ` ) ;
581+
582+ // Test custom navigation instruction when results fit in pageSize
583+ events . type ( 'New' ) ;
584+ await Promise . resolve ( ) ;
585+ expect ( getScreen ( ) ) . toMatchInlineSnapshot ( `
586+ "? Select a Canadian province New
587+ ❯ New Brunswick
588+ Newfoundland and Labrador
589+ (Utiliser les flèches directionnelles)"
590+ ` ) ;
591+
592+ events . keypress ( 'enter' ) ;
593+ await expect ( answer ) . resolves . toEqual ( 'NB' ) ;
594+ } ) ;
561595} ) ;
0 commit comments