Skip to content

Allow stubbed components to receive any props even if the child component does not contain them #815

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
miriamgreis opened this issue Jul 11, 2018 · 2 comments

Comments

@miriamgreis
Copy link

What problem does this feature solve?

In the tests of our project, we shallowMount a component with many sub components. One of these sub component receives a complex property. The property is however not part of the sub component, but part of a mixin. We want to test that the complex property, which contains a function call, works correctly.

Currently, the property is registered as an attribute on the stub as it is not recognised as a property. This doesn't allow us to call the function and test that it is passed correctly.

Here is a small working example to make the problem more clear: https://github.com/miriamgreis/vue-test-utils-getting-started

We use a workaround and register the mixin globally for the test case to be able to test the property as we do not want to mount the whole component with all its sub components. However, this leads to Vue warnings that a required property is missing for all other sub components.

What does the proposed API look like?

We suggest to allow stubbed component to receive any properties no matter whether they are part of the stubbed component or not to make it easier to test properties of mixins.

@miriamgreis
Copy link
Author

We realised that this is even more important with Vuetify components. Components such as v-select do not have any properties as they are all part of mixins. So there is no good solution to test whether the right properties are passed.

@ebisbe
Copy link
Collaborator

ebisbe commented Feb 15, 2023

#1564 (comment)

@ebisbe ebisbe closed this as completed Feb 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants