@@ -10,14 +10,17 @@ const options = [
10
10
{ label : "Germany" , value : "DE" } ,
11
11
] ;
12
12
13
- async function openMenu ( wrapper : ReturnType < typeof mount > , method : "mousedown" | "focus-space" = "mousedown" ) {
13
+ async function openMenu ( wrapper : ReturnType < typeof mount > , method : "mousedown" | "focus-space" | "single-value" = "mousedown" ) {
14
14
if ( method === "mousedown" ) {
15
15
await wrapper . get ( "input" ) . trigger ( "mousedown" ) ;
16
16
}
17
- else {
17
+ else if ( method === "focus-space" ) {
18
18
await wrapper . get ( "input" ) . trigger ( "focus" ) ;
19
19
await wrapper . get ( "input" ) . trigger ( "keydown" , { key : "Space" } ) ;
20
20
}
21
+ else if ( method === "single-value" ) {
22
+ await wrapper . get ( ".single-value" ) . trigger ( "click" ) ;
23
+ }
21
24
}
22
25
23
26
async function dispatchEvent ( wrapper : ReturnType < typeof mount > , event : Event ) {
@@ -74,6 +77,14 @@ describe("input + menu interactions behavior", () => {
74
77
expect ( wrapper . findAll ( "div[role='option']" ) . length ) . toBe ( options . length ) ;
75
78
} ) ;
76
79
80
+ it ( "should not open the menu when is-disabled and an option is selected" , async ( ) => {
81
+ const wrapper = mount ( VueSelect , { props : { modelValue : options [ 0 ] . value , options, isDisabled : true } } ) ;
82
+
83
+ await openMenu ( wrapper , "single-value" ) ;
84
+
85
+ expect ( wrapper . findAll ( "div[role='option']" ) . length ) . toBe ( 0 ) ;
86
+ } ) ;
87
+
77
88
it ( "should close the menu after focusing and pressing tab" , async ( ) => {
78
89
const wrapper = mount ( VueSelect , { props : { modelValue : null , options } } ) ;
79
90
0 commit comments