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(ByRole): Constrain API #1211

Merged
merged 3 commits into from
Feb 9, 2023

Conversation

eps1lon
Copy link
Member

@eps1lon eps1lon commented Feb 6, 2023

BREAKING CHANGE: Only allow string as a role.
Drop support for exact, trim, collapseWhitespace, and normalizer options.

What:

Closes #1202

Why:

Options are not needed as far as I can tell. From the tests we have, it seems to me this encourages rather bad queries. Will ship this soon-ish (since it's just an alpha) to test.

How:

Checklist:

Only allow `string` as a `role`.
Drop support for `exact`, `trim`, `collapseWhitespace`, and `normalizer` options.
@eps1lon eps1lon changed the title feat: Drop support for Node.js 12.x (#1207) fix(ByRole): Constraint API Feb 6, 2023
@eps1lon eps1lon changed the title fix(ByRole): Constraint API fix(ByRole): Constrain API Feb 6, 2023
@codesandbox-ci
Copy link

codesandbox-ci bot commented Feb 6, 2023

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 deaeef2:

Sandbox Source
react-testing-library-examples Configuration

@eps1lon eps1lon marked this pull request as draft February 6, 2023 19:02
@eps1lon eps1lon marked this pull request as ready for review February 6, 2023 19:04
@codecov
Copy link

codecov bot commented Feb 6, 2023

Codecov Report

Merging #1211 (deaeef2) into alpha (42809fe) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##             alpha     #1211   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           24        24           
  Lines         1000       992    -8     
  Branches       328       322    -6     
=========================================
- Hits          1000       992    -8     
Flag Coverage Δ
node-14 100.00% <100.00%> (ø)
node-16 100.00% <100.00%> (ø)
node-18 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/queries/role.ts 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Member

@timdeschryver timdeschryver left a comment

Choose a reason for hiding this comment

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

👍 I like the change, I think this guards us against misusage of it and also remove some confusion

@eps1lon eps1lon merged commit 746def6 into testing-library:alpha Feb 9, 2023
@eps1lon eps1lon deleted the fix/constrain-by-role branch February 9, 2023 12:34
@eps1lon eps1lon mentioned this pull request Feb 9, 2023
@remidej
Copy link

remidej commented May 17, 2023

Hello! I know byRole often has perf issues when used on large dom nodes. Do you expect this PR to improve the performance?

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.

3 participants