react-dom 16.10.2 → 16.13.1
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-info.json +5 -5
- package/cjs/react-dom-server.browser.development.js +411 -729
- package/cjs/react-dom-server.browser.production.min.js +41 -41
- package/cjs/react-dom-server.node.development.js +406 -720
- package/cjs/react-dom-server.node.production.min.js +40 -40
- package/cjs/react-dom-test-utils.development.js +200 -393
- package/cjs/react-dom-test-utils.production.min.js +22 -22
- package/cjs/react-dom-unstable-fizz.browser.development.js +11 -25
- package/cjs/react-dom-unstable-fizz.browser.production.min.js +3 -3
- package/cjs/react-dom-unstable-fizz.node.development.js +24 -27
- package/cjs/react-dom-unstable-fizz.node.production.min.js +4 -3
- package/cjs/react-dom-unstable-native-dependencies.development.js +203 -338
- package/cjs/react-dom-unstable-native-dependencies.production.min.js +23 -27
- package/cjs/react-dom.development.js +10451 -13365
- package/cjs/react-dom.production.min.js +280 -281
- package/cjs/react-dom.profiling.min.js +285 -285
- package/package.json +3 -3
- package/umd/react-dom-server.browser.development.js +3310 -3639
- package/umd/react-dom-server.browser.production.min.js +38 -38
- package/umd/react-dom-test-utils.development.js +1181 -1374
- package/umd/react-dom-test-utils.production.min.js +23 -23
- package/umd/react-dom-unstable-fizz.browser.development.js +105 -119
- package/umd/react-dom-unstable-fizz.browser.production.min.js +3 -3
- package/umd/react-dom-unstable-native-dependencies.development.js +1326 -1462
- package/umd/react-dom-unstable-native-dependencies.production.min.js +21 -22
- package/umd/react-dom.development.js +19905 -22830
- package/umd/react-dom.production.min.js +229 -234
- package/umd/react-dom.profiling.min.js +237 -241
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v16.
|
|
1
|
+
/** @license React v16.13.1
|
|
2
2
|
* react-dom-test-utils.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -20,66 +20,72 @@ var React = require('react');
|
|
|
20
20
|
var ReactDOM = require('react-dom');
|
|
21
21
|
var Scheduler = require('scheduler');
|
|
22
22
|
|
|
23
|
-
//
|
|
24
|
-
//
|
|
25
|
-
//
|
|
23
|
+
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; // Prevent newer renderers from RTE when used with older react package versions.
|
|
24
|
+
// Current owner and dispatcher used to share the same ref,
|
|
25
|
+
// but PR #14548 split them out to better support the react-debug-tools package.
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
error.name = 'Invariant Violation';
|
|
32
|
-
return error;
|
|
27
|
+
if (!ReactSharedInternals.hasOwnProperty('ReactCurrentDispatcher')) {
|
|
28
|
+
ReactSharedInternals.ReactCurrentDispatcher = {
|
|
29
|
+
current: null
|
|
30
|
+
};
|
|
33
31
|
}
|
|
34
32
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
* expecting.
|
|
41
|
-
*
|
|
42
|
-
* The invariant message will be stripped in production, but the invariant
|
|
43
|
-
* will remain to ensure logic does not differ in production.
|
|
44
|
-
*/
|
|
33
|
+
if (!ReactSharedInternals.hasOwnProperty('ReactCurrentBatchConfig')) {
|
|
34
|
+
ReactSharedInternals.ReactCurrentBatchConfig = {
|
|
35
|
+
suspense: null
|
|
36
|
+
};
|
|
37
|
+
}
|
|
45
38
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
* same logic and follow the same code paths.
|
|
51
|
-
*/
|
|
52
|
-
var warningWithoutStack = function () {};
|
|
39
|
+
// by calls to these methods by a Babel plugin.
|
|
40
|
+
//
|
|
41
|
+
// In PROD (or in packages without access to React internals),
|
|
42
|
+
// they are left as they are instead.
|
|
53
43
|
|
|
54
|
-
{
|
|
55
|
-
|
|
56
|
-
for (var _len = arguments.length, args = new Array(_len >
|
|
57
|
-
args[_key -
|
|
44
|
+
function warn(format) {
|
|
45
|
+
{
|
|
46
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
47
|
+
args[_key - 1] = arguments[_key];
|
|
58
48
|
}
|
|
59
49
|
|
|
60
|
-
|
|
61
|
-
|
|
50
|
+
printWarning('warn', format, args);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function error(format) {
|
|
54
|
+
{
|
|
55
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
56
|
+
args[_key2 - 1] = arguments[_key2];
|
|
62
57
|
}
|
|
63
58
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
59
|
+
printWarning('error', format, args);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
68
62
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
63
|
+
function printWarning(level, format, args) {
|
|
64
|
+
// When changing this logic, you might want to also
|
|
65
|
+
// update consoleWithStackDev.www.js as well.
|
|
66
|
+
{
|
|
67
|
+
var hasExistingStack = args.length > 0 && typeof args[args.length - 1] === 'string' && args[args.length - 1].indexOf('\n in') === 0;
|
|
72
68
|
|
|
73
|
-
if (
|
|
74
|
-
var
|
|
75
|
-
|
|
76
|
-
});
|
|
77
|
-
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
|
|
78
|
-
// breaks IE9: https://github.com/facebook/react/issues/13610
|
|
69
|
+
if (!hasExistingStack) {
|
|
70
|
+
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
71
|
+
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
|
79
72
|
|
|
80
|
-
|
|
73
|
+
if (stack !== '') {
|
|
74
|
+
format += '%s';
|
|
75
|
+
args = args.concat([stack]);
|
|
76
|
+
}
|
|
81
77
|
}
|
|
82
78
|
|
|
79
|
+
var argsWithFormat = args.map(function (item) {
|
|
80
|
+
return '' + item;
|
|
81
|
+
}); // Careful: RN currently depends on this prefix
|
|
82
|
+
|
|
83
|
+
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
|
|
84
|
+
// breaks IE9: https://github.com/facebook/react/issues/13610
|
|
85
|
+
// eslint-disable-next-line react-internal/no-production-logging
|
|
86
|
+
|
|
87
|
+
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
88
|
+
|
|
83
89
|
try {
|
|
84
90
|
// --- Welcome to debugging React ---
|
|
85
91
|
// This error was thrown as a convenience so that you can use this stack
|
|
@@ -90,11 +96,9 @@ var warningWithoutStack = function () {};
|
|
|
90
96
|
});
|
|
91
97
|
throw new Error(message);
|
|
92
98
|
} catch (x) {}
|
|
93
|
-
}
|
|
99
|
+
}
|
|
94
100
|
}
|
|
95
101
|
|
|
96
|
-
var warningWithoutStack$1 = warningWithoutStack;
|
|
97
|
-
|
|
98
102
|
/**
|
|
99
103
|
* `ReactInstanceMap` maintains a mapping from a public facing stateful
|
|
100
104
|
* instance (key) and the internal representation (value). This allows public
|
|
@@ -104,56 +108,15 @@ var warningWithoutStack$1 = warningWithoutStack;
|
|
|
104
108
|
* Note that this module is currently shared and assumed to be stateless.
|
|
105
109
|
* If this becomes an actual Map, that will break.
|
|
106
110
|
*/
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* This API should be called `delete` but we'd have to make sure to always
|
|
110
|
-
* transform these to strings for IE support. When this transform is fully
|
|
111
|
-
* supported we can rename it.
|
|
112
|
-
*/
|
|
113
|
-
|
|
114
111
|
function get(key) {
|
|
115
112
|
return key._reactInternalFiber;
|
|
116
113
|
}
|
|
117
114
|
|
|
118
|
-
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; // Prevent newer renderers from RTE when used with older react package versions.
|
|
119
|
-
// Current owner and dispatcher used to share the same ref,
|
|
120
|
-
// but PR #14548 split them out to better support the react-debug-tools package.
|
|
121
|
-
|
|
122
|
-
if (!ReactSharedInternals.hasOwnProperty('ReactCurrentDispatcher')) {
|
|
123
|
-
ReactSharedInternals.ReactCurrentDispatcher = {
|
|
124
|
-
current: null
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
if (!ReactSharedInternals.hasOwnProperty('ReactCurrentBatchConfig')) {
|
|
129
|
-
ReactSharedInternals.ReactCurrentBatchConfig = {
|
|
130
|
-
suspense: null
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
135
|
-
// nor polyfill, then a plain number is used for performance.
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
// TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
|
|
143
|
-
// (unstable) APIs that have been removed. Can we remove the symbols?
|
|
144
|
-
|
|
145
|
-
{
|
|
146
|
-
|
|
147
|
-
}
|
|
148
|
-
|
|
149
115
|
var FunctionComponent = 0;
|
|
150
116
|
var ClassComponent = 1;
|
|
151
|
-
// Before we know whether it is function or class
|
|
152
117
|
|
|
153
118
|
var HostRoot = 3; // Root of a host tree. Could be nested inside another node.
|
|
154
119
|
|
|
155
|
-
// A subtree. Could be an entry point to a different renderer.
|
|
156
|
-
|
|
157
120
|
var HostComponent = 5;
|
|
158
121
|
var HostText = 6;
|
|
159
122
|
|
|
@@ -161,90 +124,13 @@ var HostText = 6;
|
|
|
161
124
|
var NoEffect =
|
|
162
125
|
/* */
|
|
163
126
|
0;
|
|
164
|
-
// You can change the rest (and add more).
|
|
165
127
|
|
|
166
128
|
var Placement =
|
|
167
129
|
/* */
|
|
168
130
|
2;
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
131
|
var Hydrating =
|
|
179
132
|
/* */
|
|
180
133
|
1024;
|
|
181
|
-
// Passive & Update & Callback & Ref & Snapshot
|
|
182
|
-
|
|
183
|
-
// Union of all host effects
|
|
184
|
-
|
|
185
|
-
// Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
|
|
186
|
-
|
|
187
|
-
// In some cases, StrictMode should also double-render lifecycles.
|
|
188
|
-
// This can be confusing for tests though,
|
|
189
|
-
// And it can be bad for performance in production.
|
|
190
|
-
// This feature flag can be used to control the behavior:
|
|
191
|
-
|
|
192
|
-
// To preserve the "Pause on caught exceptions" behavior of the debugger, we
|
|
193
|
-
// replay the begin phase of a failed component inside invokeGuardedCallback.
|
|
194
|
-
|
|
195
|
-
// Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
|
|
196
|
-
|
|
197
|
-
// Gather advanced timing metrics for Profiler subtrees.
|
|
198
|
-
|
|
199
|
-
// Trace which interactions trigger each commit.
|
|
200
|
-
|
|
201
|
-
// Only used in www builds.
|
|
202
|
-
|
|
203
|
-
// TODO: true? Here it might just be false.
|
|
204
|
-
|
|
205
|
-
// Only used in www builds.
|
|
206
|
-
|
|
207
|
-
// Only used in www builds.
|
|
208
|
-
|
|
209
|
-
// Disable javascript: URL strings in href for XSS protection.
|
|
210
|
-
|
|
211
|
-
// React Fire: prevent the value and checked attributes from syncing
|
|
212
|
-
// with their related DOM properties
|
|
213
|
-
|
|
214
|
-
// These APIs will no longer be "unstable" in the upcoming 16.7 release,
|
|
215
|
-
// Control this behavior with a flag to support 16.6 minor releases in the meanwhile.
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
// See https://github.com/react-native-community/discussions-and-proposals/issues/72 for more information
|
|
219
|
-
// This is a flag so we can fix warnings in RN core before turning it on
|
|
220
|
-
|
|
221
|
-
// Experimental React Flare event system and event components support.
|
|
222
|
-
|
|
223
|
-
// Experimental Host Component support.
|
|
224
|
-
|
|
225
|
-
// Experimental Scope support.
|
|
226
|
-
|
|
227
|
-
// New API for JSX transforms to target - https://github.com/reactjs/rfcs/pull/107
|
|
228
|
-
|
|
229
|
-
// We will enforce mocking scheduler with scheduler/unstable_mock at some point. (v17?)
|
|
230
|
-
// Till then, we warn about the missing mock, but still fallback to a sync mode compatible version
|
|
231
|
-
|
|
232
|
-
// For tests, we flush suspense fallbacks in an act scope;
|
|
233
|
-
// *except* in some of our own tests, where we test incremental loading states.
|
|
234
|
-
|
|
235
|
-
// Changes priority of some events like mousemove to user-blocking priority,
|
|
236
|
-
// but without making them discrete. The flag exists in case it causes
|
|
237
|
-
// starvation problems.
|
|
238
|
-
|
|
239
|
-
// Add a callback property to suspense to notify which promises are currently
|
|
240
|
-
// in the update queue. This allows reporting and tracing of what is causing
|
|
241
|
-
// the user to see a loading state.
|
|
242
|
-
// Also allows hydration callbacks to fire when a dehydrated boundary gets
|
|
243
|
-
// hydrated or deleted.
|
|
244
|
-
|
|
245
|
-
// Part of the simplification of React.createElement so we can eventually move
|
|
246
|
-
// from React.createElement to React.jsx
|
|
247
|
-
// https://github.com/reactjs/rfcs/blob/createlement-rfc/text/0000-create-element-changes.md
|
|
248
134
|
|
|
249
135
|
var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
|
|
250
136
|
function getNearestMountedFiber(fiber) {
|
|
@@ -285,18 +171,12 @@ function getNearestMountedFiber(fiber) {
|
|
|
285
171
|
return null;
|
|
286
172
|
}
|
|
287
173
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
174
|
function assertIsMounted(fiber) {
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
throw ReactError(Error("Unable to find node on an unmounted component."));
|
|
297
|
-
}
|
|
175
|
+
if (!(getNearestMountedFiber(fiber) === fiber)) {
|
|
176
|
+
{
|
|
177
|
+
throw Error( "Unable to find node on an unmounted component." );
|
|
298
178
|
}
|
|
299
|
-
}
|
|
179
|
+
}
|
|
300
180
|
}
|
|
301
181
|
|
|
302
182
|
function findCurrentFiberUsingSlowPath(fiber) {
|
|
@@ -306,13 +186,11 @@ function findCurrentFiberUsingSlowPath(fiber) {
|
|
|
306
186
|
// If there is no alternate, then we only need to check if it is mounted.
|
|
307
187
|
var nearestMounted = getNearestMountedFiber(fiber);
|
|
308
188
|
|
|
309
|
-
(
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
throw ReactError(Error("Unable to find node on an unmounted component."));
|
|
313
|
-
}
|
|
189
|
+
if (!(nearestMounted !== null)) {
|
|
190
|
+
{
|
|
191
|
+
throw Error( "Unable to find node on an unmounted component." );
|
|
314
192
|
}
|
|
315
|
-
}
|
|
193
|
+
}
|
|
316
194
|
|
|
317
195
|
if (nearestMounted !== fiber) {
|
|
318
196
|
return null;
|
|
@@ -377,13 +255,11 @@ function findCurrentFiberUsingSlowPath(fiber) {
|
|
|
377
255
|
// way this could possibly happen is if this was unmounted, if at all.
|
|
378
256
|
|
|
379
257
|
|
|
380
|
-
|
|
258
|
+
{
|
|
381
259
|
{
|
|
382
|
-
|
|
383
|
-
throw ReactError(Error("Unable to find node on an unmounted component."));
|
|
384
|
-
}
|
|
260
|
+
throw Error( "Unable to find node on an unmounted component." );
|
|
385
261
|
}
|
|
386
|
-
}
|
|
262
|
+
}
|
|
387
263
|
}
|
|
388
264
|
|
|
389
265
|
if (a.return !== b.return) {
|
|
@@ -442,34 +318,28 @@ function findCurrentFiberUsingSlowPath(fiber) {
|
|
|
442
318
|
_child = _child.sibling;
|
|
443
319
|
}
|
|
444
320
|
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
throw ReactError(Error("Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue."));
|
|
449
|
-
}
|
|
321
|
+
if (!didFindChild) {
|
|
322
|
+
{
|
|
323
|
+
throw Error( "Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue." );
|
|
450
324
|
}
|
|
451
|
-
}
|
|
325
|
+
}
|
|
452
326
|
}
|
|
453
327
|
}
|
|
454
328
|
|
|
455
|
-
(
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
throw ReactError(Error("Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue."));
|
|
459
|
-
}
|
|
329
|
+
if (!(a.alternate === b)) {
|
|
330
|
+
{
|
|
331
|
+
throw Error( "Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue." );
|
|
460
332
|
}
|
|
461
|
-
}
|
|
333
|
+
}
|
|
462
334
|
} // If the root is not a host container, we're in a disconnected tree. I.e.
|
|
463
335
|
// unmounted.
|
|
464
336
|
|
|
465
337
|
|
|
466
|
-
(
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
throw ReactError(Error("Unable to find node on an unmounted component."));
|
|
470
|
-
}
|
|
338
|
+
if (!(a.tag === HostRoot)) {
|
|
339
|
+
{
|
|
340
|
+
throw Error( "Unable to find node on an unmounted component." );
|
|
471
341
|
}
|
|
472
|
-
}
|
|
342
|
+
}
|
|
473
343
|
|
|
474
344
|
if (a.stateNode.current === a) {
|
|
475
345
|
// We've determined that A is the current branch.
|
|
@@ -480,7 +350,6 @@ function findCurrentFiberUsingSlowPath(fiber) {
|
|
|
480
350
|
return alternate;
|
|
481
351
|
}
|
|
482
352
|
|
|
483
|
-
/* eslint valid-typeof: 0 */
|
|
484
353
|
var EVENT_POOL_SIZE = 10;
|
|
485
354
|
/**
|
|
486
355
|
* @interface Event
|
|
@@ -722,8 +591,9 @@ function getPooledWarningPropertyDefinition(propName, getVal) {
|
|
|
722
591
|
}
|
|
723
592
|
|
|
724
593
|
function warn(action, result) {
|
|
725
|
-
|
|
726
|
-
|
|
594
|
+
{
|
|
595
|
+
error("This synthetic event is reused for performance reasons. If you're seeing this, " + "you're %s `%s` on a released/nullified synthetic event. %s. " + 'If you must keep the original synthetic event around, use event.persist(). ' + 'See https://fb.me/react-event-pooling for more information.', action, propName, result);
|
|
596
|
+
}
|
|
727
597
|
}
|
|
728
598
|
}
|
|
729
599
|
|
|
@@ -742,13 +612,11 @@ function getPooledEvent(dispatchConfig, targetInst, nativeEvent, nativeInst) {
|
|
|
742
612
|
function releasePooledEvent(event) {
|
|
743
613
|
var EventConstructor = this;
|
|
744
614
|
|
|
745
|
-
(
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
throw ReactError(Error("Trying to release an event instance into a pool of a different type."));
|
|
749
|
-
}
|
|
615
|
+
if (!(event instanceof EventConstructor)) {
|
|
616
|
+
{
|
|
617
|
+
throw Error( "Trying to release an event instance into a pool of a different type." );
|
|
750
618
|
}
|
|
751
|
-
}
|
|
619
|
+
}
|
|
752
620
|
|
|
753
621
|
event.destructor();
|
|
754
622
|
|
|
@@ -763,61 +631,6 @@ function addEventPoolingTo(EventConstructor) {
|
|
|
763
631
|
EventConstructor.release = releasePooledEvent;
|
|
764
632
|
}
|
|
765
633
|
|
|
766
|
-
/**
|
|
767
|
-
* Forked from fbjs/warning:
|
|
768
|
-
* https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
|
|
769
|
-
*
|
|
770
|
-
* Only change is we use console.warn instead of console.error,
|
|
771
|
-
* and do nothing when 'console' is not supported.
|
|
772
|
-
* This really simplifies the code.
|
|
773
|
-
* ---
|
|
774
|
-
* Similar to invariant but only logs a warning if the condition is not met.
|
|
775
|
-
* This can be used to log issues in development environments in critical
|
|
776
|
-
* paths. Removing the logging code for production environments will keep the
|
|
777
|
-
* same logic and follow the same code paths.
|
|
778
|
-
*/
|
|
779
|
-
var lowPriorityWarningWithoutStack = function () {};
|
|
780
|
-
|
|
781
|
-
{
|
|
782
|
-
var printWarning = function (format) {
|
|
783
|
-
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
784
|
-
args[_key - 1] = arguments[_key];
|
|
785
|
-
}
|
|
786
|
-
|
|
787
|
-
var argIndex = 0;
|
|
788
|
-
var message = 'Warning: ' + format.replace(/%s/g, function () {
|
|
789
|
-
return args[argIndex++];
|
|
790
|
-
});
|
|
791
|
-
|
|
792
|
-
if (typeof console !== 'undefined') {
|
|
793
|
-
console.warn(message);
|
|
794
|
-
}
|
|
795
|
-
|
|
796
|
-
try {
|
|
797
|
-
// --- Welcome to debugging React ---
|
|
798
|
-
// This error was thrown as a convenience so that you can use this stack
|
|
799
|
-
// to find the callsite that caused this warning to fire.
|
|
800
|
-
throw new Error(message);
|
|
801
|
-
} catch (x) {}
|
|
802
|
-
};
|
|
803
|
-
|
|
804
|
-
lowPriorityWarningWithoutStack = function (condition, format) {
|
|
805
|
-
if (format === undefined) {
|
|
806
|
-
throw new Error('`lowPriorityWarningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
807
|
-
}
|
|
808
|
-
|
|
809
|
-
if (!condition) {
|
|
810
|
-
for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
811
|
-
args[_key2 - 2] = arguments[_key2];
|
|
812
|
-
}
|
|
813
|
-
|
|
814
|
-
printWarning.apply(void 0, [format].concat(args));
|
|
815
|
-
}
|
|
816
|
-
};
|
|
817
|
-
}
|
|
818
|
-
|
|
819
|
-
var lowPriorityWarningWithoutStack$1 = lowPriorityWarningWithoutStack;
|
|
820
|
-
|
|
821
634
|
/**
|
|
822
635
|
* HTML nodeType values that represent the type of the node
|
|
823
636
|
*/
|
|
@@ -941,7 +754,6 @@ var TOP_CONTEXT_MENU = unsafeCastStringToDOMTopLevelType('contextmenu');
|
|
|
941
754
|
var TOP_COPY = unsafeCastStringToDOMTopLevelType('copy');
|
|
942
755
|
var TOP_CUT = unsafeCastStringToDOMTopLevelType('cut');
|
|
943
756
|
var TOP_DOUBLE_CLICK = unsafeCastStringToDOMTopLevelType('dblclick');
|
|
944
|
-
|
|
945
757
|
var TOP_DRAG = unsafeCastStringToDOMTopLevelType('drag');
|
|
946
758
|
var TOP_DRAG_END = unsafeCastStringToDOMTopLevelType('dragend');
|
|
947
759
|
var TOP_DRAG_ENTER = unsafeCastStringToDOMTopLevelType('dragenter');
|
|
@@ -956,9 +768,7 @@ var TOP_ENCRYPTED = unsafeCastStringToDOMTopLevelType('encrypted');
|
|
|
956
768
|
var TOP_ENDED = unsafeCastStringToDOMTopLevelType('ended');
|
|
957
769
|
var TOP_ERROR = unsafeCastStringToDOMTopLevelType('error');
|
|
958
770
|
var TOP_FOCUS = unsafeCastStringToDOMTopLevelType('focus');
|
|
959
|
-
|
|
960
771
|
var TOP_INPUT = unsafeCastStringToDOMTopLevelType('input');
|
|
961
|
-
|
|
962
772
|
var TOP_KEY_DOWN = unsafeCastStringToDOMTopLevelType('keydown');
|
|
963
773
|
var TOP_KEY_PRESS = unsafeCastStringToDOMTopLevelType('keypress');
|
|
964
774
|
var TOP_KEY_UP = unsafeCastStringToDOMTopLevelType('keyup');
|
|
@@ -966,7 +776,6 @@ var TOP_LOAD = unsafeCastStringToDOMTopLevelType('load');
|
|
|
966
776
|
var TOP_LOAD_START = unsafeCastStringToDOMTopLevelType('loadstart');
|
|
967
777
|
var TOP_LOADED_DATA = unsafeCastStringToDOMTopLevelType('loadeddata');
|
|
968
778
|
var TOP_LOADED_METADATA = unsafeCastStringToDOMTopLevelType('loadedmetadata');
|
|
969
|
-
|
|
970
779
|
var TOP_MOUSE_DOWN = unsafeCastStringToDOMTopLevelType('mousedown');
|
|
971
780
|
var TOP_MOUSE_MOVE = unsafeCastStringToDOMTopLevelType('mousemove');
|
|
972
781
|
var TOP_MOUSE_OUT = unsafeCastStringToDOMTopLevelType('mouseout');
|
|
@@ -976,23 +785,13 @@ var TOP_PASTE = unsafeCastStringToDOMTopLevelType('paste');
|
|
|
976
785
|
var TOP_PAUSE = unsafeCastStringToDOMTopLevelType('pause');
|
|
977
786
|
var TOP_PLAY = unsafeCastStringToDOMTopLevelType('play');
|
|
978
787
|
var TOP_PLAYING = unsafeCastStringToDOMTopLevelType('playing');
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
788
|
var TOP_PROGRESS = unsafeCastStringToDOMTopLevelType('progress');
|
|
988
789
|
var TOP_RATE_CHANGE = unsafeCastStringToDOMTopLevelType('ratechange');
|
|
989
|
-
|
|
990
790
|
var TOP_SCROLL = unsafeCastStringToDOMTopLevelType('scroll');
|
|
991
791
|
var TOP_SEEKED = unsafeCastStringToDOMTopLevelType('seeked');
|
|
992
792
|
var TOP_SEEKING = unsafeCastStringToDOMTopLevelType('seeking');
|
|
993
793
|
var TOP_SELECTION_CHANGE = unsafeCastStringToDOMTopLevelType('selectionchange');
|
|
994
794
|
var TOP_STALLED = unsafeCastStringToDOMTopLevelType('stalled');
|
|
995
|
-
|
|
996
795
|
var TOP_SUSPEND = unsafeCastStringToDOMTopLevelType('suspend');
|
|
997
796
|
var TOP_TEXT_INPUT = unsafeCastStringToDOMTopLevelType('textInput');
|
|
998
797
|
var TOP_TIME_UPDATE = unsafeCastStringToDOMTopLevelType('timeupdate');
|
|
@@ -1005,58 +804,66 @@ var TOP_TRANSITION_END = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEven
|
|
|
1005
804
|
var TOP_VOLUME_CHANGE = unsafeCastStringToDOMTopLevelType('volumechange');
|
|
1006
805
|
var TOP_WAITING = unsafeCastStringToDOMTopLevelType('waiting');
|
|
1007
806
|
var TOP_WHEEL = unsafeCastStringToDOMTopLevelType('wheel'); // List of events that need to be individually attached to media elements.
|
|
1008
|
-
// Note that events in this list will *not* be listened to at the top level
|
|
1009
|
-
// unless they're explicitly whitelisted in `ReactBrowserEventEmitter.listenTo`.
|
|
1010
807
|
|
|
1011
808
|
var PLUGIN_EVENT_SYSTEM = 1;
|
|
1012
809
|
|
|
1013
810
|
var didWarnAboutMessageChannel = false;
|
|
1014
|
-
var
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
811
|
+
var enqueueTaskImpl = null;
|
|
812
|
+
function enqueueTask(task) {
|
|
813
|
+
if (enqueueTaskImpl === null) {
|
|
814
|
+
try {
|
|
815
|
+
// read require off the module object to get around the bundlers.
|
|
816
|
+
// we don't want them to detect a require and bundle a Node polyfill.
|
|
817
|
+
var requireString = ('require' + Math.random()).slice(0, 7);
|
|
818
|
+
var nodeRequire = module && module[requireString]; // assuming we're in node, let's try to get node's
|
|
819
|
+
// version of setImmediate, bypassing fake timers if any.
|
|
820
|
+
|
|
821
|
+
enqueueTaskImpl = nodeRequire('timers').setImmediate;
|
|
822
|
+
} catch (_err) {
|
|
823
|
+
// we're in a browser
|
|
824
|
+
// we can't use regular timers because they may still be faked
|
|
825
|
+
// so we try MessageChannel+postMessage instead
|
|
826
|
+
enqueueTaskImpl = function (callback) {
|
|
827
|
+
{
|
|
828
|
+
if (didWarnAboutMessageChannel === false) {
|
|
829
|
+
didWarnAboutMessageChannel = true;
|
|
830
|
+
|
|
831
|
+
if (typeof MessageChannel === 'undefined') {
|
|
832
|
+
error('This browser does not have a MessageChannel implementation, ' + 'so enqueuing tasks via await act(async () => ...) will fail. ' + 'Please file an issue at https://github.com/facebook/react/issues ' + 'if you encounter this warning.');
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
var channel = new MessageChannel();
|
|
838
|
+
channel.port1.onmessage = callback;
|
|
839
|
+
channel.port2.postMessage(undefined);
|
|
840
|
+
};
|
|
1034
841
|
}
|
|
842
|
+
}
|
|
1035
843
|
|
|
1036
|
-
|
|
1037
|
-
channel.port1.onmessage = callback;
|
|
1038
|
-
channel.port2.postMessage(undefined);
|
|
1039
|
-
};
|
|
844
|
+
return enqueueTaskImpl(task);
|
|
1040
845
|
}
|
|
1041
846
|
|
|
1042
|
-
var enqueueTask$1 = enqueueTask;
|
|
1043
|
-
|
|
1044
847
|
// ReactDOM.js, and ReactTestUtils.js:
|
|
1045
848
|
|
|
1046
|
-
var _ReactDOM$__SECRET_IN
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
849
|
+
var _ReactDOM$__SECRET_IN = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Events,
|
|
850
|
+
|
|
851
|
+
/* eslint-disable no-unused-vars */
|
|
852
|
+
getInstanceFromNode = _ReactDOM$__SECRET_IN[0],
|
|
853
|
+
getNodeFromInstance = _ReactDOM$__SECRET_IN[1],
|
|
854
|
+
getFiberCurrentPropsFromNode = _ReactDOM$__SECRET_IN[2],
|
|
855
|
+
injectEventPluginsByName = _ReactDOM$__SECRET_IN[3],
|
|
856
|
+
eventNameDispatchConfigs = _ReactDOM$__SECRET_IN[4],
|
|
857
|
+
accumulateTwoPhaseDispatches = _ReactDOM$__SECRET_IN[5],
|
|
858
|
+
accumulateDirectDispatches = _ReactDOM$__SECRET_IN[6],
|
|
859
|
+
enqueueStateRestore = _ReactDOM$__SECRET_IN[7],
|
|
860
|
+
restoreStateIfNeeded = _ReactDOM$__SECRET_IN[8],
|
|
861
|
+
dispatchEvent = _ReactDOM$__SECRET_IN[9],
|
|
862
|
+
runEventsInBatch = _ReactDOM$__SECRET_IN[10],
|
|
863
|
+
|
|
864
|
+
/* eslint-enable no-unused-vars */
|
|
865
|
+
flushPassiveEffects = _ReactDOM$__SECRET_IN[11],
|
|
866
|
+
IsThisRendererActing = _ReactDOM$__SECRET_IN[12];
|
|
1060
867
|
var batchedUpdates = ReactDOM.unstable_batchedUpdates;
|
|
1061
868
|
var IsSomeRendererActing = ReactSharedInternals.IsSomeRendererActing; // this implementation should be exactly the same in
|
|
1062
869
|
// ReactTestUtilsAct.js, ReactTestRendererAct.js, createReactNoop.js
|
|
@@ -1066,7 +873,7 @@ var isSchedulerMocked = typeof Scheduler.unstable_flushAllWithoutAsserting === '
|
|
|
1066
873
|
var flushWork = Scheduler.unstable_flushAllWithoutAsserting || function () {
|
|
1067
874
|
var didFlushWork = false;
|
|
1068
875
|
|
|
1069
|
-
while (flushPassiveEffects
|
|
876
|
+
while (flushPassiveEffects()) {
|
|
1070
877
|
didFlushWork = true;
|
|
1071
878
|
}
|
|
1072
879
|
|
|
@@ -1076,7 +883,7 @@ var flushWork = Scheduler.unstable_flushAllWithoutAsserting || function () {
|
|
|
1076
883
|
function flushWorkAndMicroTasks(onDone) {
|
|
1077
884
|
try {
|
|
1078
885
|
flushWork();
|
|
1079
|
-
enqueueTask
|
|
886
|
+
enqueueTask(function () {
|
|
1080
887
|
if (flushWork()) {
|
|
1081
888
|
flushWorkAndMicroTasks(onDone);
|
|
1082
889
|
} else {
|
|
@@ -1091,25 +898,27 @@ function flushWorkAndMicroTasks(onDone) {
|
|
|
1091
898
|
|
|
1092
899
|
|
|
1093
900
|
var actingUpdatesScopeDepth = 0;
|
|
901
|
+
|
|
1094
902
|
function act(callback) {
|
|
903
|
+
|
|
1095
904
|
var previousActingUpdatesScopeDepth = actingUpdatesScopeDepth;
|
|
1096
905
|
var previousIsSomeRendererActing;
|
|
1097
906
|
var previousIsThisRendererActing;
|
|
1098
907
|
actingUpdatesScopeDepth++;
|
|
1099
908
|
previousIsSomeRendererActing = IsSomeRendererActing.current;
|
|
1100
|
-
previousIsThisRendererActing = IsThisRendererActing
|
|
909
|
+
previousIsThisRendererActing = IsThisRendererActing.current;
|
|
1101
910
|
IsSomeRendererActing.current = true;
|
|
1102
|
-
IsThisRendererActing
|
|
911
|
+
IsThisRendererActing.current = true;
|
|
1103
912
|
|
|
1104
913
|
function onDone() {
|
|
1105
914
|
actingUpdatesScopeDepth--;
|
|
1106
915
|
IsSomeRendererActing.current = previousIsSomeRendererActing;
|
|
1107
|
-
IsThisRendererActing
|
|
916
|
+
IsThisRendererActing.current = previousIsThisRendererActing;
|
|
1108
917
|
|
|
1109
918
|
{
|
|
1110
919
|
if (actingUpdatesScopeDepth > previousActingUpdatesScopeDepth) {
|
|
1111
920
|
// if it's _less than_ previousActingUpdatesScopeDepth, then we can assume the 'other' one has warned
|
|
1112
|
-
|
|
921
|
+
error('You seem to have overlapping act() calls, this is not supported. ' + 'Be sure to await previous act() calls before making a new one. ');
|
|
1113
922
|
}
|
|
1114
923
|
}
|
|
1115
924
|
}
|
|
@@ -1134,7 +943,7 @@ function act(callback) {
|
|
|
1134
943
|
//eslint-disable-next-line no-undef
|
|
1135
944
|
Promise.resolve().then(function () {}).then(function () {
|
|
1136
945
|
if (called === false) {
|
|
1137
|
-
|
|
946
|
+
error('You called act(async () => ...) without await. ' + 'This could lead to unexpected testing behaviour, interleaving multiple act ' + 'calls and mixing their scopes. You should - await act(async () => ...);');
|
|
1138
947
|
}
|
|
1139
948
|
});
|
|
1140
949
|
}
|
|
@@ -1172,7 +981,9 @@ function act(callback) {
|
|
|
1172
981
|
};
|
|
1173
982
|
} else {
|
|
1174
983
|
{
|
|
1175
|
-
|
|
984
|
+
if (result !== undefined) {
|
|
985
|
+
error('The callback passed to act(...) function ' + 'must return undefined, or a Promise. You returned %s', result);
|
|
986
|
+
}
|
|
1176
987
|
} // flush effects until none remain, and cleanup
|
|
1177
988
|
|
|
1178
989
|
|
|
@@ -1193,7 +1004,7 @@ function act(callback) {
|
|
|
1193
1004
|
return {
|
|
1194
1005
|
then: function (resolve) {
|
|
1195
1006
|
{
|
|
1196
|
-
|
|
1007
|
+
error('Do not await the result of calling act(...) with sync logic, it is not a Promise.');
|
|
1197
1008
|
}
|
|
1198
1009
|
|
|
1199
1010
|
resolve();
|
|
@@ -1205,20 +1016,28 @@ function act(callback) {
|
|
|
1205
1016
|
var findDOMNode = ReactDOM.findDOMNode; // Keep in sync with ReactDOMUnstableNativeDependencies.js
|
|
1206
1017
|
// ReactDOM.js, and ReactTestUtilsAct.js:
|
|
1207
1018
|
|
|
1208
|
-
var _ReactDOM$__SECRET_IN = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Events
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1019
|
+
var _ReactDOM$__SECRET_IN$1 = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Events,
|
|
1020
|
+
getInstanceFromNode$1 = _ReactDOM$__SECRET_IN$1[0],
|
|
1021
|
+
|
|
1022
|
+
/* eslint-disable no-unused-vars */
|
|
1023
|
+
getNodeFromInstance$1 = _ReactDOM$__SECRET_IN$1[1],
|
|
1024
|
+
getFiberCurrentPropsFromNode$1 = _ReactDOM$__SECRET_IN$1[2],
|
|
1025
|
+
injectEventPluginsByName$1 = _ReactDOM$__SECRET_IN$1[3],
|
|
1026
|
+
|
|
1027
|
+
/* eslint-enable no-unused-vars */
|
|
1028
|
+
eventNameDispatchConfigs$1 = _ReactDOM$__SECRET_IN$1[4],
|
|
1029
|
+
accumulateTwoPhaseDispatches$1 = _ReactDOM$__SECRET_IN$1[5],
|
|
1030
|
+
accumulateDirectDispatches$1 = _ReactDOM$__SECRET_IN$1[6],
|
|
1031
|
+
enqueueStateRestore$1 = _ReactDOM$__SECRET_IN$1[7],
|
|
1032
|
+
restoreStateIfNeeded$1 = _ReactDOM$__SECRET_IN$1[8],
|
|
1033
|
+
dispatchEvent$1 = _ReactDOM$__SECRET_IN$1[9],
|
|
1034
|
+
runEventsInBatch$1 = _ReactDOM$__SECRET_IN$1[10],
|
|
1035
|
+
|
|
1036
|
+
/* eslint-disable no-unused-vars */
|
|
1037
|
+
flushPassiveEffects$1 = _ReactDOM$__SECRET_IN$1[11],
|
|
1038
|
+
IsThisRendererActing$1
|
|
1039
|
+
/* eslint-enable no-unused-vars */
|
|
1040
|
+
= _ReactDOM$__SECRET_IN$1[12];
|
|
1222
1041
|
|
|
1223
1042
|
function Event(suffix) {}
|
|
1224
1043
|
|
|
@@ -1237,7 +1056,7 @@ var hasWarnedAboutDeprecatedMockComponent = false;
|
|
|
1237
1056
|
|
|
1238
1057
|
function simulateNativeEventOnNode(topLevelType, node, fakeNativeEvent) {
|
|
1239
1058
|
fakeNativeEvent.target = node;
|
|
1240
|
-
dispatchEvent(topLevelType, PLUGIN_EVENT_SYSTEM, fakeNativeEvent);
|
|
1059
|
+
dispatchEvent$1(topLevelType, PLUGIN_EVENT_SYSTEM, document, fakeNativeEvent);
|
|
1241
1060
|
}
|
|
1242
1061
|
/**
|
|
1243
1062
|
* Simulates a top level event being dispatched from a raw event that occurred
|
|
@@ -1322,13 +1141,11 @@ function validateClassInstance(inst, methodName) {
|
|
|
1322
1141
|
received = stringified;
|
|
1323
1142
|
}
|
|
1324
1143
|
|
|
1325
|
-
|
|
1144
|
+
{
|
|
1326
1145
|
{
|
|
1327
|
-
|
|
1328
|
-
throw ReactError(Error(methodName + "(...): the first argument must be a React class instance. Instead received: " + received + "."));
|
|
1329
|
-
}
|
|
1146
|
+
throw Error( methodName + "(...): the first argument must be a React class instance. Instead received: " + received + "." );
|
|
1330
1147
|
}
|
|
1331
|
-
}
|
|
1148
|
+
}
|
|
1332
1149
|
}
|
|
1333
1150
|
/**
|
|
1334
1151
|
* Utilities for making it easy to test React components.
|
|
@@ -1411,13 +1228,11 @@ var ReactTestUtils = {
|
|
|
1411
1228
|
var classList = className.split(/\s+/);
|
|
1412
1229
|
|
|
1413
1230
|
if (!Array.isArray(classNames)) {
|
|
1414
|
-
(
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
throw ReactError(Error("TestUtils.scryRenderedDOMComponentsWithClass expects a className as a second argument."));
|
|
1418
|
-
}
|
|
1231
|
+
if (!(classNames !== undefined)) {
|
|
1232
|
+
{
|
|
1233
|
+
throw Error( "TestUtils.scryRenderedDOMComponentsWithClass expects a className as a second argument." );
|
|
1419
1234
|
}
|
|
1420
|
-
}
|
|
1235
|
+
}
|
|
1421
1236
|
|
|
1422
1237
|
classNames = classNames.split(/\s+/);
|
|
1423
1238
|
}
|
|
@@ -1519,9 +1334,12 @@ var ReactTestUtils = {
|
|
|
1519
1334
|
* @return {object} the ReactTestUtils object (for chaining)
|
|
1520
1335
|
*/
|
|
1521
1336
|
mockComponent: function (module, mockTagName) {
|
|
1522
|
-
|
|
1523
|
-
hasWarnedAboutDeprecatedMockComponent
|
|
1524
|
-
|
|
1337
|
+
{
|
|
1338
|
+
if (!hasWarnedAboutDeprecatedMockComponent) {
|
|
1339
|
+
hasWarnedAboutDeprecatedMockComponent = true;
|
|
1340
|
+
|
|
1341
|
+
warn('ReactTestUtils.mockComponent() is deprecated. ' + 'Use shallow rendering or jest.mock() instead.\n\n' + 'See https://fb.me/test-utils-mock-component for more information.');
|
|
1342
|
+
}
|
|
1525
1343
|
}
|
|
1526
1344
|
|
|
1527
1345
|
mockTagName = mockTagName || module.mockTagName || 'div';
|
|
@@ -1553,29 +1371,25 @@ var ReactTestUtils = {
|
|
|
1553
1371
|
|
|
1554
1372
|
function makeSimulator(eventType) {
|
|
1555
1373
|
return function (domNode, eventData) {
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
throw ReactError(Error("TestUtils.Simulate expected a DOM node as the first argument but received a React element. Pass the DOM node you wish to simulate the event on instead. Note that TestUtils.Simulate will not work if you are using shallow rendering."));
|
|
1560
|
-
}
|
|
1374
|
+
if (!!React.isValidElement(domNode)) {
|
|
1375
|
+
{
|
|
1376
|
+
throw Error( "TestUtils.Simulate expected a DOM node as the first argument but received a React element. Pass the DOM node you wish to simulate the event on instead. Note that TestUtils.Simulate will not work if you are using shallow rendering." );
|
|
1561
1377
|
}
|
|
1562
|
-
}
|
|
1378
|
+
}
|
|
1563
1379
|
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
throw ReactError(Error("TestUtils.Simulate expected a DOM node as the first argument but received a component instance. Pass the DOM node you wish to simulate the event on instead."));
|
|
1568
|
-
}
|
|
1380
|
+
if (!!ReactTestUtils.isCompositeComponent(domNode)) {
|
|
1381
|
+
{
|
|
1382
|
+
throw Error( "TestUtils.Simulate expected a DOM node as the first argument but received a component instance. Pass the DOM node you wish to simulate the event on instead." );
|
|
1569
1383
|
}
|
|
1570
|
-
}
|
|
1384
|
+
}
|
|
1571
1385
|
|
|
1572
|
-
var dispatchConfig = eventNameDispatchConfigs[eventType];
|
|
1386
|
+
var dispatchConfig = eventNameDispatchConfigs$1[eventType];
|
|
1573
1387
|
var fakeNativeEvent = new Event();
|
|
1574
1388
|
fakeNativeEvent.target = domNode;
|
|
1575
1389
|
fakeNativeEvent.type = eventType.toLowerCase(); // We don't use SyntheticEvent.getPooled in order to not have to worry about
|
|
1576
1390
|
// properly destroying any properties assigned from `eventData` upon release
|
|
1577
1391
|
|
|
1578
|
-
var targetInst = getInstanceFromNode(domNode);
|
|
1392
|
+
var targetInst = getInstanceFromNode$1(domNode);
|
|
1579
1393
|
var event = new SyntheticEvent(dispatchConfig, targetInst, fakeNativeEvent, domNode); // Since we aren't using pooling, always persist the event. This will make
|
|
1580
1394
|
// sure it's marked and won't warn when setting additional properties.
|
|
1581
1395
|
|
|
@@ -1584,18 +1398,18 @@ function makeSimulator(eventType) {
|
|
|
1584
1398
|
_assign(event, eventData);
|
|
1585
1399
|
|
|
1586
1400
|
if (dispatchConfig.phasedRegistrationNames) {
|
|
1587
|
-
accumulateTwoPhaseDispatches(event);
|
|
1401
|
+
accumulateTwoPhaseDispatches$1(event);
|
|
1588
1402
|
} else {
|
|
1589
|
-
accumulateDirectDispatches(event);
|
|
1403
|
+
accumulateDirectDispatches$1(event);
|
|
1590
1404
|
}
|
|
1591
1405
|
|
|
1592
1406
|
ReactDOM.unstable_batchedUpdates(function () {
|
|
1593
1407
|
// Normally extractEvent enqueues a state restore, but we'll just always
|
|
1594
1408
|
// do that since we're by-passing it here.
|
|
1595
|
-
enqueueStateRestore(domNode);
|
|
1596
|
-
runEventsInBatch(event);
|
|
1409
|
+
enqueueStateRestore$1(domNode);
|
|
1410
|
+
runEventsInBatch$1(event);
|
|
1597
1411
|
});
|
|
1598
|
-
restoreStateIfNeeded();
|
|
1412
|
+
restoreStateIfNeeded$1();
|
|
1599
1413
|
};
|
|
1600
1414
|
}
|
|
1601
1415
|
|
|
@@ -1603,7 +1417,7 @@ function buildSimulators() {
|
|
|
1603
1417
|
ReactTestUtils.Simulate = {};
|
|
1604
1418
|
var eventType;
|
|
1605
1419
|
|
|
1606
|
-
for (eventType in eventNameDispatchConfigs) {
|
|
1420
|
+
for (eventType in eventNameDispatchConfigs$1) {
|
|
1607
1421
|
/**
|
|
1608
1422
|
* @param {!Element|ReactDOMComponent} domComponentOrNode
|
|
1609
1423
|
* @param {?object} eventData Fake event data to use in SyntheticEvent.
|
|
@@ -1655,18 +1469,11 @@ function makeNativeSimulator(eventType, topLevelType) {
|
|
|
1655
1469
|
ReactTestUtils.SimulateNative[eventType] = makeNativeSimulator(eventType, topLevelType);
|
|
1656
1470
|
});
|
|
1657
1471
|
|
|
1658
|
-
|
|
1659
|
-
var ReactTestUtils$2 = Object.freeze({
|
|
1660
|
-
default: ReactTestUtils
|
|
1661
|
-
});
|
|
1662
|
-
|
|
1663
|
-
var ReactTestUtils$3 = ( ReactTestUtils$2 && ReactTestUtils ) || ReactTestUtils$2;
|
|
1664
|
-
|
|
1665
1472
|
// TODO: decide on the top-level export form.
|
|
1666
1473
|
// This is hacky but makes it work with both Rollup and Jest.
|
|
1667
1474
|
|
|
1668
1475
|
|
|
1669
|
-
var testUtils = ReactTestUtils
|
|
1476
|
+
var testUtils = ReactTestUtils.default || ReactTestUtils;
|
|
1670
1477
|
|
|
1671
1478
|
module.exports = testUtils;
|
|
1672
1479
|
})();
|