testing-library/jest-native

Matcher toBeDisabled does not take into account the editable prop of TextInput

HugoChollet opened this issue · 3 comments

Problem / Feature Request

The matcher toBeDisabled does not take into account the editable prop of the <TextInput /> component.

render(<TextInput testId="input" editable={false}/>)
expect(screen.getByTestId("input")).toBeDisabled() // will fail

In the readme.md, it says:

Check whether or not an element is disabled from a user perspective

In my opinion when we have <TextInput editable={false}/> the element appears to be disabled from a user perspective

What do you think of adding the editable prop into the checks of the matcher toBeDisabled ?

Environment

@testing-library/react-native version: 11.3.0
jest-preset: react-expo
react-native version: 0.69.6
node version: 18.11

Agreed, that would be a nice addition to have

@HugoChollet Would you like to contribute a PR for this?

close by #135