0👍
The answer is that you should not do that. Because BaseSelector
should have it’s own tests in which you should test behavior changes through the setProps
.
But if you can’t do this for some reason, here what you can do:
- Check the props passed to
BaseSelector
. They always depend on some reactive data (props
,data
, orcomputed
) - Change those data in
MyForm
instead.
For example
// MyForm.vue
data() {
return {
servicePicker: {data: null}
}
}
// test.js
wrapper = mount(MyForm)
wrapper.setData({servicePicker: {data: [...some data]})
expect(wrapper.findComponent(BaseSelector)).toDoSomething()
But I suggest you to cover the behavior of BaseSelector
in separate test by changing it’s props or data. And then in the MyForm
‘s test you should just check the passed props to BaseSelector
expect(wrapper.findComponent(BaseSelector).props('options')).toEqual(expected)
- [Vuejs]-How to upload file using laravel vue api?
- [Vuejs]-Why tailwind ui not rendered correctly in vue?
Source:stackexchange.com