Open pguilbert opened 5 months ago
https://stackblitz.com/edit/github-5sxamx?file=components%2FMyComponent.nuxt.spec.ts
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:
render
renderSuspended
await renderSuspended(MyComponent, { props: { title: 'Test title', onTest }, }); expect(onTest).toHaveBeenCalled(); โ
No response
Environment
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:
While this works fine with the testing library
render
helper, Nuxt'srenderSuspended
fails to pass the event handler to the component:Additional context
No response
Logs
No response