@testing-library/react-native 12.2.0 → 12.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/fireEvent.js +1 -1
- package/build/fireEvent.js.map +1 -1
- package/build/helpers/component-tree.d.ts +11 -5
- package/build/helpers/component-tree.js +5 -1
- package/build/helpers/component-tree.js.map +1 -1
- package/build/helpers/findAll.d.ts +2 -1
- package/build/helpers/findAll.js +2 -1
- package/build/helpers/findAll.js.map +1 -1
- package/build/helpers/host-component-names.d.ts +11 -2
- package/build/helpers/host-component-names.js +10 -0
- package/build/helpers/host-component-names.js.map +1 -1
- package/build/helpers/matchers/matchLabelText.js +1 -1
- package/build/helpers/matchers/matchLabelText.js.map +1 -1
- package/build/queries/a11yState.js +1 -1
- package/build/queries/a11yState.js.map +1 -1
- package/build/queries/a11yValue.js +1 -1
- package/build/queries/a11yValue.js.map +1 -1
- package/build/queries/displayValue.js +5 -6
- package/build/queries/displayValue.js.map +1 -1
- package/build/queries/hintText.js +1 -1
- package/build/queries/hintText.js.map +1 -1
- package/build/queries/labelText.js +1 -1
- package/build/queries/labelText.js.map +1 -1
- package/build/queries/placeholderText.js +3 -4
- package/build/queries/placeholderText.js.map +1 -1
- package/build/queries/role.js +1 -1
- package/build/queries/role.js.map +1 -1
- package/build/queries/testId.js +3 -3
- package/build/queries/testId.js.map +1 -1
- package/build/queries/text.js +1 -2
- package/build/queries/text.js.map +1 -1
- package/build/render.js.map +1 -1
- package/build/user-event/clear.d.ts +3 -0
- package/build/user-event/clear.js +41 -0
- package/build/user-event/clear.js.map +1 -0
- package/build/user-event/index.d.ts +1 -0
- package/build/user-event/index.js +2 -1
- package/build/user-event/index.js.map +1 -1
- package/build/user-event/press/press.js +1 -4
- package/build/user-event/press/press.js.map +1 -1
- package/build/user-event/setup/setup.d.ts +14 -2
- package/build/user-event/setup/setup.js +3 -1
- package/build/user-event/setup/setup.js.map +1 -1
- package/build/user-event/type/type.d.ts +2 -1
- package/build/user-event/type/type.js +8 -4
- package/build/user-event/type/type.js.map +1 -1
- package/build/user-event/utils/host-components.d.ts +2 -0
- package/build/user-event/utils/host-components.js +11 -0
- package/build/user-event/utils/host-components.js.map +1 -0
- package/build/user-event/utils/index.d.ts +1 -0
- package/build/user-event/utils/index.js +11 -0
- package/build/user-event/utils/index.js.map +1 -1
- package/build/user-event/utils/text-range.d.ts +0 -1
- package/build/user-event/utils/text-range.js +0 -11
- package/build/user-event/utils/text-range.js.map +1 -1
- package/package.json +5 -4
- package/.DS_Store +0 -0
- package/.codecov.yml +0 -9
- package/.eslintcache +0 -1
- package/.eslintignore +0 -2
- package/.eslintrc +0 -19
- package/.flowconfig +0 -63
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -38
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -14
- package/.github/ISSUE_TEMPLATE/question.md +0 -9
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -10
- package/.github/actions/setup-deps/action.yml +0 -22
- package/.github/actions/setup-website-deps/action.yml +0 -22
- package/.github/dependabot.yml +0 -10
- package/.github/workflows/deploy-website.yml +0 -36
- package/.github/workflows/example-apps.yml +0 -25
- package/.github/workflows/main.yml +0 -103
- package/.gitignore +0 -11
- package/.prettierrc.js +0 -5
- package/CODE_OF_CONDUCT.md +0 -73
- package/CONTRIBUTING.md +0 -64
- package/babel.config.js +0 -22
- package/build/helpers/filterNodeByType.d.ts +0 -3
- package/build/helpers/filterNodeByType.js +0 -9
- package/build/helpers/filterNodeByType.js.map +0 -1
- package/coverage/clover.xml +0 -1176
- package/coverage/coverage-final.json +0 -70
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -266
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -196
- package/coverage/lcov-report/src/act.ts.html +0 -343
- package/coverage/lcov-report/src/cleanup.ts.html +0 -130
- package/coverage/lcov-report/src/config.ts.html +0 -301
- package/coverage/lcov-report/src/fireEvent.ts.html +0 -559
- package/coverage/lcov-report/src/flushMicroTasks.ts.html +0 -124
- package/coverage/lcov-report/src/helpers/accessiblity.ts.html +0 -412
- package/coverage/lcov-report/src/helpers/component-tree.ts.html +0 -352
- package/coverage/lcov-report/src/helpers/debugDeep.ts.html +0 -166
- package/coverage/lcov-report/src/helpers/debugShallow.ts.html +0 -151
- package/coverage/lcov-report/src/helpers/deprecation.ts.html +0 -244
- package/coverage/lcov-report/src/helpers/errors.ts.html +0 -283
- package/coverage/lcov-report/src/helpers/filterNodeByType.ts.html +0 -106
- package/coverage/lcov-report/src/helpers/findAll.ts.html +0 -289
- package/coverage/lcov-report/src/helpers/format-default.ts.html +0 -301
- package/coverage/lcov-report/src/helpers/format.ts.html +0 -226
- package/coverage/lcov-report/src/helpers/getTextContent.ts.html +0 -145
- package/coverage/lcov-report/src/helpers/host-component-names.tsx.html +0 -286
- package/coverage/lcov-report/src/helpers/index.html +0 -326
- package/coverage/lcov-report/src/helpers/matchers/accessibilityState.ts.html +0 -229
- package/coverage/lcov-report/src/helpers/matchers/accessibilityValue.ts.html +0 -157
- package/coverage/lcov-report/src/helpers/matchers/index.html +0 -206
- package/coverage/lcov-report/src/helpers/matchers/matchArrayProp.ts.html +0 -148
- package/coverage/lcov-report/src/helpers/matchers/matchLabelText.ts.html +0 -238
- package/coverage/lcov-report/src/helpers/matchers/matchObjectProp.ts.html +0 -160
- package/coverage/lcov-report/src/helpers/matchers/matchStringProp.ts.html +0 -154
- package/coverage/lcov-report/src/helpers/matchers/matchTextContent.ts.html +0 -145
- package/coverage/lcov-report/src/helpers/query-name.ts.html +0 -97
- package/coverage/lcov-report/src/helpers/stringValidation.ts.html +0 -193
- package/coverage/lcov-report/src/helpers/timers.ts.html +0 -382
- package/coverage/lcov-report/src/index.html +0 -356
- package/coverage/lcov-report/src/index.ts.html +0 -184
- package/coverage/lcov-report/src/matches.ts.html +0 -232
- package/coverage/lcov-report/src/pure.ts.html +0 -157
- package/coverage/lcov-report/src/queries/a11yState.ts.html +0 -478
- package/coverage/lcov-report/src/queries/a11yValue.ts.html +0 -478
- package/coverage/lcov-report/src/queries/displayValue.ts.html +0 -319
- package/coverage/lcov-report/src/queries/hintText.ts.html +0 -421
- package/coverage/lcov-report/src/queries/index.html +0 -281
- package/coverage/lcov-report/src/queries/labelText.ts.html +0 -262
- package/coverage/lcov-report/src/queries/makeQueries.ts.html +0 -850
- package/coverage/lcov-report/src/queries/placeholderText.ts.html +0 -322
- package/coverage/lcov-report/src/queries/role.ts.html +0 -481
- package/coverage/lcov-report/src/queries/testId.ts.html +0 -298
- package/coverage/lcov-report/src/queries/text.ts.html +0 -283
- package/coverage/lcov-report/src/queries/unsafeProps.ts.html +0 -313
- package/coverage/lcov-report/src/queries/unsafeType.ts.html +0 -304
- package/coverage/lcov-report/src/react-versions.ts.html +0 -118
- package/coverage/lcov-report/src/render-act.ts.html +0 -142
- package/coverage/lcov-report/src/render.tsx.html +0 -592
- package/coverage/lcov-report/src/renderHook.tsx.html +0 -262
- package/coverage/lcov-report/src/screen.ts.html +0 -454
- package/coverage/lcov-report/src/shallow.ts.html +0 -139
- package/coverage/lcov-report/src/test-utils/events.ts.html +0 -145
- package/coverage/lcov-report/src/test-utils/index.html +0 -131
- package/coverage/lcov-report/src/test-utils/index.ts.html +0 -88
- package/coverage/lcov-report/src/user-event/event-builder/common.ts.html +0 -229
- package/coverage/lcov-report/src/user-event/event-builder/index.html +0 -146
- package/coverage/lcov-report/src/user-event/event-builder/index.ts.html +0 -106
- package/coverage/lcov-report/src/user-event/event-builder/test-input.ts.html +0 -343
- package/coverage/lcov-report/src/user-event/event-builder/text-input.ts.html +0 -343
- package/coverage/lcov-report/src/user-event/index.html +0 -116
- package/coverage/lcov-report/src/user-event/index.ts.html +0 -121
- package/coverage/lcov-report/src/user-event/press/index.html +0 -131
- package/coverage/lcov-report/src/user-event/press/index.ts.html +0 -88
- package/coverage/lcov-report/src/user-event/press/press.ts.html +0 -133
- package/coverage/lcov-report/src/user-event/setup/index.html +0 -131
- package/coverage/lcov-report/src/user-event/setup/index.ts.html +0 -91
- package/coverage/lcov-report/src/user-event/setup/setup.ts.html +0 -358
- package/coverage/lcov-report/src/user-event/type/index.html +0 -146
- package/coverage/lcov-report/src/user-event/type/index.ts.html +0 -88
- package/coverage/lcov-report/src/user-event/type/parseKeys.ts.html +0 -208
- package/coverage/lcov-report/src/user-event/type/type.ts.html +0 -484
- package/coverage/lcov-report/src/user-event/utils/content-size.ts.html +0 -160
- package/coverage/lcov-report/src/user-event/utils/dispatch-event.ts.html +0 -367
- package/coverage/lcov-report/src/user-event/utils/events.ts.html +0 -247
- package/coverage/lcov-report/src/user-event/utils/index.html +0 -176
- package/coverage/lcov-report/src/user-event/utils/index.ts.html +0 -97
- package/coverage/lcov-report/src/user-event/utils/text-range.ts.html +0 -118
- package/coverage/lcov-report/src/user-event/utils/wait.ts.html +0 -130
- package/coverage/lcov-report/src/waitFor.ts.html +0 -772
- package/coverage/lcov-report/src/waitForElementToBeRemoved.ts.html +0 -211
- package/coverage/lcov-report/src/within.ts.html +0 -175
- package/coverage/lcov.info +0 -2614
- package/examples/.DS_Store +0 -0
- package/examples/basic/.expo/README.md +0 -17
- package/examples/basic/.expo/devices.json +0 -3
- package/examples/basic/.expo/packager-info.json +0 -4
- package/examples/basic/.expo/settings.json +0 -8
- package/examples/basic/.expo-shared/assets.json +0 -4
- package/examples/basic/.gitignore +0 -14
- package/examples/basic/App.tsx +0 -20
- package/examples/basic/README.md +0 -11
- package/examples/basic/__tests__/App.test.tsx +0 -119
- package/examples/basic/app.json +0 -31
- package/examples/basic/assets/adaptive-icon.png +0 -0
- package/examples/basic/assets/favicon.png +0 -0
- package/examples/basic/assets/icon.png +0 -0
- package/examples/basic/assets/splash.png +0 -0
- package/examples/basic/babel.config.js +0 -6
- package/examples/basic/components/Home.tsx +0 -28
- package/examples/basic/components/LoginForm.tsx +0 -138
- package/examples/basic/jest-setup.ts +0 -7
- package/examples/basic/jest.config.js +0 -5
- package/examples/basic/package.json +0 -30
- package/examples/basic/tsconfig.json +0 -7
- package/examples/basic/yarn-error.log +0 -8083
- package/examples/basic/yarn.lock +0 -8878
- package/examples/react-navigation/README.md +0 -16
- package/examples/react-navigation/babel.config.js +0 -4
- package/examples/react-navigation/jest-setup.js +0 -11
- package/examples/react-navigation/jest.config.js +0 -10
- package/examples/react-navigation/package.json +0 -31
- package/examples/react-navigation/src/App.js +0 -21
- package/examples/react-navigation/src/DrawerNavigator.js +0 -15
- package/examples/react-navigation/src/DrawerNavigator.test.js +0 -42
- package/examples/react-navigation/src/NativeStackNavigator.js +0 -15
- package/examples/react-navigation/src/NativeStackNavigator.test.js +0 -34
- package/examples/react-navigation/src/StackNavigator.js +0 -15
- package/examples/react-navigation/src/StackNavigator.test.js +0 -34
- package/examples/react-navigation/src/TabNavigator.js +0 -15
- package/examples/react-navigation/src/TabNavigator.test.js +0 -21
- package/examples/react-navigation/src/screens/DetailsScreen.js +0 -43
- package/examples/react-navigation/src/screens/DetailsScreen.test.js +0 -27
- package/examples/react-navigation/src/screens/DrawerHomeScreen.js +0 -26
- package/examples/react-navigation/src/screens/HomeScreen.js +0 -48
- package/examples/react-navigation/src/screens/SettingsScreen.js +0 -20
- package/examples/react-navigation/src/test-utils.js +0 -12
- package/examples/react-navigation/yarn.lock +0 -5610
- package/examples/redux/App.js +0 -27
- package/examples/redux/README.md +0 -5
- package/examples/redux/actions/todoActions.js +0 -25
- package/examples/redux/babel.config.js +0 -6
- package/examples/redux/components/AddTodo.js +0 -73
- package/examples/redux/components/AddTodo.test.js +0 -27
- package/examples/redux/components/TodoElem.js +0 -25
- package/examples/redux/components/TodoList.js +0 -29
- package/examples/redux/components/TodoList.test.js +0 -34
- package/examples/redux/index.js +0 -8
- package/examples/redux/jest-setup.js +0 -2
- package/examples/redux/jest.config.js +0 -4
- package/examples/redux/package.json +0 -23
- package/examples/redux/reducers/index.js +0 -6
- package/examples/redux/reducers/todoReducer.js +0 -27
- package/examples/redux/store.js +0 -10
- package/examples/redux/test-utils.js +0 -11
- package/examples/redux/yarn-error.log +0 -8083
- package/examples/redux/yarn.lock +0 -8423
- package/experiments-app/.expo/README.md +0 -15
- package/experiments-app/.expo/devices.json +0 -3
- package/experiments-app/.expo/settings.json +0 -10
- package/experiments-app/.gitignore +0 -17
- package/experiments-app/.prettierrc.js +0 -5
- package/experiments-app/app.json +0 -30
- package/experiments-app/assets/adaptive-icon.png +0 -0
- package/experiments-app/assets/favicon.png +0 -0
- package/experiments-app/assets/icon.png +0 -0
- package/experiments-app/assets/splash.png +0 -0
- package/experiments-app/babel.config.js +0 -6
- package/experiments-app/index.js +0 -4
- package/experiments-app/package.json +0 -31
- package/experiments-app/src/App.tsx +0 -31
- package/experiments-app/src/MainScreen.tsx +0 -51
- package/experiments-app/src/experiments.ts +0 -17
- package/experiments-app/src/screens/TextInputEventPropagation.tsx +0 -54
- package/experiments-app/src/screens/TextInputEvents.tsx +0 -60
- package/experiments-app/src/utils/helpers.ts +0 -8
- package/experiments-app/tsconfig.json +0 -6
- package/experiments-app/yarn.lock +0 -6913
- package/flow-typed/npm/jest_v26.x.x.js +0 -1218
- package/flow-typed/npm/react-test-renderer_v16.x.x.js +0 -81
- package/jest-setup.ts +0 -10
- package/renovate.json +0 -19
- package/scripts/test_react_17 +0 -12
- package/src/.DS_Store +0 -0
- package/src/__tests__/.DS_Store +0 -0
- package/src/__tests__/__snapshots__/render-debug.test.tsx.snap +0 -548
- package/src/__tests__/__snapshots__/render.test.tsx.snap +0 -39
- package/src/__tests__/act.test.tsx +0 -56
- package/src/__tests__/auto-cleanup-skip.test.tsx +0 -39
- package/src/__tests__/auto-cleanup.test.tsx +0 -50
- package/src/__tests__/cleanup.test.tsx +0 -26
- package/src/__tests__/config.test.ts +0 -55
- package/src/__tests__/fireEvent-textInput.test.tsx +0 -154
- package/src/__tests__/fireEvent.test.tsx +0 -485
- package/src/__tests__/host-component-names.test.tsx +0 -109
- package/src/__tests__/host-text-nesting.test.tsx +0 -90
- package/src/__tests__/jest-native.test.tsx +0 -84
- package/src/__tests__/questionsBoard.test.tsx +0 -62
- package/src/__tests__/react-native-api.test.tsx +0 -126
- package/src/__tests__/render-debug.test.tsx +0 -207
- package/src/__tests__/render-stringValidation.test.tsx +0 -157
- package/src/__tests__/render.test.tsx +0 -256
- package/src/__tests__/renderHook.test.tsx +0 -114
- package/src/__tests__/screen.test.tsx +0 -66
- package/src/__tests__/timerUtils.ts +0 -7
- package/src/__tests__/timers.test.ts +0 -27
- package/src/__tests__/waitFor.test.tsx +0 -327
- package/src/__tests__/waitForElementToBeRemoved.test.tsx +0 -151
- package/src/__tests__/within.test.tsx +0 -96
- package/src/act.ts +0 -86
- package/src/cleanup.ts +0 -15
- package/src/config.ts +0 -72
- package/src/fireEvent.ts +0 -159
- package/src/flush-micro-tasks.ts +0 -30
- package/src/helpers/__tests__/accessiblity.test.tsx +0 -373
- package/src/helpers/__tests__/component-tree.test.tsx +0 -226
- package/src/helpers/__tests__/format-default.tsx +0 -114
- package/src/helpers/__tests__/getTextContent.test.tsx +0 -49
- package/src/helpers/__tests__/includeHiddenElements.test.tsx +0 -39
- package/src/helpers/__tests__/query-name.test.ts +0 -10
- package/src/helpers/__tests__/timers.test.ts +0 -8
- package/src/helpers/accessiblity.ts +0 -108
- package/src/helpers/component-tree.ts +0 -89
- package/src/helpers/debugDeep.ts +0 -27
- package/src/helpers/debugShallow.ts +0 -22
- package/src/helpers/deprecation.ts +0 -53
- package/src/helpers/errors.ts +0 -66
- package/src/helpers/filterNodeByType.ts +0 -7
- package/src/helpers/findAll.ts +0 -68
- package/src/helpers/format-default.ts +0 -72
- package/src/helpers/format.ts +0 -47
- package/src/helpers/getTextContent.ts +0 -20
- package/src/helpers/host-component-names.tsx +0 -75
- package/src/helpers/matchers/__tests__/matchArrayValue.test.ts +0 -34
- package/src/helpers/matchers/__tests__/matchObject.test.ts +0 -37
- package/src/helpers/matchers/__tests__/matchStringValue.test.ts +0 -15
- package/src/helpers/matchers/accessibilityState.ts +0 -48
- package/src/helpers/matchers/accessibilityValue.ts +0 -24
- package/src/helpers/matchers/matchArrayProp.ts +0 -21
- package/src/helpers/matchers/matchLabelText.ts +0 -51
- package/src/helpers/matchers/matchObjectProp.ts +0 -25
- package/src/helpers/matchers/matchStringProp.ts +0 -23
- package/src/helpers/matchers/matchTextContent.ts +0 -20
- package/src/helpers/pointer-events.ts +0 -27
- package/src/helpers/query-name.ts +0 -4
- package/src/helpers/stringValidation.ts +0 -36
- package/src/helpers/timers.ts +0 -98
- package/src/index.ts +0 -33
- package/src/matches.ts +0 -49
- package/src/pure.ts +0 -27
- package/src/queries/__tests__/a11yState.test.tsx +0 -439
- package/src/queries/__tests__/a11yValue.test.tsx +0 -309
- package/src/queries/__tests__/displayValue.test.tsx +0 -221
- package/src/queries/__tests__/hintText.test.tsx +0 -177
- package/src/queries/__tests__/labelText.test.tsx +0 -242
- package/src/queries/__tests__/makeQueries.test.tsx +0 -235
- package/src/queries/__tests__/placeholderText.test.tsx +0 -136
- package/src/queries/__tests__/role-value.test.tsx +0 -176
- package/src/queries/__tests__/role.test.tsx +0 -824
- package/src/queries/__tests__/testId.test.tsx +0 -200
- package/src/queries/__tests__/text.test.tsx +0 -556
- package/src/queries/a11yState.ts +0 -131
- package/src/queries/a11yValue.ts +0 -131
- package/src/queries/displayValue.ts +0 -78
- package/src/queries/hintText.ts +0 -112
- package/src/queries/labelText.ts +0 -59
- package/src/queries/makeQueries.ts +0 -255
- package/src/queries/options.ts +0 -14
- package/src/queries/placeholderText.ts +0 -79
- package/src/queries/role.ts +0 -132
- package/src/queries/testId.ts +0 -71
- package/src/queries/text.ts +0 -66
- package/src/queries/unsafeProps.ts +0 -76
- package/src/queries/unsafeType.ts +0 -73
- package/src/react-versions.ts +0 -11
- package/src/render-act.ts +0 -19
- package/src/render.tsx +0 -183
- package/src/renderHook.tsx +0 -56
- package/src/screen.ts +0 -123
- package/src/shallow.ts +0 -18
- package/src/test-utils/events.ts +0 -24
- package/src/test-utils/index.ts +0 -1
- package/src/user-event/event-builder/common.ts +0 -66
- package/src/user-event/event-builder/index.ts +0 -7
- package/src/user-event/event-builder/text-input.ts +0 -86
- package/src/user-event/index.ts +0 -17
- package/src/user-event/press/__tests__/longPress.real-timers.test.tsx +0 -117
- package/src/user-event/press/__tests__/longPress.test.tsx +0 -157
- package/src/user-event/press/__tests__/press.real-timers.test.tsx +0 -320
- package/src/user-event/press/__tests__/press.test.tsx +0 -457
- package/src/user-event/press/constants.ts +0 -7
- package/src/user-event/press/index.ts +0 -1
- package/src/user-event/press/press.ts +0 -169
- package/src/user-event/setup/index.ts +0 -2
- package/src/user-event/setup/setup.ts +0 -127
- package/src/user-event/type/__tests__/__snapshots__/type-managed.test.tsx.snap +0 -339
- package/src/user-event/type/__tests__/__snapshots__/type.test.tsx.snap +0 -668
- package/src/user-event/type/__tests__/parseKeys.test.ts +0 -23
- package/src/user-event/type/__tests__/type-managed.test.tsx +0 -121
- package/src/user-event/type/__tests__/type.test.tsx +0 -336
- package/src/user-event/type/index.ts +0 -1
- package/src/user-event/type/parseKeys.ts +0 -41
- package/src/user-event/type/type.ts +0 -135
- package/src/user-event/utils/__tests__/dispatch-event.test.tsx +0 -41
- package/src/user-event/utils/__tests__/wait.test.ts +0 -63
- package/src/user-event/utils/content-size.ts +0 -25
- package/src/user-event/utils/dispatch-event.ts +0 -38
- package/src/user-event/utils/index.ts +0 -5
- package/src/user-event/utils/text-range.ts +0 -11
- package/src/user-event/utils/wait.ts +0 -15
- package/src/user-event/utils/warn-about-real-timers.ts +0 -13
- package/src/waitFor.ts +0 -228
- package/src/waitForElementToBeRemoved.ts +0 -42
- package/src/within.ts +0 -30
- package/tsconfig.json +0 -17
- package/tsconfig.release.json +0 -8
- package/website/.DS_Store +0 -0
- package/website/.docusaurus/DONT-EDIT-THIS-FOLDER +0 -5
- package/website/.docusaurus/client-modules.js +0 -6
- package/website/.docusaurus/codeTranslations.json +0 -1
- package/website/.docusaurus/docusaurus-plugin-content-blog/default/blog-post-list-prop-default.json +0 -4
- package/website/.docusaurus/docusaurus-plugin-content-blog/default/plugin-route-context-module-100.json +0 -4
- package/website/.docusaurus/docusaurus-plugin-content-docs/default/plugin-route-context-module-100.json +0 -4
- package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-api-md-c82.json +0 -27
- package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-eslint-p-llugin-testing-library-md-d24.json +0 -27
- package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-faq-md-ad8.json +0 -27
- package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-getting-started-md-8a6.json +0 -23
- package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-how-should-i-query-md-f2d.json +0 -27
- package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-migration-v-11-md-add.json +0 -27
- package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-migration-v-12-md-14f.json +0 -27
- package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-migration-v-2-md-698.json +0 -27
- package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-migration-v-7-md-6bb.json +0 -27
- package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-migration-v-9-md-f69.json +0 -27
- package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-queries-md-7ad.json +0 -27
- package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-react-navigation-md-1bd.json +0 -27
- package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-redux-integration-md-77b.json +0 -23
- package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-testing-environment-md-1c6.json +0 -27
- package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-troubleshooting-md-01d.json +0 -27
- package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-understanding-act-md-aa9.json +0 -27
- package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-user-event-md-501.json +0 -27
- package/website/.docusaurus/docusaurus-plugin-content-docs/default/version-current-metadata-prop-751.json +0 -268
- package/website/.docusaurus/docusaurus-plugin-content-docs/react-native-testing-library-docs-route-96e.json +0 -115
- package/website/.docusaurus/docusaurus-plugin-content-docs/site-docs-api-md-c82.json +0 -19
- package/website/.docusaurus/docusaurus-plugin-content-docs/site-docs-eslint-p-llugin-testing-library-md-d24.json +0 -19
- package/website/.docusaurus/docusaurus-plugin-content-docs/site-docs-faq-md-ad8.json +0 -19
- package/website/.docusaurus/docusaurus-plugin-content-docs/site-docs-getting-started-md-8a6.json +0 -15
- package/website/.docusaurus/docusaurus-plugin-content-docs/site-docs-how-should-i-query-md-f2d.json +0 -19
- package/website/.docusaurus/docusaurus-plugin-content-docs/site-docs-migration-v-11-md-add.json +0 -19
- package/website/.docusaurus/docusaurus-plugin-content-docs/site-docs-migration-v-2-md-698.json +0 -19
- package/website/.docusaurus/docusaurus-plugin-content-docs/site-docs-migration-v-7-md-6bb.json +0 -19
- package/website/.docusaurus/docusaurus-plugin-content-docs/site-docs-migration-v-9-md-f69.json +0 -19
- package/website/.docusaurus/docusaurus-plugin-content-docs/site-docs-queries-md-7ad.json +0 -19
- package/website/.docusaurus/docusaurus-plugin-content-docs/site-docs-react-navigation-md-1bd.json +0 -19
- package/website/.docusaurus/docusaurus-plugin-content-docs/site-docs-redux-integration-md-77b.json +0 -15
- package/website/.docusaurus/docusaurus-plugin-content-docs/site-docs-troubleshooting-md-01d.json +0 -19
- package/website/.docusaurus/docusaurus-plugin-content-docs/site-docs-understanding-act-md-aa9.json +0 -19
- package/website/.docusaurus/docusaurus-plugin-content-pages/default/plugin-route-context-module-100.json +0 -4
- package/website/.docusaurus/docusaurus-plugin-debug/default/docusaurus-debug-all-content-673.json +0 -623
- package/website/.docusaurus/docusaurus-plugin-debug/default/plugin-route-context-module-100.json +0 -4
- package/website/.docusaurus/docusaurus-theme-search-algolia/default/plugin-route-context-module-100.json +0 -4
- package/website/.docusaurus/docusaurus.config.js +0 -267
- package/website/.docusaurus/docusaurus.config.mjs +0 -365
- package/website/.docusaurus/globalData.json +0 -113
- package/website/.docusaurus/i18n.json +0 -17
- package/website/.docusaurus/registry.js +0 -35
- package/website/.docusaurus/routes.js +0 -162
- package/website/.docusaurus/routesChunkNames.json +0 -133
- package/website/.docusaurus/site-metadata.json +0 -36
- package/website/.gitignore +0 -20
- package/website/README.md +0 -33
- package/website/docker/.dockerignore +0 -3
- package/website/docker/Dockerfile +0 -9
- package/website/docker/docker-compose.yml +0 -11
- package/website/docs/API.md +0 -940
- package/website/docs/EslintPLluginTestingLibrary.md +0 -28
- package/website/docs/FAQ.md +0 -44
- package/website/docs/GettingStarted.md +0 -100
- package/website/docs/HowShouldIQuery.md +0 -21
- package/website/docs/MigrationV11.md +0 -64
- package/website/docs/MigrationV12.md +0 -67
- package/website/docs/MigrationV2.md +0 -126
- package/website/docs/MigrationV7.md +0 -119
- package/website/docs/MigrationV9.md +0 -67
- package/website/docs/Queries.md +0 -567
- package/website/docs/ReactNavigation.md +0 -371
- package/website/docs/ReduxIntegration.md +0 -137
- package/website/docs/TestingEnvironment.md +0 -154
- package/website/docs/Troubleshooting.md +0 -44
- package/website/docs/UnderstandingAct.md +0 -227
- package/website/docs/UserEvent.md +0 -143
- package/website/docusaurus.config.js +0 -114
- package/website/package.json +0 -31
- package/website/sidebars.js +0 -20
- package/website/src/components/Feature.js +0 -31
- package/website/src/css/custom.css +0 -13
- package/website/src/css/index.module.css +0 -77
- package/website/src/pages/index.js +0 -82
- package/website/static/.nojekyll +0 -0
- package/website/static/css/custom.css +0 -28
- package/website/static/img/hit.png +0 -0
- package/website/static/img/locomotive.png +0 -0
- package/website/static/img/owl.png +0 -0
- package/website/static/img/tools.png +0 -0
- package/website/yarn.lock +0 -7669
- package/yarn-error.log +0 -10613
- package/yarn.lock +0 -7765
package/src/config.ts
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { DebugOptions } from './helpers/debugDeep';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Global configuration options for React Native Testing Library.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
export type Config = {
|
|
8
|
-
/** Default timeout, in ms, for `waitFor` and `findBy*` queries. */
|
|
9
|
-
asyncUtilTimeout: number;
|
|
10
|
-
|
|
11
|
-
/** Default value for `includeHiddenElements` query option. */
|
|
12
|
-
defaultIncludeHiddenElements: boolean;
|
|
13
|
-
|
|
14
|
-
/** Default options for `debug` helper. */
|
|
15
|
-
defaultDebugOptions?: Partial<DebugOptions>;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export type ConfigAliasOptions = {
|
|
19
|
-
/** RTL-compatibility alias to `defaultIncludeHiddenElements` */
|
|
20
|
-
defaultHidden: boolean;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export type HostComponentNames = {
|
|
24
|
-
text: string;
|
|
25
|
-
textInput: string;
|
|
26
|
-
switch: string;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export type InternalConfig = Config & {
|
|
30
|
-
/** Names for key React Native host components. */
|
|
31
|
-
hostComponentNames?: HostComponentNames;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const defaultConfig: InternalConfig = {
|
|
35
|
-
asyncUtilTimeout: 1000,
|
|
36
|
-
defaultIncludeHiddenElements: false,
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
let config = { ...defaultConfig };
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Configure global options for React Native Testing Library.
|
|
43
|
-
*/
|
|
44
|
-
export function configure(options: Partial<Config & ConfigAliasOptions>) {
|
|
45
|
-
const { defaultHidden, ...restOptions } = options;
|
|
46
|
-
|
|
47
|
-
const defaultIncludeHiddenElements =
|
|
48
|
-
restOptions.defaultIncludeHiddenElements ??
|
|
49
|
-
defaultHidden ??
|
|
50
|
-
config.defaultIncludeHiddenElements;
|
|
51
|
-
|
|
52
|
-
config = {
|
|
53
|
-
...config,
|
|
54
|
-
...restOptions,
|
|
55
|
-
defaultIncludeHiddenElements,
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export function configureInternal(option: Partial<InternalConfig>) {
|
|
60
|
-
config = {
|
|
61
|
-
...config,
|
|
62
|
-
...option,
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export function resetToDefaults() {
|
|
67
|
-
config = { ...defaultConfig };
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export function getConfig() {
|
|
71
|
-
return config;
|
|
72
|
-
}
|
package/src/fireEvent.ts
DELETED
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import { ReactTestInstance } from 'react-test-renderer';
|
|
2
|
-
import {
|
|
3
|
-
ViewProps,
|
|
4
|
-
TextProps,
|
|
5
|
-
TextInputProps,
|
|
6
|
-
PressableProps,
|
|
7
|
-
ScrollViewProps,
|
|
8
|
-
} from 'react-native';
|
|
9
|
-
import act from './act';
|
|
10
|
-
import { isPointerEventEnabled } from './helpers/pointer-events';
|
|
11
|
-
import { isHostElement } from './helpers/component-tree';
|
|
12
|
-
import { isHostTextInput } from './helpers/host-component-names';
|
|
13
|
-
|
|
14
|
-
type EventHandler = (...args: unknown[]) => unknown;
|
|
15
|
-
|
|
16
|
-
export function isTouchResponder(element: ReactTestInstance) {
|
|
17
|
-
if (!isHostElement(element)) {
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return (
|
|
22
|
-
Boolean(element.props.onStartShouldSetResponder) || isHostTextInput(element)
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* List of events affected by `pointerEvents` prop.
|
|
28
|
-
*
|
|
29
|
-
* Note: `fireEvent` is accepting both `press` and `onPress` for event names,
|
|
30
|
-
* so we need cover both forms.
|
|
31
|
-
*/
|
|
32
|
-
const eventsAffectedByPointerEventsProp = new Set(['press', 'onPress']);
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* List of `TextInput` events not affected by `editable` prop.
|
|
36
|
-
*
|
|
37
|
-
* Note: `fireEvent` is accepting both `press` and `onPress` for event names,
|
|
38
|
-
* so we need cover both forms.
|
|
39
|
-
*/
|
|
40
|
-
const textInputEventsIgnoringEditableProp = new Set([
|
|
41
|
-
'contentSizeChange',
|
|
42
|
-
'onContentSizeChange',
|
|
43
|
-
'layout',
|
|
44
|
-
'onLayout',
|
|
45
|
-
'scroll',
|
|
46
|
-
'onScroll',
|
|
47
|
-
]);
|
|
48
|
-
|
|
49
|
-
export function isEventEnabled(
|
|
50
|
-
element: ReactTestInstance,
|
|
51
|
-
eventName: string,
|
|
52
|
-
nearestTouchResponder?: ReactTestInstance
|
|
53
|
-
) {
|
|
54
|
-
if (isHostTextInput(nearestTouchResponder)) {
|
|
55
|
-
return (
|
|
56
|
-
nearestTouchResponder?.props.editable !== false ||
|
|
57
|
-
textInputEventsIgnoringEditableProp.has(eventName)
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if (
|
|
62
|
-
eventsAffectedByPointerEventsProp.has(eventName) &&
|
|
63
|
-
!isPointerEventEnabled(element)
|
|
64
|
-
) {
|
|
65
|
-
return false;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const touchStart = nearestTouchResponder?.props.onStartShouldSetResponder?.();
|
|
69
|
-
const touchMove = nearestTouchResponder?.props.onMoveShouldSetResponder?.();
|
|
70
|
-
if (touchStart || touchMove) {
|
|
71
|
-
return true;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return touchStart === undefined && touchMove === undefined;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function findEventHandler(
|
|
78
|
-
element: ReactTestInstance,
|
|
79
|
-
eventName: string,
|
|
80
|
-
nearestTouchResponder?: ReactTestInstance
|
|
81
|
-
): EventHandler | null {
|
|
82
|
-
const touchResponder = isTouchResponder(element)
|
|
83
|
-
? element
|
|
84
|
-
: nearestTouchResponder;
|
|
85
|
-
|
|
86
|
-
const handler = getEventHandler(element, eventName);
|
|
87
|
-
if (handler && isEventEnabled(element, eventName, touchResponder))
|
|
88
|
-
return handler;
|
|
89
|
-
|
|
90
|
-
if (element.parent === null || element.parent.parent === null) {
|
|
91
|
-
return null;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
return findEventHandler(element.parent, eventName, touchResponder);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
function getEventHandler(element: ReactTestInstance, eventName: string) {
|
|
98
|
-
const eventHandlerName = getEventHandlerName(eventName);
|
|
99
|
-
if (typeof element.props[eventHandlerName] === 'function') {
|
|
100
|
-
return element.props[eventHandlerName];
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
if (typeof element.props[eventName] === 'function') {
|
|
104
|
-
return element.props[eventName];
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
return undefined;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
function getEventHandlerName(eventName: string) {
|
|
111
|
-
return `on${eventName.charAt(0).toUpperCase()}${eventName.slice(1)}`;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
// Allows any string but will provide autocomplete for type T
|
|
115
|
-
type StringWithAutoComplete<T> = T | (string & Record<never, never>);
|
|
116
|
-
|
|
117
|
-
// String union type of keys of T that start with on, stripped from on
|
|
118
|
-
type OnKeys<T> = keyof {
|
|
119
|
-
[K in keyof T as K extends `on${infer Rest}`
|
|
120
|
-
? Uncapitalize<Rest>
|
|
121
|
-
: never]: T[K];
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
type EventName = StringWithAutoComplete<
|
|
125
|
-
| OnKeys<ViewProps>
|
|
126
|
-
| OnKeys<TextProps>
|
|
127
|
-
| OnKeys<TextInputProps>
|
|
128
|
-
| OnKeys<PressableProps>
|
|
129
|
-
| OnKeys<ScrollViewProps>
|
|
130
|
-
>;
|
|
131
|
-
|
|
132
|
-
function fireEvent(
|
|
133
|
-
element: ReactTestInstance,
|
|
134
|
-
eventName: EventName,
|
|
135
|
-
...data: unknown[]
|
|
136
|
-
) {
|
|
137
|
-
const handler = findEventHandler(element, eventName);
|
|
138
|
-
if (!handler) {
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
let returnValue;
|
|
143
|
-
act(() => {
|
|
144
|
-
returnValue = handler(...data);
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
return returnValue;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
fireEvent.press = (element: ReactTestInstance, ...data: unknown[]) =>
|
|
151
|
-
fireEvent(element, 'press', ...data);
|
|
152
|
-
|
|
153
|
-
fireEvent.changeText = (element: ReactTestInstance, ...data: unknown[]) =>
|
|
154
|
-
fireEvent(element, 'changeText', ...data);
|
|
155
|
-
|
|
156
|
-
fireEvent.scroll = (element: ReactTestInstance, ...data: unknown[]) =>
|
|
157
|
-
fireEvent(element, 'scroll', ...data);
|
|
158
|
-
|
|
159
|
-
export default fireEvent;
|
package/src/flush-micro-tasks.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { setImmediate } from './helpers/timers';
|
|
2
|
-
|
|
3
|
-
export function flushMicroTasks() {
|
|
4
|
-
return new Promise((resolve) => setImmediate(resolve));
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @deprecated To be removed in the next major release.
|
|
9
|
-
*/
|
|
10
|
-
type Thenable<T> = { then: (callback: () => T) => unknown };
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* This legacy implementation of `flushMicroTasks` is used for compatibility with
|
|
14
|
-
* older versions of React Native (pre 0.71) which uses Promise polyfil.
|
|
15
|
-
*
|
|
16
|
-
* For users with older version of React Native there is a workaround of using our own
|
|
17
|
-
* Jest preset instead the `react-native` one, but requiring such change would be a
|
|
18
|
-
* breaking change for existing users.
|
|
19
|
-
*
|
|
20
|
-
* @deprecated To be removed in the next major release.
|
|
21
|
-
*/
|
|
22
|
-
export function flushMicroTasksLegacy(): Thenable<void> {
|
|
23
|
-
return {
|
|
24
|
-
// using "thenable" instead of a Promise, because otherwise it breaks when
|
|
25
|
-
// using "modern" fake timers
|
|
26
|
-
then(resolve) {
|
|
27
|
-
setImmediate(resolve);
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
}
|
|
@@ -1,373 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
View,
|
|
4
|
-
Text,
|
|
5
|
-
TextInput,
|
|
6
|
-
Pressable,
|
|
7
|
-
Switch,
|
|
8
|
-
TouchableOpacity,
|
|
9
|
-
} from 'react-native';
|
|
10
|
-
import { render, isHiddenFromAccessibility, isInaccessible } from '../..';
|
|
11
|
-
import { isAccessibilityElement } from '../accessiblity';
|
|
12
|
-
|
|
13
|
-
describe('isHiddenFromAccessibility', () => {
|
|
14
|
-
test('returns false for accessible elements', () => {
|
|
15
|
-
expect(
|
|
16
|
-
isHiddenFromAccessibility(
|
|
17
|
-
render(<View testID="subject" />).getByTestId('subject', {
|
|
18
|
-
includeHiddenElements: true,
|
|
19
|
-
})
|
|
20
|
-
)
|
|
21
|
-
).toBe(false);
|
|
22
|
-
|
|
23
|
-
expect(
|
|
24
|
-
isHiddenFromAccessibility(
|
|
25
|
-
render(<Text testID="subject">Hello</Text>).getByTestId('subject', {
|
|
26
|
-
includeHiddenElements: true,
|
|
27
|
-
})
|
|
28
|
-
)
|
|
29
|
-
).toBe(false);
|
|
30
|
-
|
|
31
|
-
expect(
|
|
32
|
-
isHiddenFromAccessibility(
|
|
33
|
-
render(<TextInput testID="subject" />).getByTestId('subject', {
|
|
34
|
-
includeHiddenElements: true,
|
|
35
|
-
})
|
|
36
|
-
)
|
|
37
|
-
).toBe(false);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
test('returns true for null elements', () => {
|
|
41
|
-
expect(isHiddenFromAccessibility(null)).toBe(true);
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
test('detects elements with accessibilityElementsHidden prop', () => {
|
|
45
|
-
const view = render(<View testID="subject" accessibilityElementsHidden />);
|
|
46
|
-
expect(
|
|
47
|
-
isHiddenFromAccessibility(
|
|
48
|
-
view.getByTestId('subject', {
|
|
49
|
-
includeHiddenElements: true,
|
|
50
|
-
})
|
|
51
|
-
)
|
|
52
|
-
).toBe(true);
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
test('detects nested elements with accessibilityElementsHidden prop', () => {
|
|
56
|
-
const view = render(
|
|
57
|
-
<View accessibilityElementsHidden>
|
|
58
|
-
<View testID="subject" />
|
|
59
|
-
</View>
|
|
60
|
-
);
|
|
61
|
-
expect(
|
|
62
|
-
isHiddenFromAccessibility(
|
|
63
|
-
view.getByTestId('subject', {
|
|
64
|
-
includeHiddenElements: true,
|
|
65
|
-
})
|
|
66
|
-
)
|
|
67
|
-
).toBe(true);
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
test('detects deeply nested elements with accessibilityElementsHidden prop', () => {
|
|
71
|
-
const view = render(
|
|
72
|
-
<View accessibilityElementsHidden>
|
|
73
|
-
<View>
|
|
74
|
-
<View>
|
|
75
|
-
<View testID="subject" />
|
|
76
|
-
</View>
|
|
77
|
-
</View>
|
|
78
|
-
</View>
|
|
79
|
-
);
|
|
80
|
-
expect(
|
|
81
|
-
isHiddenFromAccessibility(
|
|
82
|
-
view.getByTestId('subject', {
|
|
83
|
-
includeHiddenElements: true,
|
|
84
|
-
})
|
|
85
|
-
)
|
|
86
|
-
).toBe(true);
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
test('detects elements with importantForAccessibility="no-hide-descendants" prop', () => {
|
|
90
|
-
const view = render(
|
|
91
|
-
<View testID="subject" importantForAccessibility="no-hide-descendants" />
|
|
92
|
-
);
|
|
93
|
-
expect(
|
|
94
|
-
isHiddenFromAccessibility(
|
|
95
|
-
view.getByTestId('subject', {
|
|
96
|
-
includeHiddenElements: true,
|
|
97
|
-
})
|
|
98
|
-
)
|
|
99
|
-
).toBe(true);
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
test('detects nested elements with importantForAccessibility="no-hide-descendants" prop', () => {
|
|
103
|
-
const view = render(
|
|
104
|
-
<View importantForAccessibility="no-hide-descendants">
|
|
105
|
-
<View testID="subject" />
|
|
106
|
-
</View>
|
|
107
|
-
);
|
|
108
|
-
expect(
|
|
109
|
-
isHiddenFromAccessibility(
|
|
110
|
-
view.getByTestId('subject', {
|
|
111
|
-
includeHiddenElements: true,
|
|
112
|
-
})
|
|
113
|
-
)
|
|
114
|
-
).toBe(true);
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
test('detects elements with display=none', () => {
|
|
118
|
-
const view = render(<View testID="subject" style={{ display: 'none' }} />);
|
|
119
|
-
expect(
|
|
120
|
-
isHiddenFromAccessibility(
|
|
121
|
-
view.getByTestId('subject', {
|
|
122
|
-
includeHiddenElements: true,
|
|
123
|
-
})
|
|
124
|
-
)
|
|
125
|
-
).toBe(true);
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
test('detects nested elements with display=none', () => {
|
|
129
|
-
const view = render(
|
|
130
|
-
<View style={{ display: 'none' }}>
|
|
131
|
-
<View testID="subject" />
|
|
132
|
-
</View>
|
|
133
|
-
);
|
|
134
|
-
expect(
|
|
135
|
-
isHiddenFromAccessibility(
|
|
136
|
-
view.getByTestId('subject', {
|
|
137
|
-
includeHiddenElements: true,
|
|
138
|
-
})
|
|
139
|
-
)
|
|
140
|
-
).toBe(true);
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
test('detects deeply nested elements with display=none', () => {
|
|
144
|
-
const view = render(
|
|
145
|
-
<View style={{ display: 'none' }}>
|
|
146
|
-
<View>
|
|
147
|
-
<View>
|
|
148
|
-
<View testID="subject" />
|
|
149
|
-
</View>
|
|
150
|
-
</View>
|
|
151
|
-
</View>
|
|
152
|
-
);
|
|
153
|
-
expect(
|
|
154
|
-
isHiddenFromAccessibility(
|
|
155
|
-
view.getByTestId('subject', {
|
|
156
|
-
includeHiddenElements: true,
|
|
157
|
-
})
|
|
158
|
-
)
|
|
159
|
-
).toBe(true);
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
test('detects elements with display=none with complex style', () => {
|
|
163
|
-
const view = render(
|
|
164
|
-
<View
|
|
165
|
-
testID="subject"
|
|
166
|
-
style={[
|
|
167
|
-
{ display: 'flex' },
|
|
168
|
-
[{ display: 'flex' }],
|
|
169
|
-
{ display: 'none' },
|
|
170
|
-
]}
|
|
171
|
-
/>
|
|
172
|
-
);
|
|
173
|
-
expect(
|
|
174
|
-
isHiddenFromAccessibility(
|
|
175
|
-
view.getByTestId('subject', {
|
|
176
|
-
includeHiddenElements: true,
|
|
177
|
-
})
|
|
178
|
-
)
|
|
179
|
-
).toBe(true);
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
test('is not trigged by opacity = 0', () => {
|
|
183
|
-
const view = render(<View testID="subject" style={{ opacity: 0 }} />);
|
|
184
|
-
expect(
|
|
185
|
-
isHiddenFromAccessibility(
|
|
186
|
-
view.getByTestId('subject', {
|
|
187
|
-
includeHiddenElements: true,
|
|
188
|
-
})
|
|
189
|
-
)
|
|
190
|
-
).toBe(false);
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
test('detects siblings of element with accessibilityViewIsModal prop', () => {
|
|
194
|
-
const view = render(
|
|
195
|
-
<View>
|
|
196
|
-
<View accessibilityViewIsModal />
|
|
197
|
-
<View testID="subject" />
|
|
198
|
-
</View>
|
|
199
|
-
);
|
|
200
|
-
expect(
|
|
201
|
-
isHiddenFromAccessibility(
|
|
202
|
-
view.getByTestId('subject', {
|
|
203
|
-
includeHiddenElements: true,
|
|
204
|
-
})
|
|
205
|
-
)
|
|
206
|
-
).toBe(true);
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
test('detects deeply nested siblings of element with accessibilityViewIsModal prop', () => {
|
|
210
|
-
const view = render(
|
|
211
|
-
<View>
|
|
212
|
-
<View accessibilityViewIsModal />
|
|
213
|
-
<View>
|
|
214
|
-
<View>
|
|
215
|
-
<View testID="subject" />
|
|
216
|
-
</View>
|
|
217
|
-
</View>
|
|
218
|
-
</View>
|
|
219
|
-
);
|
|
220
|
-
expect(
|
|
221
|
-
isHiddenFromAccessibility(
|
|
222
|
-
view.getByTestId('subject', {
|
|
223
|
-
includeHiddenElements: true,
|
|
224
|
-
})
|
|
225
|
-
)
|
|
226
|
-
).toBe(true);
|
|
227
|
-
});
|
|
228
|
-
|
|
229
|
-
test('is not triggered for element with accessibilityViewIsModal prop', () => {
|
|
230
|
-
const view = render(
|
|
231
|
-
<View>
|
|
232
|
-
<View accessibilityViewIsModal testID="subject" />
|
|
233
|
-
</View>
|
|
234
|
-
);
|
|
235
|
-
expect(
|
|
236
|
-
isHiddenFromAccessibility(
|
|
237
|
-
view.getByTestId('subject', {
|
|
238
|
-
includeHiddenElements: true,
|
|
239
|
-
})
|
|
240
|
-
)
|
|
241
|
-
).toBe(false);
|
|
242
|
-
});
|
|
243
|
-
|
|
244
|
-
test('is not triggered for child of element with accessibilityViewIsModal prop', () => {
|
|
245
|
-
const view = render(
|
|
246
|
-
<View>
|
|
247
|
-
<View accessibilityViewIsModal>
|
|
248
|
-
<View testID="subject" />
|
|
249
|
-
</View>
|
|
250
|
-
</View>
|
|
251
|
-
);
|
|
252
|
-
expect(
|
|
253
|
-
isHiddenFromAccessibility(
|
|
254
|
-
view.getByTestId('subject', {
|
|
255
|
-
includeHiddenElements: true,
|
|
256
|
-
})
|
|
257
|
-
)
|
|
258
|
-
).toBe(false);
|
|
259
|
-
});
|
|
260
|
-
|
|
261
|
-
test('is not triggered for descendent of element with accessibilityViewIsModal prop', () => {
|
|
262
|
-
const view = render(
|
|
263
|
-
<View>
|
|
264
|
-
<View accessibilityViewIsModal>
|
|
265
|
-
<View>
|
|
266
|
-
<View>
|
|
267
|
-
<View testID="subject" />
|
|
268
|
-
</View>
|
|
269
|
-
</View>
|
|
270
|
-
</View>
|
|
271
|
-
</View>
|
|
272
|
-
);
|
|
273
|
-
expect(
|
|
274
|
-
isHiddenFromAccessibility(
|
|
275
|
-
view.getByTestId('subject', {
|
|
276
|
-
includeHiddenElements: true,
|
|
277
|
-
})
|
|
278
|
-
)
|
|
279
|
-
).toBe(false);
|
|
280
|
-
});
|
|
281
|
-
|
|
282
|
-
test('has isInaccessible alias', () => {
|
|
283
|
-
expect(isInaccessible).toBe(isHiddenFromAccessibility);
|
|
284
|
-
});
|
|
285
|
-
});
|
|
286
|
-
|
|
287
|
-
describe('isAccessibilityElement', () => {
|
|
288
|
-
test('matches View component properly', () => {
|
|
289
|
-
const { getByTestId } = render(
|
|
290
|
-
<View>
|
|
291
|
-
<View testID="default" />
|
|
292
|
-
<View testID="true" accessible />
|
|
293
|
-
<View testID="false" accessible={false} />
|
|
294
|
-
</View>
|
|
295
|
-
);
|
|
296
|
-
expect(isAccessibilityElement(getByTestId('default'))).toBeFalsy();
|
|
297
|
-
expect(isAccessibilityElement(getByTestId('true'))).toBeTruthy();
|
|
298
|
-
expect(isAccessibilityElement(getByTestId('false'))).toBeFalsy();
|
|
299
|
-
});
|
|
300
|
-
|
|
301
|
-
test('matches TextInput component properly', () => {
|
|
302
|
-
const { getByTestId } = render(
|
|
303
|
-
<View>
|
|
304
|
-
<TextInput testID="default" />
|
|
305
|
-
<TextInput testID="true" accessible />
|
|
306
|
-
<TextInput testID="false" accessible={false} />
|
|
307
|
-
</View>
|
|
308
|
-
);
|
|
309
|
-
expect(isAccessibilityElement(getByTestId('default'))).toBeTruthy();
|
|
310
|
-
expect(isAccessibilityElement(getByTestId('true'))).toBeTruthy();
|
|
311
|
-
expect(isAccessibilityElement(getByTestId('false'))).toBeFalsy();
|
|
312
|
-
});
|
|
313
|
-
|
|
314
|
-
test('matches Text component properly', () => {
|
|
315
|
-
const { getByTestId } = render(
|
|
316
|
-
<View>
|
|
317
|
-
<Text testID="default">Default</Text>
|
|
318
|
-
<Text testID="true" accessible>
|
|
319
|
-
True
|
|
320
|
-
</Text>
|
|
321
|
-
<Text testID="false" accessible={false}>
|
|
322
|
-
False
|
|
323
|
-
</Text>
|
|
324
|
-
</View>
|
|
325
|
-
);
|
|
326
|
-
expect(isAccessibilityElement(getByTestId('default'))).toBeTruthy();
|
|
327
|
-
expect(isAccessibilityElement(getByTestId('true'))).toBeTruthy();
|
|
328
|
-
expect(isAccessibilityElement(getByTestId('false'))).toBeFalsy();
|
|
329
|
-
});
|
|
330
|
-
|
|
331
|
-
test('matches Switch component properly', () => {
|
|
332
|
-
const { getByTestId } = render(
|
|
333
|
-
<View>
|
|
334
|
-
<Switch testID="default" />
|
|
335
|
-
<Switch testID="true" accessible />
|
|
336
|
-
<Switch testID="false" accessible={false} />
|
|
337
|
-
</View>
|
|
338
|
-
);
|
|
339
|
-
expect(isAccessibilityElement(getByTestId('default'))).toBeTruthy();
|
|
340
|
-
expect(isAccessibilityElement(getByTestId('true'))).toBeTruthy();
|
|
341
|
-
expect(isAccessibilityElement(getByTestId('false'))).toBeFalsy();
|
|
342
|
-
});
|
|
343
|
-
|
|
344
|
-
test('matches Pressable component properly', () => {
|
|
345
|
-
const { getByTestId } = render(
|
|
346
|
-
<View>
|
|
347
|
-
<Pressable testID="default" />
|
|
348
|
-
<Pressable testID="true" accessible />
|
|
349
|
-
<Pressable testID="false" accessible={false} />
|
|
350
|
-
</View>
|
|
351
|
-
);
|
|
352
|
-
expect(isAccessibilityElement(getByTestId('default'))).toBeTruthy();
|
|
353
|
-
expect(isAccessibilityElement(getByTestId('true'))).toBeTruthy();
|
|
354
|
-
expect(isAccessibilityElement(getByTestId('false'))).toBeFalsy();
|
|
355
|
-
});
|
|
356
|
-
|
|
357
|
-
test('matches TouchableOpacity component properly', () => {
|
|
358
|
-
const { getByTestId } = render(
|
|
359
|
-
<View>
|
|
360
|
-
<TouchableOpacity testID="default" />
|
|
361
|
-
<TouchableOpacity testID="true" accessible />
|
|
362
|
-
<TouchableOpacity testID="false" accessible={false} />
|
|
363
|
-
</View>
|
|
364
|
-
);
|
|
365
|
-
expect(isAccessibilityElement(getByTestId('default'))).toBeTruthy();
|
|
366
|
-
expect(isAccessibilityElement(getByTestId('true'))).toBeTruthy();
|
|
367
|
-
expect(isAccessibilityElement(getByTestId('false'))).toBeFalsy();
|
|
368
|
-
});
|
|
369
|
-
|
|
370
|
-
test('returns false when given null', () => {
|
|
371
|
-
expect(isAccessibilityElement(null)).toEqual(false);
|
|
372
|
-
});
|
|
373
|
-
});
|