Skip to content

renderSuspended does not handle onEvent notation #731

@pguilbert

Description

@pguilbert

Environment


  • Operating System: Linux
  • Node Version: v18.18.0
  • Nuxt Version: 3.9.3
  • CLI Version: 3.10.0
  • Nitro Version: 2.8.1
  • Package Manager: npm@10.2.3
  • Builder: -
  • User Config: devtools
  • Runtime Modules: -
  • Build Modules: -

Reproduction

https://stackblitz.com/edit/github-5sxamx?file=components%2FMyComponent.nuxt.spec.ts

Describe the bug

One convenient method for verifying that a component has emitted the expected events is to pass a prop with "onX" that contain a mocked function:

const onTest = vi.fn()
render(MyComponent, {
  props: { title: 'Test title', onTest},
});
expect(onTest).toHaveBeenCalled(); 

While this works fine with the testing library render helper, Nuxt's renderSuspended fails to pass the event handler to the component:

await renderSuspended(MyComponent, {
  props: { title: 'Test title', onTest },
});
expect(onTest).toHaveBeenCalled(); 

Additional context

No response

Logs

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions