-
Notifications
You must be signed in to change notification settings - Fork 20
Closed
Description
it.concurrent('test', async ({ expect }) => {
const container = document.createElement('div')
let value = false
const result = render(
() => {
function doStuff() {
console.log('hello, world!')
value = true
}
return <button onClick={doStuff} />
},
{ container }
)
const button = result.getByRole('button')
fireEvent.click(button)
expect(value).toBe(true)
})Using vitest, the button event is not fired when using a custom container. When not specified, the event works just fine:
it.concurrent('test', async ({ expect }) => {
let value = false
const result = render(
() => {
function doStuff() {
console.log('hello, world!')
value = true
}
return <button onClick={doStuff} />
}
)
const button = result.getByRole('button')
fireEvent.click(button)
expect(value).toBe(true)
})However, I prefer to have tests isolated as they can run concurrently. This works in other frameworks such as react testing lib.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels