fix: toBeDisabled now also evaluates disabled prop when element is Text#1802
fix: toBeDisabled now also evaluates disabled prop when element is Text#1802mdjastrzebski merged 3 commits intocallstack:mainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1802 +/- ##
==========================================
+ Coverage 95.25% 95.33% +0.08%
==========================================
Files 94 94
Lines 5247 5253 +6
Branches 569 575 +6
==========================================
+ Hits 4998 5008 +10
+ Misses 249 245 -4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@mdjastrzebski Would it be possible to merge this into v12 too? It'd be a huge help, as our team is currently skipping v13. We're doing this to avoid |
|
@rarenatoe You should be able to use v13 without serious effort.
Which version of React & React Native are you on? |
|
I am on react 18.3.1 and react-native 0.77.3 |
Summary
Resolves #1801 by ensuring
Textcomponents with thedisabledprop are correctly identified as disabled bycomputeAriaDisabled.Previously,
computeAriaDisableddidn't check for thedisabledprop onTextelements, causing queries likegetByRole('text', { disabled: true })to fail. The change adds a check to returntruewhenisHostText(element)andprops.disabledare both true, aligningreact-native-testing-library's behavior with expected accessibility states.Test plan
New unit tests have been added for
computeAriaDisabledto verify this change. These tests cover:Textcomponent withdisabled={true}: AssertscomputeAriaDisabledreturnstrue.Textcomponent withoutdisabledprop ordisabled={false}: AssertscomputeAriaDisabledreturnsfalse.Existing
TextInputbehavior: Ensures non-editableTextInputcomponents are still correctly identified as disabled.aria-disabledandaccessibilityState.disabledprops: Verifies these existing checks continue to function.The new
computeAriaDisabledtests should pass, demonstrating correct handling of thedisabledprop onTextcomponents.