-
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
Bug: Stencil Custom Element is not stubbed #1953
Comments
Hi @paddelboot Stubs are only stubbing Vue components not web components or components from other frameworks, so this behavior is expected. Does that answer your question? |
Thanks for the quick answer. Well, that's unfortunate that we cannot just stub any non native HTML element. |
Hello @cexbrayat , do you know please if |
@wassim-ben-amor I don't think it's documented somewhere. If that was supported out of the box in VTU v1 (I don't know because I never used web components in a Vue v2 project), then it is indeed a breaking change. |
Hello @cexbrayat , sorry for adding replies to a closed thread. I just wanted to understand more the part:
The stub works correctly, but I can no more trigger custom events for example. If I keep this part in the config, I can stub the webcomponent but I can not trigger custom events from it by using |
Can you provide us a small repro online using https://stackblitz.com/github/vuejs/create-vue-templates/tree/main/typescript-vitest?file=src%2Fcomponents%2F__tests__%2FHelloWorld.spec.ts ? It only takes a few minutes, and we'll be able to take a look |
Hello @cexbrayat , Just FYI, I thought about a workaround by having the possibility to edit the vitest config dynamically (decide on each mount if we want to enable custom elements or not, so we decide to go with scneario 1 or scenario2). But it seems to be not possible and these configs can not be changed during the test. I have created a thread on vite-plugin-vue to evaluate this possibility. |
@wassim-ben-amor Thanks for the reproductionsand yes, I think it is the expected behaviors. Especially 2 because you are in fact running into #2087, so vm.$emit is the way to go for now |
Describe the bug
Stencil Custom Element is not being stubbed
To Reproduce
In
App.vue
we import a Stencil custom element:In our test file, we try to stub this element:
Expected behavior
web-component-loader
should be stubbed. Instead, it is rendered fully.The text was updated successfully, but these errors were encountered: