-
Notifications
You must be signed in to change notification settings - Fork 244
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
need export createWrapper #283
Comments
Hi @gzponline Until now, we did not need to export Do you have a use-case where you need |
if create a new Vue instance in a component such as popper, tooltips, datepick table UI component, their sub-component will use data or methods of their parent component, and some components maybe append their sub-component DOM to , wapper.find can not find them.so I can not trigger some event in it I will try to make a demo in this repo later, and if you have other suggestions for this, please tell me @cexbrayat |
If I understand correctly, I think you are looking for See https://vue-test-utils.vuejs.org/v2/guide/stubs-shallow-mount.html I usually do something like (if I want to stub the const wrapper = mount(Bet, {
global: {
stubs: {
RouterLink: true
}
}
}); Then you can still use
Does that work for you? |
@cexbrayat <el-tooltip class="item" effect="dark" content="Top Left prompts info" placement="top-start">
<el-button>top-start</el-button>
</el-tooltip> https://element.eleme.io/#/en-US/component/tooltip in this component will create a VM node and use PopperJS render it. this.popperVM.node = (
<transition
name={this.transition}
onAfterLeave={this.doDestroy}>
<div
role="tooltip"
aria-label={ariaLabel}
id={this.tooltipId}
aria-hidden={(this.disabled || !this.showPopper) ? 'true' : 'false'}
v-show={!this.disabled && this.showPopper}
class={
['zm-tooltip__popper', 'is-' + this.effect, this.popperClass, this.breakWord ? 'is-break-word' : '']
}>
{this.$slots.content || this.content}
</div>
</transition>); this.popperJS = new PopperJS(reference, popper, options); this popper is not child dom in our before in vue-test-utils (vue.js 2.~), we use createWrapper to get a wrapper then trigger event , but in this next version, I find this function is not export. I do not know if you understand me, there are many other component use this way, especially some complex component in my team, table and picker all render by this way. and it puzzles me a long time 😄 I will try to make a simple demo not depending on myself code, maybe it will be easy to understand,and I think createWrapper is usefull |
@gzponline A simple demo to illustrate your use-case would be awesome 👍 |
I think we should just export it - any reason why this should be internal, when |
Going to close this for now - no follow up from OP. I don't really see a problem exposing this, though. We won't document If someone else has this need just make a PR exporting |
hey @lmiller1990 I don't know if this has been addressed in any other way by now, but my use-case is that I am mounting a modal component, but the modal itself gets rendered at the root of the document.
Basically what I want is
|
Hi @lmiller1990 , In my current project we have the following code, which is a utility to create a download link from a blob and click it without user interaction to download files.
It doesn't contain a Vue component, but since we use VTU to test the rest of the app, we used
We can work around it in this case and assert on the Is there maybe a different way of having a Wrapper around the |
Should we just export |
I found a workaround actually. Not sure if that is "clean" or a hack tbh.
So maybe a hint in the documentation would be sufficient for people who have similar use cases as me. |
👍 Nice to hear you found what you were looking for @AntonioDell |
vue-test-utils-next we export these:
I think 'createWrapper' also needs to be exported to the user... or will we use other opinions?
and in doc I did not find about this,
if need I can create a pull request export createWrapper
The text was updated successfully, but these errors were encountered: