Skip to content

Commit 7267da4

Browse files
committed
Merge branch 'feat/to-be-visible' of github.com:fluiddot/jest-native into feat/to-be-visible
2 parents 4d09779 + 8bde02c commit 7267da4

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,7 @@ An element is visible if **all** the following conditions are met:
325325
- it does not have its style property `display` set to `none`.
326326
- it does not have its style property `opacity` set to `0`.
327327
- it is not a `Modal` component or it does not have the prop `visible` set to `false`.
328-
- it is accessible (i.e. `accessibilityElementsHidden` prop is not defined or `false`, and
329-
`importantForAccessibility` prop is not equal to `no-hide-descendants`).
328+
- it is not hidden from accessibility as checked by [`isInaccessible`](https://callstack.github.io/react-native-testing-library/docs/api#isinaccessible) function from React Native Testing Library
330329
- its ancestor elements are also visible.
331330

332331
#### Examples

src/__tests__/to-be-visible.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,15 @@ describe('.toBeVisible', () => {
8080
expect(getByTestId('test')).not.toBeVisible();
8181
});
8282

83-
test('handles innacessible view (iOS)', () => {
83+
test('handles inaccessible view (iOS)', () => {
8484
const { getByTestId, update } = render(<View testID="test" accessibilityElementsHidden />);
8585
expect(getByTestId('test')).not.toBeVisible();
8686

8787
update(<View testID="test" accessibilityElementsHidden={false} />);
8888
expect(getByTestId('test')).toBeVisible();
8989
});
9090

91-
test('handles view within innacessible view (iOS)', () => {
91+
test('handles view within inaccessible view (iOS)', () => {
9292
const { getByTestId } = render(
9393
<View accessibilityElementsHidden>
9494
<View>
@@ -99,7 +99,7 @@ describe('.toBeVisible', () => {
9999
expect(getByTestId('test')).not.toBeVisible();
100100
});
101101

102-
test('handles innacessible view (Android)', () => {
102+
test('handles inaccessible view (Android)', () => {
103103
const { getByTestId, update } = render(
104104
<View testID="test" importantForAccessibility="no-hide-descendants" />,
105105
);
@@ -109,7 +109,7 @@ describe('.toBeVisible', () => {
109109
expect(getByTestId('test')).toBeVisible();
110110
});
111111

112-
test('handles view within innacessible view (Android)', () => {
112+
test('handles view within inaccessible view (Android)', () => {
113113
const { getByTestId } = render(
114114
<View importantForAccessibility="no-hide-descendants">
115115
<View>

0 commit comments

Comments
 (0)