@testing-library/react-native 12.1.1 → 12.1.3
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/.DS_Store +0 -0
- package/.codecov.yml +9 -0
- package/.eslintcache +1 -0
- package/.eslintignore +2 -0
- package/.eslintrc +19 -0
- package/.flowconfig +63 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +38 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +14 -0
- package/.github/ISSUE_TEMPLATE/question.md +9 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +10 -0
- package/.github/actions/setup-deps/action.yml +22 -0
- package/.github/actions/setup-website-deps/action.yml +22 -0
- package/.github/dependabot.yml +10 -0
- package/.github/workflows/deploy-website.yml +36 -0
- package/.github/workflows/example-apps.yml +25 -0
- package/.github/workflows/main.yml +103 -0
- package/.gitignore +11 -0
- package/.prettierrc.js +5 -0
- package/CODE_OF_CONDUCT.md +73 -0
- package/CONTRIBUTING.md +64 -0
- package/README.md +8 -7
- package/babel.config.js +22 -0
- package/build/act.js.map +1 -1
- package/build/cleanup.js.map +1 -1
- package/build/config.d.ts +1 -0
- package/build/config.js.map +1 -1
- package/build/fireEvent.d.ts +13 -5
- package/build/fireEvent.js +57 -48
- package/build/fireEvent.js.map +1 -1
- package/build/flush-micro-tasks.d.ts +19 -0
- package/build/flush-micro-tasks.js +36 -0
- package/build/flush-micro-tasks.js.map +1 -0
- package/build/helpers/accessiblity.js +3 -1
- package/build/helpers/accessiblity.js.map +1 -1
- package/build/helpers/component-tree.d.ts +0 -15
- package/build/helpers/component-tree.js +0 -45
- package/build/helpers/component-tree.js.map +1 -1
- package/build/helpers/deprecation.d.ts +1 -0
- package/build/helpers/deprecation.js +16 -0
- package/build/helpers/deprecation.js.map +1 -1
- package/build/helpers/errors.d.ts +0 -4
- package/build/helpers/errors.js +1 -25
- package/build/helpers/errors.js.map +1 -1
- package/build/helpers/findAll.js.map +1 -1
- package/build/helpers/format-default.js.map +1 -1
- package/build/helpers/format.js.map +1 -1
- package/build/helpers/host-component-names.js +4 -1
- package/build/helpers/host-component-names.js.map +1 -1
- package/build/helpers/matchers/matchLabelText.js.map +1 -1
- package/build/helpers/pointer-events.d.ts +9 -0
- package/build/helpers/pointer-events.js +25 -0
- package/build/helpers/pointer-events.js.map +1 -0
- package/build/helpers/stringValidation.js.map +1 -1
- package/build/helpers/timers.js.map +1 -1
- package/build/index.js +2 -2
- package/build/index.js.map +1 -1
- package/build/matches.js.map +1 -1
- package/build/pure.d.ts +1 -1
- package/build/pure.js.map +1 -1
- package/build/queries/a11yState.js.map +1 -1
- package/build/queries/a11yValue.js.map +1 -1
- package/build/queries/displayValue.js.map +1 -1
- package/build/queries/hintText.js.map +1 -1
- package/build/queries/labelText.js.map +1 -1
- package/build/queries/makeQueries.js.map +1 -1
- package/build/queries/placeholderText.js.map +1 -1
- package/build/queries/role.js.map +1 -1
- package/build/queries/testId.js.map +1 -1
- package/build/queries/text.js.map +1 -1
- package/build/queries/unsafeProps.js.map +1 -1
- package/build/render.d.ts +171 -12
- package/build/render.js +11 -4
- package/build/render.js.map +1 -1
- package/build/renderHook.d.ts +3 -6
- package/build/renderHook.js +4 -3
- package/build/renderHook.js.map +1 -1
- package/build/shallow.js.map +1 -1
- package/build/test-utils/events.d.ts +10 -0
- package/build/test-utils/events.js +27 -0
- package/build/test-utils/events.js.map +1 -0
- package/build/test-utils/index.d.ts +1 -0
- package/build/test-utils/index.js +17 -0
- package/build/test-utils/index.js.map +1 -0
- package/build/user-event/event-builder/common.d.ts +45 -0
- package/build/user-event/event-builder/common.js +58 -0
- package/build/user-event/event-builder/common.js.map +1 -0
- package/build/user-event/event-builder/index.d.ts +32 -0
- package/build/user-event/event-builder/index.js +12 -0
- package/build/user-event/event-builder/index.js.map +1 -0
- package/build/user-event/index.d.ts +9 -0
- package/build/user-event/index.js +16 -0
- package/build/user-event/index.js.map +1 -0
- package/build/user-event/press/constants.d.ts +2 -0
- package/build/user-event/press/constants.js +16 -0
- package/build/user-event/press/constants.js.map +1 -0
- package/build/user-event/press/index.d.ts +1 -0
- package/build/user-event/press/index.js +19 -0
- package/build/user-event/press/index.js.map +1 -0
- package/build/user-event/press/press.d.ts +7 -0
- package/build/user-event/press/press.js +106 -0
- package/build/user-event/press/press.js.map +1 -0
- package/build/user-event/press/utils/warnAboutRealTimers.d.ts +1 -0
- package/build/user-event/press/utils/warnAboutRealTimers.js +14 -0
- package/build/user-event/press/utils/warnAboutRealTimers.js.map +1 -0
- package/build/user-event/setup/index.d.ts +2 -0
- package/build/user-event/setup/index.js +13 -0
- package/build/user-event/setup/index.js.map +1 -0
- package/build/user-event/setup/setup.d.ts +39 -0
- package/build/user-event/setup/setup.js +56 -0
- package/build/user-event/setup/setup.js.map +1 -0
- package/build/user-event/type/index.d.ts +1 -0
- package/build/user-event/type/index.js +13 -0
- package/build/user-event/type/index.js.map +1 -0
- package/build/user-event/type/type.d.ts +3 -0
- package/build/user-event/type/type.js +18 -0
- package/build/user-event/type/type.js.map +1 -0
- package/build/user-event/utils/events.d.ts +9 -0
- package/build/user-event/utils/events.js +44 -0
- package/build/user-event/utils/events.js.map +1 -0
- package/build/user-event/utils/index.d.ts +2 -0
- package/build/user-event/utils/index.js +28 -0
- package/build/user-event/utils/index.js.map +1 -0
- package/build/user-event/utils/wait.d.ts +2 -0
- package/build/user-event/utils/wait.js +14 -0
- package/build/user-event/utils/wait.js.map +1 -0
- package/build/waitFor.js +3 -3
- package/build/waitFor.js.map +1 -1
- package/build/waitForElementToBeRemoved.js.map +1 -1
- package/examples/basic/.expo-shared/assets.json +4 -0
- package/examples/basic/.gitignore +14 -0
- package/examples/basic/App.tsx +20 -0
- package/examples/basic/README.md +11 -0
- package/examples/basic/__tests__/App.test.tsx +119 -0
- package/examples/basic/app.json +31 -0
- 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 +6 -0
- package/examples/basic/components/Home.tsx +28 -0
- package/examples/basic/components/LoginForm.tsx +138 -0
- package/examples/basic/jest-setup.ts +7 -0
- package/examples/basic/jest.config.js +5 -0
- package/examples/basic/package.json +30 -0
- package/examples/basic/tsconfig.json +7 -0
- package/examples/react-navigation/README.md +14 -0
- package/examples/react-navigation/babel.config.js +4 -0
- package/examples/react-navigation/jest-setup.js +11 -0
- package/examples/react-navigation/jest.config.js +10 -0
- package/examples/react-navigation/package.json +31 -0
- package/examples/react-navigation/src/App.js +21 -0
- package/examples/react-navigation/src/DrawerNavigator.js +15 -0
- package/examples/react-navigation/src/DrawerNavigator.test.js +42 -0
- package/examples/react-navigation/src/NativeStackNavigator.js +15 -0
- package/examples/react-navigation/src/NativeStackNavigator.test.js +34 -0
- package/examples/react-navigation/src/StackNavigator.js +15 -0
- package/examples/react-navigation/src/StackNavigator.test.js +34 -0
- package/examples/react-navigation/src/TabNavigator.js +15 -0
- package/examples/react-navigation/src/TabNavigator.test.js +21 -0
- package/examples/react-navigation/src/screens/DetailsScreen.js +43 -0
- package/examples/react-navigation/src/screens/DetailsScreen.test.js +27 -0
- package/examples/react-navigation/src/screens/DrawerHomeScreen.js +26 -0
- package/examples/react-navigation/src/screens/HomeScreen.js +48 -0
- package/examples/react-navigation/src/screens/SettingsScreen.js +20 -0
- package/examples/react-navigation/src/test-utils.js +12 -0
- package/examples/redux/App.js +27 -0
- package/examples/redux/actions/todoActions.js +25 -0
- package/examples/redux/babel.config.js +6 -0
- package/examples/redux/components/AddTodo.js +73 -0
- package/examples/redux/components/AddTodo.test.js +27 -0
- package/examples/redux/components/TodoElem.js +25 -0
- package/examples/redux/components/TodoList.js +29 -0
- package/examples/redux/components/TodoList.test.js +34 -0
- package/examples/redux/index.js +8 -0
- package/examples/redux/jest-setup.js +2 -0
- package/examples/redux/jest.config.js +4 -0
- package/examples/redux/package.json +23 -0
- package/examples/redux/reducers/index.js +6 -0
- package/examples/redux/reducers/todoReducer.js +27 -0
- package/examples/redux/store.js +10 -0
- package/examples/redux/test-utils.js +11 -0
- package/experiments-app/.expo/README.md +15 -0
- package/experiments-app/.expo/devices.json +3 -0
- package/experiments-app/.expo/packager-info.json +9 -0
- package/experiments-app/.expo/settings.json +9 -0
- package/experiments-app/.gitignore +17 -0
- package/experiments-app/.prettierrc.js +5 -0
- package/experiments-app/app.json +30 -0
- 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 +6 -0
- package/experiments-app/index.js +4 -0
- package/experiments-app/package.json +31 -0
- package/experiments-app/src/App.tsx +31 -0
- package/experiments-app/src/MainScreen.tsx +51 -0
- package/experiments-app/src/experiments.ts +17 -0
- package/experiments-app/src/screens/TextInputEventPropagation.tsx +54 -0
- package/experiments-app/src/screens/TextInputEvents.tsx +50 -0
- package/experiments-app/src/utils/helpers.ts +8 -0
- package/experiments-app/tsconfig.json +6 -0
- package/experiments-app/yarn.lock +6913 -0
- package/flow-typed/npm/jest_v26.x.x.js +1218 -0
- package/flow-typed/npm/react-test-renderer_v16.x.x.js +81 -0
- package/jest-setup.ts +10 -0
- package/package.json +6 -6
- package/renovate.json +19 -0
- package/scripts/test_react_17 +12 -0
- package/src/__tests__/__snapshots__/render-debug.test.tsx.snap +548 -0
- package/src/__tests__/__snapshots__/render.test.tsx.snap +39 -0
- package/src/__tests__/act.test.tsx +52 -0
- package/src/__tests__/auto-cleanup-skip.test.tsx +39 -0
- package/src/__tests__/auto-cleanup.test.tsx +50 -0
- package/src/__tests__/cleanup.test.tsx +26 -0
- package/src/__tests__/config.test.ts +55 -0
- package/src/__tests__/fireEvent-textInput.test.tsx +154 -0
- package/src/__tests__/fireEvent.test.tsx +485 -0
- package/src/__tests__/host-component-names.test.tsx +109 -0
- package/src/__tests__/host-text-nesting.test.tsx +90 -0
- package/src/__tests__/jest-native.test.tsx +84 -0
- package/src/__tests__/questionsBoard.test.tsx +62 -0
- package/src/__tests__/react-native-api.test.tsx +126 -0
- package/src/__tests__/render-debug.test.tsx +207 -0
- package/src/__tests__/render-stringValidation.test.tsx +157 -0
- package/src/__tests__/render.test.tsx +256 -0
- package/src/__tests__/renderHook.test.tsx +114 -0
- package/src/__tests__/screen.test.tsx +66 -0
- package/src/__tests__/timerUtils.ts +7 -0
- package/src/__tests__/timers.test.ts +27 -0
- package/src/__tests__/waitFor.test.tsx +327 -0
- package/src/__tests__/waitForElementToBeRemoved.test.tsx +151 -0
- package/src/__tests__/within.test.tsx +96 -0
- package/src/act.ts +86 -0
- package/src/cleanup.ts +15 -0
- package/src/config.ts +72 -0
- package/src/fireEvent.ts +163 -0
- package/src/flush-micro-tasks.ts +30 -0
- package/src/helpers/__tests__/accessiblity.test.tsx +373 -0
- package/src/helpers/__tests__/component-tree.test.tsx +226 -0
- package/src/helpers/__tests__/format-default.tsx +114 -0
- package/src/helpers/__tests__/getTextContent.test.tsx +49 -0
- package/src/helpers/__tests__/includeHiddenElements.test.tsx +39 -0
- package/src/helpers/__tests__/query-name.test.ts +10 -0
- package/src/helpers/__tests__/timers.test.ts +8 -0
- package/src/helpers/accessiblity.ts +108 -0
- package/src/helpers/component-tree.ts +89 -0
- package/src/helpers/debugDeep.ts +27 -0
- package/src/helpers/debugShallow.ts +22 -0
- package/src/helpers/deprecation.ts +53 -0
- package/src/helpers/errors.ts +66 -0
- package/src/helpers/filterNodeByType.ts +7 -0
- package/src/helpers/findAll.ts +68 -0
- package/src/helpers/format-default.ts +72 -0
- package/src/helpers/format.ts +47 -0
- package/src/helpers/getTextContent.ts +20 -0
- package/src/helpers/host-component-names.tsx +67 -0
- package/src/helpers/matchers/__tests__/matchArrayValue.test.ts +34 -0
- package/src/helpers/matchers/__tests__/matchObject.test.ts +37 -0
- package/src/helpers/matchers/__tests__/matchStringValue.test.ts +15 -0
- package/src/helpers/matchers/accessibilityState.ts +48 -0
- package/src/helpers/matchers/accessibilityValue.ts +24 -0
- package/src/helpers/matchers/matchArrayProp.ts +21 -0
- package/src/helpers/matchers/matchLabelText.ts +51 -0
- package/src/helpers/matchers/matchObjectProp.ts +25 -0
- package/src/helpers/matchers/matchStringProp.ts +23 -0
- package/src/helpers/matchers/matchTextContent.ts +20 -0
- package/src/helpers/pointer-events.ts +27 -0
- package/src/helpers/query-name.ts +4 -0
- package/src/helpers/stringValidation.ts +36 -0
- package/src/helpers/timers.ts +98 -0
- package/src/index.ts +33 -0
- package/src/matches.ts +49 -0
- package/src/pure.ts +25 -0
- package/src/queries/__tests__/a11yState.test.tsx +439 -0
- package/src/queries/__tests__/a11yValue.test.tsx +309 -0
- package/src/queries/__tests__/displayValue.test.tsx +221 -0
- package/src/queries/__tests__/hintText.test.tsx +177 -0
- package/src/queries/__tests__/labelText.test.tsx +242 -0
- package/src/queries/__tests__/makeQueries.test.tsx +235 -0
- package/src/queries/__tests__/placeholderText.test.tsx +136 -0
- package/src/queries/__tests__/role-value.test.tsx +176 -0
- package/src/queries/__tests__/role.test.tsx +824 -0
- package/src/queries/__tests__/testId.test.tsx +200 -0
- package/src/queries/__tests__/text.test.tsx +556 -0
- package/src/queries/a11yState.ts +131 -0
- package/src/queries/a11yValue.ts +131 -0
- package/src/queries/displayValue.ts +78 -0
- package/src/queries/hintText.ts +112 -0
- package/src/queries/labelText.ts +59 -0
- package/src/queries/makeQueries.ts +255 -0
- package/src/queries/options.ts +14 -0
- package/src/queries/placeholderText.ts +79 -0
- package/src/queries/role.ts +132 -0
- package/src/queries/testId.ts +71 -0
- package/src/queries/text.ts +66 -0
- package/src/queries/unsafeProps.ts +76 -0
- package/src/queries/unsafeType.ts +73 -0
- package/src/react-versions.ts +11 -0
- package/src/render-act.ts +19 -0
- package/src/render.tsx +183 -0
- package/src/renderHook.tsx +56 -0
- package/src/screen.ts +123 -0
- package/src/shallow.ts +18 -0
- package/src/test-utils/events.ts +24 -0
- package/src/test-utils/index.ts +1 -0
- package/src/user-event/event-builder/common.ts +50 -0
- package/src/user-event/event-builder/index.ts +5 -0
- package/src/user-event/index.ts +14 -0
- package/src/user-event/press/__tests__/longPress.real-timers.test.tsx +115 -0
- package/src/user-event/press/__tests__/longPress.test.tsx +157 -0
- package/src/user-event/press/__tests__/press.real-timers.test.tsx +318 -0
- package/src/user-event/press/__tests__/press.test.tsx +422 -0
- package/src/user-event/press/constants.ts +7 -0
- package/src/user-event/press/index.ts +1 -0
- package/src/user-event/press/press.ts +134 -0
- package/src/user-event/press/utils/warnAboutRealTimers.ts +6 -0
- package/src/user-event/setup/index.ts +2 -0
- package/src/user-event/setup/setup.ts +93 -0
- package/src/user-event/type/__tests__/__snapshots__/type.test.tsx.snap +26 -0
- package/src/user-event/type/__tests__/type.test.tsx +63 -0
- package/src/user-event/type/index.ts +1 -0
- package/src/user-event/type/type.ts +20 -0
- package/src/user-event/utils/__tests__/wait.test.ts +63 -0
- package/src/user-event/utils/events.ts +54 -0
- package/src/user-event/utils/index.ts +2 -0
- package/src/user-event/utils/wait.ts +15 -0
- package/src/waitFor.ts +228 -0
- package/src/waitForElementToBeRemoved.ts +42 -0
- package/src/within.ts +30 -0
- package/tsconfig.json +17 -0
- package/tsconfig.release.json +8 -0
- package/website/.gitignore +20 -0
- package/website/README.md +33 -0
- package/website/docker/.dockerignore +3 -0
- package/website/docker/Dockerfile +9 -0
- package/website/docker/docker-compose.yml +11 -0
- package/website/docs/API.md +946 -0
- package/website/docs/EslintPLluginTestingLibrary.md +28 -0
- package/website/docs/FAQ.md +44 -0
- package/website/docs/GettingStarted.md +100 -0
- package/website/docs/HowShouldIQuery.md +21 -0
- package/website/docs/MigrationV11.md +64 -0
- package/website/docs/MigrationV12.md +67 -0
- package/website/docs/MigrationV2.md +126 -0
- package/website/docs/MigrationV7.md +119 -0
- package/website/docs/MigrationV9.md +67 -0
- package/website/docs/Queries.md +567 -0
- package/website/docs/ReactNavigation.md +371 -0
- package/website/docs/ReduxIntegration.md +137 -0
- package/website/docs/TestingEnvironment.md +154 -0
- package/website/docs/Troubleshooting.md +44 -0
- package/website/docs/UnderstandingAct.md +227 -0
- package/website/docs/UserEvent.md +66 -0
- package/website/docusaurus.config.js +114 -0
- package/website/package.json +31 -0
- package/website/sidebars.js +20 -0
- package/website/src/components/Feature.js +31 -0
- package/website/src/css/custom.css +13 -0
- package/website/src/css/index.module.css +77 -0
- package/website/src/pages/index.js +82 -0
- package/website/static/.nojekyll +0 -0
- package/website/static/css/custom.css +28 -0
- 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 +7669 -0
- package/yarn.lock +7765 -0
- package/build/flushMicroTasks.d.ts +0 -5
- package/build/flushMicroTasks.js +0 -17
- package/build/flushMicroTasks.js.map +0 -1
package/build/render.d.ts
CHANGED
|
@@ -1,17 +1,159 @@
|
|
|
1
1
|
import type { ReactTestInstance } from 'react-test-renderer';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { DebugOptions } from './helpers/debugDeep';
|
|
4
|
-
export
|
|
4
|
+
export interface RenderOptions {
|
|
5
5
|
wrapper?: React.ComponentType<any>;
|
|
6
6
|
createNodeMock?: (element: React.ReactElement) => any;
|
|
7
7
|
unstable_validateStringsRenderedWithinText?: boolean;
|
|
8
|
-
}
|
|
8
|
+
}
|
|
9
9
|
export type RenderResult = ReturnType<typeof render>;
|
|
10
10
|
/**
|
|
11
|
-
* Renders test component deeply using
|
|
11
|
+
* Renders test component deeply using React Test Renderer and exposes helpers
|
|
12
12
|
* to assert on the output.
|
|
13
13
|
*/
|
|
14
|
-
export default function render<T>(component: React.ReactElement<T>,
|
|
14
|
+
export default function render<T>(component: React.ReactElement<T>, options?: RenderOptions): {
|
|
15
|
+
update: (component: React.ReactElement<any, string | React.JSXElementConstructor<any>>) => void;
|
|
16
|
+
unmount: () => void;
|
|
17
|
+
rerender: (component: React.ReactElement<any, string | React.JSXElementConstructor<any>>) => void;
|
|
18
|
+
toJSON: () => import("react-test-renderer").ReactTestRendererJSON | import("react-test-renderer").ReactTestRendererJSON[] | null;
|
|
19
|
+
debug: DebugFunction;
|
|
20
|
+
root: ReactTestInstance;
|
|
21
|
+
UNSAFE_root: ReactTestInstance;
|
|
22
|
+
UNSAFE_getByProps: (props: {
|
|
23
|
+
[key: string]: any;
|
|
24
|
+
}) => ReactTestInstance;
|
|
25
|
+
UNSAFE_getAllByProps: (props: {
|
|
26
|
+
[key: string]: any;
|
|
27
|
+
}) => ReactTestInstance[];
|
|
28
|
+
UNSAFE_queryByProps: (props: {
|
|
29
|
+
[key: string]: any;
|
|
30
|
+
}) => ReactTestInstance | null;
|
|
31
|
+
UNSAFE_queryAllByProps: (props: {
|
|
32
|
+
[key: string]: any;
|
|
33
|
+
}) => ReactTestInstance[];
|
|
34
|
+
UNSAFE_getByType: <P>(type: React.ComponentType<P>) => ReactTestInstance;
|
|
35
|
+
UNSAFE_getAllByType: <P_1>(type: React.ComponentType<P_1>) => ReactTestInstance[];
|
|
36
|
+
UNSAFE_queryByType: <P_2>(type: React.ComponentType<P_2>) => ReactTestInstance | null;
|
|
37
|
+
UNSAFE_queryAllByType: <P_3>(type: React.ComponentType<P_3>) => ReactTestInstance[];
|
|
38
|
+
getByA11yValue: import("./queries/makeQueries").GetByQuery<import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
39
|
+
getAllByA11yValue: import("./queries/makeQueries").GetAllByQuery<import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
40
|
+
queryByA11yValue: import("./queries/makeQueries").QueryByQuery<import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
41
|
+
queryAllByA11yValue: import("./queries/makeQueries").QueryAllByQuery<import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
42
|
+
findByA11yValue: import("./queries/makeQueries").FindByQuery<import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
43
|
+
findAllByA11yValue: import("./queries/makeQueries").FindAllByQuery<import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
44
|
+
getByAccessibilityValue: import("./queries/makeQueries").GetByQuery<import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
45
|
+
getAllByAccessibilityValue: import("./queries/makeQueries").GetAllByQuery<import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
46
|
+
queryByAccessibilityValue: import("./queries/makeQueries").QueryByQuery<import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
47
|
+
queryAllByAccessibilityValue: import("./queries/makeQueries").QueryAllByQuery<import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
48
|
+
findByAccessibilityValue: import("./queries/makeQueries").FindByQuery<import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
49
|
+
findAllByAccessibilityValue: import("./queries/makeQueries").FindAllByQuery<import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
50
|
+
getByA11yState: import("./queries/makeQueries").GetByQuery<import("./helpers/matchers/accessibilityState").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
51
|
+
getAllByA11yState: import("./queries/makeQueries").GetAllByQuery<import("./helpers/matchers/accessibilityState").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
52
|
+
queryByA11yState: import("./queries/makeQueries").QueryByQuery<import("./helpers/matchers/accessibilityState").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
53
|
+
queryAllByA11yState: import("./queries/makeQueries").QueryAllByQuery<import("./helpers/matchers/accessibilityState").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
54
|
+
findByA11yState: import("./queries/makeQueries").FindByQuery<import("./helpers/matchers/accessibilityState").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
55
|
+
findAllByA11yState: import("./queries/makeQueries").FindAllByQuery<import("./helpers/matchers/accessibilityState").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
56
|
+
getByAccessibilityState: import("./queries/makeQueries").GetByQuery<import("./helpers/matchers/accessibilityState").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
57
|
+
getAllByAccessibilityState: import("./queries/makeQueries").GetAllByQuery<import("./helpers/matchers/accessibilityState").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
58
|
+
queryByAccessibilityState: import("./queries/makeQueries").QueryByQuery<import("./helpers/matchers/accessibilityState").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
59
|
+
queryAllByAccessibilityState: import("./queries/makeQueries").QueryAllByQuery<import("./helpers/matchers/accessibilityState").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
60
|
+
findByAccessibilityState: import("./queries/makeQueries").FindByQuery<import("./helpers/matchers/accessibilityState").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
61
|
+
findAllByAccessibilityState: import("./queries/makeQueries").FindAllByQuery<import("./helpers/matchers/accessibilityState").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
62
|
+
getByRole: import("./queries/makeQueries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./helpers/matchers/accessibilityState").AccessibilityStateMatcher & {
|
|
63
|
+
name?: import("./matches").TextMatch | undefined;
|
|
64
|
+
value?: import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher | undefined; /**
|
|
65
|
+
* Renders test component deeply using React Test Renderer and exposes helpers
|
|
66
|
+
* to assert on the output.
|
|
67
|
+
*/
|
|
68
|
+
}>;
|
|
69
|
+
getAllByRole: import("./queries/makeQueries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./helpers/matchers/accessibilityState").AccessibilityStateMatcher & {
|
|
70
|
+
name?: import("./matches").TextMatch | undefined;
|
|
71
|
+
value?: import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher | undefined; /**
|
|
72
|
+
* Renders test component deeply using React Test Renderer and exposes helpers
|
|
73
|
+
* to assert on the output.
|
|
74
|
+
*/
|
|
75
|
+
}>;
|
|
76
|
+
queryByRole: import("./queries/makeQueries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./helpers/matchers/accessibilityState").AccessibilityStateMatcher & {
|
|
77
|
+
name?: import("./matches").TextMatch | undefined;
|
|
78
|
+
value?: import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher | undefined; /**
|
|
79
|
+
* Renders test component deeply using React Test Renderer and exposes helpers
|
|
80
|
+
* to assert on the output.
|
|
81
|
+
*/
|
|
82
|
+
}>;
|
|
83
|
+
queryAllByRole: import("./queries/makeQueries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./helpers/matchers/accessibilityState").AccessibilityStateMatcher & {
|
|
84
|
+
name?: import("./matches").TextMatch | undefined;
|
|
85
|
+
value?: import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher | undefined; /**
|
|
86
|
+
* Renders test component deeply using React Test Renderer and exposes helpers
|
|
87
|
+
* to assert on the output.
|
|
88
|
+
*/
|
|
89
|
+
}>;
|
|
90
|
+
findByRole: import("./queries/makeQueries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./helpers/matchers/accessibilityState").AccessibilityStateMatcher & {
|
|
91
|
+
name?: import("./matches").TextMatch | undefined;
|
|
92
|
+
value?: import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher | undefined; /**
|
|
93
|
+
* Renders test component deeply using React Test Renderer and exposes helpers
|
|
94
|
+
* to assert on the output.
|
|
95
|
+
*/
|
|
96
|
+
}>;
|
|
97
|
+
findAllByRole: import("./queries/makeQueries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./helpers/matchers/accessibilityState").AccessibilityStateMatcher & {
|
|
98
|
+
name?: import("./matches").TextMatch | undefined;
|
|
99
|
+
value?: import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher | undefined; /**
|
|
100
|
+
* Renders test component deeply using React Test Renderer and exposes helpers
|
|
101
|
+
* to assert on the output.
|
|
102
|
+
*/
|
|
103
|
+
}>;
|
|
104
|
+
getByHintText: import("./queries/makeQueries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
105
|
+
getAllByHintText: import("./queries/makeQueries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
106
|
+
queryByHintText: import("./queries/makeQueries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
107
|
+
queryAllByHintText: import("./queries/makeQueries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
108
|
+
findByHintText: import("./queries/makeQueries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
109
|
+
findAllByHintText: import("./queries/makeQueries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
110
|
+
getByA11yHint: import("./queries/makeQueries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
111
|
+
getAllByA11yHint: import("./queries/makeQueries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
112
|
+
queryByA11yHint: import("./queries/makeQueries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
113
|
+
queryAllByA11yHint: import("./queries/makeQueries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
114
|
+
findByA11yHint: import("./queries/makeQueries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
115
|
+
findAllByA11yHint: import("./queries/makeQueries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
116
|
+
getByAccessibilityHint: import("./queries/makeQueries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
117
|
+
getAllByAccessibilityHint: import("./queries/makeQueries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
118
|
+
queryByAccessibilityHint: import("./queries/makeQueries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
119
|
+
queryAllByAccessibilityHint: import("./queries/makeQueries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
120
|
+
findByAccessibilityHint: import("./queries/makeQueries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
121
|
+
findAllByAccessibilityHint: import("./queries/makeQueries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
122
|
+
getByLabelText: import("./queries/makeQueries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
123
|
+
getAllByLabelText: import("./queries/makeQueries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
124
|
+
queryByLabelText: import("./queries/makeQueries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
125
|
+
queryAllByLabelText: import("./queries/makeQueries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
126
|
+
findByLabelText: import("./queries/makeQueries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
127
|
+
findAllByLabelText: import("./queries/makeQueries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
128
|
+
getByPlaceholderText: import("./queries/makeQueries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
129
|
+
getAllByPlaceholderText: import("./queries/makeQueries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
130
|
+
queryByPlaceholderText: import("./queries/makeQueries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
131
|
+
queryAllByPlaceholderText: import("./queries/makeQueries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
132
|
+
findByPlaceholderText: import("./queries/makeQueries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
133
|
+
findAllByPlaceholderText: import("./queries/makeQueries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
134
|
+
getByDisplayValue: import("./queries/makeQueries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
135
|
+
getAllByDisplayValue: import("./queries/makeQueries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
136
|
+
queryByDisplayValue: import("./queries/makeQueries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
137
|
+
queryAllByDisplayValue: import("./queries/makeQueries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
138
|
+
findByDisplayValue: import("./queries/makeQueries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
139
|
+
findAllByDisplayValue: import("./queries/makeQueries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
140
|
+
getByTestId: import("./queries/makeQueries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
141
|
+
getAllByTestId: import("./queries/makeQueries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
142
|
+
queryByTestId: import("./queries/makeQueries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
143
|
+
queryAllByTestId: import("./queries/makeQueries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
144
|
+
findByTestId: import("./queries/makeQueries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
145
|
+
findAllByTestId: import("./queries/makeQueries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
146
|
+
getByText: import("./queries/makeQueries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
147
|
+
getAllByText: import("./queries/makeQueries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
148
|
+
queryByText: import("./queries/makeQueries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
149
|
+
queryAllByText: import("./queries/makeQueries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
150
|
+
findByText: import("./queries/makeQueries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
151
|
+
findAllByText: import("./queries/makeQueries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
152
|
+
};
|
|
153
|
+
export interface RenderInternalOptions extends RenderOptions {
|
|
154
|
+
detectHostComponentNames?: boolean;
|
|
155
|
+
}
|
|
156
|
+
export declare function renderInternal<T>(component: React.ReactElement<T>, { wrapper: Wrapper, createNodeMock, unstable_validateStringsRenderedWithinText, detectHostComponentNames, }?: RenderInternalOptions): {
|
|
15
157
|
update: (component: React.ReactElement<any, string | React.JSXElementConstructor<any>>) => void;
|
|
16
158
|
unmount: () => void;
|
|
17
159
|
rerender: (component: React.ReactElement<any, string | React.JSXElementConstructor<any>>) => void;
|
|
@@ -61,27 +203,45 @@ export default function render<T>(component: React.ReactElement<T>, { wrapper: W
|
|
|
61
203
|
findAllByAccessibilityState: import("./queries/makeQueries").FindAllByQuery<import("./helpers/matchers/accessibilityState").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
62
204
|
getByRole: import("./queries/makeQueries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./helpers/matchers/accessibilityState").AccessibilityStateMatcher & {
|
|
63
205
|
name?: import("./matches").TextMatch | undefined;
|
|
64
|
-
value?: import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher | undefined;
|
|
206
|
+
value?: import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher | undefined; /**
|
|
207
|
+
* Renders test component deeply using React Test Renderer and exposes helpers
|
|
208
|
+
* to assert on the output.
|
|
209
|
+
*/
|
|
65
210
|
}>;
|
|
66
211
|
getAllByRole: import("./queries/makeQueries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./helpers/matchers/accessibilityState").AccessibilityStateMatcher & {
|
|
67
212
|
name?: import("./matches").TextMatch | undefined;
|
|
68
|
-
value?: import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher | undefined;
|
|
213
|
+
value?: import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher | undefined; /**
|
|
214
|
+
* Renders test component deeply using React Test Renderer and exposes helpers
|
|
215
|
+
* to assert on the output.
|
|
216
|
+
*/
|
|
69
217
|
}>;
|
|
70
218
|
queryByRole: import("./queries/makeQueries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./helpers/matchers/accessibilityState").AccessibilityStateMatcher & {
|
|
71
219
|
name?: import("./matches").TextMatch | undefined;
|
|
72
|
-
value?: import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher | undefined;
|
|
220
|
+
value?: import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher | undefined; /**
|
|
221
|
+
* Renders test component deeply using React Test Renderer and exposes helpers
|
|
222
|
+
* to assert on the output.
|
|
223
|
+
*/
|
|
73
224
|
}>;
|
|
74
225
|
queryAllByRole: import("./queries/makeQueries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./helpers/matchers/accessibilityState").AccessibilityStateMatcher & {
|
|
75
226
|
name?: import("./matches").TextMatch | undefined;
|
|
76
|
-
value?: import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher | undefined;
|
|
227
|
+
value?: import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher | undefined; /**
|
|
228
|
+
* Renders test component deeply using React Test Renderer and exposes helpers
|
|
229
|
+
* to assert on the output.
|
|
230
|
+
*/
|
|
77
231
|
}>;
|
|
78
232
|
findByRole: import("./queries/makeQueries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./helpers/matchers/accessibilityState").AccessibilityStateMatcher & {
|
|
79
233
|
name?: import("./matches").TextMatch | undefined;
|
|
80
|
-
value?: import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher | undefined;
|
|
234
|
+
value?: import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher | undefined; /**
|
|
235
|
+
* Renders test component deeply using React Test Renderer and exposes helpers
|
|
236
|
+
* to assert on the output.
|
|
237
|
+
*/
|
|
81
238
|
}>;
|
|
82
239
|
findAllByRole: import("./queries/makeQueries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./helpers/matchers/accessibilityState").AccessibilityStateMatcher & {
|
|
83
240
|
name?: import("./matches").TextMatch | undefined;
|
|
84
|
-
value?: import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher | undefined;
|
|
241
|
+
value?: import("./helpers/matchers/accessibilityValue").AccessibilityValueMatcher | undefined; /**
|
|
242
|
+
* Renders test component deeply using React Test Renderer and exposes helpers
|
|
243
|
+
* to assert on the output.
|
|
244
|
+
*/
|
|
85
245
|
}>;
|
|
86
246
|
getByHintText: import("./queries/makeQueries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
87
247
|
getAllByHintText: import("./queries/makeQueries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
@@ -132,8 +292,7 @@ export default function render<T>(component: React.ReactElement<T>, { wrapper: W
|
|
|
132
292
|
findByText: import("./queries/makeQueries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
133
293
|
findAllByText: import("./queries/makeQueries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
134
294
|
};
|
|
135
|
-
interface DebugFunction {
|
|
295
|
+
export interface DebugFunction {
|
|
136
296
|
(options?: DebugOptions | string): void;
|
|
137
297
|
shallow: (message?: string) => void;
|
|
138
298
|
}
|
|
139
|
-
export {};
|
package/build/render.js
CHANGED
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = render;
|
|
7
|
+
exports.renderInternal = renderInternal;
|
|
7
8
|
var React = _interopRequireWildcard(require("react"));
|
|
8
9
|
var _act = _interopRequireDefault(require("./act"));
|
|
9
10
|
var _cleanup = require("./cleanup");
|
|
@@ -20,15 +21,21 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
20
21
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
21
22
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
22
23
|
/**
|
|
23
|
-
* Renders test component deeply using
|
|
24
|
+
* Renders test component deeply using React Test Renderer and exposes helpers
|
|
24
25
|
* to assert on the output.
|
|
25
26
|
*/
|
|
26
|
-
function render(component, {
|
|
27
|
+
function render(component, options = {}) {
|
|
28
|
+
return renderInternal(component, options);
|
|
29
|
+
}
|
|
30
|
+
function renderInternal(component, {
|
|
27
31
|
wrapper: Wrapper,
|
|
28
32
|
createNodeMock,
|
|
29
|
-
unstable_validateStringsRenderedWithinText
|
|
33
|
+
unstable_validateStringsRenderedWithinText,
|
|
34
|
+
detectHostComponentNames = true
|
|
30
35
|
} = {}) {
|
|
31
|
-
|
|
36
|
+
if (detectHostComponentNames) {
|
|
37
|
+
(0, _hostComponentNames.configureHostComponentNamesIfNeeded)();
|
|
38
|
+
}
|
|
32
39
|
if (unstable_validateStringsRenderedWithinText) {
|
|
33
40
|
return renderWithStringValidation(component, {
|
|
34
41
|
wrapper: Wrapper,
|
package/build/render.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.js","names":["React","_interopRequireWildcard","require","_act","_interopRequireDefault","_cleanup","_config","_componentTree","_debugDeep","_debugShallow","_hostComponentNames","_stringValidation","_renderAct","_screen","_within","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","render","component","wrapper","Wrapper","createNodeMock","unstable_validateStringsRenderedWithinText","configureHostComponentNamesIfNeeded","renderWithStringValidation","wrap","element","createElement","renderer","renderWithAct","undefined","buildRenderResult","handleRender","_","phase","validateStringsRenderedWithinText","screen","toJSON","Profiler","id","onRender","update","updateWithAct","instance","root","unmount","act","addToCleanupQueue","result","getQueriesForElement","rerender","debug","getHostChildren","UNSAFE_root","enumerable","Error","setRenderResult","debugImpl","options","defaultDebugOptions","getConfig","debugOptions","message","console","warn","json","debugDeep","shallow","debugShallow"],"sources":["../src/render.tsx"],"sourcesContent":["import type { ReactTestInstance, ReactTestRenderer } from 'react-test-renderer';\nimport * as React from 'react';\nimport { Profiler } from 'react';\nimport act from './act';\nimport { addToCleanupQueue } from './cleanup';\nimport { getConfig } from './config';\nimport { getHostChildren } from './helpers/component-tree';\nimport debugDeep, { DebugOptions } from './helpers/debugDeep';\nimport debugShallow from './helpers/debugShallow';\nimport { configureHostComponentNamesIfNeeded } from './helpers/host-component-names';\nimport { validateStringsRenderedWithinText } from './helpers/stringValidation';\nimport { renderWithAct } from './render-act';\nimport { setRenderResult, screen } from './screen';\nimport { getQueriesForElement } from './within';\n\nexport type RenderOptions = {\n wrapper?: React.ComponentType<any>;\n createNodeMock?: (element: React.ReactElement) => any;\n unstable_validateStringsRenderedWithinText?: boolean;\n};\n\nexport type RenderResult = ReturnType<typeof render>;\n\n/**\n * Renders test component deeply using react-test-renderer and exposes helpers\n * to assert on the output.\n */\nexport default function render<T>(\n component: React.ReactElement<T>,\n {\n wrapper: Wrapper,\n createNodeMock,\n unstable_validateStringsRenderedWithinText,\n }: RenderOptions = {}\n) {\n configureHostComponentNamesIfNeeded();\n\n if (unstable_validateStringsRenderedWithinText) {\n return renderWithStringValidation(component, {\n wrapper: Wrapper,\n createNodeMock,\n });\n }\n\n const wrap = (element: React.ReactElement) =>\n Wrapper ? <Wrapper>{element}</Wrapper> : element;\n\n const renderer = renderWithAct(\n wrap(component),\n createNodeMock ? { createNodeMock } : undefined\n );\n\n return buildRenderResult(renderer, wrap);\n}\n\nfunction renderWithStringValidation<T>(\n component: React.ReactElement<T>,\n {\n wrapper: Wrapper,\n createNodeMock,\n }: Omit<RenderOptions, 'unstable_validateStringsRenderedWithinText'> = {}\n) {\n const handleRender: React.ProfilerProps['onRender'] = (_, phase) => {\n if (phase === 'update') {\n validateStringsRenderedWithinText(screen.toJSON());\n }\n };\n\n const wrap = (element: React.ReactElement) => (\n <Profiler id=\"renderProfiler\" onRender={handleRender}>\n {Wrapper ? <Wrapper>{element}</Wrapper> : element}\n </Profiler>\n );\n\n const renderer = renderWithAct(\n wrap(component),\n createNodeMock ? { createNodeMock } : undefined\n );\n validateStringsRenderedWithinText(renderer.toJSON());\n\n return buildRenderResult(renderer, wrap);\n}\n\nfunction buildRenderResult(\n renderer: ReactTestRenderer,\n wrap: (element: React.ReactElement) => JSX.Element\n) {\n const update = updateWithAct(renderer, wrap);\n const instance = renderer.root;\n\n const unmount = () => {\n act(() => {\n renderer.unmount();\n });\n };\n\n addToCleanupQueue(unmount);\n\n const result = {\n ...getQueriesForElement(instance),\n update,\n unmount,\n rerender: update, // alias for `update`\n toJSON: renderer.toJSON,\n debug: debug(instance, renderer),\n get root() {\n return getHostChildren(instance)[0];\n },\n UNSAFE_root: instance,\n };\n\n // Add as non-enumerable property, so that it's safe to enumerate\n // `render` result, e.g. using destructuring rest syntax.\n Object.defineProperty(result, 'container', {\n enumerable: false,\n get() {\n throw new Error(\n \"'container' property has been renamed to 'UNSAFE_root'.\\n\\n\" +\n \"Consider using 'root' property which returns root host element.\"\n );\n },\n });\n\n setRenderResult(result);\n return result;\n}\n\nfunction updateWithAct(\n renderer: ReactTestRenderer,\n wrap: (innerElement: React.ReactElement) => React.ReactElement\n) {\n return function (component: React.ReactElement) {\n act(() => {\n renderer.update(wrap(component));\n });\n };\n}\n\ninterface DebugFunction {\n (options?: DebugOptions | string): void;\n shallow: (message?: string) => void;\n}\n\nfunction debug(\n instance: ReactTestInstance,\n renderer: ReactTestRenderer\n): DebugFunction {\n function debugImpl(options?: DebugOptions | string) {\n const { defaultDebugOptions } = getConfig();\n const debugOptions =\n typeof options === 'string'\n ? { ...defaultDebugOptions, message: options }\n : { ...defaultDebugOptions, ...options };\n\n if (typeof options === 'string') {\n // eslint-disable-next-line no-console\n console.warn(\n 'Using debug(\"message\") is deprecated and will be removed in future release, please use debug({ message; \"message\" }) instead.'\n );\n }\n\n const json = renderer.toJSON();\n if (json) {\n return debugDeep(json, debugOptions);\n }\n }\n debugImpl.shallow = (message?: string) => debugShallow(instance, message);\n return debugImpl;\n}\n"],"mappings":";;;;;;AACA,IAAAA,KAAA,GAAAC,uBAAA,CA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RequireWildcard","require","_act","_interopRequireDefault","_cleanup","_config","_componentTree","_debugDeep","_debugShallow","_hostComponentNames","_stringValidation","_renderAct","_screen","_within","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","render","component","options","renderInternal","wrapper","Wrapper","createNodeMock","unstable_validateStringsRenderedWithinText","detectHostComponentNames","configureHostComponentNamesIfNeeded","renderWithStringValidation","wrap","element","createElement","renderer","renderWithAct","undefined","buildRenderResult","handleRender","_","phase","validateStringsRenderedWithinText","screen","toJSON","Profiler","id","onRender","update","updateWithAct","instance","root","unmount","act","addToCleanupQueue","result","getQueriesForElement","rerender","debug","getHostChildren","UNSAFE_root","enumerable","Error","setRenderResult","debugImpl","defaultDebugOptions","getConfig","debugOptions","message","console","warn","json","debugDeep","shallow","debugShallow"],"sources":["../src/render.tsx"],"sourcesContent":["import type { ReactTestInstance, ReactTestRenderer } from 'react-test-renderer';\nimport * as React from 'react';\nimport { Profiler } from 'react';\nimport act from './act';\nimport { addToCleanupQueue } from './cleanup';\nimport { getConfig } from './config';\nimport { getHostChildren } from './helpers/component-tree';\nimport debugDeep, { DebugOptions } from './helpers/debugDeep';\nimport debugShallow from './helpers/debugShallow';\nimport { configureHostComponentNamesIfNeeded } from './helpers/host-component-names';\nimport { validateStringsRenderedWithinText } from './helpers/stringValidation';\nimport { renderWithAct } from './render-act';\nimport { setRenderResult, screen } from './screen';\nimport { getQueriesForElement } from './within';\n\nexport interface RenderOptions {\n wrapper?: React.ComponentType<any>;\n createNodeMock?: (element: React.ReactElement) => any;\n unstable_validateStringsRenderedWithinText?: boolean;\n}\n\nexport type RenderResult = ReturnType<typeof render>;\n\n/**\n * Renders test component deeply using React Test Renderer and exposes helpers\n * to assert on the output.\n */\nexport default function render<T>(\n component: React.ReactElement<T>,\n options: RenderOptions = {}\n) {\n return renderInternal(component, options);\n}\n\nexport interface RenderInternalOptions extends RenderOptions {\n detectHostComponentNames?: boolean;\n}\n\nexport function renderInternal<T>(\n component: React.ReactElement<T>,\n {\n wrapper: Wrapper,\n createNodeMock,\n unstable_validateStringsRenderedWithinText,\n detectHostComponentNames = true,\n }: RenderInternalOptions = {}\n) {\n if (detectHostComponentNames) {\n configureHostComponentNamesIfNeeded();\n }\n\n if (unstable_validateStringsRenderedWithinText) {\n return renderWithStringValidation(component, {\n wrapper: Wrapper,\n createNodeMock,\n });\n }\n\n const wrap = (element: React.ReactElement) =>\n Wrapper ? <Wrapper>{element}</Wrapper> : element;\n\n const renderer = renderWithAct(\n wrap(component),\n createNodeMock ? { createNodeMock } : undefined\n );\n\n return buildRenderResult(renderer, wrap);\n}\n\nfunction renderWithStringValidation<T>(\n component: React.ReactElement<T>,\n {\n wrapper: Wrapper,\n createNodeMock,\n }: Omit<RenderOptions, 'unstable_validateStringsRenderedWithinText'> = {}\n) {\n const handleRender: React.ProfilerProps['onRender'] = (_, phase) => {\n if (phase === 'update') {\n validateStringsRenderedWithinText(screen.toJSON());\n }\n };\n\n const wrap = (element: React.ReactElement) => (\n <Profiler id=\"renderProfiler\" onRender={handleRender}>\n {Wrapper ? <Wrapper>{element}</Wrapper> : element}\n </Profiler>\n );\n\n const renderer = renderWithAct(\n wrap(component),\n createNodeMock ? { createNodeMock } : undefined\n );\n validateStringsRenderedWithinText(renderer.toJSON());\n\n return buildRenderResult(renderer, wrap);\n}\n\nfunction buildRenderResult(\n renderer: ReactTestRenderer,\n wrap: (element: React.ReactElement) => JSX.Element\n) {\n const update = updateWithAct(renderer, wrap);\n const instance = renderer.root;\n\n const unmount = () => {\n act(() => {\n renderer.unmount();\n });\n };\n\n addToCleanupQueue(unmount);\n\n const result = {\n ...getQueriesForElement(instance),\n update,\n unmount,\n rerender: update, // alias for `update`\n toJSON: renderer.toJSON,\n debug: debug(instance, renderer),\n get root() {\n return getHostChildren(instance)[0];\n },\n UNSAFE_root: instance,\n };\n\n // Add as non-enumerable property, so that it's safe to enumerate\n // `render` result, e.g. using destructuring rest syntax.\n Object.defineProperty(result, 'container', {\n enumerable: false,\n get() {\n throw new Error(\n \"'container' property has been renamed to 'UNSAFE_root'.\\n\\n\" +\n \"Consider using 'root' property which returns root host element.\"\n );\n },\n });\n\n setRenderResult(result);\n return result;\n}\n\nfunction updateWithAct(\n renderer: ReactTestRenderer,\n wrap: (innerElement: React.ReactElement) => React.ReactElement\n) {\n return function (component: React.ReactElement) {\n act(() => {\n renderer.update(wrap(component));\n });\n };\n}\n\nexport interface DebugFunction {\n (options?: DebugOptions | string): void;\n shallow: (message?: string) => void;\n}\n\nfunction debug(\n instance: ReactTestInstance,\n renderer: ReactTestRenderer\n): DebugFunction {\n function debugImpl(options?: DebugOptions | string) {\n const { defaultDebugOptions } = getConfig();\n const debugOptions =\n typeof options === 'string'\n ? { ...defaultDebugOptions, message: options }\n : { ...defaultDebugOptions, ...options };\n\n if (typeof options === 'string') {\n // eslint-disable-next-line no-console\n console.warn(\n 'Using debug(\"message\") is deprecated and will be removed in future release, please use debug({ message; \"message\" }) instead.'\n );\n }\n\n const json = renderer.toJSON();\n if (json) {\n return debugDeep(json, debugOptions);\n }\n }\n debugImpl.shallow = (message?: string) => debugShallow(instance, message);\n return debugImpl;\n}\n"],"mappings":";;;;;;;AACA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,IAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,cAAA,GAAAL,OAAA;AACA,IAAAM,UAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,aAAA,GAAAL,sBAAA,CAAAF,OAAA;AACA,IAAAQ,mBAAA,GAAAR,OAAA;AACA,IAAAS,iBAAA,GAAAT,OAAA;AACA,IAAAU,UAAA,GAAAV,OAAA;AACA,IAAAW,OAAA,GAAAX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AIqD,KAAK,CACb,6DAA6D,GAC3D,iEACJ,CAAC;IACH;EACF,CAAC,CAAC;EAEF,IAAAC,uBAAe,EAACR,MAAM,CAAC;EACvB,OAAOA,MAAM;AACf;AAEA,SAASN,aAAaA,CACpBd,QAA2B,EAC3BH,IAA8D,EAC9D;EACA,OAAO,UAAUV,SAA6B,EAAE;IAC9C,IAAA+B,YAAG,EAAC,MAAM;MACRlB,QAAQ,CAACa,MAAM,CAAChB,IAAI,CAACV,SAAS,CAAC,CAAC;IAClC,CAAC,CAAC;EACJ,CAAC;AACH;AAOA,SAASoC,KAAKA,CACZR,QAA2B,EAC3Bf,QAA2B,EACZ;EACf,SAAS6B,SAASA,CAACzC,OAA+B,EAAE;IAClD,MAAM;MAAE0C;IAAoB,CAAC,GAAG,IAAAC,iBAAS,EAAC,CAAC;IAC3C,MAAMC,YAAY,GAChB,OAAO5C,OAAO,KAAK,QAAQ,GACvB;MAAE,GAAG0C,mBAAmB;MAAEG,OAAO,EAAE7C;IAAQ,CAAC,GAC5C;MAAE,GAAG0C,mBAAmB;MAAE,GAAG1C;IAAQ,CAAC;IAE5C,IAAI,OAAOA,OAAO,KAAK,QAAQ,EAAE;MAC/B;MACA8C,OAAO,CAACC,IAAI,CACV,+HACF,CAAC;IACH;IAEA,MAAMC,IAAI,GAAGpC,QAAQ,CAACS,MAAM,CAAC,CAAC;IAC9B,IAAI2B,IAAI,EAAE;MACR,OAAO,IAAAC,kBAAS,EAACD,IAAI,EAAEJ,YAAY,CAAC;IACtC;EACF;EACAH,SAAS,CAACS,OAAO,GAAIL,OAAgB,IAAK,IAAAM,qBAAY,EAACxB,QAAQ,EAAEkB,OAAO,CAAC;EACzE,OAAOJ,SAAS;AAClB"}
|
package/build/renderHook.d.ts
CHANGED
|
@@ -6,11 +6,8 @@ export type RenderHookResult<Result, Props> = {
|
|
|
6
6
|
};
|
|
7
7
|
unmount: () => void;
|
|
8
8
|
};
|
|
9
|
-
export type RenderHookOptions<Props> =
|
|
10
|
-
initialProps
|
|
9
|
+
export type RenderHookOptions<Props> = {
|
|
10
|
+
initialProps?: Props;
|
|
11
11
|
wrapper?: ComponentType<any>;
|
|
12
|
-
}
|
|
13
|
-
wrapper?: ComponentType<any>;
|
|
14
|
-
initialProps?: never;
|
|
15
|
-
} | undefined;
|
|
12
|
+
};
|
|
16
13
|
export declare function renderHook<Result, Props>(renderCallback: (props: Props) => Result, options?: RenderHookOptions<Props>): RenderHookResult<Result, Props>;
|
package/build/renderHook.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.renderHook = renderHook;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _render =
|
|
8
|
+
var _render = require("./render");
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
10
|
function renderHook(renderCallback, options) {
|
|
11
11
|
const initialProps = options?.initialProps;
|
|
@@ -23,13 +23,14 @@ function renderHook(renderCallback, options) {
|
|
|
23
23
|
const {
|
|
24
24
|
rerender: baseRerender,
|
|
25
25
|
unmount
|
|
26
|
-
} = (0, _render.
|
|
26
|
+
} = (0, _render.renderInternal)(
|
|
27
27
|
/*#__PURE__*/
|
|
28
28
|
// @ts-expect-error since option can be undefined, initialProps can be undefined when it should'nt
|
|
29
29
|
_react.default.createElement(TestComponent, {
|
|
30
30
|
renderCallbackProps: initialProps
|
|
31
31
|
}), {
|
|
32
|
-
wrapper
|
|
32
|
+
wrapper,
|
|
33
|
+
detectHostComponentNames: false
|
|
33
34
|
});
|
|
34
35
|
function rerender(rerenderCallbackProps) {
|
|
35
36
|
return baseRerender( /*#__PURE__*/_react.default.createElement(TestComponent, {
|
package/build/renderHook.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderHook.js","names":["_react","_interopRequireDefault","require","_render","obj","__esModule","default","renderHook","renderCallback","options","initialProps","wrapper","result","React","createRef","TestComponent","renderCallbackProps","renderResult","useEffect","current","rerender","baseRerender","unmount","
|
|
1
|
+
{"version":3,"file":"renderHook.js","names":["_react","_interopRequireDefault","require","_render","obj","__esModule","default","renderHook","renderCallback","options","initialProps","wrapper","result","React","createRef","TestComponent","renderCallbackProps","renderResult","useEffect","current","rerender","baseRerender","unmount","renderInternal","createElement","detectHostComponentNames","rerenderCallbackProps"],"sources":["../src/renderHook.tsx"],"sourcesContent":["import React from 'react';\nimport type { ComponentType } from 'react';\nimport { renderInternal } from './render';\n\nexport type RenderHookResult<Result, Props> = {\n rerender: (props: Props) => void;\n result: { current: Result };\n unmount: () => void;\n};\n\nexport type RenderHookOptions<Props> = {\n initialProps?: Props;\n wrapper?: ComponentType<any>;\n};\n\nexport function renderHook<Result, Props>(\n renderCallback: (props: Props) => Result,\n options?: RenderHookOptions<Props>\n): RenderHookResult<Result, Props> {\n const initialProps = options?.initialProps;\n const wrapper = options?.wrapper;\n\n const result: React.MutableRefObject<Result | null> = React.createRef();\n\n function TestComponent({\n renderCallbackProps,\n }: {\n renderCallbackProps: Props;\n }) {\n const renderResult = renderCallback(renderCallbackProps);\n\n React.useEffect(() => {\n result.current = renderResult;\n });\n\n return null;\n }\n\n const { rerender: baseRerender, unmount } = renderInternal(\n // @ts-expect-error since option can be undefined, initialProps can be undefined when it should'nt\n <TestComponent renderCallbackProps={initialProps} />,\n {\n wrapper,\n detectHostComponentNames: false,\n }\n );\n\n function rerender(rerenderCallbackProps: Props) {\n return baseRerender(\n <TestComponent renderCallbackProps={rerenderCallbackProps} />\n );\n }\n\n // @ts-expect-error result is ill typed because ref is initialized to null\n return { result, rerender, unmount };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAD,OAAA;AAA0C,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAanC,SAASG,UAAUA,CACxBC,cAAwC,EACxCC,OAAkC,EACD;EACjC,MAAMC,YAAY,GAAGD,OAAO,EAAEC,YAAY;EAC1C,MAAMC,OAAO,GAAGF,OAAO,EAAEE,OAAO;EAEhC,MAAMC,MAA6C,gBAAGC,cAAK,CAACC,SAAS,CAAC,CAAC;EAEvE,SAASC,aAAaA,CAAC;IACrBC;EAGF,CAAC,EAAE;IACD,MAAMC,YAAY,GAAGT,cAAc,CAACQ,mBAAmB,CAAC;IAExDH,cAAK,CAACK,SAAS,CAAC,MAAM;MACpBN,MAAM,CAACO,OAAO,GAAGF,YAAY;IAC/B,CAAC,CAAC;IAEF,OAAO,IAAI;EACb;EAEA,MAAM;IAAEG,QAAQ,EAAEC,YAAY;IAAEC;EAAQ,CAAC,GAAG,IAAAC,sBAAc;EAAA;EACxD;EACAvB,MAAA,CAAAM,OAAA,CAAAkB,aAAA,CAACT,aAAa;IAACC,mBAAmB,EAAEN;EAAa,CAAE,CAAC,EACpD;IACEC,OAAO;IACPc,wBAAwB,EAAE;EAC5B,CACF,CAAC;EAED,SAASL,QAAQA,CAACM,qBAA4B,EAAE;IAC9C,OAAOL,YAAY,eACjBrB,MAAA,CAAAM,OAAA,CAAAkB,aAAA,CAACT,aAAa;MAACC,mBAAmB,EAAEU;IAAsB,CAAE,CAC9D,CAAC;EACH;;EAEA;EACA,OAAO;IAAEd,MAAM;IAAEQ,QAAQ;IAAEE;EAAQ,CAAC;AACtC"}
|
package/build/shallow.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shallow.js","names":["React","_interopRequireWildcard","require","_shallow","_interopRequireDefault","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","shallowInternal","instance","renderer","ShallowRenderer","render","createElement","type","props","output","getRenderOutput"],"sources":["../src/shallow.ts"],"sourcesContent":["import * as React from 'react';\nimport { ReactTestInstance } from 'react-test-renderer';\nimport ShallowRenderer from 'react-test-renderer/shallow'; // eslint-disable-line import/no-extraneous-dependencies\n\n/**\n * Renders test component shallowly using react-test-renderer/shallow\n */\nexport function shallowInternal(\n instance: ReactTestInstance | React.ReactElement<any>\n): { output: any } {\n const renderer = new (ShallowRenderer as any)();\n\n renderer.render(React.createElement(instance.type, instance.props));\n\n return {\n output: renderer.getRenderOutput(),\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAC,sBAAA,CAAAF,OAAA;AAA0D,SAAAE,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAR,wBAAAI,GAAA,EAAAI,WAAA,SAAAA,WAAA,IAAAJ,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAQ,KAAA,GAAAL,wBAAA,CAAAC,WAAA,OAAAI,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAT,GAAA,YAAAQ,KAAA,CAAAE,GAAA,CAAAV,GAAA,SAAAW,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAhB,GAAA,QAAAgB,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAnB,GAAA,EAAAgB,GAAA,SAAAI,IAAA,GAAAR,qBAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAf,GAAA,EAAAgB,GAAA,cAAAI,IAAA,KAAAA,IAAA,CAAAV,GAAA,IAAAU,IAAA,CAAAC,GAAA,KAAAR,MAAA,CAAAC,cAAA,CAAAH,MAAA,EAAAK,GAAA,EAAAI,IAAA,YAAAT,MAAA,CAAAK,GAAA,IAAAhB,GAAA,CAAAgB,GAAA,SAAAL,MAAA,CAAAT,OAAA,GAAAF,GAAA,MAAAQ,KAAA,IAAAA,KAAA,CAAAa,GAAA,CAAArB,GAAA,EAAAW,MAAA,YAAAA,MAAA;AAAC;;AAE3D;AACA;AACA;AACO,SAASW,eAAeA,CAC7BC,QAAqD,EACpC;EACjB,MAAMC,QAAQ,GAAG,IAAKC,gBAAe,
|
|
1
|
+
{"version":3,"file":"shallow.js","names":["React","_interopRequireWildcard","require","_shallow","_interopRequireDefault","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","shallowInternal","instance","renderer","ShallowRenderer","render","createElement","type","props","output","getRenderOutput"],"sources":["../src/shallow.ts"],"sourcesContent":["import * as React from 'react';\nimport { ReactTestInstance } from 'react-test-renderer';\nimport ShallowRenderer from 'react-test-renderer/shallow'; // eslint-disable-line import/no-extraneous-dependencies\n\n/**\n * Renders test component shallowly using react-test-renderer/shallow\n */\nexport function shallowInternal(\n instance: ReactTestInstance | React.ReactElement<any>\n): { output: any } {\n const renderer = new (ShallowRenderer as any)();\n\n renderer.render(React.createElement(instance.type, instance.props));\n\n return {\n output: renderer.getRenderOutput(),\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAC,sBAAA,CAAAF,OAAA;AAA0D,SAAAE,uBAAAC,GAAA,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AqD,EACpC;EACjB,MAAMC,QAAQ,GAAG,IAAKC,gBAAe,CAAS,CAAC;EAE/CD,QAAQ,CAACE,MAAM,eAAC/B,KAAK,CAACgC,aAAa,CAACJ,QAAQ,CAACK,IAAI,EAAEL,QAAQ,CAACM,KAAK,CAAC,CAAC;EAEnE,OAAO;IACLC,MAAM,EAAEN,QAAQ,CAACO,eAAe,CAAC;EACnC,CAAC;AACH"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface EventEntry {
|
|
2
|
+
name: string;
|
|
3
|
+
payload: any;
|
|
4
|
+
}
|
|
5
|
+
export declare function createEventLogger(): {
|
|
6
|
+
events: EventEntry[];
|
|
7
|
+
logEvent: (name: string) => (event: unknown) => void;
|
|
8
|
+
};
|
|
9
|
+
export declare function getEventsName(events: EventEntry[]): string[];
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createEventLogger = createEventLogger;
|
|
7
|
+
exports.getEventsName = getEventsName;
|
|
8
|
+
function createEventLogger() {
|
|
9
|
+
const events = [];
|
|
10
|
+
const logEvent = name => {
|
|
11
|
+
return event => {
|
|
12
|
+
const eventEntry = {
|
|
13
|
+
name,
|
|
14
|
+
payload: event
|
|
15
|
+
};
|
|
16
|
+
events.push(eventEntry);
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
return {
|
|
20
|
+
events,
|
|
21
|
+
logEvent
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function getEventsName(events) {
|
|
25
|
+
return events.map(event => event.name);
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.js","names":["createEventLogger","events","logEvent","name","event","eventEntry","payload","push","getEventsName","map"],"sources":["../../src/test-utils/events.ts"],"sourcesContent":["interface EventEntry {\n name: string;\n payload: any;\n}\n\nexport function createEventLogger() {\n const events: EventEntry[] = [];\n const logEvent = (name: string) => {\n return (event: unknown) => {\n const eventEntry: EventEntry = {\n name,\n payload: event,\n };\n\n events.push(eventEntry);\n };\n };\n\n return { events, logEvent };\n}\n\nexport function getEventsName(events: EventEntry[]) {\n return events.map((event) => event.name);\n}\n"],"mappings":";;;;;;;AAKO,SAASA,iBAAiBA,CAAA,EAAG;EAClC,MAAMC,MAAoB,GAAG,EAAE;EAC/B,MAAMC,QAAQ,GAAIC,IAAY,IAAK;IACjC,OAAQC,KAAc,IAAK;MACzB,MAAMC,UAAsB,GAAG;QAC7BF,IAAI;QACJG,OAAO,EAAEF;MACX,CAAC;MAEDH,MAAM,CAACM,IAAI,CAACF,UAAU,CAAC;IACzB,CAAC;EACH,CAAC;EAED,OAAO;IAAEJ,MAAM;IAAEC;EAAS,CAAC;AAC7B;AAEO,SAASM,aAAaA,CAACP,MAAoB,EAAE;EAClD,OAAOA,MAAM,CAACQ,GAAG,CAAEL,KAAK,IAAKA,KAAK,CAACD,IAAI,CAAC;AAC1C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './events';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _events = require("./events");
|
|
7
|
+
Object.keys(_events).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _events[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _events[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_events","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["../../src/test-utils/index.ts"],"sourcesContent":["export * from './events';\n"],"mappings":";;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,OAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,OAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,OAAA,CAAAK,GAAA;IAAA;EAAA;AAAA"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/// <reference types="jest" />
|
|
2
|
+
export declare const CommonEventBuilder: {
|
|
3
|
+
/**
|
|
4
|
+
* Experimental values:
|
|
5
|
+
* - iOS: `{"changedTouches": [[Circular]], "identifier": 1, "locationX": 253, "locationY": 30.333328247070312, "pageX": 273, "pageY": 141.3333282470703, "target": 75, "timestamp": 875928682.0450834, "touches": [[Circular]]}`
|
|
6
|
+
* - Android: `{"changedTouches": [[Circular]], "identifier": 0, "locationX": 160, "locationY": 40.3636360168457, "pageX": 180, "pageY": 140.36363220214844, "target": 53, "targetSurface": -1, "timestamp": 10290805, "touches": [[Circular]]}`
|
|
7
|
+
*/
|
|
8
|
+
touch: () => {
|
|
9
|
+
persist: jest.Mock<any, any, any>;
|
|
10
|
+
currentTarget: {
|
|
11
|
+
measure: jest.Mock<any, any, any>;
|
|
12
|
+
};
|
|
13
|
+
nativeEvent: {
|
|
14
|
+
changedTouches: never[];
|
|
15
|
+
identifier: number;
|
|
16
|
+
locationX: number;
|
|
17
|
+
locationY: number;
|
|
18
|
+
pageX: number;
|
|
19
|
+
pageY: number;
|
|
20
|
+
target: number;
|
|
21
|
+
timestamp: number;
|
|
22
|
+
touches: never[];
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Experimental values:
|
|
27
|
+
* - iOS: `{"eventCount": 0, "target": 75, "text": ""}`
|
|
28
|
+
* - Android: `{"target": 53}`
|
|
29
|
+
*/
|
|
30
|
+
focus: () => {
|
|
31
|
+
nativeEvent: {
|
|
32
|
+
target: number;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Experimental values:
|
|
37
|
+
* - iOS: `{"eventCount": 0, "target": 75, "text": ""}`
|
|
38
|
+
* - Android: `{"target": 53}`
|
|
39
|
+
*/
|
|
40
|
+
blur: () => {
|
|
41
|
+
nativeEvent: {
|
|
42
|
+
target: number;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CommonEventBuilder = void 0;
|
|
7
|
+
const CommonEventBuilder = {
|
|
8
|
+
/**
|
|
9
|
+
* Experimental values:
|
|
10
|
+
* - iOS: `{"changedTouches": [[Circular]], "identifier": 1, "locationX": 253, "locationY": 30.333328247070312, "pageX": 273, "pageY": 141.3333282470703, "target": 75, "timestamp": 875928682.0450834, "touches": [[Circular]]}`
|
|
11
|
+
* - Android: `{"changedTouches": [[Circular]], "identifier": 0, "locationX": 160, "locationY": 40.3636360168457, "pageX": 180, "pageY": 140.36363220214844, "target": 53, "targetSurface": -1, "timestamp": 10290805, "touches": [[Circular]]}`
|
|
12
|
+
*/
|
|
13
|
+
touch: () => {
|
|
14
|
+
return {
|
|
15
|
+
persist: jest.fn(),
|
|
16
|
+
currentTarget: {
|
|
17
|
+
measure: jest.fn()
|
|
18
|
+
},
|
|
19
|
+
nativeEvent: {
|
|
20
|
+
changedTouches: [],
|
|
21
|
+
identifier: 0,
|
|
22
|
+
locationX: 0,
|
|
23
|
+
locationY: 0,
|
|
24
|
+
pageX: 0,
|
|
25
|
+
pageY: 0,
|
|
26
|
+
target: 0,
|
|
27
|
+
timestamp: Date.now(),
|
|
28
|
+
touches: []
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
},
|
|
32
|
+
/**
|
|
33
|
+
* Experimental values:
|
|
34
|
+
* - iOS: `{"eventCount": 0, "target": 75, "text": ""}`
|
|
35
|
+
* - Android: `{"target": 53}`
|
|
36
|
+
*/
|
|
37
|
+
focus: () => {
|
|
38
|
+
return {
|
|
39
|
+
nativeEvent: {
|
|
40
|
+
target: 0
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
/**
|
|
45
|
+
* Experimental values:
|
|
46
|
+
* - iOS: `{"eventCount": 0, "target": 75, "text": ""}`
|
|
47
|
+
* - Android: `{"target": 53}`
|
|
48
|
+
*/
|
|
49
|
+
blur: () => {
|
|
50
|
+
return {
|
|
51
|
+
nativeEvent: {
|
|
52
|
+
target: 0
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
exports.CommonEventBuilder = CommonEventBuilder;
|
|
58
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","names":["CommonEventBuilder","touch","persist","jest","fn","currentTarget","measure","nativeEvent","changedTouches","identifier","locationX","locationY","pageX","pageY","target","timestamp","Date","now","touches","focus","blur","exports"],"sources":["../../../src/user-event/event-builder/common.ts"],"sourcesContent":["export const CommonEventBuilder = {\n /**\n * Experimental values:\n * - iOS: `{\"changedTouches\": [[Circular]], \"identifier\": 1, \"locationX\": 253, \"locationY\": 30.333328247070312, \"pageX\": 273, \"pageY\": 141.3333282470703, \"target\": 75, \"timestamp\": 875928682.0450834, \"touches\": [[Circular]]}`\n * - Android: `{\"changedTouches\": [[Circular]], \"identifier\": 0, \"locationX\": 160, \"locationY\": 40.3636360168457, \"pageX\": 180, \"pageY\": 140.36363220214844, \"target\": 53, \"targetSurface\": -1, \"timestamp\": 10290805, \"touches\": [[Circular]]}`\n */\n touch: () => {\n return {\n persist: jest.fn(),\n currentTarget: { measure: jest.fn() },\n nativeEvent: {\n changedTouches: [],\n identifier: 0,\n locationX: 0,\n locationY: 0,\n pageX: 0,\n pageY: 0,\n target: 0,\n timestamp: Date.now(),\n touches: [],\n },\n };\n },\n\n /**\n * Experimental values:\n * - iOS: `{\"eventCount\": 0, \"target\": 75, \"text\": \"\"}`\n * - Android: `{\"target\": 53}`\n */\n focus: () => {\n return {\n nativeEvent: {\n target: 0,\n },\n };\n },\n\n /**\n * Experimental values:\n * - iOS: `{\"eventCount\": 0, \"target\": 75, \"text\": \"\"}`\n * - Android: `{\"target\": 53}`\n */\n blur: () => {\n return {\n nativeEvent: {\n target: 0,\n },\n };\n },\n};\n"],"mappings":";;;;;;AAAO,MAAMA,kBAAkB,GAAG;EAChC;AACF;AACA;AACA;AACA;EACEC,KAAK,EAAEA,CAAA,KAAM;IACX,OAAO;MACLC,OAAO,EAAEC,IAAI,CAACC,EAAE,CAAC,CAAC;MAClBC,aAAa,EAAE;QAAEC,OAAO,EAAEH,IAAI,CAACC,EAAE,CAAC;MAAE,CAAC;MACrCG,WAAW,EAAE;QACXC,cAAc,EAAE,EAAE;QAClBC,UAAU,EAAE,CAAC;QACbC,SAAS,EAAE,CAAC;QACZC,SAAS,EAAE,CAAC;QACZC,KAAK,EAAE,CAAC;QACRC,KAAK,EAAE,CAAC;QACRC,MAAM,EAAE,CAAC;QACTC,SAAS,EAAEC,IAAI,CAACC,GAAG,CAAC,CAAC;QACrBC,OAAO,EAAE;MACX;IACF,CAAC;EACH,CAAC;EAED;AACF;AACA;AACA;AACA;EACEC,KAAK,EAAEA,CAAA,KAAM;IACX,OAAO;MACLZ,WAAW,EAAE;QACXO,MAAM,EAAE;MACV;IACF,CAAC;EACH,CAAC;EAED;AACF;AACA;AACA;AACA;EACEM,IAAI,EAAEA,CAAA,KAAM;IACV,OAAO;MACLb,WAAW,EAAE;QACXO,MAAM,EAAE;MACV;IACF,CAAC;EACH;AACF,CAAC;AAACO,OAAA,CAAArB,kBAAA,GAAAA,kBAAA"}
|