You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I want to simulate a user selection on a multi-select element (a select element which have the mulitple attribute).
Describe the solution you'd like
I'd like that, when I gave several values to setValue, all the matching options are selected inside the select element.
Describe alternatives you've considered
Looking at what has been done in test-utils v1, I created this Typescript utility function that does the trick:
Is your feature request related to a problem? Please describe.
I want to simulate a user selection on a multi-select element (a
select
element which have themulitple
attribute).Currently, if I do this in my test:
await wrapper.find('select').setValue('1');
My
doSomething
function receives an event, whosetarget.selectedOptions
contains the selection of a single element.But when I do this:
await wrapper.find('select').setValue(['1', '2']);
My
doSomething
function receives an event, whosetarget.selectedOptions
is an empty array.It's like
setValue
accepts an array as argument, but does not process it properly. I found no way to simulate a multiple selection.EDIT:
Checking the source code, the multiple select is not handled at all:
It has been done in test-utils v1 though : https://github.com/vuejs/vue-test-utils/pull/1554/files
Describe the solution you'd like
I'd like that, when I gave several values to
setValue
, all the matching options are selected inside theselect
element.Describe alternatives you've considered
Looking at what has been done in test-utils v1, I created this Typescript utility function that does the trick:
I can use it like this:
await setSelected('1', '2');
and mydoSomething
function receives the right selected options.The text was updated successfully, but these errors were encountered: