-
Notifications
You must be signed in to change notification settings - Fork 727
docs: fix reference error in code sample #947
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
Conversation
@@ -51,8 +51,8 @@ export function getByTestId(...args) { | |||
const result = getAllByTestId(...args) | |||
if (result.length > 1) { | |||
throw queryHelpers.getElementError( | |||
`Found multiple elements with the [data-test-id="${id}"]`, | |||
container, | |||
`Found multiple elements with the [data-test-id="${args.id}"]`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While the current example isn't correct, I think that suggestion also isn't valid.
args
is an array in this case, so accessing id
and container
won't work.
I can't make a suggestion on the getByTestId
method, but I believe the arguments should be:
export function getByTestId(container, id, ...rest)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah you are right I'll correct it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one more thingy,
- const result = getAllByTestId(...args)
+ const result = getAllByTestId(container, id, ...rest)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops, thank you. I swear I've written code before 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @lukeingalls
@all-contributors please add @lukeingalls for docs |
I've put up a pull request to add @lukeingalls! 🎉 |
No description provided.