@@ -380,6 +380,28 @@ describe("component props", () => {
380
380
expect ( wrapper . findAll ( "div[role='option']" ) . length ) . toBe ( options . length ) ;
381
381
} ) ;
382
382
383
+ it ( "should not allow focusing or typing when isSearchable is false" , async ( ) => {
384
+ const wrapper = mount ( VueSelect , { props : { modelValue : null , options, isSearchable : false } } ) ;
385
+
386
+ const input = wrapper . get ( "input" ) ;
387
+
388
+ // Input should be readonly and removed from tab order
389
+ expect ( input . attributes ( "readonly" ) ) . toBe ( "" ) ;
390
+ expect ( input . attributes ( "tabindex" ) ) . toBe ( "-1" ) ;
391
+
392
+ // Focus attempt should not set focus-visible behavior or allow typing to change value
393
+ await input . trigger ( "focus" ) ;
394
+ await input . setValue ( "United" ) ;
395
+
396
+ // Menu shouldn't open due to typing, and no search event should be emitted
397
+ expect ( wrapper . findAll ( "div[role='option']" ) . length ) . toBe ( 0 ) ;
398
+ expect ( wrapper . emitted ( "search" ) ) . toBeUndefined ( ) ;
399
+
400
+ // Opening the menu via control still works
401
+ await openMenu ( wrapper , "mousedown" ) ;
402
+ expect ( wrapper . findAll ( "div[role='option']" ) . length ) . toBe ( options . length ) ;
403
+ } ) ;
404
+
383
405
it ( "should not autofocus an option when passing the autofocus prop" , async ( ) => {
384
406
const wrapper = mount ( VueSelect , { props : { modelValue : null , options, shouldAutofocusOption : false } } ) ;
385
407
0 commit comments