Skip to content

feat: add semantic html elements implicit role support to queryByRole… #280

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

szabototo89
Copy link
Contributor

@szabototo89 szabototo89 commented Jun 8, 2019

…/getByRole selectors (#262)

  • Add aria-query library as a dependency

  • Extend queryByRole to use aria-query ARIA roles to identify semantic HTML elements

What: queryAllByRole function has been extended to find semantic HTML elements by role. So users don't need to anymore explicitly specify role attributes to find elements.

Why: It makes dom-testing-library more convenient to use.

How: queryAllByRole function has been extended to find HTML elements based on HTML element names and attributes. aria-query library has been used for get elements-role mapping.

Checklist:

  • Documentation added to the
    docs site
  • Typescript definitions updated (there was no API change)
  • Tests
  • Ready to be merged

…/getByRole selectors (testing-library#262)

* Add aria-query library as a dependency

* Extend queryByRole to use aria-query ARIA roles to identify semantic HTML elements
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 amazing. I'm only now realizing the impact of this feature. I hope that we can promote the ByRole queries more in the docs. This is honestly huge. Thank you so much!!!

@kentcdodds kentcdodds merged commit 4b2e8a5 into testing-library:master Jun 8, 2019
@kentcdodds
Copy link
Member

Seriously. Thank you!

@kentcdodds
Copy link
Member

@all-contributors please add @szabototo89 for code and tests

@allcontributors
Copy link
Contributor

@kentcdodds

I've put up a pull request to add @szabototo89! 🎉

@kentcdodds
Copy link
Member

🎉 This PR is included in version 5.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@kentcdodds
Copy link
Member

I couldn't find your twitter username, but here's a thank-you tweet as well: https://twitter.com/kentcdodds/status/1137446728724930565

@szabototo89
Copy link
Contributor Author

szabototo89 commented Jun 8, 2019

I'm happy to help! :) Thank you very much! My twitter name is @szabototo (https://twitter.com/szabototo)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants