Skip to content
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

Edit isCustomElement filtering during vitest runtime #283

Open
5 of 6 tasks
wassim-ben-amor opened this issue Nov 3, 2023 · 0 comments
Open
5 of 6 tasks

Edit isCustomElement filtering during vitest runtime #283

wassim-ben-amor opened this issue Nov 3, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@wassim-ben-amor
Copy link

Related plugins

Description

Using Vitest based on vite config, when using for example:

    vue({
      customElement: true,
      template: {
        compilerOptions: {
          isCustomElement: tag => tag.includes('-'),
        },
      },
    }),

I want to be able to edit the isCustomElement filtering during the test run. In fact, when testing web components using vue test utils, there are 2 scenarios:
1- If isCustomElement is set to true on this webcomponent, we can no more apply a stub on it as it is totally ignored. But we can still do wrapper.find(...).trigger('customEvent', { detail: 'HelloWorld' })
2- If isCustomElement is set to false on this webcomponent, it's possible to createa stub for this component, but without creating a stub It is no more possible to trigger custom events, as we can only trigger DOM events, for example click, submit or keyup but no custom events.

Suggested solution

During the test case, before launching the mount(). If we have the ability to change the isCustomElement filtering. We can decide which scenario we can apply:
1- no stubs but ability to fire custom events
2- stubs but no ability to fire custom events

Alternative

I didn't find any alternative to have all the possibilities: Ability to stub the webcomponent & Ability to fire custom events

Additional context

No response

Validations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants