Skip to content

Allow array values for select.setValue #1505

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bugy opened this issue Apr 12, 2020 · 2 comments · Fixed by #1554
Closed

Allow array values for select.setValue #1505

bugy opened this issue Apr 12, 2020 · 2 comments · Fixed by #1554

Comments

@bugy
Copy link
Contributor

bugy commented Apr 12, 2020

What problem does this feature solve?

In #775, select.setValue('abc') support was added (https://vue-test-utils.vuejs.org/api/wrapper/#setvalue)
It would be nice to extend this method and support array values when it's a multiselect.

If you don't mind, I could try making a PR

What does the proposed API look like?

const wrapper = mount(Foo)
wrapper.get('select').setValue(['abc', 'def'])
@lmiller1990
Copy link
Member

I thought this was already supported 🤔

If not, sure, we should support this!

@bugy
Copy link
Contributor Author

bugy commented May 21, 2020

Hi, I finally found a time for a PR: #1554
:)

lmiller1990 pushed a commit that referenced this issue May 22, 2020
* feat(wrapper.setvalue): allow array for multiselect .setValue() method

enables Wrapper.setValue() method to accept array value for select elements (requires select to have
an attribute 'multiple' or 'multiple="true"')

fix #1505

* fix "missing property" error

* Update test/specs/wrapper/setValue.spec.js

Co-authored-by: Adrià Fontcuberta <[email protected]>

* Update test/specs/wrapper/setValue.spec.js

Co-authored-by: Adrià Fontcuberta <[email protected]>

Co-authored-by: Adrià Fontcuberta <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants