-
Notifications
You must be signed in to change notification settings - Fork 266
Mounting only the slots of stubbed child components #69
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
So what does does, is render all the slots of a component? For simpler cases (pure unit tests) I guess that would be OK, when you dont rely on scopedSlots or slots rendering conditionally. Even though it makes sense, I think this will either have to stay in user land, or will be exported as a separate utility, similar to what you have now. Current implementation is: stubbed components are just plain elements tags, that do not render any of their slots. |
It's not documented anywhere because it's not intended behavior, but rather a side effect of poorly implemented You are welcome to play with the I agree that this probably doesn't really belong as a core behavior; no other testing frameworks do this, and they get by fine (including Enzyme, which has a |
@dobromir-hristov is looking into this. The idea is looking to be to provide this as a config users can enable, so you can have the behavior you like. eg |
Another use case for this to shallow mount a view/component that contains a 3rd-party component. Where you don't want to load the complexity of that 3rd party component, but you do want to test your code being passed into the slot. It can make snapshots more useful and less cluttered. |
Let's chat about this in here #108 This could be a helper. I don't mind having this feature. |
use the renderStubDefaultSlot: true to solve it.
|
Original: vuejs/vue-test-utils#1216
What problem does this feature solve?
We currently have a helper file in our codebase we pull in to testing files, it contains this beauty:
It would be nice if there was a more elegant way of handling this, or at least better documented (not requiring links to 3 different places).
What does the proposed API look like?
That helper function gets used like so:
I think it would be nicer if there was something like that built in, so we could just do this:
We use this helper a lot, it seems like the kind of common "utility" that would be in Vue-Test-Utils.
The text was updated successfully, but these errors were encountered: