@testing-library/react-native 13.0.0-beta.0 → 14.0.0-alpha.0
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/act.d.ts +4 -3
- package/build/act.js +1 -6
- package/build/act.js.map +1 -1
- package/build/config.d.ts +1 -11
- package/build/config.js +1 -2
- package/build/config.js.map +1 -1
- package/build/fire-event.d.ts +7 -7
- package/build/fire-event.js +26 -4
- package/build/fire-event.js.map +1 -1
- package/build/helpers/accessibility.d.ts +14 -14
- package/build/helpers/accessibility.js +2 -2
- package/build/helpers/accessibility.js.map +1 -1
- package/build/helpers/component-tree.d.ts +7 -31
- package/build/helpers/component-tree.js +15 -73
- package/build/helpers/component-tree.js.map +1 -1
- package/build/helpers/debug.d.ts +2 -2
- package/build/helpers/debug.js.map +1 -1
- package/build/helpers/find-all.d.ts +2 -3
- package/build/helpers/find-all.js +5 -5
- package/build/helpers/find-all.js.map +1 -1
- package/build/helpers/format.d.ts +3 -3
- package/build/helpers/format.js.map +1 -1
- package/build/helpers/host-component-names.d.ts +7 -8
- package/build/helpers/host-component-names.js +7 -6
- package/build/helpers/host-component-names.js.map +1 -1
- package/build/helpers/matchers/match-accessibility-state.d.ts +2 -2
- package/build/helpers/matchers/match-accessibility-state.js.map +1 -1
- package/build/helpers/matchers/match-accessibility-value.d.ts +2 -2
- package/build/helpers/matchers/match-accessibility-value.js.map +1 -1
- package/build/helpers/matchers/match-label-text.d.ts +2 -2
- package/build/helpers/matchers/match-label-text.js.map +1 -1
- package/build/helpers/matchers/match-text-content.d.ts +2 -2
- package/build/helpers/matchers/match-text-content.js.map +1 -1
- package/build/helpers/pointer-events.d.ts +2 -2
- package/build/helpers/pointer-events.js +1 -2
- package/build/helpers/pointer-events.js.map +1 -1
- package/build/helpers/text-content.d.ts +2 -2
- package/build/helpers/text-content.js.map +1 -1
- package/build/helpers/text-input.d.ts +3 -3
- package/build/helpers/text-input.js.map +1 -1
- package/build/helpers/wrap-async.d.ts +1 -0
- package/build/helpers/wrap-async.js +1 -0
- package/build/helpers/wrap-async.js.map +1 -1
- package/build/index.d.ts +1 -0
- package/build/index.flow.js +0 -1
- package/build/index.js +11 -0
- package/build/index.js.map +1 -1
- package/build/matchers/to-be-busy.d.ts +2 -2
- package/build/matchers/to-be-busy.js.map +1 -1
- package/build/matchers/to-be-checked.d.ts +2 -2
- package/build/matchers/to-be-checked.js.map +1 -1
- package/build/matchers/to-be-disabled.d.ts +3 -3
- package/build/matchers/to-be-disabled.js +1 -2
- package/build/matchers/to-be-disabled.js.map +1 -1
- package/build/matchers/to-be-empty-element.d.ts +2 -2
- package/build/matchers/to-be-empty-element.js +1 -2
- package/build/matchers/to-be-empty-element.js.map +1 -1
- package/build/matchers/to-be-expanded.d.ts +3 -3
- package/build/matchers/to-be-expanded.js.map +1 -1
- package/build/matchers/to-be-on-the-screen.d.ts +2 -2
- package/build/matchers/to-be-on-the-screen.js +1 -1
- package/build/matchers/to-be-on-the-screen.js.map +1 -1
- package/build/matchers/to-be-partially-checked.d.ts +2 -2
- package/build/matchers/to-be-partially-checked.js.map +1 -1
- package/build/matchers/to-be-selected.d.ts +2 -2
- package/build/matchers/to-be-selected.js.map +1 -1
- package/build/matchers/to-be-visible.d.ts +2 -2
- package/build/matchers/to-be-visible.js +1 -2
- package/build/matchers/to-be-visible.js.map +1 -1
- package/build/matchers/to-contain-element.d.ts +2 -2
- package/build/matchers/to-contain-element.js +2 -1
- package/build/matchers/to-contain-element.js.map +1 -1
- package/build/matchers/to-have-accessibility-value.d.ts +2 -2
- package/build/matchers/to-have-accessibility-value.js.map +1 -1
- package/build/matchers/to-have-accessible-name.d.ts +2 -2
- package/build/matchers/to-have-accessible-name.js.map +1 -1
- package/build/matchers/to-have-display-value.d.ts +2 -2
- package/build/matchers/to-have-display-value.js.map +1 -1
- package/build/matchers/to-have-prop.d.ts +2 -2
- package/build/matchers/to-have-prop.js.map +1 -1
- package/build/matchers/to-have-style.d.ts +2 -2
- package/build/matchers/to-have-style.js.map +1 -1
- package/build/matchers/to-have-text-content.d.ts +2 -2
- package/build/matchers/to-have-text-content.js.map +1 -1
- package/build/matchers/types.d.ts +2 -2
- package/build/matchers/types.js.map +1 -1
- package/build/matchers/utils.d.ts +5 -5
- package/build/matchers/utils.js +10 -6
- package/build/matchers/utils.js.map +1 -1
- package/build/native-state.d.ts +3 -3
- package/build/native-state.js.map +1 -1
- package/build/queries/display-value.d.ts +2 -2
- package/build/queries/display-value.js.map +1 -1
- package/build/queries/hint-text.d.ts +2 -2
- package/build/queries/hint-text.js.map +1 -1
- package/build/queries/label-text.d.ts +2 -2
- package/build/queries/label-text.js.map +1 -1
- package/build/queries/make-queries.d.ts +9 -9
- package/build/queries/make-queries.js +2 -2
- package/build/queries/make-queries.js.map +1 -1
- package/build/queries/placeholder-text.d.ts +2 -2
- package/build/queries/placeholder-text.js.map +1 -1
- package/build/queries/role.d.ts +2 -2
- package/build/queries/role.js.map +1 -1
- package/build/queries/test-id.d.ts +2 -2
- package/build/queries/test-id.js.map +1 -1
- package/build/queries/text.d.ts +2 -2
- package/build/queries/text.js.map +1 -1
- package/build/render.d.ts +47 -85
- package/build/render.js +25 -69
- package/build/render.js.map +1 -1
- package/build/screen.js +1 -9
- package/build/screen.js.map +1 -1
- package/build/tsconfig.release.tsbuildinfo +1 -1
- package/build/user-event/clear.d.ts +2 -2
- package/build/user-event/clear.js.map +1 -1
- package/build/user-event/index.d.ts +7 -7
- package/build/user-event/index.js.map +1 -1
- package/build/user-event/paste.d.ts +2 -2
- package/build/user-event/paste.js.map +1 -1
- package/build/user-event/press/press.d.ts +3 -3
- package/build/user-event/press/press.js +1 -2
- package/build/user-event/press/press.js.map +1 -1
- package/build/user-event/scroll/scroll-to.d.ts +2 -2
- package/build/user-event/scroll/scroll-to.js.map +1 -1
- package/build/user-event/setup/setup.d.ts +7 -7
- package/build/user-event/setup/setup.js.map +1 -1
- package/build/user-event/type/type.d.ts +3 -3
- package/build/user-event/type/type.js.map +1 -1
- package/build/user-event/utils/dispatch-event.d.ts +2 -2
- package/build/user-event/utils/dispatch-event.js.map +1 -1
- package/build/within.d.ts +20 -36
- package/build/within.js +7 -11
- package/build/within.js.map +1 -1
- package/package.json +11 -12
- package/typings/index.flow.js +0 -1
- package/build/helpers/string-validation.d.ts +0 -2
- package/build/helpers/string-validation.js +0 -31
- package/build/helpers/string-validation.js.map +0 -1
- package/build/queries/unsafe-props.d.ts +0 -16
- package/build/queries/unsafe-props.js +0 -49
- package/build/queries/unsafe-props.js.map +0 -1
- package/build/queries/unsafe-type.d.ts +0 -9
- package/build/queries/unsafe-type.js +0 -47
- package/build/queries/unsafe-type.js.map +0 -1
- package/build/render-act.d.ts +0 -2
- package/build/render-act.js +0 -22
- package/build/render-act.js.map +0 -1
package/build/render.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ReactTestInstance } from 'react-test-renderer';
|
|
2
1
|
import * as React from 'react';
|
|
2
|
+
import { HostElement } from 'universal-test-renderer/react-native';
|
|
3
3
|
import { DebugOptions } from './helpers/debug';
|
|
4
4
|
export interface RenderOptions {
|
|
5
5
|
/**
|
|
@@ -7,49 +7,45 @@ export interface RenderOptions {
|
|
|
7
7
|
* reusable custom render functions for common data providers.
|
|
8
8
|
*/
|
|
9
9
|
wrapper?: React.ComponentType<any>;
|
|
10
|
-
|
|
11
|
-
* Set to `false` to disable concurrent rendering.
|
|
12
|
-
* Otherwise `render` will default to concurrent rendering.
|
|
13
|
-
*/
|
|
14
|
-
concurrentRoot?: boolean;
|
|
15
|
-
createNodeMock?: (element: React.ReactElement) => unknown;
|
|
16
|
-
unstable_validateStringsRenderedWithinText?: boolean;
|
|
10
|
+
createNodeMock?: (element: React.ReactElement) => object;
|
|
17
11
|
}
|
|
18
12
|
export type RenderResult = ReturnType<typeof render>;
|
|
19
13
|
/**
|
|
20
14
|
* Renders test component deeply using React Test Renderer and exposes helpers
|
|
21
15
|
* to assert on the output.
|
|
22
16
|
*/
|
|
23
|
-
export default function render<T>(
|
|
24
|
-
update: (
|
|
17
|
+
export default function render<T>(element: React.ReactElement<T>, options?: RenderOptions): {
|
|
18
|
+
update: (element: React.ReactElement) => void;
|
|
25
19
|
unmount: () => void;
|
|
26
|
-
rerender: (
|
|
27
|
-
toJSON: () =>
|
|
20
|
+
rerender: (element: React.ReactElement) => void;
|
|
21
|
+
toJSON: () => import("universal-test-renderer").JsonNode | null | undefined;
|
|
28
22
|
debug: DebugFunction;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
UNSAFE_getByType: <P>(type: React.ComponentType<P>) => ReactTestInstance;
|
|
44
|
-
UNSAFE_getAllByType: <P>(type: React.ComponentType<P>) => Array<ReactTestInstance>;
|
|
45
|
-
UNSAFE_queryByType: <P>(type: React.ComponentType<P>) => ReactTestInstance | null;
|
|
46
|
-
UNSAFE_queryAllByType: <P>(type: React.ComponentType<P>) => Array<ReactTestInstance>;
|
|
23
|
+
container: HostElement;
|
|
24
|
+
root: HostElement | null;
|
|
25
|
+
getByText: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
26
|
+
getAllByText: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
27
|
+
queryByText: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
28
|
+
queryAllByText: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
29
|
+
findByText: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
30
|
+
findAllByText: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
31
|
+
getByTestId: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
32
|
+
getAllByTestId: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
33
|
+
queryByTestId: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
34
|
+
queryAllByTestId: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
35
|
+
findByTestId: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
36
|
+
findAllByTestId: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
47
37
|
getByRole: import("./queries/make-queries").GetByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
48
38
|
getAllByRole: import("./queries/make-queries").GetAllByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
49
39
|
queryByRole: import("./queries/make-queries").QueryByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
50
40
|
queryAllByRole: import("./queries/make-queries").QueryAllByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
51
41
|
findByRole: import("./queries/make-queries").FindByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
52
42
|
findAllByRole: import("./queries/make-queries").FindAllByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
43
|
+
getByLabelText: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
44
|
+
getAllByLabelText: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
45
|
+
queryByLabelText: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
46
|
+
queryAllByLabelText: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
47
|
+
findByLabelText: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
48
|
+
findAllByLabelText: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
53
49
|
getByHintText: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
54
50
|
getAllByHintText: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
55
51
|
queryByHintText: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
@@ -68,12 +64,6 @@ export default function render<T>(component: React.ReactElement<T>, options?: Re
|
|
|
68
64
|
queryAllByAccessibilityHint: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
69
65
|
findByAccessibilityHint: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
70
66
|
findAllByAccessibilityHint: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
71
|
-
getByLabelText: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
72
|
-
getAllByLabelText: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
73
|
-
queryByLabelText: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
74
|
-
queryAllByLabelText: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
75
|
-
findByLabelText: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
76
|
-
findAllByLabelText: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
77
67
|
getByPlaceholderText: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
78
68
|
getAllByPlaceholderText: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
79
69
|
queryByPlaceholderText: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
@@ -86,49 +76,39 @@ export default function render<T>(component: React.ReactElement<T>, options?: Re
|
|
|
86
76
|
queryAllByDisplayValue: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
87
77
|
findByDisplayValue: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
88
78
|
findAllByDisplayValue: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
79
|
+
};
|
|
80
|
+
export declare function renderInternal<T>(element: React.ReactElement<T>, options?: RenderOptions): {
|
|
81
|
+
update: (element: React.ReactElement) => void;
|
|
82
|
+
unmount: () => void;
|
|
83
|
+
rerender: (element: React.ReactElement) => void;
|
|
84
|
+
toJSON: () => import("universal-test-renderer").JsonNode | null | undefined;
|
|
85
|
+
debug: DebugFunction;
|
|
86
|
+
container: HostElement;
|
|
87
|
+
root: HostElement | null;
|
|
95
88
|
getByText: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
96
89
|
getAllByText: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
97
90
|
queryByText: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
98
91
|
queryAllByText: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
99
92
|
findByText: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
100
93
|
findAllByText: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
debug: DebugFunction;
|
|
108
|
-
root: ReactTestInstance;
|
|
109
|
-
UNSAFE_root: ReactTestInstance;
|
|
110
|
-
UNSAFE_getByProps: (props: {
|
|
111
|
-
[key: string]: any;
|
|
112
|
-
}) => ReactTestInstance;
|
|
113
|
-
UNSAFE_getAllByProps: (props: {
|
|
114
|
-
[key: string]: any;
|
|
115
|
-
}) => Array<ReactTestInstance>;
|
|
116
|
-
UNSAFE_queryByProps: (props: {
|
|
117
|
-
[key: string]: any;
|
|
118
|
-
}) => ReactTestInstance | null;
|
|
119
|
-
UNSAFE_queryAllByProps: (props: {
|
|
120
|
-
[key: string]: any;
|
|
121
|
-
}) => Array<ReactTestInstance>;
|
|
122
|
-
UNSAFE_getByType: <P>(type: React.ComponentType<P>) => ReactTestInstance;
|
|
123
|
-
UNSAFE_getAllByType: <P>(type: React.ComponentType<P>) => Array<ReactTestInstance>;
|
|
124
|
-
UNSAFE_queryByType: <P>(type: React.ComponentType<P>) => ReactTestInstance | null;
|
|
125
|
-
UNSAFE_queryAllByType: <P>(type: React.ComponentType<P>) => Array<ReactTestInstance>;
|
|
94
|
+
getByTestId: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
95
|
+
getAllByTestId: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
96
|
+
queryByTestId: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
97
|
+
queryAllByTestId: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
98
|
+
findByTestId: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
99
|
+
findAllByTestId: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
126
100
|
getByRole: import("./queries/make-queries").GetByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
127
101
|
getAllByRole: import("./queries/make-queries").GetAllByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
128
102
|
queryByRole: import("./queries/make-queries").QueryByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
129
103
|
queryAllByRole: import("./queries/make-queries").QueryAllByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
130
104
|
findByRole: import("./queries/make-queries").FindByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
131
105
|
findAllByRole: import("./queries/make-queries").FindAllByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
106
|
+
getByLabelText: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
107
|
+
getAllByLabelText: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
108
|
+
queryByLabelText: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
109
|
+
queryAllByLabelText: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
110
|
+
findByLabelText: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
111
|
+
findAllByLabelText: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
132
112
|
getByHintText: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
133
113
|
getAllByHintText: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
134
114
|
queryByHintText: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
@@ -147,12 +127,6 @@ export declare function renderInternal<T>(component: React.ReactElement<T>, opti
|
|
|
147
127
|
queryAllByAccessibilityHint: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
148
128
|
findByAccessibilityHint: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
149
129
|
findAllByAccessibilityHint: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
150
|
-
getByLabelText: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
151
|
-
getAllByLabelText: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
152
|
-
queryByLabelText: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
153
|
-
queryAllByLabelText: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
154
|
-
findByLabelText: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
155
|
-
findAllByLabelText: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
156
130
|
getByPlaceholderText: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
157
131
|
getAllByPlaceholderText: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
158
132
|
queryByPlaceholderText: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
@@ -165,17 +139,5 @@ export declare function renderInternal<T>(component: React.ReactElement<T>, opti
|
|
|
165
139
|
queryAllByDisplayValue: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
166
140
|
findByDisplayValue: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
167
141
|
findAllByDisplayValue: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
168
|
-
getByTestId: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
169
|
-
getAllByTestId: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
170
|
-
queryByTestId: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
171
|
-
queryAllByTestId: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
172
|
-
findByTestId: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
173
|
-
findAllByTestId: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
174
|
-
getByText: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
175
|
-
getAllByText: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
176
|
-
queryByText: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
177
|
-
queryAllByText: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
178
|
-
findByText: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
179
|
-
findAllByText: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
180
142
|
};
|
|
181
143
|
export type DebugFunction = (options?: DebugOptions | string) => void;
|
package/build/render.js
CHANGED
|
@@ -5,15 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = render;
|
|
7
7
|
exports.renderInternal = renderInternal;
|
|
8
|
-
var
|
|
9
|
-
var
|
|
8
|
+
var React = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _reactNative = require("universal-test-renderer/react-native");
|
|
10
10
|
var _act = _interopRequireDefault(require("./act"));
|
|
11
11
|
var _cleanup = require("./cleanup");
|
|
12
12
|
var _config = require("./config");
|
|
13
|
-
var _componentTree = require("./helpers/component-tree");
|
|
14
13
|
var _debug = require("./helpers/debug");
|
|
15
|
-
var _stringValidation = require("./helpers/string-validation");
|
|
16
|
-
var _renderAct = require("./render-act");
|
|
17
14
|
var _screen = require("./screen");
|
|
18
15
|
var _within = require("./within");
|
|
19
16
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -23,53 +20,28 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
23
20
|
* Renders test component deeply using React Test Renderer and exposes helpers
|
|
24
21
|
* to assert on the output.
|
|
25
22
|
*/
|
|
26
|
-
function render(
|
|
27
|
-
return renderInternal(
|
|
23
|
+
function render(element, options = {}) {
|
|
24
|
+
return renderInternal(element, options);
|
|
28
25
|
}
|
|
29
|
-
function renderInternal(
|
|
26
|
+
function renderInternal(element, options) {
|
|
30
27
|
const {
|
|
31
|
-
wrapper: Wrapper
|
|
32
|
-
concurrentRoot,
|
|
33
|
-
unstable_validateStringsRenderedWithinText,
|
|
34
|
-
...rest
|
|
28
|
+
wrapper: Wrapper
|
|
35
29
|
} = options || {};
|
|
36
|
-
const testRendererOptions = {
|
|
37
|
-
...rest,
|
|
38
|
-
// @ts-expect-error incomplete typing on RTR package
|
|
39
|
-
unstable_isConcurrent: concurrentRoot ?? (0, _config.getConfig)().concurrentRoot
|
|
40
|
-
};
|
|
41
|
-
if (unstable_validateStringsRenderedWithinText) {
|
|
42
|
-
return renderWithStringValidation(component, {
|
|
43
|
-
wrapper: Wrapper,
|
|
44
|
-
...testRendererOptions
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
30
|
const wrap = element => Wrapper ? /*#__PURE__*/React.createElement(Wrapper, null, element) : element;
|
|
48
|
-
const renderer = (0,
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
wrapper: Wrapper,
|
|
55
|
-
...testRendererOptions
|
|
56
|
-
} = options ?? {};
|
|
57
|
-
const handleRender = (_, phase) => {
|
|
58
|
-
if (renderer && phase === 'update') {
|
|
59
|
-
(0, _stringValidation.validateStringsRenderedWithinText)(renderer.toJSON());
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
const wrap = element => /*#__PURE__*/React.createElement(_react.Profiler, {
|
|
63
|
-
id: "renderProfiler",
|
|
64
|
-
onRender: handleRender
|
|
65
|
-
}, Wrapper ? /*#__PURE__*/React.createElement(Wrapper, null, element) : element);
|
|
66
|
-
renderer = (0, _renderAct.renderWithAct)(wrap(component), testRendererOptions);
|
|
67
|
-
(0, _stringValidation.validateStringsRenderedWithinText)(renderer.toJSON());
|
|
31
|
+
const renderer = (0, _reactNative.createRoot)({
|
|
32
|
+
createNodeMock: options?.createNodeMock
|
|
33
|
+
});
|
|
34
|
+
void (0, _act.default)(() => {
|
|
35
|
+
renderer.render(wrap(element));
|
|
36
|
+
});
|
|
68
37
|
return buildRenderResult(renderer, wrap);
|
|
69
38
|
}
|
|
70
39
|
function buildRenderResult(renderer, wrap) {
|
|
71
|
-
const update =
|
|
72
|
-
|
|
40
|
+
const update = element => {
|
|
41
|
+
void (0, _act.default)(() => {
|
|
42
|
+
renderer.render(wrap(element));
|
|
43
|
+
});
|
|
44
|
+
};
|
|
73
45
|
const unmount = () => {
|
|
74
46
|
void (0, _act.default)(() => {
|
|
75
47
|
renderer.unmount();
|
|
@@ -77,38 +49,22 @@ function buildRenderResult(renderer, wrap) {
|
|
|
77
49
|
};
|
|
78
50
|
(0, _cleanup.addToCleanupQueue)(unmount);
|
|
79
51
|
const result = {
|
|
80
|
-
...(0, _within.getQueriesForElement)(
|
|
52
|
+
...(0, _within.getQueriesForElement)(renderer.container),
|
|
81
53
|
update,
|
|
82
54
|
unmount,
|
|
83
55
|
rerender: update,
|
|
84
56
|
// alias for `update`
|
|
85
|
-
toJSON: renderer.toJSON,
|
|
86
|
-
debug: makeDebug(
|
|
57
|
+
toJSON: () => renderer.root?.toJSON(),
|
|
58
|
+
debug: makeDebug(renderer),
|
|
59
|
+
container: renderer.container,
|
|
87
60
|
get root() {
|
|
88
|
-
return
|
|
89
|
-
},
|
|
90
|
-
UNSAFE_root: instance
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
// Add as non-enumerable property, so that it's safe to enumerate
|
|
94
|
-
// `render` result, e.g. using destructuring rest syntax.
|
|
95
|
-
Object.defineProperty(result, 'container', {
|
|
96
|
-
enumerable: false,
|
|
97
|
-
get() {
|
|
98
|
-
throw new Error("'container' property has been renamed to 'UNSAFE_root'.\n\n" + "Consider using 'root' property which returns root host element.");
|
|
61
|
+
return renderer.root;
|
|
99
62
|
}
|
|
100
|
-
}
|
|
63
|
+
};
|
|
101
64
|
(0, _screen.setRenderResult)(result);
|
|
102
65
|
return result;
|
|
103
66
|
}
|
|
104
|
-
function
|
|
105
|
-
return function (component) {
|
|
106
|
-
void (0, _act.default)(() => {
|
|
107
|
-
renderer.update(wrap(component));
|
|
108
|
-
});
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
function makeDebug(instance, renderer) {
|
|
67
|
+
function makeDebug(renderer) {
|
|
112
68
|
function debugImpl(options) {
|
|
113
69
|
const {
|
|
114
70
|
defaultDebugOptions
|
|
@@ -124,7 +80,7 @@ function makeDebug(instance, renderer) {
|
|
|
124
80
|
// eslint-disable-next-line no-console
|
|
125
81
|
console.warn('Using debug("message") is deprecated and will be removed in future release, please use debug({ message: "message" }) instead.');
|
|
126
82
|
}
|
|
127
|
-
const json = renderer.toJSON();
|
|
83
|
+
const json = renderer.root?.toJSON();
|
|
128
84
|
if (json) {
|
|
129
85
|
return (0, _debug.debug)(json, debugOptions);
|
|
130
86
|
}
|
package/build/render.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.js","names":["_react","_interopRequireWildcard","require","React","_act","_interopRequireDefault","_cleanup","_config","_componentTree","_debug","_stringValidation","_renderAct","_screen","_within","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","render","component","options","renderInternal","wrapper","Wrapper","concurrentRoot","unstable_validateStringsRenderedWithinText","rest","testRendererOptions","unstable_isConcurrent","getConfig","renderWithStringValidation","wrap","element","createElement","renderer","renderWithAct","buildRenderResult","handleRender","_","phase","validateStringsRenderedWithinText","toJSON","Profiler","id","onRender","update","updateWithAct","instance","root","unmount","act","addToCleanupQueue","result","getQueriesForElement","rerender","debug","makeDebug","getHostSelves","UNSAFE_root","enumerable","Error","setRenderResult","debugImpl","defaultDebugOptions","debugOptions","message","console","warn","json"],"sources":["../src/render.tsx"],"sourcesContent":["import type {\n ReactTestInstance,\n ReactTestRenderer,\n TestRendererOptions,\n} 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 { getHostSelves } from './helpers/component-tree';\nimport { debug, DebugOptions } from './helpers/debug';\nimport { validateStringsRenderedWithinText } from './helpers/string-validation';\nimport { renderWithAct } from './render-act';\nimport { setRenderResult } from './screen';\nimport { getQueriesForElement } from './within';\n\nexport interface RenderOptions {\n /**\n * Pass a React Component as the wrapper option to have it rendered around the inner element. This is most useful for creating\n * reusable custom render functions for common data providers.\n */\n wrapper?: React.ComponentType<any>;\n\n /**\n * Set to `false` to disable concurrent rendering.\n * Otherwise `render` will default to concurrent rendering.\n */\n concurrentRoot?: boolean;\n\n createNodeMock?: (element: React.ReactElement) => unknown;\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>(component: React.ReactElement<T>, options: RenderOptions = {}) {\n return renderInternal(component, options);\n}\n\nexport function renderInternal<T>(component: React.ReactElement<T>, options?: RenderOptions) {\n const {\n wrapper: Wrapper,\n concurrentRoot,\n unstable_validateStringsRenderedWithinText,\n ...rest\n } = options || {};\n\n const testRendererOptions: TestRendererOptions = {\n ...rest,\n // @ts-expect-error incomplete typing on RTR package\n unstable_isConcurrent: concurrentRoot ?? getConfig().concurrentRoot,\n };\n\n if (unstable_validateStringsRenderedWithinText) {\n return renderWithStringValidation(component, {\n wrapper: Wrapper,\n ...testRendererOptions,\n });\n }\n\n const wrap = (element: React.ReactElement) => (Wrapper ? <Wrapper>{element}</Wrapper> : element);\n const renderer = renderWithAct(wrap(component), testRendererOptions);\n return buildRenderResult(renderer, wrap);\n}\n\nfunction renderWithStringValidation<T>(\n component: React.ReactElement<T>,\n options: Omit<RenderOptions, 'unstable_validateStringsRenderedWithinText'> = {},\n) {\n let renderer: ReactTestRenderer;\n const { wrapper: Wrapper, ...testRendererOptions } = options ?? {};\n\n const handleRender: React.ProfilerOnRenderCallback = (_, phase) => {\n if (renderer && phase === 'update') {\n validateStringsRenderedWithinText(renderer.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 renderer = renderWithAct(wrap(component), testRendererOptions);\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 void 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: makeDebug(instance, renderer),\n get root(): ReactTestInstance {\n return getHostSelves(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\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 void act(() => {\n renderer.update(wrap(component));\n });\n };\n}\n\nexport type DebugFunction = (options?: DebugOptions | string) => void;\n\nfunction makeDebug(instance: ReactTestInstance, renderer: ReactTestRenderer): 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 debug(json, debugOptions);\n }\n }\n return debugImpl;\n}\n"],"mappings":";;;;;;;AAKA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAA+B,IAAAC,KAAA,GAAAH,MAAA;AAE/B,IAAAI,IAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,cAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,iBAAA,GAAAR,OAAA;AACA,IAAAS,UAAA,GAAAT,OAAA;AACA,IAAAU,OAAA,GAAAV,OAAA;AACA,IAAAW,OAAA,GAAAX,OAAA;AAAgD,SAAAG,uBAAAS,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,yBAAAH,CAAA,6BAAAI,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAD,wBAAA,YAAAA,CAAAH,CAAA,WAAAA,CAAA,GAAAM,CAAA,GAAAD,CAAA,KAAAL,CAAA;AAAA,SAAAb,wBAAAa,CAAA,EAAAK,CAAA,SAAAA,CAAA,IAAAL,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,eAAAA,CAAA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AC;AACH;AAIA,SAASqC,SAASA,CAACT,QAA2B,EAAEb,QAA2B,EAAiB;EAC1F,SAAS4B,SAASA,CAAC1C,OAA+B,EAAE;IAClD,MAAM;MAAE2C;IAAoB,CAAC,GAAG,IAAAlC,iBAAS,EAAC,CAAC;IAC3C,MAAMmC,YAAY,GAChB,OAAO5C,OAAO,KAAK,QAAQ,GACvB;MAAE,GAAG2C,mBAAmB;MAAEE,OAAO,EAAE7C;IAAQ,CAAC,GAC5C;MAAE,GAAG2C,mBAAmB;MAAE,GAAG3C;IAAQ,CAAC;IAE5C,IAAI,OAAOA,OAAO,KAAK,QAAQ,EAAE;MAC/B;MACA8C,OAAO,CAACC,IAAI,CACV,+HACF,CAAC;IACH;IAEA,MAAMC,IAAI,GAAGlC,QAAQ,CAACO,MAAM,CAAC,CAAC;IAC9B,IAAI2B,IAAI,EAAE;MACR,OAAO,IAAAb,YAAK,EAACa,IAAI,EAAEJ,YAAY,CAAC;IAClC;EACF;EACA,OAAOF,SAAS;AAClB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"render.js","names":["React","_interopRequireWildcard","require","_reactNative","_act","_interopRequireDefault","_cleanup","_config","_debug","_screen","_within","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","render","element","options","renderInternal","wrapper","Wrapper","wrap","createElement","renderer","createRoot","createNodeMock","act","buildRenderResult","update","unmount","addToCleanupQueue","result","getQueriesForElement","container","rerender","toJSON","root","debug","makeDebug","setRenderResult","debugImpl","defaultDebugOptions","getConfig","debugOptions","message","console","warn","json"],"sources":["../src/render.tsx"],"sourcesContent":["import * as React from 'react';\nimport { createRoot, HostElement, Root } from 'universal-test-renderer/react-native';\nimport act from './act';\nimport { addToCleanupQueue } from './cleanup';\nimport { getConfig } from './config';\nimport { debug, DebugOptions } from './helpers/debug';\nimport { setRenderResult } from './screen';\nimport { getQueriesForElement } from './within';\n\nexport interface RenderOptions {\n /**\n * Pass a React Component as the wrapper option to have it rendered around the inner element. This is most useful for creating\n * reusable custom render functions for common data providers.\n */\n wrapper?: React.ComponentType<any>;\n createNodeMock?: (element: React.ReactElement) => object;\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>(element: React.ReactElement<T>, options: RenderOptions = {}) {\n return renderInternal(element, options);\n}\n\nexport function renderInternal<T>(element: React.ReactElement<T>, options?: RenderOptions) {\n const { wrapper: Wrapper } = options || {};\n\n const wrap = (element: React.ReactElement) => (Wrapper ? <Wrapper>{element}</Wrapper> : element);\n const renderer = createRoot({\n createNodeMock: options?.createNodeMock,\n });\n void act(() => {\n renderer.render(wrap(element));\n });\n\n return buildRenderResult(renderer, wrap);\n}\n\nfunction buildRenderResult(renderer: Root, wrap: (element: React.ReactElement) => JSX.Element) {\n const update = (element: React.ReactElement) => {\n void act(() => {\n renderer.render(wrap(element));\n });\n };\n\n const unmount = () => {\n void act(() => {\n renderer.unmount();\n });\n };\n\n addToCleanupQueue(unmount);\n\n const result = {\n ...getQueriesForElement(renderer.container),\n update,\n unmount,\n rerender: update, // alias for `update`\n toJSON: () => renderer.root?.toJSON(),\n debug: makeDebug(renderer),\n container: renderer.container,\n get root(): HostElement | null {\n return renderer.root;\n },\n };\n\n setRenderResult(result);\n return result;\n}\n\nexport type DebugFunction = (options?: DebugOptions | string) => void;\n\nfunction makeDebug(renderer: Root): 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.root?.toJSON();\n if (json) {\n return debug(json, debugOptions);\n }\n }\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18,7 @@ const defaultScreen = {
|
|
|
18
18
|
get root() {
|
|
19
19
|
throw new Error(SCREEN_ERROR);
|
|
20
20
|
},
|
|
21
|
-
get
|
|
21
|
+
get container() {
|
|
22
22
|
throw new Error(SCREEN_ERROR);
|
|
23
23
|
},
|
|
24
24
|
debug: notImplementedDebug,
|
|
@@ -56,14 +56,6 @@ const defaultScreen = {
|
|
|
56
56
|
queryAllByRole: notImplemented,
|
|
57
57
|
findByRole: notImplemented,
|
|
58
58
|
findAllByRole: notImplemented,
|
|
59
|
-
UNSAFE_getByProps: notImplemented,
|
|
60
|
-
UNSAFE_getAllByProps: notImplemented,
|
|
61
|
-
UNSAFE_queryByProps: notImplemented,
|
|
62
|
-
UNSAFE_queryAllByProps: notImplemented,
|
|
63
|
-
UNSAFE_getByType: notImplemented,
|
|
64
|
-
UNSAFE_getAllByType: notImplemented,
|
|
65
|
-
UNSAFE_queryByType: notImplemented,
|
|
66
|
-
UNSAFE_queryAllByType: notImplemented,
|
|
67
59
|
getByPlaceholderText: notImplemented,
|
|
68
60
|
getAllByPlaceholderText: notImplemented,
|
|
69
61
|
queryByPlaceholderText: notImplemented,
|
package/build/screen.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screen.js","names":["SCREEN_ERROR","notImplemented","Error","notImplementedDebug","defaultScreen","isDetached","root","
|
|
1
|
+
{"version":3,"file":"screen.js","names":["SCREEN_ERROR","notImplemented","Error","notImplementedDebug","defaultScreen","isDetached","root","container","debug","update","unmount","rerender","toJSON","getByLabelText","getAllByLabelText","queryByLabelText","queryAllByLabelText","findByLabelText","findAllByLabelText","getByHintText","getAllByHintText","queryByHintText","queryAllByHintText","findByHintText","findAllByHintText","getByA11yHint","getAllByA11yHint","queryByA11yHint","queryAllByA11yHint","findByA11yHint","findAllByA11yHint","getByAccessibilityHint","getAllByAccessibilityHint","queryByAccessibilityHint","queryAllByAccessibilityHint","findByAccessibilityHint","findAllByAccessibilityHint","getByRole","getAllByRole","queryByRole","queryAllByRole","findByRole","findAllByRole","getByPlaceholderText","getAllByPlaceholderText","queryByPlaceholderText","queryAllByPlaceholderText","findByPlaceholderText","findAllByPlaceholderText","getByDisplayValue","getAllByDisplayValue","queryByDisplayValue","queryAllByDisplayValue","findByDisplayValue","findAllByDisplayValue","getByTestId","getAllByTestId","queryByTestId","queryAllByTestId","findByTestId","findAllByTestId","getByText","getAllByText","queryByText","queryAllByText","findByText","findAllByText","screen","exports","setRenderResult","renderResult","clearRenderResult"],"sources":["../src/screen.ts"],"sourcesContent":["import { HostElement } from 'universal-test-renderer';\nimport { RenderResult } from './render';\n\nconst SCREEN_ERROR = '`render` method has not been called';\n\nconst notImplemented = () => {\n throw new Error(SCREEN_ERROR);\n};\n\nconst notImplementedDebug = () => {\n throw new Error(SCREEN_ERROR);\n};\n\ninterface Screen extends RenderResult {\n isDetached?: boolean;\n}\n\nconst defaultScreen: Screen = {\n isDetached: true,\n get root(): HostElement | null {\n throw new Error(SCREEN_ERROR);\n },\n get container(): HostElement {\n throw new Error(SCREEN_ERROR);\n },\n debug: notImplementedDebug,\n update: notImplemented,\n unmount: notImplemented,\n rerender: notImplemented,\n toJSON: notImplemented,\n getByLabelText: notImplemented,\n getAllByLabelText: notImplemented,\n queryByLabelText: notImplemented,\n queryAllByLabelText: notImplemented,\n findByLabelText: notImplemented,\n findAllByLabelText: notImplemented,\n getByHintText: notImplemented,\n getAllByHintText: notImplemented,\n queryByHintText: notImplemented,\n queryAllByHintText: notImplemented,\n findByHintText: notImplemented,\n findAllByHintText: notImplemented,\n getByA11yHint: notImplemented,\n getAllByA11yHint: notImplemented,\n queryByA11yHint: notImplemented,\n queryAllByA11yHint: notImplemented,\n findByA11yHint: notImplemented,\n findAllByA11yHint: notImplemented,\n getByAccessibilityHint: notImplemented,\n getAllByAccessibilityHint: notImplemented,\n queryByAccessibilityHint: notImplemented,\n queryAllByAccessibilityHint: notImplemented,\n findByAccessibilityHint: notImplemented,\n findAllByAccessibilityHint: notImplemented,\n getByRole: notImplemented,\n getAllByRole: notImplemented,\n queryByRole: notImplemented,\n queryAllByRole: notImplemented,\n findByRole: notImplemented,\n findAllByRole: notImplemented,\n getByPlaceholderText: notImplemented,\n getAllByPlaceholderText: notImplemented,\n queryByPlaceholderText: notImplemented,\n queryAllByPlaceholderText: notImplemented,\n findByPlaceholderText: notImplemented,\n findAllByPlaceholderText: notImplemented,\n getByDisplayValue: notImplemented,\n getAllByDisplayValue: notImplemented,\n queryByDisplayValue: notImplemented,\n queryAllByDisplayValue: notImplemented,\n findByDisplayValue: notImplemented,\n findAllByDisplayValue: notImplemented,\n getByTestId: notImplemented,\n getAllByTestId: notImplemented,\n queryByTestId: notImplemented,\n queryAllByTestId: notImplemented,\n findByTestId: notImplemented,\n findAllByTestId: notImplemented,\n getByText: notImplemented,\n getAllByText: notImplemented,\n queryByText: notImplemented,\n queryAllByText: notImplemented,\n findByText: notImplemented,\n findAllByText: notImplemented,\n};\n\nexport let screen: Screen = defaultScreen;\n\nexport function setRenderResult(renderResult: RenderResult) {\n screen = renderResult;\n}\n\nexport function clearRenderResult() {\n screen = defaultScreen;\n}\n"],"mappings":";;;;;;;;AAGA,MAAMA,YAAY,GAAG,qCAAqC;AAE1D,MAAMC,cAAc,GAAGA,CAAA,KAAM;EAC3B,MAAM,IAAIC,KAAK,CAACF,YAAY,CAAC;AAC/B,CAAC;AAED,MAAMG,mBAAmB,GAAGA,CAAA,KAAM;EAChC,MAAM,IAAID,KAAK,CAACF,YAAY,CAAC;AAC/B,CAAC;AAMD,MAAMI,aAAqB,GAAG;EAC5BC,UAAU,EAAE,IAAI;EAChB,IAAIC,IAAIA,CAAA,EAAuB;IAC7B,MAAM,IAAIJ,KAAK,CAACF,YAAY,CAAC;EAC/B,CAAC;EACD,IAAIO,SAASA,CAAA,EAAgB;IAC3B,MAAM,IAAIL,KAAK,CAACF,YAAY,CAAC;EAC/B,CAAC;EACDQ,KAAK,EAAEL,mBAAmB;EAC1BM,MAAM,EAAER,cA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jD,cAAc;EACpCkD,mBAAmB,EAAElD,cAAc;EACnCmD,sBAAsB,EAAEnD,cAAc;EACtCoD,kBAAkB,EAAEpD,cAAc;EAClCqD,qBAAqB,EAAErD,cAAc;EACrCsD,WAAW,EAAEtD,cAAc;EAC3BuD,cAAc,EAAEvD,cAAc;EAC9BwD,aAAa,EAAExD,cAAc;EAC7ByD,gBAAgB,EAAEzD,cAAc;EAChC0D,YAAY,EAAE1D,cAAc;EAC5B2D,eAAe,EAAE3D,cAAc;EAC/B4D,SAAS,EAAE5D,cAAc;EACzB6D,YAAY,EAAE7D,cAAc;EAC5B8D,WAAW,EAAE9D,cAAc;EAC3B+D,cAAc,EAAE/D,cAAc;EAC9BgE,UAAU,EAAEhE,cAAc;EAC1BiE,aAAa,EAAEjE;AACjB,CAAC;AAEM,IAAIkE,MAAc,GAAAC,OAAA,CAAAD,MAAA,GAAG/D,aAAa;AAElC,SAASiE,eAAeA,CAACC,YAA0B,EAAE;EAC1DF,OAAA,CAAAD,MAAA,GAAAA,MAAM,GAAGG,YAAY;AACvB;AAEO,SAASC,iBAAiBA,CAAA,EAAG;EAClCH,OAAA,CAAAD,MAAA,GAAAA,MAAM,GAAG/D,aAAa;AACxB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../src/act.ts","../src/cleanup.ts","../src/config.ts","../src/fire-event.ts","../src/flush-micro-tasks.ts","../src/index.ts","../src/matches.ts","../src/native-state.ts","../src/pure.ts","../src/react-versions.ts","../src/render-
|
|
1
|
+
{"root":["../src/act.ts","../src/cleanup.ts","../src/config.ts","../src/fire-event.ts","../src/flush-micro-tasks.ts","../src/index.ts","../src/matches.ts","../src/native-state.ts","../src/pure.ts","../src/react-versions.ts","../src/render-hook.tsx","../src/render.tsx","../src/screen.ts","../src/types.ts","../src/wait-for-element-to-be-removed.ts","../src/wait-for.ts","../src/within.ts","../src/helpers/accessibility.ts","../src/helpers/component-tree.ts","../src/helpers/debug.ts","../src/helpers/errors.ts","../src/helpers/find-all.ts","../src/helpers/format-default.ts","../src/helpers/format.ts","../src/helpers/host-component-names.ts","../src/helpers/object.ts","../src/helpers/pointer-events.ts","../src/helpers/text-content.ts","../src/helpers/text-input.ts","../src/helpers/timers.ts","../src/helpers/wrap-async.ts","../src/helpers/matchers/match-accessibility-state.ts","../src/helpers/matchers/match-accessibility-value.ts","../src/helpers/matchers/match-array-prop.ts","../src/helpers/matchers/match-label-text.ts","../src/helpers/matchers/match-object-prop.ts","../src/helpers/matchers/match-string-prop.ts","../src/helpers/matchers/match-text-content.ts","../src/matchers/extend-expect.ts","../src/matchers/index.ts","../src/matchers/to-be-busy.ts","../src/matchers/to-be-checked.ts","../src/matchers/to-be-disabled.ts","../src/matchers/to-be-empty-element.ts","../src/matchers/to-be-expanded.ts","../src/matchers/to-be-on-the-screen.ts","../src/matchers/to-be-partially-checked.ts","../src/matchers/to-be-selected.ts","../src/matchers/to-be-visible.ts","../src/matchers/to-contain-element.ts","../src/matchers/to-have-accessibility-value.ts","../src/matchers/to-have-accessible-name.ts","../src/matchers/to-have-display-value.ts","../src/matchers/to-have-prop.ts","../src/matchers/to-have-style.ts","../src/matchers/to-have-text-content.ts","../src/matchers/types.ts","../src/matchers/utils.ts","../src/queries/display-value.ts","../src/queries/hint-text.ts","../src/queries/label-text.ts","../src/queries/make-queries.ts","../src/queries/options.ts","../src/queries/placeholder-text.ts","../src/queries/role.ts","../src/queries/test-id.ts","../src/queries/text.ts","../src/test-utils/events.ts","../src/test-utils/index.ts","../src/user-event/clear.ts","../src/user-event/index.ts","../src/user-event/paste.ts","../src/user-event/event-builder/base.ts","../src/user-event/event-builder/common.ts","../src/user-event/event-builder/index.ts","../src/user-event/event-builder/scroll-view.ts","../src/user-event/event-builder/text-input.ts","../src/user-event/press/index.ts","../src/user-event/press/press.ts","../src/user-event/scroll/index.ts","../src/user-event/scroll/scroll-to.ts","../src/user-event/scroll/utils.ts","../src/user-event/setup/index.ts","../src/user-event/setup/setup.ts","../src/user-event/type/index.ts","../src/user-event/type/parse-keys.ts","../src/user-event/type/type.ts","../src/user-event/utils/content-size.ts","../src/user-event/utils/dispatch-event.ts","../src/user-event/utils/index.ts","../src/user-event/utils/text-range.ts","../src/user-event/utils/wait.ts"],"version":"5.6.3"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HostElement } from 'universal-test-renderer';
|
|
2
2
|
import { UserEventInstance } from './setup';
|
|
3
|
-
export declare function clear(this: UserEventInstance, element:
|
|
3
|
+
export declare function clear(this: UserEventInstance, element: HostElement): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clear.js","names":["_errors","require","_hostComponentNames","_textInput","_pointerEvents","_eventBuilder","_utils","_type","clear","element","isHostTextInput","ErrorWithStack","type","isEditableTextInput","isPointerEventEnabled","dispatchEvent","EventBuilder","Common","focus","textToClear","getTextInputValue","selectionRange","start","end","length","TextInput","selectionChange","emptyText","emitTypingEvents","config","key","text","wait","endEditing","blur"],"sources":["../../src/user-event/clear.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"clear.js","names":["_errors","require","_hostComponentNames","_textInput","_pointerEvents","_eventBuilder","_utils","_type","clear","element","isHostTextInput","ErrorWithStack","type","isEditableTextInput","isPointerEventEnabled","dispatchEvent","EventBuilder","Common","focus","textToClear","getTextInputValue","selectionRange","start","end","length","TextInput","selectionChange","emptyText","emitTypingEvents","config","key","text","wait","endEditing","blur"],"sources":["../../src/user-event/clear.ts"],"sourcesContent":["import { HostElement } from 'universal-test-renderer';\nimport { ErrorWithStack } from '../helpers/errors';\nimport { isHostTextInput } from '../helpers/host-component-names';\nimport { getTextInputValue, isEditableTextInput } from '../helpers/text-input';\nimport { isPointerEventEnabled } from '../helpers/pointer-events';\nimport { EventBuilder } from './event-builder';\nimport { UserEventInstance } from './setup';\nimport { dispatchEvent, wait } from './utils';\nimport { emitTypingEvents } from './type/type';\n\nexport async function clear(this: UserEventInstance, element: HostElement): Promise<void> {\n if (!isHostTextInput(element)) {\n throw new ErrorWithStack(\n `clear() only supports host \"TextInput\" elements. Passed element has type: \"${element.type}\".`,\n clear,\n );\n }\n\n if (!isEditableTextInput(element) || !isPointerEventEnabled(element)) {\n return;\n }\n\n // 1. Enter element\n dispatchEvent(element, 'focus', EventBuilder.Common.focus());\n\n // 2. Select all\n const textToClear = getTextInputValue(element);\n const selectionRange = {\n start: 0,\n end: textToClear.length,\n };\n dispatchEvent(element, 'selectionChange', EventBuilder.TextInput.selectionChange(selectionRange));\n\n // 3. Press backspace with selected text\n const emptyText = '';\n await emitTypingEvents(element, {\n config: this.config,\n key: 'Backspace',\n text: emptyText,\n });\n\n // 4. Exit element\n await wait(this.config);\n dispatchEvent(element, 'endEditing', EventBuilder.TextInput.endEditing(emptyText));\n dispatchEvent(element, 'blur', EventBuilder.Common.blur());\n}\n"],"mappings":";;;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AAEA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AAEO,eAAeO,KAAKA,CAA0BC,OAAoB,EAAiB;EACxF,IAAI,CAAC,IAAAC,mCAAe,EAACD,OAAO,CAAC,EAAE;IAC7B,MAAM,IAAIE,sBAAc,CACtB,8EAA8EF,OAAO,CAACG,IAAI,IAAI,EAC9FJ,KACF,CAAC;EACH;EAEA,IAAI,CAAC,IAAAK,8BAAmB,EAACJ,OAAO,CAAC,IAAI,CAAC,IAAAK,oCAAqB,EAACL,OAAO,CAAC,EAAE;IACpE;EACF;;EAEA;EACA,IAAAM,oBAAa,EAACN,OAAO,EAAE,OAAO,EAAEO,0BAAY,CAACC,MAAM,CAACC,KAAK,CAAC,CAAC,CAAC;;EAE5D;EACA,MAAMC,WAAW,GAAG,IAAAC,4BAAiB,EAACX,OAAO,CAAC;EAC9C,MAAMY,cAAc,GAAG;IACrBC,KAAK,EAAE,CAAC;IACRC,GAAG,EAAEJ,WAAW,CAACK;EACnB,CAAC;EACD,IAAAT,oBAAa,EAACN,OAAO,EAAE,iBAAiB,EAAEO,0BAAY,CAACS,SAAS,CAACC,eAAe,CAACL,cAAc,CAAC,CAAC;;EAEjG;EACA,MAAMM,SAAS,GAAG,EAAE;EACpB,MAAM,IAAAC,sBAAgB,EAACnB,OAAO,EAAE;IAC9BoB,MAAM,EAAE,IAAI,CAACA,MAAM;IACnBC,GAAG,EAAE,WAAW;IAChBC,IAAI,EAAEJ;EACR,CAAC,CAAC;;EAEF;EACA,MAAM,IAAAK,WAAI,EAAC,IAAI,CAACH,MAAM,CAAC;EACvB,IAAAd,oBAAa,EAACN,OAAO,EAAE,YAAY,EAAEO,0BAAY,CAACS,SAAS,CAACQ,UAAU,CAACN,SAAS,CAAC,CAAC;EAClF,IAAAZ,oBAAa,EAACN,OAAO,EAAE,MAAM,EAAEO,0BAAY,CAACC,MAAM,CAACiB,IAAI,CAAC,CAAC,CAAC;AAC5D","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HostElement } from 'universal-test-renderer';
|
|
2
2
|
import { setup } from './setup';
|
|
3
3
|
import { PressOptions } from './press';
|
|
4
4
|
import { TypeOptions } from './type';
|
|
@@ -6,10 +6,10 @@ import { ScrollToOptions } from './scroll';
|
|
|
6
6
|
export { UserEventConfig } from './setup';
|
|
7
7
|
export declare const userEvent: {
|
|
8
8
|
setup: typeof setup;
|
|
9
|
-
press: (element:
|
|
10
|
-
longPress: (element:
|
|
11
|
-
type: (element:
|
|
12
|
-
clear: (element:
|
|
13
|
-
paste: (element:
|
|
14
|
-
scrollTo: (element:
|
|
9
|
+
press: (element: HostElement) => Promise<void>;
|
|
10
|
+
longPress: (element: HostElement, options?: PressOptions) => Promise<void>;
|
|
11
|
+
type: (element: HostElement, text: string, options?: TypeOptions) => Promise<void>;
|
|
12
|
+
clear: (element: HostElement) => Promise<void>;
|
|
13
|
+
paste: (element: HostElement, text: string) => Promise<void>;
|
|
14
|
+
scrollTo: (element: HostElement, options: ScrollToOptions) => Promise<void>;
|
|
15
15
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_setup","require","userEvent","exports","setup","press","element","longPress","options","type","text","clear","paste","scrollTo"],"sources":["../../src/user-event/index.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"index.js","names":["_setup","require","userEvent","exports","setup","press","element","longPress","options","type","text","clear","paste","scrollTo"],"sources":["../../src/user-event/index.ts"],"sourcesContent":["import { HostElement } from 'universal-test-renderer';\nimport { setup } from './setup';\nimport { PressOptions } from './press';\nimport { TypeOptions } from './type';\nimport { ScrollToOptions } from './scroll';\n\nexport { UserEventConfig } from './setup';\n\nexport const userEvent = {\n setup,\n\n // Direct access for User Event v13 compatibility\n press: (element: HostElement) => setup().press(element),\n longPress: (element: HostElement, options?: PressOptions) => setup().longPress(element, options),\n type: (element: HostElement, text: string, options?: TypeOptions) =>\n setup().type(element, text, options),\n clear: (element: HostElement) => setup().clear(element),\n paste: (element: HostElement, text: string) => setup().paste(element, text),\n scrollTo: (element: HostElement, options: ScrollToOptions) => setup().scrollTo(element, options),\n};\n"],"mappings":";;;;;;;;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAOO,MAAMC,SAAS,GAAAC,OAAA,CAAAD,SAAA,GAAG;EACvBE,KAAK,EAALA,YAAK;EAEL;EACAC,KAAK,EAAGC,OAAoB,IAAK,IAAAF,YAAK,EAAC,CAAC,CAACC,KAAK,CAACC,OAAO,CAAC;EACvDC,SAAS,EAAEA,CAACD,OAAoB,EAAEE,OAAsB,KAAK,IAAAJ,YAAK,EAAC,CAAC,CAACG,SAAS,CAACD,OAAO,EAAEE,OAAO,CAAC;EAChGC,IAAI,EAAEA,CAACH,OAAoB,EAAEI,IAAY,EAAEF,OAAqB,KAC9D,IAAAJ,YAAK,EAAC,CAAC,CAACK,IAAI,CAACH,OAAO,EAAEI,IAAI,EAAEF,OAAO,CAAC;EACtCG,KAAK,EAAGL,OAAoB,IAAK,IAAAF,YAAK,EAAC,CAAC,CAACO,KAAK,CAACL,OAAO,CAAC;EACvDM,KAAK,EAAEA,CAACN,OAAoB,EAAEI,IAAY,KAAK,IAAAN,YAAK,EAAC,CAAC,CAACQ,KAAK,CAACN,OAAO,EAAEI,IAAI,CAAC;EAC3EG,QAAQ,EAAEA,CAACP,OAAoB,EAAEE,OAAwB,KAAK,IAAAJ,YAAK,EAAC,CAAC,CAACS,QAAQ,CAACP,OAAO,EAAEE,OAAO;AACjG,CAAC","ignoreList":[]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HostElement } from 'universal-test-renderer';
|
|
2
2
|
import { UserEventInstance } from './setup';
|
|
3
|
-
export declare function paste(this: UserEventInstance, element:
|
|
3
|
+
export declare function paste(this: UserEventInstance, element: HostElement, text: string): Promise<void>;
|