Skip to content
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

fix: use exact match for data-testid #29

Conversation

alexkrolick
Copy link
Collaborator

[fixes #8]

What:

Why:

How:

Checklist:

  • ~~~Documentation~~~
  • Tests
  • Ready to be merged
  • Added myself to contributors table

@alexkrolick
Copy link
Collaborator Author

alexkrolick commented May 4, 2018

Need to add tests to exercise error paths for matchesExact

EDIT: done

export {matches}
function matchesExact(textToMatch, node, matcher) {
if (typeof textToMatch !== 'string') {
return false
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only line not exercised by public api tests because the exact match is already pre-filtered with querySelectorAll in queryAllByAttribute. Added unit tests for the matchers instead to document match behavior.

Copy link
Member

@kentcdodds kentcdodds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks great. Let's just fix that failing test and we should be good to go!

Copy link
Member

@kentcdodds kentcdodds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great! Thanks for this.

@kentcdodds kentcdodds merged commit 7bab309 into testing-library:master May 4, 2018
@alexkrolick alexkrolick deleted the fix/case-sensitive-data-attributes branch May 4, 2018 19:33
@kentcdodds
Copy link
Member

🎉 This PR is included in version 1.10.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

alexkrolick pushed a commit to alexkrolick/dom-testing-library that referenced this pull request Sep 13, 2018
* docs(contributors): add sompylasar

* docs(contributors): fix @lgandecki missing docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

queryByTestId, getByTestId use partial case-insensitive text match by default, which is unexpected
2 participants