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

feat: toBeExpanded matcher #1497

Merged
merged 4 commits into from Sep 19, 2023

Conversation

siepra
Copy link
Contributor

@siepra siepra commented Sep 13, 2023

Summary

Part of Jest matchers migration
Following the example of #1493

Test plan

yarn test

@codecov
Copy link

codecov bot commented Sep 13, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.02% 🎉

Comparison is base (d898a9d) 98.09% compared to head (c6d182f) 98.12%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1497      +/-   ##
==========================================
+ Coverage   98.09%   98.12%   +0.02%     
==========================================
  Files          94       96       +2     
  Lines        5630     5704      +74     
  Branches      873      885      +12     
==========================================
+ Hits         5523     5597      +74     
  Misses        107      107              
Files Changed Coverage Δ
src/helpers/accessiblity.ts 100.00% <100.00%> (ø)
src/matchers/extend-expect.ts 100.00% <100.00%> (ø)
src/matchers/to-be-collapsed.tsx 100.00% <100.00%> (ø)
src/matchers/to-be-expanded.tsx 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mdjastrzebski
Copy link
Member

@siepra thanks for submitting this PR. During our experiments with iOS/Android RN runtime we've noticed that expanded: false state is behaving different than omitting the expanded entry. Detailed behavior here: https://github.com/callstack/react-native-testing-library/wiki/Accessibility:-State#expanded-state

Basically, RN treats explicit expanded: false as "collapsed" state, where as lack of expanded state means that this is neither expanded nor no collapsed. Therefore, it would make sense to introduce, in this PR, additional matcher of toBeCollapsed which would check expanded === false condition. Pls add isElementCollapsed as well + relevant tests.

Copy link
Member

@mdjastrzebski mdjastrzebski left a comment

Choose a reason for hiding this comment

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

Looks good! ✅

@mdjastrzebski mdjastrzebski merged commit a9f32a6 into callstack:main Sep 19, 2023
9 checks passed
@mdjastrzebski
Copy link
Member

🎉 Release in version: v12.4.0

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.

None yet

2 participants