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

chore: deprecate some a11y queries #1226

Merged
merged 11 commits into from
Jan 28, 2023
Merged

Conversation

mdjastrzebski
Copy link
Member

@mdjastrzebski mdjastrzebski commented Nov 15, 2022

Summary

Make *ByA11yState and *ByA11yValue queries deprecated, redirecting user to use *ByRole queries or toHaveAcessbibilityState/Value() matchers.

When doing any of the mentioned queries, user will received following warning to console:

getByA11yValue(...) is deprecated and will be removed in the future.
      
Use expect(...).toHaveAccessibilityValue(...) matcher o rgetByRole(role, { value: ... }) query instead.
getByAccessibilityState(...) is deprecated and will be removed in the future.
 
Use getByRole(role, { disabled, selected, checked, busy, expanded }) query or expect(...).toHaveAccessibilityState(...) matcher instead.

Resolves #1208

Test plan

Add tests for deprecation messages warnings.

@mdjastrzebski mdjastrzebski changed the title feat: deprecate some a11y queries [WIP] feat: deprecate some a11y queries Dec 29, 2022
@mdjastrzebski mdjastrzebski force-pushed the feat/deprecate-some-a11y-queries branch from 4fae1c7 to 2078fa5 Compare January 27, 2023 10:55
@mdjastrzebski mdjastrzebski requested review from MattAgn, AugustinLF and pierrezimmermannbam and removed request for MattAgn and AugustinLF January 27, 2023 10:57
@mdjastrzebski mdjastrzebski marked this pull request as ready for review January 27, 2023 10:57
@mdjastrzebski mdjastrzebski changed the title [WIP] feat: deprecate some a11y queries chore: deprecate some a11y queries Jan 27, 2023
getByAccessibilityState: getByA11yState,
getAllByAccessibilityState: getAllByA11yState,
queryByAccessibilityState: queryByA11yState,
queryAllByAccessibilityState: queryAllByA11yState,
findByAccessibilityState: findByA11yState,
findAllByAccessibilityState: findAllByA11yState,
},
'AccessibilityState',
'Role(role, { disabled, selected, checked, busy, expanded }) query or expect(...).toHaveAccessibilityState(...) matcher'
'Use {queryPrefix}ByRole(role, { disabled, selected, checked, busy, expanded }) query or expect(...).toHaveAccessibilityState(...) matcher instead.'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Great refactor !

Copy link
Collaborator

@pierrezimmermannbam pierrezimmermannbam left a comment

Choose a reason for hiding this comment

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

Looks very good ! Great deprecation warnings and documentation

src/queries/a11yState.ts Outdated Show resolved Hide resolved
src/queries/__tests__/a11yState.test.tsx Outdated Show resolved Hide resolved
website/docs/Queries.md Outdated Show resolved Hide resolved
website/docs/Queries.md Outdated Show resolved Hide resolved
src/queries/a11yState.ts Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Jan 28, 2023

Codecov Report

Base: 95.98% // Head: 96.04% // Increases project coverage by +0.06% 🎉

Coverage data is based on head (7ef6445) compared to base (897b7de).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1226      +/-   ##
==========================================
+ Coverage   95.98%   96.04%   +0.06%     
==========================================
  Files          47       49       +2     
  Lines        3240     3290      +50     
  Branches      489      494       +5     
==========================================
+ Hits         3110     3160      +50     
  Misses        130      130              
Impacted Files Coverage Δ
src/helpers/deprecation.ts 100.00% <100.00%> (ø)
src/helpers/query-name.ts 100.00% <100.00%> (ø)
src/queries/a11yState.ts 100.00% <100.00%> (ø)
src/queries/a11yValue.ts 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@mdjastrzebski mdjastrzebski merged commit 8bd1952 into main Jan 28, 2023
@mdjastrzebski mdjastrzebski deleted the feat/deprecate-some-a11y-queries branch January 28, 2023 21:31
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.

Call for maintainers: Flow types
4 participants