@testing-library/react-native 14.0.0-alpha.4 → 14.0.0-alpha.5
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 +2 -2
- package/build/act.js +6 -3
- package/build/act.js.map +1 -1
- package/build/cleanup.d.ts +3 -5
- package/build/cleanup.js +2 -8
- package/build/cleanup.js.map +1 -1
- package/build/fire-event.d.ts +9 -9
- package/build/fire-event.js +21 -16
- package/build/fire-event.js.map +1 -1
- package/build/helpers/host-component-names.d.ts +1 -0
- package/build/helpers/host-component-names.js +2 -1
- package/build/helpers/host-component-names.js.map +1 -1
- package/build/helpers/timers.d.ts +3 -1
- package/build/helpers/timers.js +3 -1
- package/build/helpers/timers.js.map +1 -1
- package/build/index.js +1 -1
- package/build/index.js.map +1 -1
- package/build/pure.d.ts +10 -10
- package/build/pure.js +37 -39
- package/build/pure.js.map +1 -1
- package/build/queries/make-queries.js +3 -4
- package/build/queries/make-queries.js.map +1 -1
- package/build/render-hook.d.ts +1 -1
- package/build/render-hook.js +11 -12
- package/build/render-hook.js.map +1 -1
- package/build/render.d.ts +8 -77
- package/build/render.js +23 -40
- package/build/render.js.map +1 -1
- package/build/screen.js +1 -4
- package/build/screen.js.map +1 -1
- package/build/tsconfig.release.tsbuildinfo +1 -1
- package/build/types.js +4 -0
- package/build/unsafe-render-sync.d.ts +144 -0
- package/build/{render-async.js → unsafe-render-sync.js} +49 -31
- package/build/unsafe-render-sync.js.map +1 -0
- package/build/user-event/press/press.js +2 -3
- package/build/user-event/press/press.js.map +1 -1
- package/build/user-event/utils/dispatch-event.js +2 -5
- package/build/user-event/utils/dispatch-event.js.map +1 -1
- package/build/user-event/utils/text-range.js +4 -0
- package/build/wait-for-element-to-be-removed.d.ts +1 -1
- package/build/wait-for-element-to-be-removed.js +3 -4
- package/build/wait-for-element-to-be-removed.js.map +1 -1
- package/build/wait-for.d.ts +1 -1
- package/build/wait-for.js +6 -7
- package/build/wait-for.js.map +1 -1
- package/package.json +9 -12
- package/build/index.flow.js +0 -378
- package/build/render-act.d.ts +0 -3
- package/build/render-act.js +0 -29
- package/build/render-act.js.map +0 -1
- package/build/render-async.d.ts +0 -83
- package/build/render-async.js.map +0 -1
- package/typings/index.flow.js +0 -378
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type HostElement, type JsonElement } from 'universal-test-renderer';
|
|
3
|
+
import type { DebugOptions } from './helpers/debug';
|
|
4
|
+
export interface RenderSyncOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Pass a React Component as the wrapper option to have it rendered around the inner element. This is most useful for creating
|
|
7
|
+
* reusable custom render functions for common data providers.
|
|
8
|
+
*/
|
|
9
|
+
wrapper?: React.ComponentType<any>;
|
|
10
|
+
createNodeMock?: (element: React.ReactElement) => object;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated Use `render` (async) instead. This function is provided for migration purposes only.
|
|
14
|
+
* Renders test component deeply using React Test Renderer and exposes helpers
|
|
15
|
+
* to assert on the output.
|
|
16
|
+
*/
|
|
17
|
+
export declare function unsafe_renderSync<T>(component: React.ReactElement<T>, options?: RenderSyncOptions): {
|
|
18
|
+
rerender: (component: React.ReactElement) => void;
|
|
19
|
+
update: (component: React.ReactElement) => void;
|
|
20
|
+
unmount: () => void;
|
|
21
|
+
toJSON: () => JsonElement | null;
|
|
22
|
+
debug: DebugFunction;
|
|
23
|
+
container: HostElement;
|
|
24
|
+
root: HostElement | null;
|
|
25
|
+
getByRole: import("./queries/make-queries").GetByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
26
|
+
getAllByRole: import("./queries/make-queries").GetAllByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
27
|
+
queryByRole: import("./queries/make-queries").QueryByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
28
|
+
queryAllByRole: import("./queries/make-queries").QueryAllByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
29
|
+
findByRole: import("./queries/make-queries").FindByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
30
|
+
findAllByRole: import("./queries/make-queries").FindAllByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
31
|
+
getByHintText: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
32
|
+
getAllByHintText: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
33
|
+
queryByHintText: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
34
|
+
queryAllByHintText: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
35
|
+
findByHintText: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
36
|
+
findAllByHintText: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
37
|
+
getByA11yHint: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
38
|
+
getAllByA11yHint: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
39
|
+
queryByA11yHint: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
40
|
+
queryAllByA11yHint: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
41
|
+
findByA11yHint: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
42
|
+
findAllByA11yHint: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
43
|
+
getByAccessibilityHint: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
44
|
+
getAllByAccessibilityHint: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
45
|
+
queryByAccessibilityHint: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
46
|
+
queryAllByAccessibilityHint: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
47
|
+
findByAccessibilityHint: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
48
|
+
findAllByAccessibilityHint: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
49
|
+
getByLabelText: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
50
|
+
getAllByLabelText: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
51
|
+
queryByLabelText: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
52
|
+
queryAllByLabelText: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
53
|
+
findByLabelText: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
54
|
+
findAllByLabelText: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
55
|
+
getByPlaceholderText: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
56
|
+
getAllByPlaceholderText: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
57
|
+
queryByPlaceholderText: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
58
|
+
queryAllByPlaceholderText: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
59
|
+
findByPlaceholderText: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
60
|
+
findAllByPlaceholderText: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
61
|
+
getByDisplayValue: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
62
|
+
getAllByDisplayValue: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
63
|
+
queryByDisplayValue: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
64
|
+
queryAllByDisplayValue: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
65
|
+
findByDisplayValue: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
66
|
+
findAllByDisplayValue: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
67
|
+
getByTestId: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
68
|
+
getAllByTestId: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
69
|
+
queryByTestId: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
70
|
+
queryAllByTestId: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
71
|
+
findByTestId: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
72
|
+
findAllByTestId: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
73
|
+
getByText: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
74
|
+
getAllByText: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
75
|
+
queryByText: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
76
|
+
queryAllByText: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
77
|
+
findByText: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
78
|
+
findAllByText: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
79
|
+
};
|
|
80
|
+
export type RenderSyncResult = ReturnType<typeof unsafe_renderSync>;
|
|
81
|
+
export declare function renderInternal<T>(component: React.ReactElement<T>, options?: RenderSyncOptions): {
|
|
82
|
+
rerender: (component: React.ReactElement) => void;
|
|
83
|
+
update: (component: React.ReactElement) => void;
|
|
84
|
+
unmount: () => void;
|
|
85
|
+
toJSON: () => JsonElement | null;
|
|
86
|
+
debug: DebugFunction;
|
|
87
|
+
container: HostElement;
|
|
88
|
+
root: HostElement | null;
|
|
89
|
+
getByRole: import("./queries/make-queries").GetByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
90
|
+
getAllByRole: import("./queries/make-queries").GetAllByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
91
|
+
queryByRole: import("./queries/make-queries").QueryByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
92
|
+
queryAllByRole: import("./queries/make-queries").QueryAllByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
93
|
+
findByRole: import("./queries/make-queries").FindByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
94
|
+
findAllByRole: import("./queries/make-queries").FindAllByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
95
|
+
getByHintText: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
96
|
+
getAllByHintText: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
97
|
+
queryByHintText: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
98
|
+
queryAllByHintText: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
99
|
+
findByHintText: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
100
|
+
findAllByHintText: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
101
|
+
getByA11yHint: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
102
|
+
getAllByA11yHint: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
103
|
+
queryByA11yHint: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
104
|
+
queryAllByA11yHint: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
105
|
+
findByA11yHint: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
106
|
+
findAllByA11yHint: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
107
|
+
getByAccessibilityHint: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
108
|
+
getAllByAccessibilityHint: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
109
|
+
queryByAccessibilityHint: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
110
|
+
queryAllByAccessibilityHint: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
111
|
+
findByAccessibilityHint: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
112
|
+
findAllByAccessibilityHint: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
113
|
+
getByLabelText: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
114
|
+
getAllByLabelText: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
115
|
+
queryByLabelText: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
116
|
+
queryAllByLabelText: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
117
|
+
findByLabelText: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
118
|
+
findAllByLabelText: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
119
|
+
getByPlaceholderText: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
120
|
+
getAllByPlaceholderText: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
121
|
+
queryByPlaceholderText: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
122
|
+
queryAllByPlaceholderText: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
123
|
+
findByPlaceholderText: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
124
|
+
findAllByPlaceholderText: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
125
|
+
getByDisplayValue: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
126
|
+
getAllByDisplayValue: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
127
|
+
queryByDisplayValue: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
128
|
+
queryAllByDisplayValue: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
129
|
+
findByDisplayValue: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
130
|
+
findAllByDisplayValue: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
131
|
+
getByTestId: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
132
|
+
getAllByTestId: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
133
|
+
queryByTestId: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
134
|
+
queryAllByTestId: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
135
|
+
findByTestId: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
136
|
+
findAllByTestId: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
137
|
+
getByText: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
138
|
+
getAllByText: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
139
|
+
queryByText: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
140
|
+
queryAllByText: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
141
|
+
findByText: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
142
|
+
findAllByText: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
143
|
+
};
|
|
144
|
+
export type DebugFunction = (options?: DebugOptions) => void;
|
|
@@ -3,78 +3,96 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.renderInternal = renderInternal;
|
|
7
|
+
exports.unsafe_renderSync = unsafe_renderSync;
|
|
7
8
|
var React = _interopRequireWildcard(require("react"));
|
|
8
|
-
var
|
|
9
|
+
var _universalTestRenderer = require("universal-test-renderer");
|
|
10
|
+
var _act = require("./act");
|
|
9
11
|
var _cleanup = require("./cleanup");
|
|
10
12
|
var _config = require("./config");
|
|
11
13
|
var _debug = require("./helpers/debug");
|
|
12
|
-
var
|
|
13
|
-
var _renderAct = require("./render-act");
|
|
14
|
+
var _hostComponentNames = require("./helpers/host-component-names");
|
|
14
15
|
var _screen = require("./screen");
|
|
15
16
|
var _within = require("./within");
|
|
16
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
17
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
18
18
|
/**
|
|
19
|
+
* @deprecated Use `render` (async) instead. This function is provided for migration purposes only.
|
|
19
20
|
* Renders test component deeply using React Test Renderer and exposes helpers
|
|
20
21
|
* to assert on the output.
|
|
21
22
|
*/
|
|
22
|
-
|
|
23
|
+
function unsafe_renderSync(component, options = {}) {
|
|
24
|
+
return renderInternal(component, options);
|
|
25
|
+
}
|
|
26
|
+
function renderInternal(component, options) {
|
|
23
27
|
const {
|
|
24
|
-
wrapper: Wrapper
|
|
28
|
+
wrapper: Wrapper,
|
|
29
|
+
createNodeMock
|
|
25
30
|
} = options || {};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
31
|
+
const rendererOptions = {
|
|
32
|
+
textComponents: _hostComponentNames.HOST_TEXT_NAMES,
|
|
33
|
+
createNodeMock
|
|
34
|
+
};
|
|
29
35
|
const wrap = element => Wrapper ? /*#__PURE__*/React.createElement(Wrapper, null, element) : element;
|
|
30
|
-
const renderer =
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
const renderer = (0, _universalTestRenderer.createRoot)(rendererOptions);
|
|
37
|
+
(0, _act.unsafe_act)(() => {
|
|
38
|
+
renderer.render(wrap(component));
|
|
39
|
+
});
|
|
40
|
+
const rerender = component => {
|
|
41
|
+
(0, _act.unsafe_act)(() => {
|
|
42
|
+
renderer.render(wrap(component));
|
|
43
|
+
});
|
|
37
44
|
};
|
|
38
45
|
const rerenderAsync = async component => {
|
|
39
|
-
|
|
40
|
-
await (0, _act.default)(async () => {
|
|
46
|
+
await (0, _act.act)(() => {
|
|
41
47
|
renderer.render(wrap(component));
|
|
42
48
|
});
|
|
43
49
|
};
|
|
44
50
|
const unmount = () => {
|
|
45
|
-
|
|
51
|
+
(0, _act.unsafe_act)(() => {
|
|
52
|
+
renderer.unmount();
|
|
53
|
+
});
|
|
46
54
|
};
|
|
47
55
|
const unmountAsync = async () => {
|
|
48
|
-
|
|
49
|
-
await (0, _act.default)(async () => {
|
|
56
|
+
await (0, _act.act)(() => {
|
|
50
57
|
renderer.unmount();
|
|
51
58
|
});
|
|
52
59
|
};
|
|
60
|
+
const toJSON = () => {
|
|
61
|
+
const json = renderer.container.toJSON();
|
|
62
|
+
if (json?.children?.length === 0) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
if (json?.children?.length === 1 && typeof json.children[0] !== 'string') {
|
|
66
|
+
return json.children[0];
|
|
67
|
+
}
|
|
68
|
+
return json;
|
|
69
|
+
};
|
|
53
70
|
(0, _cleanup.addToCleanupQueue)(unmountAsync);
|
|
54
71
|
const result = {
|
|
55
72
|
...(0, _within.getQueriesForElement)(renderer.container),
|
|
56
73
|
rerender,
|
|
57
|
-
rerenderAsync,
|
|
58
74
|
update: rerender,
|
|
59
|
-
// alias for
|
|
60
|
-
updateAsync: rerenderAsync,
|
|
61
|
-
// alias for `rerenderAsync`
|
|
75
|
+
// alias for 'rerender'
|
|
62
76
|
unmount,
|
|
63
|
-
|
|
64
|
-
toJSON: () => renderer.container.toJSON(),
|
|
77
|
+
toJSON,
|
|
65
78
|
debug: makeDebug(renderer),
|
|
66
79
|
get container() {
|
|
67
80
|
return renderer.container;
|
|
68
81
|
},
|
|
69
82
|
get root() {
|
|
70
|
-
const firstChild = container.children[0];
|
|
83
|
+
const firstChild = renderer.container.children[0];
|
|
71
84
|
if (typeof firstChild === 'string') {
|
|
72
85
|
throw new Error('Invariant Violation: Root element must be a host element. Detected attempt to render a string within the root element.');
|
|
73
86
|
}
|
|
74
87
|
return firstChild;
|
|
75
88
|
}
|
|
76
89
|
};
|
|
77
|
-
(0, _screen.setRenderResult)(
|
|
90
|
+
(0, _screen.setRenderResult)({
|
|
91
|
+
...result,
|
|
92
|
+
rerender: rerenderAsync,
|
|
93
|
+
update: rerenderAsync,
|
|
94
|
+
unmount: unmountAsync
|
|
95
|
+
});
|
|
78
96
|
return result;
|
|
79
97
|
}
|
|
80
98
|
function makeDebug(renderer) {
|
|
@@ -93,4 +111,4 @@ function makeDebug(renderer) {
|
|
|
93
111
|
}
|
|
94
112
|
return debugImpl;
|
|
95
113
|
}
|
|
96
|
-
//# sourceMappingURL=render-
|
|
114
|
+
//# sourceMappingURL=unsafe-render-sync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unsafe-render-sync.js","names":["React","_interopRequireWildcard","require","_universalTestRenderer","_act","_cleanup","_config","_debug","_hostComponentNames","_screen","_within","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","unsafe_renderSync","component","options","renderInternal","wrapper","Wrapper","createNodeMock","rendererOptions","textComponents","HOST_TEXT_NAMES","wrap","element","createElement","renderer","createRoot","unsafe_act","render","rerender","rerenderAsync","act","unmount","unmountAsync","toJSON","json","container","children","length","addToCleanupQueue","result","getQueriesForElement","update","debug","makeDebug","root","firstChild","Error","setRenderResult","debugImpl","defaultDebugOptions","getConfig","debugOptions"],"sources":["../src/unsafe-render-sync.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n createRoot,\n type HostElement,\n type JsonElement,\n type Root,\n type RootOptions,\n} from 'universal-test-renderer';\n\nimport { act, unsafe_act } from './act';\nimport { addToCleanupQueue } from './cleanup';\nimport { getConfig } from './config';\nimport type { DebugOptions } from './helpers/debug';\nimport { debug } from './helpers/debug';\nimport { HOST_TEXT_NAMES } from './helpers/host-component-names';\nimport { setRenderResult } from './screen';\nimport { getQueriesForElement } from './within';\n\nexport interface RenderSyncOptions {\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 // eslint-disable-next-line @typescript-eslint/no-explicit-any\n wrapper?: React.ComponentType<any>;\n\n createNodeMock?: (element: React.ReactElement) => object;\n}\n\n/**\n * @deprecated Use `render` (async) instead. This function is provided for migration purposes only.\n * Renders test component deeply using React Test Renderer and exposes helpers\n * to assert on the output.\n */\nexport function unsafe_renderSync<T>(\n component: React.ReactElement<T>,\n options: RenderSyncOptions = {},\n) {\n return renderInternal(component, options);\n}\n\nexport type RenderSyncResult = ReturnType<typeof unsafe_renderSync>;\n\nexport function renderInternal<T>(component: React.ReactElement<T>, options?: RenderSyncOptions) {\n const { wrapper: Wrapper, createNodeMock } = options || {};\n\n const rendererOptions: RootOptions = {\n textComponents: HOST_TEXT_NAMES,\n createNodeMock,\n };\n\n const wrap = (element: React.ReactElement) => (Wrapper ? <Wrapper>{element}</Wrapper> : element);\n\n const renderer = createRoot(rendererOptions);\n\n unsafe_act(() => {\n renderer.render(wrap(component));\n });\n\n const rerender = (component: React.ReactElement) => {\n unsafe_act(() => {\n renderer.render(wrap(component));\n });\n };\n\n const rerenderAsync = async (component: React.ReactElement) => {\n await act(() => {\n renderer.render(wrap(component));\n });\n };\n\n const unmount = () => {\n unsafe_act(() => {\n renderer.unmount();\n });\n };\n\n const unmountAsync = async () => {\n await act(() => {\n renderer.unmount();\n });\n };\n\n const toJSON = (): JsonElement | null => {\n const json = renderer.container.toJSON();\n if (json?.children?.length === 0) {\n return null;\n }\n\n if (json?.children?.length === 1 && typeof json.children[0] !== 'string') {\n return json.children[0];\n }\n\n return json;\n };\n\n addToCleanupQueue(unmountAsync);\n\n const result = {\n ...getQueriesForElement(renderer.container),\n rerender,\n update: rerender, // alias for 'rerender'\n unmount,\n toJSON,\n debug: makeDebug(renderer),\n get container(): HostElement {\n return renderer.container;\n },\n get root(): HostElement | null {\n const firstChild = renderer.container.children[0];\n if (typeof firstChild === 'string') {\n throw new Error(\n 'Invariant Violation: Root element must be a host element. Detected attempt to render a string within the root element.',\n );\n }\n\n return firstChild;\n },\n };\n\n setRenderResult({\n ...result,\n rerender: rerenderAsync,\n update: rerenderAsync,\n unmount: unmountAsync,\n });\n\n return result;\n}\n\nexport type DebugFunction = (options?: DebugOptions) => void;\n\nfunction makeDebug(renderer: Root): DebugFunction {\n function debugImpl(options?: DebugOptions) {\n const { defaultDebugOptions } = getConfig();\n const debugOptions = { ...defaultDebugOptions, ...options };\n const json = renderer.container.toJSON();\n if (json) {\n return debug(json, debugOptions);\n }\n }\n return debugImpl;\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAD,OAAA;AAQA,IAAAE,IAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAEA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,mBAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,O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ACF,MAAM,CAAC,CAAC;IACxC,IAAIC,IAAI,EAAE;MACR,OAAO,IAAAQ,YAAK,EAACR,IAAI,EAAEiB,YAAY,CAAC;IAClC;EACF;EACA,OAAOH,SAAS;AAClB","ignoreList":[]}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.DEFAULT_MIN_PRESS_DURATION = exports.DEFAULT_LONG_PRESS_DELAY_MS = void 0;
|
|
7
7
|
exports.longPress = longPress;
|
|
8
8
|
exports.press = press;
|
|
9
|
-
var _act =
|
|
9
|
+
var _act = require("../../act");
|
|
10
10
|
var _eventHandler = require("../../event-handler");
|
|
11
11
|
var _componentTree = require("../../helpers/component-tree");
|
|
12
12
|
var _errors = require("../../helpers/errors");
|
|
@@ -14,7 +14,6 @@ var _hostComponentNames = require("../../helpers/host-component-names");
|
|
|
14
14
|
var _pointerEvents = require("../../helpers/pointer-events");
|
|
15
15
|
var _eventBuilder = require("../event-builder");
|
|
16
16
|
var _utils = require("../utils");
|
|
17
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
17
|
// These are constants defined in the React Native repo
|
|
19
18
|
// See: https://github.com/facebook/react-native/blob/50e38cc9f1e6713228a91ad50f426c4f65e65e1a/packages/react-native/Libraries/Pressability/Pressability.js#L264
|
|
20
19
|
const DEFAULT_MIN_PRESS_DURATION = exports.DEFAULT_MIN_PRESS_DURATION = 130;
|
|
@@ -102,7 +101,7 @@ async function emitPressabilityPressEvents(config, element, options) {
|
|
|
102
101
|
// before emitting the `pressOut` event. We need to wait here, so that
|
|
103
102
|
// `press()` function does not return before that.
|
|
104
103
|
if (DEFAULT_MIN_PRESS_DURATION - duration > 0) {
|
|
105
|
-
await (0, _act.
|
|
104
|
+
await (0, _act.act)(() => (0, _utils.wait)(config, DEFAULT_MIN_PRESS_DURATION - duration));
|
|
106
105
|
}
|
|
107
106
|
}
|
|
108
107
|
//# sourceMappingURL=press.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"press.js","names":["_act","
|
|
1
|
+
{"version":3,"file":"press.js","names":["_act","require","_eventHandler","_componentTree","_errors","_hostComponentNames","_pointerEvents","_eventBuilder","_utils","DEFAULT_MIN_PRESS_DURATION","exports","DEFAULT_LONG_PRESS_DELAY_MS","press","element","isHostElement","ErrorWithStack","basePress","config","type","longPress","options","duration","isEnabledHostElement","hasPressEventHandler","emitDirectPressEvents","isEnabledTouchResponder","emitPressabilityPressEvents","parent","isPointerEventEnabled","isHostText","props","disabled","isHostTextInput","editable","onStartShouldSetResponder","getEventHandlerFromProps","wait","dispatchEvent","EventBuilder","Common","touch","responderGrant","responderRelease","act"],"sources":["../../../src/user-event/press/press.ts"],"sourcesContent":["import type { HostElement } from 'universal-test-renderer';\n\nimport { act } from '../../act';\nimport { getEventHandlerFromProps } from '../../event-handler';\nimport { isHostElement } from '../../helpers/component-tree';\nimport { ErrorWithStack } from '../../helpers/errors';\nimport { isHostText, isHostTextInput } from '../../helpers/host-component-names';\nimport { isPointerEventEnabled } from '../../helpers/pointer-events';\nimport { EventBuilder } from '../event-builder';\nimport type { UserEventConfig, UserEventInstance } from '../setup';\nimport { dispatchEvent, wait } from '../utils';\n\n// These are constants defined in the React Native repo\n// See: https://github.com/facebook/react-native/blob/50e38cc9f1e6713228a91ad50f426c4f65e65e1a/packages/react-native/Libraries/Pressability/Pressability.js#L264\nexport const DEFAULT_MIN_PRESS_DURATION = 130;\nexport const DEFAULT_LONG_PRESS_DELAY_MS = 500;\n\nexport interface PressOptions {\n duration?: number;\n}\n\nexport async function press(this: UserEventInstance, element: HostElement): Promise<void> {\n if (!isHostElement(element)) {\n throw new ErrorWithStack(`press() works only with host elements.`, press);\n }\n\n await basePress(this.config, element, {\n type: 'press',\n });\n}\n\nexport async function longPress(\n this: UserEventInstance,\n element: HostElement,\n options?: PressOptions,\n): Promise<void> {\n if (!isHostElement(element)) {\n throw new ErrorWithStack(`longPress() works only with host elements.`, longPress);\n }\n\n await basePress(this.config, element, {\n type: 'longPress',\n duration: options?.duration ?? DEFAULT_LONG_PRESS_DELAY_MS,\n });\n}\n\ninterface BasePressOptions {\n type: 'press' | 'longPress';\n duration?: number;\n}\n\nconst basePress = async (\n config: UserEventConfig,\n element: HostElement,\n options: BasePressOptions,\n): Promise<void> => {\n if (isEnabledHostElement(element) && hasPressEventHandler(element)) {\n await emitDirectPressEvents(config, element, options);\n return;\n }\n\n if (isEnabledTouchResponder(element)) {\n await emitPressabilityPressEvents(config, element, options);\n return;\n }\n\n if (!element.parent) {\n return;\n }\n\n await basePress(config, element.parent, options);\n};\n\nfunction isEnabledHostElement(element: HostElement) {\n if (!isPointerEventEnabled(element)) {\n return false;\n }\n\n if (isHostText(element)) {\n return element.props.disabled !== true;\n }\n\n if (isHostTextInput(element)) {\n return element.props.editable !== false;\n }\n\n return true;\n}\n\nfunction isEnabledTouchResponder(element: HostElement) {\n return isPointerEventEnabled(element) && element.props.onStartShouldSetResponder?.();\n}\n\nfunction hasPressEventHandler(element: HostElement) {\n return (\n getEventHandlerFromProps(element.props, 'press') ||\n getEventHandlerFromProps(element.props, 'longPress') ||\n getEventHandlerFromProps(element.props, 'pressIn') ||\n getEventHandlerFromProps(element.props, 'pressOut')\n );\n}\n\n/**\n * Dispatches a press event sequence for host elements that have `onPress*` event handlers.\n */\nasync function emitDirectPressEvents(\n config: UserEventConfig,\n element: HostElement,\n options: BasePressOptions,\n) {\n await wait(config);\n await dispatchEvent(element, 'pressIn', EventBuilder.Common.touch());\n\n await wait(config, options.duration);\n\n // Long press events are emitted before `pressOut`.\n if (options.type === 'longPress') {\n await dispatchEvent(element, 'longPress', EventBuilder.Common.touch());\n }\n\n await dispatchEvent(element, 'pressOut', EventBuilder.Common.touch());\n\n // Regular press events are emitted after `pressOut` according to the React Native docs.\n // See: https://reactnative.dev/docs/pressable#onpress\n // Experimentally for very short presses (< 130ms) `press` events are actually emitted before `onPressOut`, but\n // we will ignore that as in reality most pressed would be above the 130ms threshold.\n if (options.type === 'press') {\n await dispatchEvent(element, 'press', EventBuilder.Common.touch());\n }\n}\n\nasync function emitPressabilityPressEvents(\n config: UserEventConfig,\n element: HostElement,\n options: BasePressOptions,\n) {\n await wait(config);\n\n await dispatchEvent(element, 'responderGrant', EventBuilder.Common.responderGrant());\n\n const duration = options.duration ?? DEFAULT_MIN_PRESS_DURATION;\n await wait(config, duration);\n\n await dispatchEvent(element, 'responderRelease', EventBuilder.Common.responderRelease());\n\n // React Native will wait for minimal delay of DEFAULT_MIN_PRESS_DURATION\n // before emitting the `pressOut` event. We need to wait here, so that\n // `press()` function does not return before that.\n if (DEFAULT_MIN_PRESS_DURATION - duration > 0) {\n await act(() => wait(config, DEFAULT_MIN_PRESS_DURATION - duration));\n }\n}\n"],"mappings":";;;;;;;;AAEA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,mBAAA,GAAAJ,OAAA;AACA,IAAAK,cAAA,GAAAL,OAAA;AACA,IAAAM,aAAA,GAAAN,OAAA;AAEA,IAAAO,MAAA,GAAAP,OAAA;AAEA;AACA;AACO,MAAMQ,0BAA0B,GAAAC,OAAA,CAAAD,0BAAA,GAAG,GAAG;AACtC,MAAME,2BAA2B,GAAAD,OAAA,CAAAC,2BAAA,GAAG,GAAG;AAMvC,eAAeC,KAAKA,CAA0BC,OAAoB,EAAiB;EACxF,IAAI,CAAC,IAAAC,4BAAa,EAACD,OAAO,CAAC,EAAE;IAC3B,MAAM,IAAIE,sBAAc,CAAC,wCAAwC,EAAEH,KAAK,CAAC;EAC3E;EAEA,MAAMI,SAAS,CAAC,IAAI,CAACC,MAAM,EAAEJ,OAAO,EAAE;IACpCK,IAAI,EAAE;EACR,CAAC,CAAC;AACJ;AAEO,eAAeC,SAASA,CAE7BN,OAAoB,EACpBO,OAAsB,EACP;EACf,IAAI,CAAC,IAAA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OAAyB,EACzB;EACA,MAAM,IAAAgB,WAAI,EAACnB,MAAM,CAAC;EAElB,MAAM,IAAAoB,oBAAa,EAACxB,OAAO,EAAE,gBAAgB,EAAEyB,0BAAY,CAACC,MAAM,CAACE,cAAc,CAAC,CAAC,CAAC;EAEpF,MAAMpB,QAAQ,GAAGD,OAAO,CAACC,QAAQ,IAAIZ,0BAA0B;EAC/D,MAAM,IAAA2B,WAAI,EAACnB,MAAM,EAAEI,QAAQ,CAAC;EAE5B,MAAM,IAAAgB,oBAAa,EAACxB,OAAO,EAAE,kBAAkB,EAAEyB,0BAAY,CAACC,MAAM,CAACG,gBAAgB,CAAC,CAAC,CAAC;;EAExF;EACA;EACA;EACA,IAAIjC,0BAA0B,GAAGY,QAAQ,GAAG,CAAC,EAAE;IAC7C,MAAM,IAAAsB,QAAG,EAAC,MAAM,IAAAP,WAAI,EAACnB,MAAM,EAAER,0BAA0B,GAAGY,QAAQ,CAAC,CAAC;EACtE;AACF","ignoreList":[]}
|
|
@@ -4,10 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.dispatchEvent = dispatchEvent;
|
|
7
|
-
var _act =
|
|
7
|
+
var _act = require("../../act");
|
|
8
8
|
var _eventHandler = require("../../event-handler");
|
|
9
9
|
var _componentTree = require("../../helpers/component-tree");
|
|
10
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
10
|
/**
|
|
12
11
|
* Basic dispatch event function used by User Event module.
|
|
13
12
|
*
|
|
@@ -23,9 +22,7 @@ async function dispatchEvent(element, eventName, ...event) {
|
|
|
23
22
|
if (!handler) {
|
|
24
23
|
return;
|
|
25
24
|
}
|
|
26
|
-
|
|
27
|
-
// eslint-disable-next-line require-await
|
|
28
|
-
await (0, _act.default)(async () => {
|
|
25
|
+
await (0, _act.act)(() => {
|
|
29
26
|
handler(...event);
|
|
30
27
|
});
|
|
31
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispatch-event.js","names":["_act","
|
|
1
|
+
{"version":3,"file":"dispatch-event.js","names":["_act","require","_eventHandler","_componentTree","dispatchEvent","element","eventName","event","isElementMounted","handler","getEventHandlerFromProps","props","act"],"sources":["../../../src/user-event/utils/dispatch-event.ts"],"sourcesContent":["import type { HostElement } from 'universal-test-renderer';\n\nimport { act } from '../../act';\nimport { getEventHandlerFromProps } from '../../event-handler';\nimport { isElementMounted } from '../../helpers/component-tree';\n\n/**\n * Basic dispatch event function used by User Event module.\n *\n * @param element element trigger event on\n * @param eventName name of the event\n * @param event event payload(s)\n */\nexport async function dispatchEvent(element: HostElement, eventName: string, ...event: unknown[]) {\n if (!isElementMounted(element)) {\n return;\n }\n\n const handler = getEventHandlerFromProps(element.props, eventName);\n if (!handler) {\n return;\n }\n\n await act(() => {\n handler(...event);\n });\n}\n"],"mappings":";;;;;;AAEA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAeG,aAAaA,CAACC,OAAoB,EAAEC,SAAiB,EAAE,GAAGC,KAAgB,EAAE;EAChG,IAAI,CAAC,IAAAC,+BAAgB,EAACH,OAAO,CAAC,EAAE;IAC9B;EACF;EAEA,MAAMI,OAAO,GAAG,IAAAC,sCAAwB,EAACL,OAAO,CAACM,KAAK,EAAEL,SAAS,CAAC;EAClE,IAAI,CAACG,OAAO,EAAE;IACZ;EACF;EAEA,MAAM,IAAAG,QAAG,EAAC,MAAM;IACdH,OAAO,CAAC,GAAGF,KAAK,CAAC;EACnB,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { WaitForOptions } from './wait-for';
|
|
2
|
-
export
|
|
2
|
+
export declare function waitForElementToBeRemoved<T>(expectation: () => T, options?: WaitForOptions): Promise<T>;
|
|
@@ -3,10 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.waitForElementToBeRemoved = waitForElementToBeRemoved;
|
|
7
7
|
var _errors = require("./helpers/errors");
|
|
8
|
-
var _waitFor =
|
|
9
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
|
+
var _waitFor = require("./wait-for");
|
|
10
9
|
function isRemoved(result) {
|
|
11
10
|
return !result || Array.isArray(result) && !result.length;
|
|
12
11
|
}
|
|
@@ -19,7 +18,7 @@ async function waitForElementToBeRemoved(expectation, options) {
|
|
|
19
18
|
if (isRemoved(initialElements)) {
|
|
20
19
|
throw new _errors.ErrorWithStack('The element(s) given to waitForElementToBeRemoved are already removed. waitForElementToBeRemoved requires that the element(s) exist(s) before waiting for removal.', waitForElementToBeRemoved);
|
|
21
20
|
}
|
|
22
|
-
return await (0, _waitFor.
|
|
21
|
+
return await (0, _waitFor.waitFor)(() => {
|
|
23
22
|
let result;
|
|
24
23
|
try {
|
|
25
24
|
result = expectation();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wait-for-element-to-be-removed.js","names":["_errors","require","_waitFor","
|
|
1
|
+
{"version":3,"file":"wait-for-element-to-be-removed.js","names":["_errors","require","_waitFor","isRemoved","result","Array","isArray","length","waitForElementToBeRemoved","expectation","options","timeoutError","ErrorWithStack","initialElements","waitFor"],"sources":["../src/wait-for-element-to-be-removed.ts"],"sourcesContent":["import { ErrorWithStack } from './helpers/errors';\nimport type { WaitForOptions } from './wait-for';\nimport { waitFor } from './wait-for';\n\nfunction isRemoved<T>(result: T): boolean {\n return !result || (Array.isArray(result) && !result.length);\n}\n\nexport async function waitForElementToBeRemoved<T>(\n expectation: () => T,\n options?: WaitForOptions,\n): Promise<T> {\n // Created here so we get a nice stacktrace\n const timeoutError = new ErrorWithStack(\n 'Timed out in waitForElementToBeRemoved.',\n waitForElementToBeRemoved,\n );\n\n // Elements have to be present initally and then removed.\n const initialElements = expectation();\n if (isRemoved(initialElements)) {\n throw new ErrorWithStack(\n 'The element(s) given to waitForElementToBeRemoved are already removed. waitForElementToBeRemoved requires that the element(s) exist(s) before waiting for removal.',\n waitForElementToBeRemoved,\n );\n }\n\n return await waitFor(() => {\n let result;\n try {\n result = expectation();\n } catch {\n return initialElements;\n }\n\n if (!isRemoved(result)) {\n throw timeoutError;\n }\n\n return initialElements;\n }, options);\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AAEA,SAASE,SAASA,CAAIC,MAAS,EAAW;EACxC,OAAO,CAACA,MAAM,IAAKC,KAAK,CAACC,OAAO,CAACF,MAAM,CAAC,IAAI,CAACA,MAAM,CAACG,MAAO;AAC7D;AAEO,eAAeC,yBAAyBA,CAC7CC,WAAoB,EACpBC,OAAwB,EACZ;EACZ;EACA,MAAMC,YAAY,GAAG,IAAIC,sBAAc,CACrC,yCAAyC,EACzCJ,yBACF,CAAC;;EAED;EACA,MAAMK,eAAe,GAAGJ,WAAW,CAAC,CAAC;EACrC,IAAIN,SAAS,CAACU,eAAe,CAAC,EAAE;IAC9B,MAAM,IAAID,sBAAc,CACtB,oKAAoK,EACpKJ,yBACF,CAAC;EACH;EAEA,OAAO,MAAM,IAAAM,gBAAO,EAAC,MAAM;IACzB,IAAIV,MAAM;IACV,IAAI;MACFA,MAAM,GAAGK,WAAW,CAAC,CAAC;IACxB,CAAC,CAAC,MAAM;MACN,OAAOI,eAAe;IACxB;IAEA,IAAI,CAACV,SAAS,CAACC,MAAM,CAAC,EAAE;MACtB,MAAMO,YAAY;IACpB;IAEA,OAAOE,eAAe;EACxB,CAAC,EAAEH,OAAO,CAAC;AACb","ignoreList":[]}
|
package/build/wait-for.d.ts
CHANGED
|
@@ -5,4 +5,4 @@ export type WaitForOptions = {
|
|
|
5
5
|
stackTraceError?: ErrorWithStack;
|
|
6
6
|
onTimeout?: (error: Error) => Error;
|
|
7
7
|
};
|
|
8
|
-
export
|
|
8
|
+
export declare function waitFor<T>(expectation: () => T, options?: WaitForOptions): Promise<T>;
|
package/build/wait-for.js
CHANGED
|
@@ -3,14 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
var _act =
|
|
6
|
+
exports.waitFor = waitFor;
|
|
7
|
+
var _act = require("./act");
|
|
8
8
|
var _config = require("./config");
|
|
9
9
|
var _flushMicroTasks = require("./flush-micro-tasks");
|
|
10
10
|
var _errors = require("./helpers/errors");
|
|
11
11
|
var _timers = require("./helpers/timers");
|
|
12
12
|
var _wrapAsync = require("./helpers/wrap-async");
|
|
13
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
13
|
/* globals jest */
|
|
15
14
|
|
|
16
15
|
const DEFAULT_INTERVAL = 50;
|
|
@@ -30,8 +29,8 @@ function waitForInternal(expectation, {
|
|
|
30
29
|
let finished = false;
|
|
31
30
|
let promiseStatus = 'idle';
|
|
32
31
|
let overallTimeoutTimer = null;
|
|
33
|
-
const
|
|
34
|
-
if (
|
|
32
|
+
const fakeTimersType = (0, _timers.getJestFakeTimersType)();
|
|
33
|
+
if (fakeTimersType) {
|
|
35
34
|
checkExpectation();
|
|
36
35
|
// this is a dangerous rule to disable because it could lead to an
|
|
37
36
|
// infinite loop. However, eslint isn't smart enough to know that we're
|
|
@@ -61,7 +60,7 @@ function waitForInternal(expectation, {
|
|
|
61
60
|
// third party code that's setting up recursive timers so rapidly that
|
|
62
61
|
// the user's timer's don't get a chance to resolve. So we'll advance
|
|
63
62
|
// by an interval instead. (We have a test for this case).
|
|
64
|
-
await (0, _act.
|
|
63
|
+
await (0, _act.act)(() => fakeTimersType === 'modern' ? jest.advanceTimersByTimeAsync(interval) : jest.advanceTimersByTime(interval));
|
|
65
64
|
|
|
66
65
|
// It's really important that checkExpectation is run *before* we flush
|
|
67
66
|
// in-flight promises. To be honest, I'm not sure why, and I can't quite
|
|
@@ -85,7 +84,7 @@ function waitForInternal(expectation, {
|
|
|
85
84
|
if (overallTimeoutTimer) {
|
|
86
85
|
(0, _timers.clearTimeout)(overallTimeoutTimer);
|
|
87
86
|
}
|
|
88
|
-
if (!
|
|
87
|
+
if (!fakeTimersType) {
|
|
89
88
|
clearInterval(intervalId);
|
|
90
89
|
}
|
|
91
90
|
if (done.type === 'error') {
|