Skip to content

Ref selector for components returns wrapper which is not isVueComponent #267

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
aiankile opened this issue Dec 15, 2017 · 3 comments
Closed
Labels

Comments

@aiankile
Copy link
Contributor

Issue: When selecting a sub-component of the main wrapper by ref, e. g. via
wrapper.find({ref: 'myRef'})
the resulting wrapper cannot execute further find or exists methods:

wrapper.find({ref: 'myRef'}).find({ref: 'myRefSubref'})

'$ref selectors can only be used on Vue component wrappers'

Possible reason: find returns new Wrapper(...) directly, without calling VueWrapper. Which in turn means, selectorTypes.OPTIONS_OBJECT is used for ref selectors no matter what the ref target is, whereas selectorTypes.VUE_COMPONENT should apply in the particular case if target is a component itself.

@eddyerburgh
Copy link
Member

eddyerburgh commented Dec 15, 2017

Thanks for the bug report 🙂

You're correct, this should return a new VueWrapper when using the ref selector.

Would you like to add a PR that fixes this issue?

@aiankile
Copy link
Contributor Author

Sure, I'll prepare a PR.

aiankile added a commit to aiankile/vue-test-utils that referenced this issue Dec 15, 2017
eddyerburgh pushed a commit that referenced this issue Dec 15, 2017
@eddyerburgh
Copy link
Member

This will be released in beta.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants