eddyerburgh / avoriaz

🔬 a Vue.js testing utility library
https://eddyerburgh.gitbooks.io/avoriaz/content/
MIT License
758 stars 62 forks source link

Mock $refs when rendering shallow component #147

Open adamyarger opened 7 years ago

adamyarger commented 7 years ago

Is there any way to mock or stub $refs when using shallow to render a component?

I have a child component that takes quite a bit to get set up for testing, so using shallow is a nice way to make my tests less brittle. What I've now run into is that the child component is not recognized inside the $refs object. Is there a way to stub or mock a ref when using shallow?

eddyerburgh commented 7 years ago

Not currently.

I would happily accept a PR that added a refs option where you could pass an object. Unfortunately I don't have time at the moment to implement it myself 😞