Closed
Description
Describe the Feature
toBeVisible
is a Jest DOM matcher that asserts the visibility of given element by inspecting various CSS styles and other semantic attributes that might make element invisible.
Adapting it to our case it would assert the value in TextInput
host elements, to match given value.
Possible Implementations
Proposed API:
export function toBeVisible(
this: jest.MatcherContext,
element: ReactTestInstance
)
The matcher should:
- Validate that it is invoked on host element
- Check visibility status of given element and all of it's ancestors
Each matcher should have a fairly comprehensive test suite.
Open Questions:
- should this matcher take into account accessibility props? Consider use cases and pros and cons,
Links
toBeVisible
matcher code from Jest DOM: https://github.com/testing-library/jest-dom/blob/main/src/to-be-visible.jstoBeVisible
implementation for Jest Native: https://github.com/testing-library/jest-native/blob/main/src/to-be-visible.ts