Closed
Description
The library README includes the following bit of sample code when suggesting how to write a custom renderer in order to change the 'testid' attribute:
const customRender = (container, options) => {
const utils = render(container, options)
return {
...utils,
getByTestId: getByTestId.bind(container),
getAllByTestId: getAllByTestId.bind(container),
queryByTestId: queryByTestId.bind(container),
queryAllByTestId: queryAllByTestId.bind(container),
}
}
I might have got completely the wrong end of the stick, but should those .bind()
calls not have en extra first null
parameter? Otherwise they're passing container
in as the this
value to those functions rather than as the first parameter, as I think is intended?
Suggested solution:
Change them all to .bind(null, container)
Happy to submit a PR...
Metadata
Metadata
Assignees
Labels
No labels