-
Notifications
You must be signed in to change notification settings - Fork 668
Invalid behavior of shallowMount
on testing a child component that uses custom v-model
#965
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
Comments
shallowMount
, there is invalid behavior on testing a child component that uses custom v-model
to pass the propsshallowMount
on testing a child component that uses custom v-model
Yes, I can also confirm that passing properties via custom v-model to a stubbed component does not work. |
I think we have a similar issue using
|
I just ran into this issue. My child component has defined a custom v-model using https://vuejs.org/v2/guide/components-custom-events.html#Customizing-Component-v-model In my test I stub the child. The HTML looks like this
Despite being stubbed, the child still logs a warning
|
Version
1.0.0-beta.25
Reproduction link
https://github.com/chenxeed/reproduce-bug-vue-test-utils
Steps to reproduce
(Best to clone and try this github repo to reproduce the bugs on running the unit test)
https://github.com/chenxeed/reproduce-bug-vue-test-utils
To reproduce:
v-model
v-model
to pass the props. Make the props as "required"shallowMount
to test if the data passed to the child component throughv-model
is working or notWhat is expected?
The test should able to detect the passed data from the parent component to the child component with custom
v-model
. This is working inmount
, but notshallowMount
.What is actually happening?
The value passed from parent component to child component is not detected, and it shows warning "[Vue warn]: Missing required prop" instead.
I need to be able to test this scenario with
shallowMount
, because I'm testing a Page component that has a lot of child components and I don't want to render all by usingmount
, since I just want to test the Page components logic and its interface with the child components.The text was updated successfully, but these errors were encountered: