-
-
Notifications
You must be signed in to change notification settings - Fork 991
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
Is multiselect testable? #365
Comments
It would be nice to be able to pass it something that it can build css with so testing with headless frameworks can be easier. Every time we add another multiselect to the view it breaks our integration tests. |
Working on it :) |
@shentao that's awesome news, any eta yet? and anything we can do to help with this feature? |
Hopefully it will be released this weekend :) |
@shentao thats amazing. We are so stoked as this will address a major pain point for us right now. You guys rock 👍 |
Any news on this? |
If this is really what you need you can pass a custom
Wdyt? |
Works for me! Thanks! |
No problem. Happy to help! :) |
I haven't still being able to dusk test a form that uses vue-multiselect. If I pass a custom option using @shentao sugestion, how do I use to select the option in a dusk test? |
Same for me. I don't understand what that answer does and how it helps. |
If someone needs to use cypress with vue-multiselect <multiselect Cypress test |
You can also create a custom command for cypress like this:
then, you can call it like this: |
@svenssontobias thanks for guiding me to a solution for Dusk, which is $browser->keys('.multiselect[data-dusk="job-type"]', 'Option', '{enter}') and <multiselect
data-dusk="job-type"
:allow-empty="false"
class="form-control"
:class="{ 'is-invalid': errors[0] }"
v-model="job.type"
:options="types"
@close="validateStatus()"
></multiselect> |
Be aware if you run this command on the same field multiple times, the slice() will have a strange behaviour for each following call. It would be better to use trim() instead. |
A solution that I found was working for me (after trying the solutions mentioned above) was to set a
Basically, the idea is to initially open the multiselect and then to find the element we want to select based on it's text instead of a non existent id or using child element searching. |
Thanks @alexgil1994 !! this solution works for me as well |
I am using Laravel Dusk to test my website. I am having problems testing vue-multiselect components. I can click the multiselect itself, but I can not click a particular option as the
<li></li>
is not marked by the value of the option, so I can't pinpoint it with a css selector.Is there a way to pinpoint a specific option in vue-multiselect?
Seems like a common problem, strange that it isn't already addressed.
The text was updated successfully, but these errors were encountered: