Skip to content

Feature: adds aria-expanded filter to *ByRole #821

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

Merged
merged 3 commits into from
Dec 11, 2020

Conversation

goblindegook
Copy link
Contributor

@goblindegook goblindegook commented Nov 13, 2020

What: Adds an expanded filter to *ByRole queries.

Why: Allow supporting roles to be filtered by the aria-expanded widget attribute.

How: Implemented in a similar pattern as other attribute filters.

Checklist:

  • Documentation added to the
    docs site
  • Tests
  • Typescript definitions updated
  • Ready to be merged

@codesandbox-ci
Copy link

codesandbox-ci bot commented Nov 13, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit ea73b2a:

Sandbox Source
react-testing-library-examples Configuration

@codecov
Copy link

codecov bot commented Nov 13, 2020

Codecov Report

Merging #821 (ea73b2a) into master (21c4db3) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #821   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           26        26           
  Lines          934       941    +7     
  Branches       286       289    +3     
=========================================
+ Hits           934       941    +7     
Impacted Files Coverage Δ
src/queries/role.js 100.00% <100.00%> (ø)
src/role-helpers.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 21c4db3...ea73b2a. Read the comment docs.

Copy link
Member

@nickserv nickserv left a comment

Choose a reason for hiding this comment

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

The code looks good, though I wonder if this has an impact on *ByRole's performance

@goblindegook
Copy link
Contributor Author

I imagine the impact on performance comes before --- the change affects filtering logic that comes after that.

I am wondering though, given that in this instance we're filtering by an attribute, wouldn't it be possible to replace that container.querySelectorAll('*') at the start with a container.querySelectorAll('[aria-foo="bar"]')?

@eps1lon
Copy link
Member

eps1lon commented Nov 14, 2020

I am wondering though, given that in this instance we're filtering by an attribute, wouldn't it be possible to replace that container.querySelectorAll('*') at the start with a container.querySelectorAll('[aria-foo="bar"]')

Create a benchmark, measure and share the results. I believe I checked this in the past and only observed negligible gains.

@eps1lon
Copy link
Member

eps1lon commented Dec 11, 2020

"while dany kind of forgot"-meme format captioned with "While Sebastian kind of forgout about this PR"

@eps1lon eps1lon closed this Dec 11, 2020
@eps1lon eps1lon reopened this Dec 11, 2020
@eps1lon eps1lon merged commit f753c8a into testing-library:master Dec 11, 2020
@github-actions
Copy link

🎉 This PR is included in version 7.29.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@goblindegook goblindegook deleted the pr/aria-expanded branch December 11, 2020 18:56
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.

3 participants