react-dom 16.9.0 → 16.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/build-info.json +4 -4
  2. package/cjs/react-dom-server.browser.development.js +815 -470
  3. package/cjs/react-dom-server.browser.production.min.js +46 -46
  4. package/cjs/react-dom-server.node.development.js +827 -483
  5. package/cjs/react-dom-server.node.production.min.js +47 -47
  6. package/cjs/react-dom-test-utils.development.js +302 -177
  7. package/cjs/react-dom-test-utils.production.min.js +17 -18
  8. package/cjs/react-dom-unstable-fizz.browser.development.js +20 -17
  9. package/cjs/react-dom-unstable-fizz.browser.production.min.js +2 -2
  10. package/cjs/react-dom-unstable-fizz.node.development.js +20 -13
  11. package/cjs/react-dom-unstable-fizz.node.production.min.js +1 -1
  12. package/cjs/react-dom-unstable-native-dependencies.development.js +166 -101
  13. package/cjs/react-dom-unstable-native-dependencies.production.min.js +27 -27
  14. package/cjs/react-dom.development.js +19212 -16498
  15. package/cjs/react-dom.production.min.js +281 -266
  16. package/cjs/react-dom.profiling.min.js +287 -275
  17. package/package.json +2 -2
  18. package/umd/react-dom-server.browser.development.js +828 -473
  19. package/umd/react-dom-server.browser.production.min.js +38 -38
  20. package/umd/react-dom-test-utils.development.js +302 -179
  21. package/umd/react-dom-test-utils.production.min.js +23 -23
  22. package/umd/react-dom-unstable-fizz.browser.development.js +20 -17
  23. package/umd/react-dom-unstable-fizz.browser.production.min.js +2 -2
  24. package/umd/react-dom-unstable-native-dependencies.development.js +166 -102
  25. package/umd/react-dom-unstable-native-dependencies.production.min.js +22 -22
  26. package/umd/react-dom.development.js +19438 -16716
  27. package/umd/react-dom.production.min.js +234 -221
  28. package/umd/react-dom.profiling.min.js +241 -228
@@ -1,4 +1,4 @@
1
- /** @license React v16.9.0
1
+ /** @license React v16.10.0
2
2
  * react-dom-test-utils.development.js
3
3
  *
4
4
  * Copyright (c) Facebook, Inc. and its affiliates.
@@ -27,7 +27,6 @@ var Scheduler = require('scheduler');
27
27
  // Do not require this module directly! Use normal `invariant` calls with
28
28
  // template literal strings. The messages will be converted to ReactError during
29
29
  // build, and in production they will be minified.
30
-
31
30
  function ReactError(error) {
32
31
  error.name = 'Invariant Violation';
33
32
  return error;
@@ -50,35 +49,37 @@ function ReactError(error) {
50
49
  * paths. Removing the logging code for production environments will keep the
51
50
  * same logic and follow the same code paths.
52
51
  */
53
-
54
52
  var warningWithoutStack = function () {};
55
53
 
56
54
  {
57
55
  warningWithoutStack = function (condition, format) {
58
- for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
56
+ for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
59
57
  args[_key - 2] = arguments[_key];
60
58
  }
61
59
 
62
60
  if (format === undefined) {
63
61
  throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
64
62
  }
63
+
65
64
  if (args.length > 8) {
66
65
  // Check before the condition to catch violations early.
67
66
  throw new Error('warningWithoutStack() currently supports at most 8 arguments.');
68
67
  }
68
+
69
69
  if (condition) {
70
70
  return;
71
71
  }
72
+
72
73
  if (typeof console !== 'undefined') {
73
74
  var argsWithFormat = args.map(function (item) {
74
75
  return '' + item;
75
76
  });
76
- argsWithFormat.unshift('Warning: ' + format);
77
-
78
- // We intentionally don't use spread (or .apply) directly because it
77
+ argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
79
78
  // breaks IE9: https://github.com/facebook/react/issues/13610
79
+
80
80
  Function.prototype.apply.call(console.error, console, argsWithFormat);
81
81
  }
82
+
82
83
  try {
83
84
  // --- Welcome to debugging React ---
84
85
  // This error was thrown as a convenience so that you can use this stack
@@ -110,21 +111,20 @@ var warningWithoutStack$1 = warningWithoutStack;
110
111
  * supported we can rename it.
111
112
  */
112
113
 
113
-
114
114
  function get(key) {
115
115
  return key._reactInternalFiber;
116
116
  }
117
117
 
118
- var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
119
-
120
- // Prevent newer renderers from RTE when used with older react package versions.
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.
121
119
  // Current owner and dispatcher used to share the same ref,
122
120
  // but PR #14548 split them out to better support the react-debug-tools package.
121
+
123
122
  if (!ReactSharedInternals.hasOwnProperty('ReactCurrentDispatcher')) {
124
123
  ReactSharedInternals.ReactCurrentDispatcher = {
125
124
  current: null
126
125
  };
127
126
  }
127
+
128
128
  if (!ReactSharedInternals.hasOwnProperty('ReactCurrentBatchConfig')) {
129
129
  ReactSharedInternals.ReactCurrentBatchConfig = {
130
130
  suspense: null
@@ -139,24 +139,34 @@ if (!ReactSharedInternals.hasOwnProperty('ReactCurrentBatchConfig')) {
139
139
 
140
140
 
141
141
 
142
-
143
- // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
142
+ // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
144
143
  // (unstable) APIs that have been removed. Can we remove the symbols?
145
144
 
145
+ {
146
+
147
+ }
148
+
146
149
  var FunctionComponent = 0;
147
150
  var ClassComponent = 1;
148
151
  // Before we know whether it is function or class
152
+
149
153
  var HostRoot = 3; // Root of a host tree. Could be nested inside another node.
154
+
150
155
  // A subtree. Could be an entry point to a different renderer.
156
+
151
157
  var HostComponent = 5;
152
158
  var HostText = 6;
153
159
 
154
160
  // Don't change these two values. They're used by React Dev Tools.
155
- var NoEffect = /* */0;
161
+ var NoEffect =
162
+ /* */
163
+ 0;
164
+ // You can change the rest (and add more).
156
165
 
166
+ var Placement =
167
+ /* */
168
+ 2;
157
169
 
158
- // You can change the rest (and add more).
159
- var Placement = /* */2;
160
170
 
161
171
 
162
172
 
@@ -165,46 +175,114 @@ var Placement = /* */2;
165
175
 
166
176
 
167
177
 
178
+ var Hydrating =
179
+ /* */
180
+ 1024;
181
+ // Passive & Update & Callback & Ref & Snapshot
168
182
 
183
+ // Union of all host effects
169
184
 
170
- // Passive & Update & Callback & Ref & Snapshot
185
+ // Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
171
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:
172
191
 
173
- // Union of all host effects
192
+ // To preserve the "Pause on caught exceptions" behavior of the debugger, we
193
+ // replay the begin phase of a failed component inside invokeGuardedCallback.
174
194
 
175
- var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
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.
176
224
 
177
- var MOUNTING = 1;
178
- var MOUNTED = 2;
179
- var UNMOUNTED = 3;
225
+ // Experimental Scope support.
180
226
 
181
- function isFiberMountedImpl(fiber) {
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
+
249
+ var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
250
+ function getNearestMountedFiber(fiber) {
182
251
  var node = fiber;
252
+ var nearestMounted = fiber;
253
+
183
254
  if (!fiber.alternate) {
184
255
  // If there is no alternate, this might be a new tree that isn't inserted
185
256
  // yet. If it is, then it will have a pending insertion effect on it.
186
- if ((node.effectTag & Placement) !== NoEffect) {
187
- return MOUNTING;
188
- }
189
- while (node.return) {
190
- node = node.return;
191
- if ((node.effectTag & Placement) !== NoEffect) {
192
- return MOUNTING;
257
+ var nextNode = node;
258
+
259
+ do {
260
+ node = nextNode;
261
+
262
+ if ((node.effectTag & (Placement | Hydrating)) !== NoEffect) {
263
+ // This is an insertion or in-progress hydration. The nearest possible
264
+ // mounted fiber is the parent but we need to continue to figure out
265
+ // if that one is still mounted.
266
+ nearestMounted = node.return;
193
267
  }
194
- }
268
+
269
+ nextNode = node.return;
270
+ } while (nextNode);
195
271
  } else {
196
272
  while (node.return) {
197
273
  node = node.return;
198
274
  }
199
275
  }
276
+
200
277
  if (node.tag === HostRoot) {
201
278
  // TODO: Check if this was a nested HostRoot when used with
202
279
  // renderContainerIntoSubtree.
203
- return MOUNTED;
204
- }
205
- // If we didn't hit the root, that means that we're in an disconnected tree
280
+ return nearestMounted;
281
+ } // If we didn't hit the root, that means that we're in an disconnected tree
206
282
  // that has been unmounted.
207
- return UNMOUNTED;
283
+
284
+
285
+ return null;
208
286
  }
209
287
 
210
288
 
@@ -213,9 +291,9 @@ function isFiberMountedImpl(fiber) {
213
291
 
214
292
  function assertIsMounted(fiber) {
215
293
  (function () {
216
- if (!(isFiberMountedImpl(fiber) === MOUNTED)) {
294
+ if (!(getNearestMountedFiber(fiber) === fiber)) {
217
295
  {
218
- throw ReactError(Error('Unable to find node on an unmounted component.'));
296
+ throw ReactError(Error("Unable to find node on an unmounted component."));
219
297
  }
220
298
  }
221
299
  })();
@@ -223,71 +301,86 @@ function assertIsMounted(fiber) {
223
301
 
224
302
  function findCurrentFiberUsingSlowPath(fiber) {
225
303
  var alternate = fiber.alternate;
304
+
226
305
  if (!alternate) {
227
306
  // If there is no alternate, then we only need to check if it is mounted.
228
- var state = isFiberMountedImpl(fiber);
307
+ var nearestMounted = getNearestMountedFiber(fiber);
308
+
229
309
  (function () {
230
- if (!(state !== UNMOUNTED)) {
310
+ if (!(nearestMounted !== null)) {
231
311
  {
232
- throw ReactError(Error('Unable to find node on an unmounted component.'));
312
+ throw ReactError(Error("Unable to find node on an unmounted component."));
233
313
  }
234
314
  }
235
315
  })();
236
- if (state === MOUNTING) {
316
+
317
+ if (nearestMounted !== fiber) {
237
318
  return null;
238
319
  }
320
+
239
321
  return fiber;
240
- }
241
- // If we have two possible branches, we'll walk backwards up to the root
322
+ } // If we have two possible branches, we'll walk backwards up to the root
242
323
  // to see what path the root points to. On the way we may hit one of the
243
324
  // special cases and we'll deal with them.
325
+
326
+
244
327
  var a = fiber;
245
328
  var b = alternate;
329
+
246
330
  while (true) {
247
331
  var parentA = a.return;
332
+
248
333
  if (parentA === null) {
249
334
  // We're at the root.
250
335
  break;
251
336
  }
337
+
252
338
  var parentB = parentA.alternate;
339
+
253
340
  if (parentB === null) {
254
341
  // There is no alternate. This is an unusual case. Currently, it only
255
342
  // happens when a Suspense component is hidden. An extra fragment fiber
256
343
  // is inserted in between the Suspense fiber and its children. Skip
257
344
  // over this extra fragment fiber and proceed to the next parent.
258
345
  var nextParent = parentA.return;
346
+
259
347
  if (nextParent !== null) {
260
348
  a = b = nextParent;
261
349
  continue;
262
- }
263
- // If there's no parent, we're at the root.
264
- break;
265
- }
350
+ } // If there's no parent, we're at the root.
266
351
 
267
- // If both copies of the parent fiber point to the same child, we can
352
+
353
+ break;
354
+ } // If both copies of the parent fiber point to the same child, we can
268
355
  // assume that the child is current. This happens when we bailout on low
269
356
  // priority: the bailed out fiber's child reuses the current child.
357
+
358
+
270
359
  if (parentA.child === parentB.child) {
271
360
  var child = parentA.child;
361
+
272
362
  while (child) {
273
363
  if (child === a) {
274
364
  // We've determined that A is the current branch.
275
365
  assertIsMounted(parentA);
276
366
  return fiber;
277
367
  }
368
+
278
369
  if (child === b) {
279
370
  // We've determined that B is the current branch.
280
371
  assertIsMounted(parentA);
281
372
  return alternate;
282
373
  }
374
+
283
375
  child = child.sibling;
284
- }
285
- // We should never have an alternate for any mounting node. So the only
376
+ } // We should never have an alternate for any mounting node. So the only
286
377
  // way this could possibly happen is if this was unmounted, if at all.
378
+
379
+
287
380
  (function () {
288
381
  {
289
382
  {
290
- throw ReactError(Error('Unable to find node on an unmounted component.'));
383
+ throw ReactError(Error("Unable to find node on an unmounted component."));
291
384
  }
292
385
  }
293
386
  })();
@@ -308,6 +401,7 @@ function findCurrentFiberUsingSlowPath(fiber) {
308
401
  // Search parent A's child set
309
402
  var didFindChild = false;
310
403
  var _child = parentA.child;
404
+
311
405
  while (_child) {
312
406
  if (_child === a) {
313
407
  didFindChild = true;
@@ -315,17 +409,21 @@ function findCurrentFiberUsingSlowPath(fiber) {
315
409
  b = parentB;
316
410
  break;
317
411
  }
412
+
318
413
  if (_child === b) {
319
414
  didFindChild = true;
320
415
  b = parentA;
321
416
  a = parentB;
322
417
  break;
323
418
  }
419
+
324
420
  _child = _child.sibling;
325
421
  }
422
+
326
423
  if (!didFindChild) {
327
424
  // Search parent B's child set
328
425
  _child = parentB.child;
426
+
329
427
  while (_child) {
330
428
  if (_child === a) {
331
429
  didFindChild = true;
@@ -333,18 +431,21 @@ function findCurrentFiberUsingSlowPath(fiber) {
333
431
  b = parentA;
334
432
  break;
335
433
  }
434
+
336
435
  if (_child === b) {
337
436
  didFindChild = true;
338
437
  b = parentB;
339
438
  a = parentA;
340
439
  break;
341
440
  }
441
+
342
442
  _child = _child.sibling;
343
443
  }
444
+
344
445
  (function () {
345
446
  if (!didFindChild) {
346
447
  {
347
- 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.'));
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."));
348
449
  }
349
450
  }
350
451
  })();
@@ -354,36 +455,38 @@ function findCurrentFiberUsingSlowPath(fiber) {
354
455
  (function () {
355
456
  if (!(a.alternate === b)) {
356
457
  {
357
- 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.'));
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."));
358
459
  }
359
460
  }
360
461
  })();
361
- }
362
- // If the root is not a host container, we're in a disconnected tree. I.e.
462
+ } // If the root is not a host container, we're in a disconnected tree. I.e.
363
463
  // unmounted.
464
+
465
+
364
466
  (function () {
365
467
  if (!(a.tag === HostRoot)) {
366
468
  {
367
- throw ReactError(Error('Unable to find node on an unmounted component.'));
469
+ throw ReactError(Error("Unable to find node on an unmounted component."));
368
470
  }
369
471
  }
370
472
  })();
473
+
371
474
  if (a.stateNode.current === a) {
372
475
  // We've determined that A is the current branch.
373
476
  return fiber;
374
- }
375
- // Otherwise B has to be current branch.
477
+ } // Otherwise B has to be current branch.
478
+
479
+
376
480
  return alternate;
377
481
  }
378
482
 
379
483
  /* eslint valid-typeof: 0 */
380
-
381
484
  var EVENT_POOL_SIZE = 10;
382
-
383
485
  /**
384
486
  * @interface Event
385
487
  * @see http://www.w3.org/TR/DOM-Level-3-Events/
386
488
  */
489
+
387
490
  var EventInterface = {
388
491
  type: null,
389
492
  target: null,
@@ -408,7 +511,6 @@ function functionThatReturnsTrue() {
408
511
  function functionThatReturnsFalse() {
409
512
  return false;
410
513
  }
411
-
412
514
  /**
413
515
  * Synthetic events are dispatched by event plugins, typically in response to a
414
516
  * top-level event delegation handler.
@@ -427,6 +529,8 @@ function functionThatReturnsFalse() {
427
529
  * @param {object} nativeEvent Native browser event.
428
530
  * @param {DOMEventTarget} nativeEventTarget Target node.
429
531
  */
532
+
533
+
430
534
  function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarget) {
431
535
  {
432
536
  // these have a getter/setter for warnings
@@ -440,16 +544,19 @@ function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarg
440
544
  this.dispatchConfig = dispatchConfig;
441
545
  this._targetInst = targetInst;
442
546
  this.nativeEvent = nativeEvent;
443
-
444
547
  var Interface = this.constructor.Interface;
548
+
445
549
  for (var propName in Interface) {
446
550
  if (!Interface.hasOwnProperty(propName)) {
447
551
  continue;
448
552
  }
553
+
449
554
  {
450
555
  delete this[propName]; // this has a getter/setter for warnings
451
556
  }
557
+
452
558
  var normalize = Interface[propName];
559
+
453
560
  if (normalize) {
454
561
  this[propName] = normalize(nativeEvent);
455
562
  } else {
@@ -462,11 +569,13 @@ function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarg
462
569
  }
463
570
 
464
571
  var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false;
572
+
465
573
  if (defaultPrevented) {
466
574
  this.isDefaultPrevented = functionThatReturnsTrue;
467
575
  } else {
468
576
  this.isDefaultPrevented = functionThatReturnsFalse;
469
577
  }
578
+
470
579
  this.isPropagationStopped = functionThatReturnsFalse;
471
580
  return this;
472
581
  }
@@ -475,6 +584,7 @@ _assign(SyntheticEvent.prototype, {
475
584
  preventDefault: function () {
476
585
  this.defaultPrevented = true;
477
586
  var event = this.nativeEvent;
587
+
478
588
  if (!event) {
479
589
  return;
480
590
  }
@@ -484,11 +594,12 @@ _assign(SyntheticEvent.prototype, {
484
594
  } else if (typeof event.returnValue !== 'unknown') {
485
595
  event.returnValue = false;
486
596
  }
597
+
487
598
  this.isDefaultPrevented = functionThatReturnsTrue;
488
599
  },
489
-
490
600
  stopPropagation: function () {
491
601
  var event = this.nativeEvent;
602
+
492
603
  if (!event) {
493
604
  return;
494
605
  }
@@ -528,11 +639,13 @@ _assign(SyntheticEvent.prototype, {
528
639
  */
529
640
  destructor: function () {
530
641
  var Interface = this.constructor.Interface;
642
+
531
643
  for (var propName in Interface) {
532
644
  {
533
645
  Object.defineProperty(this, propName, getPooledWarningPropertyDefinition(propName, Interface[propName]));
534
646
  }
535
647
  }
648
+
536
649
  this.dispatchConfig = null;
537
650
  this._targetInst = null;
538
651
  this.nativeEvent = null;
@@ -540,6 +653,7 @@ _assign(SyntheticEvent.prototype, {
540
653
  this.isPropagationStopped = functionThatReturnsFalse;
541
654
  this._dispatchListeners = null;
542
655
  this._dispatchInstances = null;
656
+
543
657
  {
544
658
  Object.defineProperty(this, 'nativeEvent', getPooledWarningPropertyDefinition('nativeEvent', null));
545
659
  Object.defineProperty(this, 'isDefaultPrevented', getPooledWarningPropertyDefinition('isDefaultPrevented', functionThatReturnsFalse));
@@ -551,33 +665,33 @@ _assign(SyntheticEvent.prototype, {
551
665
  });
552
666
 
553
667
  SyntheticEvent.Interface = EventInterface;
554
-
555
668
  /**
556
669
  * Helper to reduce boilerplate when creating subclasses.
557
670
  */
671
+
558
672
  SyntheticEvent.extend = function (Interface) {
559
673
  var Super = this;
560
674
 
561
675
  var E = function () {};
676
+
562
677
  E.prototype = Super.prototype;
563
678
  var prototype = new E();
564
679
 
565
680
  function Class() {
566
681
  return Super.apply(this, arguments);
567
682
  }
683
+
568
684
  _assign(prototype, Class.prototype);
685
+
569
686
  Class.prototype = prototype;
570
687
  Class.prototype.constructor = Class;
571
-
572
688
  Class.Interface = _assign({}, Super.Interface, Interface);
573
689
  Class.extend = Super.extend;
574
690
  addEventPoolingTo(Class);
575
-
576
691
  return Class;
577
692
  };
578
693
 
579
694
  addEventPoolingTo(SyntheticEvent);
580
-
581
695
  /**
582
696
  * Helper to nullify syntheticEvent instance properties when destructing
583
697
  *
@@ -585,6 +699,7 @@ addEventPoolingTo(SyntheticEvent);
585
699
  * @param {?object} getVal
586
700
  * @return {object} defineProperty object
587
701
  */
702
+
588
703
  function getPooledWarningPropertyDefinition(propName, getVal) {
589
704
  var isFunction = typeof getVal === 'function';
590
705
  return {
@@ -614,24 +729,29 @@ function getPooledWarningPropertyDefinition(propName, getVal) {
614
729
 
615
730
  function getPooledEvent(dispatchConfig, targetInst, nativeEvent, nativeInst) {
616
731
  var EventConstructor = this;
732
+
617
733
  if (EventConstructor.eventPool.length) {
618
734
  var instance = EventConstructor.eventPool.pop();
619
735
  EventConstructor.call(instance, dispatchConfig, targetInst, nativeEvent, nativeInst);
620
736
  return instance;
621
737
  }
738
+
622
739
  return new EventConstructor(dispatchConfig, targetInst, nativeEvent, nativeInst);
623
740
  }
624
741
 
625
742
  function releasePooledEvent(event) {
626
743
  var EventConstructor = this;
744
+
627
745
  (function () {
628
746
  if (!(event instanceof EventConstructor)) {
629
747
  {
630
- throw ReactError(Error('Trying to release an event instance into a pool of a different type.'));
748
+ throw ReactError(Error("Trying to release an event instance into a pool of a different type."));
631
749
  }
632
750
  }
633
751
  })();
752
+
634
753
  event.destructor();
754
+
635
755
  if (EventConstructor.eventPool.length < EVENT_POOL_SIZE) {
636
756
  EventConstructor.eventPool.push(event);
637
757
  }
@@ -656,12 +776,11 @@ function addEventPoolingTo(EventConstructor) {
656
776
  * paths. Removing the logging code for production environments will keep the
657
777
  * same logic and follow the same code paths.
658
778
  */
659
-
660
- var lowPriorityWarning = function () {};
779
+ var lowPriorityWarningWithoutStack = function () {};
661
780
 
662
781
  {
663
782
  var printWarning = function (format) {
664
- for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
783
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
665
784
  args[_key - 1] = arguments[_key];
666
785
  }
667
786
 
@@ -669,9 +788,11 @@ var lowPriorityWarning = function () {};
669
788
  var message = 'Warning: ' + format.replace(/%s/g, function () {
670
789
  return args[argIndex++];
671
790
  });
791
+
672
792
  if (typeof console !== 'undefined') {
673
793
  console.warn(message);
674
794
  }
795
+
675
796
  try {
676
797
  // --- Welcome to debugging React ---
677
798
  // This error was thrown as a convenience so that you can use this stack
@@ -680,32 +801,31 @@ var lowPriorityWarning = function () {};
680
801
  } catch (x) {}
681
802
  };
682
803
 
683
- lowPriorityWarning = function (condition, format) {
804
+ lowPriorityWarningWithoutStack = function (condition, format) {
684
805
  if (format === undefined) {
685
- throw new Error('`lowPriorityWarning(condition, format, ...args)` requires a warning ' + 'message argument');
806
+ throw new Error('`lowPriorityWarningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
686
807
  }
808
+
687
809
  if (!condition) {
688
- for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
810
+ for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
689
811
  args[_key2 - 2] = arguments[_key2];
690
812
  }
691
813
 
692
- printWarning.apply(undefined, [format].concat(args));
814
+ printWarning.apply(void 0, [format].concat(args));
693
815
  }
694
816
  };
695
817
  }
696
818
 
697
- var lowPriorityWarning$1 = lowPriorityWarning;
819
+ var lowPriorityWarningWithoutStack$1 = lowPriorityWarningWithoutStack;
698
820
 
699
821
  /**
700
822
  * HTML nodeType values that represent the type of the node
701
823
  */
702
-
703
824
  var ELEMENT_NODE = 1;
704
825
 
705
826
  // Do not use the below two methods directly!
706
827
  // Instead use constants exported from DOMTopLevelEventTypes in ReactDOM.
707
828
  // (It is the only module that is allowed to access these methods.)
708
-
709
829
  function unsafeCastStringToDOMTopLevelType(topLevelType) {
710
830
  return topLevelType;
711
831
  }
@@ -719,64 +839,64 @@ var canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== '
719
839
  * @param {string} eventName
720
840
  * @returns {object}
721
841
  */
842
+
722
843
  function makePrefixMap(styleProp, eventName) {
723
844
  var prefixes = {};
724
-
725
845
  prefixes[styleProp.toLowerCase()] = eventName.toLowerCase();
726
846
  prefixes['Webkit' + styleProp] = 'webkit' + eventName;
727
847
  prefixes['Moz' + styleProp] = 'moz' + eventName;
728
-
729
848
  return prefixes;
730
849
  }
731
-
732
850
  /**
733
851
  * A list of event names to a configurable list of vendor prefixes.
734
852
  */
853
+
854
+
735
855
  var vendorPrefixes = {
736
856
  animationend: makePrefixMap('Animation', 'AnimationEnd'),
737
857
  animationiteration: makePrefixMap('Animation', 'AnimationIteration'),
738
858
  animationstart: makePrefixMap('Animation', 'AnimationStart'),
739
859
  transitionend: makePrefixMap('Transition', 'TransitionEnd')
740
860
  };
741
-
742
861
  /**
743
862
  * Event names that have already been detected and prefixed (if applicable).
744
863
  */
745
- var prefixedEventNames = {};
746
864
 
865
+ var prefixedEventNames = {};
747
866
  /**
748
867
  * Element to check for prefixes on.
749
868
  */
750
- var style = {};
751
869
 
870
+ var style = {};
752
871
  /**
753
872
  * Bootstrap if a DOM exists.
754
873
  */
755
- if (canUseDOM) {
756
- style = document.createElement('div').style;
757
874
 
758
- // On some platforms, in particular some releases of Android 4.x,
875
+ if (canUseDOM) {
876
+ style = document.createElement('div').style; // On some platforms, in particular some releases of Android 4.x,
759
877
  // the un-prefixed "animation" and "transition" properties are defined on the
760
878
  // style object but the events that fire will still be prefixed, so we need
761
879
  // to check if the un-prefixed events are usable, and if not remove them from the map.
880
+
762
881
  if (!('AnimationEvent' in window)) {
763
882
  delete vendorPrefixes.animationend.animation;
764
883
  delete vendorPrefixes.animationiteration.animation;
765
884
  delete vendorPrefixes.animationstart.animation;
766
- }
885
+ } // Same as above
886
+
767
887
 
768
- // Same as above
769
888
  if (!('TransitionEvent' in window)) {
770
889
  delete vendorPrefixes.transitionend.transition;
771
890
  }
772
891
  }
773
-
774
892
  /**
775
893
  * Attempts to determine the correct vendor prefixed event name.
776
894
  *
777
895
  * @param {string} eventName
778
896
  * @returns {string}
779
897
  */
898
+
899
+
780
900
  function getVendorPrefixedEventName(eventName) {
781
901
  if (prefixedEventNames[eventName]) {
782
902
  return prefixedEventNames[eventName];
@@ -802,6 +922,7 @@ function getVendorPrefixedEventName(eventName) {
802
922
  * us save some bundle size by avoiding a top level type -> event name map.
803
923
  * The rest of ReactDOM code should import top level types from this file.
804
924
  */
925
+
805
926
  var TOP_ABORT = unsafeCastStringToDOMTopLevelType('abort');
806
927
  var TOP_ANIMATION_END = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('animationend'));
807
928
  var TOP_ANIMATION_ITERATION = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('animationiteration'));
@@ -883,23 +1004,22 @@ var TOP_TOUCH_START = unsafeCastStringToDOMTopLevelType('touchstart');
883
1004
  var TOP_TRANSITION_END = unsafeCastStringToDOMTopLevelType(getVendorPrefixedEventName('transitionend'));
884
1005
  var TOP_VOLUME_CHANGE = unsafeCastStringToDOMTopLevelType('volumechange');
885
1006
  var TOP_WAITING = unsafeCastStringToDOMTopLevelType('waiting');
886
- var TOP_WHEEL = unsafeCastStringToDOMTopLevelType('wheel');
887
-
888
- // List of events that need to be individually attached to media elements.
1007
+ var TOP_WHEEL = unsafeCastStringToDOMTopLevelType('wheel'); // List of events that need to be individually attached to media elements.
889
1008
  // Note that events in this list will *not* be listened to at the top level
890
1009
  // unless they're explicitly whitelisted in `ReactBrowserEventEmitter.listenTo`.
891
1010
 
892
1011
  var PLUGIN_EVENT_SYSTEM = 1;
893
1012
 
894
1013
  var didWarnAboutMessageChannel = false;
895
- var enqueueTask = void 0;
1014
+ var enqueueTask;
1015
+
896
1016
  try {
897
1017
  // read require off the module object to get around the bundlers.
898
1018
  // we don't want them to detect a require and bundle a Node polyfill.
899
1019
  var requireString = ('require' + Math.random()).slice(0, 7);
900
- var nodeRequire = module && module[requireString];
901
- // assuming we're in node, let's try to get node's
1020
+ var nodeRequire = module && module[requireString]; // assuming we're in node, let's try to get node's
902
1021
  // version of setImmediate, bypassing fake timers if any.
1022
+
903
1023
  enqueueTask = nodeRequire('timers').setImmediate;
904
1024
  } catch (_err) {
905
1025
  // we're in a browser
@@ -912,6 +1032,7 @@ try {
912
1032
  !(typeof MessageChannel !== 'undefined') ? warningWithoutStack$1(false, '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.') : void 0;
913
1033
  }
914
1034
  }
1035
+
915
1036
  var channel = new MessageChannel();
916
1037
  channel.port1.onmessage = callback;
917
1038
  channel.port2.postMessage(undefined);
@@ -920,8 +1041,8 @@ try {
920
1041
 
921
1042
  var enqueueTask$1 = enqueueTask;
922
1043
 
923
- // Keep in sync with ReactDOMUnstableNativeDependencies.js
924
1044
  // ReactDOM.js, and ReactTestUtils.js:
1045
+
925
1046
  var _ReactDOM$__SECRET_IN$1 = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Events;
926
1047
  var getInstanceFromNode$1 = _ReactDOM$__SECRET_IN$1[0];
927
1048
  var getNodeFromInstance$1 = _ReactDOM$__SECRET_IN$1[1];
@@ -936,18 +1057,15 @@ var dispatchEvent$1 = _ReactDOM$__SECRET_IN$1[9];
936
1057
  var runEventsInBatch$1 = _ReactDOM$__SECRET_IN$1[10];
937
1058
  var flushPassiveEffects$1 = _ReactDOM$__SECRET_IN$1[11];
938
1059
  var IsThisRendererActing$1 = _ReactDOM$__SECRET_IN$1[12];
939
-
940
-
941
1060
  var batchedUpdates = ReactDOM.unstable_batchedUpdates;
942
-
943
- var IsSomeRendererActing = ReactSharedInternals.IsSomeRendererActing;
944
-
945
- // this implementation should be exactly the same in
1061
+ var IsSomeRendererActing = ReactSharedInternals.IsSomeRendererActing; // this implementation should be exactly the same in
946
1062
  // ReactTestUtilsAct.js, ReactTestRendererAct.js, createReactNoop.js
947
1063
 
948
1064
  var isSchedulerMocked = typeof Scheduler.unstable_flushAllWithoutAsserting === 'function';
1065
+
949
1066
  var flushWork = Scheduler.unstable_flushAllWithoutAsserting || function () {
950
1067
  var didFlushWork = false;
1068
+
951
1069
  while (flushPassiveEffects$1()) {
952
1070
  didFlushWork = true;
953
1071
  }
@@ -968,18 +1086,16 @@ function flushWorkAndMicroTasks(onDone) {
968
1086
  } catch (err) {
969
1087
  onDone(err);
970
1088
  }
971
- }
972
-
973
- // we track the 'depth' of the act() calls with this counter,
1089
+ } // we track the 'depth' of the act() calls with this counter,
974
1090
  // so we can tell if any async act() calls try to run in parallel.
975
1091
 
1092
+
976
1093
  var actingUpdatesScopeDepth = 0;
977
1094
  function act(callback) {
978
1095
  var previousActingUpdatesScopeDepth = actingUpdatesScopeDepth;
979
- var previousIsSomeRendererActing = void 0;
980
- var previousIsThisRendererActing = void 0;
1096
+ var previousIsSomeRendererActing;
1097
+ var previousIsThisRendererActing;
981
1098
  actingUpdatesScopeDepth++;
982
-
983
1099
  previousIsSomeRendererActing = IsSomeRendererActing.current;
984
1100
  previousIsThisRendererActing = IsThisRendererActing$1.current;
985
1101
  IsSomeRendererActing.current = true;
@@ -989,6 +1105,7 @@ function act(callback) {
989
1105
  actingUpdatesScopeDepth--;
990
1106
  IsSomeRendererActing.current = previousIsSomeRendererActing;
991
1107
  IsThisRendererActing$1.current = previousIsThisRendererActing;
1108
+
992
1109
  {
993
1110
  if (actingUpdatesScopeDepth > previousActingUpdatesScopeDepth) {
994
1111
  // if it's _less than_ previousActingUpdatesScopeDepth, then we can assume the 'other' one has warned
@@ -997,7 +1114,8 @@ function act(callback) {
997
1114
  }
998
1115
  }
999
1116
 
1000
- var result = void 0;
1117
+ var result;
1118
+
1001
1119
  try {
1002
1120
  result = batchedUpdates(callback);
1003
1121
  } catch (error) {
@@ -1010,6 +1128,7 @@ function act(callback) {
1010
1128
  // setup a boolean that gets set to true only
1011
1129
  // once this act() call is await-ed
1012
1130
  var called = false;
1131
+
1013
1132
  {
1014
1133
  if (typeof Promise !== 'undefined') {
1015
1134
  //eslint-disable-next-line no-undef
@@ -1019,11 +1138,11 @@ function act(callback) {
1019
1138
  }
1020
1139
  });
1021
1140
  }
1022
- }
1023
-
1024
- // in the async case, the returned thenable runs the callback, flushes
1141
+ } // in the async case, the returned thenable runs the callback, flushes
1025
1142
  // effects and microtasks in a loop until flushPassiveEffects() === false,
1026
1143
  // and cleans up
1144
+
1145
+
1027
1146
  return {
1028
1147
  then: function (resolve, reject) {
1029
1148
  called = true;
@@ -1032,11 +1151,13 @@ function act(callback) {
1032
1151
  onDone();
1033
1152
  resolve();
1034
1153
  return;
1035
- }
1036
- // we're about to exit the act() scope,
1154
+ } // we're about to exit the act() scope,
1037
1155
  // now's the time to flush tasks/effects
1156
+
1157
+
1038
1158
  flushWorkAndMicroTasks(function (err) {
1039
1159
  onDone();
1160
+
1040
1161
  if (err) {
1041
1162
  reject(err);
1042
1163
  } else {
@@ -1052,35 +1173,36 @@ function act(callback) {
1052
1173
  } else {
1053
1174
  {
1054
1175
  !(result === undefined) ? warningWithoutStack$1(false, 'The callback passed to act(...) function ' + 'must return undefined, or a Promise. You returned %s', result) : void 0;
1055
- }
1176
+ } // flush effects until none remain, and cleanup
1177
+
1056
1178
 
1057
- // flush effects until none remain, and cleanup
1058
1179
  try {
1059
1180
  if (actingUpdatesScopeDepth === 1 && (isSchedulerMocked === false || previousIsSomeRendererActing === false)) {
1060
1181
  // we're about to exit the act() scope,
1061
1182
  // now's the time to flush effects
1062
1183
  flushWork();
1063
1184
  }
1185
+
1064
1186
  onDone();
1065
1187
  } catch (err) {
1066
1188
  onDone();
1067
1189
  throw err;
1068
- }
1190
+ } // in the sync case, the returned thenable only warns *if* await-ed
1191
+
1069
1192
 
1070
- // in the sync case, the returned thenable only warns *if* await-ed
1071
1193
  return {
1072
1194
  then: function (resolve) {
1073
1195
  {
1074
1196
  warningWithoutStack$1(false, 'Do not await the result of calling act(...) with sync logic, it is not a Promise.');
1075
1197
  }
1198
+
1076
1199
  resolve();
1077
1200
  }
1078
1201
  };
1079
1202
  }
1080
1203
  }
1081
1204
 
1082
- var findDOMNode = ReactDOM.findDOMNode;
1083
- // Keep in sync with ReactDOMUnstableNativeDependencies.js
1205
+ var findDOMNode = ReactDOM.findDOMNode; // Keep in sync with ReactDOMUnstableNativeDependencies.js
1084
1206
  // ReactDOM.js, and ReactTestUtilsAct.js:
1085
1207
 
1086
1208
  var _ReactDOM$__SECRET_IN = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Events;
@@ -1098,11 +1220,9 @@ var runEventsInBatch = _ReactDOM$__SECRET_IN[10];
1098
1220
  var flushPassiveEffects = _ReactDOM$__SECRET_IN[11];
1099
1221
  var IsThisRendererActing = _ReactDOM$__SECRET_IN[12];
1100
1222
 
1101
-
1102
1223
  function Event(suffix) {}
1103
1224
 
1104
1225
  var hasWarnedAboutDeprecatedMockComponent = false;
1105
-
1106
1226
  /**
1107
1227
  * @class ReactTestUtils
1108
1228
  */
@@ -1114,11 +1234,11 @@ var hasWarnedAboutDeprecatedMockComponent = false;
1114
1234
  * @param {!Element} node The dom to simulate an event occurring on.
1115
1235
  * @param {?Event} fakeNativeEvent Fake native event to use in SyntheticEvent.
1116
1236
  */
1237
+
1117
1238
  function simulateNativeEventOnNode(topLevelType, node, fakeNativeEvent) {
1118
1239
  fakeNativeEvent.target = node;
1119
1240
  dispatchEvent(topLevelType, PLUGIN_EVENT_SYSTEM, fakeNativeEvent);
1120
1241
  }
1121
-
1122
1242
  /**
1123
1243
  * Simulates a top level event being dispatched from a raw event that occurred
1124
1244
  * on the `ReactDOMComponent` `comp`.
@@ -1126,6 +1246,8 @@ function simulateNativeEventOnNode(topLevelType, node, fakeNativeEvent) {
1126
1246
  * @param {!ReactDOMComponent} comp
1127
1247
  * @param {?Event} fakeNativeEvent Fake native event to use in SyntheticEvent.
1128
1248
  */
1249
+
1250
+
1129
1251
  function simulateNativeEventOnDOMComponent(topLevelType, comp, fakeNativeEvent) {
1130
1252
  simulateNativeEventOnNode(topLevelType, findDOMNode(comp), fakeNativeEvent);
1131
1253
  }
@@ -1134,33 +1256,43 @@ function findAllInRenderedFiberTreeInternal(fiber, test) {
1134
1256
  if (!fiber) {
1135
1257
  return [];
1136
1258
  }
1259
+
1137
1260
  var currentParent = findCurrentFiberUsingSlowPath(fiber);
1261
+
1138
1262
  if (!currentParent) {
1139
1263
  return [];
1140
1264
  }
1265
+
1141
1266
  var node = currentParent;
1142
1267
  var ret = [];
1268
+
1143
1269
  while (true) {
1144
1270
  if (node.tag === HostComponent || node.tag === HostText || node.tag === ClassComponent || node.tag === FunctionComponent) {
1145
1271
  var publicInst = node.stateNode;
1272
+
1146
1273
  if (test(publicInst)) {
1147
1274
  ret.push(publicInst);
1148
1275
  }
1149
1276
  }
1277
+
1150
1278
  if (node.child) {
1151
1279
  node.child.return = node;
1152
1280
  node = node.child;
1153
1281
  continue;
1154
1282
  }
1283
+
1155
1284
  if (node === currentParent) {
1156
1285
  return ret;
1157
1286
  }
1287
+
1158
1288
  while (!node.sibling) {
1159
1289
  if (!node.return || node.return === currentParent) {
1160
1290
  return ret;
1161
1291
  }
1292
+
1162
1293
  node = node.return;
1163
1294
  }
1295
+
1164
1296
  node.sibling.return = node.return;
1165
1297
  node = node.sibling;
1166
1298
  }
@@ -1171,12 +1303,15 @@ function validateClassInstance(inst, methodName) {
1171
1303
  // This is probably too relaxed but it's existing behavior.
1172
1304
  return;
1173
1305
  }
1306
+
1174
1307
  if (get(inst)) {
1175
1308
  // This is a public instance indeed.
1176
1309
  return;
1177
1310
  }
1178
- var received = void 0;
1311
+
1312
+ var received;
1179
1313
  var stringified = '' + inst;
1314
+
1180
1315
  if (Array.isArray(inst)) {
1181
1316
  received = 'an array';
1182
1317
  } else if (inst && inst.nodeType === ELEMENT_NODE && inst.tagName) {
@@ -1186,21 +1321,15 @@ function validateClassInstance(inst, methodName) {
1186
1321
  } else {
1187
1322
  received = stringified;
1188
1323
  }
1324
+
1189
1325
  (function () {
1190
1326
  {
1191
1327
  {
1192
- throw ReactError(Error(methodName + '(...): the first argument must be a React class instance. Instead received: ' + received + '.'));
1328
+ throw ReactError(Error(methodName + "(...): the first argument must be a React class instance. Instead received: " + received + "."));
1193
1329
  }
1194
1330
  }
1195
1331
  })();
1196
1332
  }
1197
-
1198
- // a plain dom element, lazily initialized, used by act() when flushing effects
1199
- var actContainerElement = null;
1200
-
1201
- // a warning for when you try to use TestUtils.act in a non-browser environment
1202
- var didWarnAboutActInNodejs = false;
1203
-
1204
1333
  /**
1205
1334
  * Utilities for making it easy to test React components.
1206
1335
  *
@@ -1210,56 +1339,55 @@ var didWarnAboutActInNodejs = false;
1210
1339
  * utilities will suffice for testing purposes.
1211
1340
  * @lends ReactTestUtils
1212
1341
  */
1342
+
1343
+
1213
1344
  var ReactTestUtils = {
1214
1345
  renderIntoDocument: function (element) {
1215
- var div = document.createElement('div');
1216
- // None of our tests actually require attaching the container to the
1346
+ var div = document.createElement('div'); // None of our tests actually require attaching the container to the
1217
1347
  // DOM, and doing so creates a mess that we rely on test isolation to
1218
1348
  // clean up, so we're going to stop honoring the name of this method
1219
1349
  // (and probably rename it eventually) if no problems arise.
1220
1350
  // document.documentElement.appendChild(div);
1351
+
1221
1352
  return ReactDOM.render(element, div);
1222
1353
  },
1223
-
1224
1354
  isElement: function (element) {
1225
1355
  return React.isValidElement(element);
1226
1356
  },
1227
-
1228
1357
  isElementOfType: function (inst, convenienceConstructor) {
1229
1358
  return React.isValidElement(inst) && inst.type === convenienceConstructor;
1230
1359
  },
1231
-
1232
1360
  isDOMComponent: function (inst) {
1233
1361
  return !!(inst && inst.nodeType === ELEMENT_NODE && inst.tagName);
1234
1362
  },
1235
-
1236
1363
  isDOMComponentElement: function (inst) {
1237
1364
  return !!(inst && React.isValidElement(inst) && !!inst.tagName);
1238
1365
  },
1239
-
1240
1366
  isCompositeComponent: function (inst) {
1241
1367
  if (ReactTestUtils.isDOMComponent(inst)) {
1242
1368
  // Accessing inst.setState warns; just return false as that'll be what
1243
1369
  // this returns when we have DOM nodes as refs directly
1244
1370
  return false;
1245
1371
  }
1372
+
1246
1373
  return inst != null && typeof inst.render === 'function' && typeof inst.setState === 'function';
1247
1374
  },
1248
-
1249
1375
  isCompositeComponentWithType: function (inst, type) {
1250
1376
  if (!ReactTestUtils.isCompositeComponent(inst)) {
1251
1377
  return false;
1252
1378
  }
1379
+
1253
1380
  var internalInstance = get(inst);
1254
1381
  var constructor = internalInstance.type;
1255
1382
  return constructor === type;
1256
1383
  },
1257
-
1258
1384
  findAllInRenderedTree: function (inst, test) {
1259
1385
  validateClassInstance(inst, 'findAllInRenderedTree');
1386
+
1260
1387
  if (!inst) {
1261
1388
  return [];
1262
1389
  }
1390
+
1263
1391
  var internalInstance = get(inst);
1264
1392
  return findAllInRenderedFiberTreeInternal(internalInstance, test);
1265
1393
  },
@@ -1274,26 +1402,31 @@ var ReactTestUtils = {
1274
1402
  return ReactTestUtils.findAllInRenderedTree(root, function (inst) {
1275
1403
  if (ReactTestUtils.isDOMComponent(inst)) {
1276
1404
  var className = inst.className;
1405
+
1277
1406
  if (typeof className !== 'string') {
1278
1407
  // SVG, probably.
1279
1408
  className = inst.getAttribute('class') || '';
1280
1409
  }
1410
+
1281
1411
  var classList = className.split(/\s+/);
1282
1412
 
1283
1413
  if (!Array.isArray(classNames)) {
1284
1414
  (function () {
1285
1415
  if (!(classNames !== undefined)) {
1286
1416
  {
1287
- throw ReactError(Error('TestUtils.scryRenderedDOMComponentsWithClass expects a className as a second argument.'));
1417
+ throw ReactError(Error("TestUtils.scryRenderedDOMComponentsWithClass expects a className as a second argument."));
1288
1418
  }
1289
1419
  }
1290
1420
  })();
1421
+
1291
1422
  classNames = classNames.split(/\s+/);
1292
1423
  }
1424
+
1293
1425
  return classNames.every(function (name) {
1294
1426
  return classList.indexOf(name) !== -1;
1295
1427
  });
1296
1428
  }
1429
+
1297
1430
  return false;
1298
1431
  });
1299
1432
  },
@@ -1307,9 +1440,11 @@ var ReactTestUtils = {
1307
1440
  findRenderedDOMComponentWithClass: function (root, className) {
1308
1441
  validateClassInstance(root, 'findRenderedDOMComponentWithClass');
1309
1442
  var all = ReactTestUtils.scryRenderedDOMComponentsWithClass(root, className);
1443
+
1310
1444
  if (all.length !== 1) {
1311
1445
  throw new Error('Did not find exactly one match (found: ' + all.length + ') ' + 'for class:' + className);
1312
1446
  }
1447
+
1313
1448
  return all[0];
1314
1449
  },
1315
1450
 
@@ -1334,9 +1469,11 @@ var ReactTestUtils = {
1334
1469
  findRenderedDOMComponentWithTag: function (root, tagName) {
1335
1470
  validateClassInstance(root, 'findRenderedDOMComponentWithTag');
1336
1471
  var all = ReactTestUtils.scryRenderedDOMComponentsWithTag(root, tagName);
1472
+
1337
1473
  if (all.length !== 1) {
1338
1474
  throw new Error('Did not find exactly one match (found: ' + all.length + ') ' + 'for tag:' + tagName);
1339
1475
  }
1476
+
1340
1477
  return all[0];
1341
1478
  },
1342
1479
 
@@ -1360,9 +1497,11 @@ var ReactTestUtils = {
1360
1497
  findRenderedComponentWithType: function (root, componentType) {
1361
1498
  validateClassInstance(root, 'findRenderedComponentWithType');
1362
1499
  var all = ReactTestUtils.scryRenderedComponentsWithType(root, componentType);
1500
+
1363
1501
  if (all.length !== 1) {
1364
1502
  throw new Error('Did not find exactly one match (found: ' + all.length + ') ' + 'for componentType:' + componentType);
1365
1503
  }
1504
+
1366
1505
  return all[0];
1367
1506
  },
1368
1507
 
@@ -1382,43 +1521,27 @@ var ReactTestUtils = {
1382
1521
  mockComponent: function (module, mockTagName) {
1383
1522
  if (!hasWarnedAboutDeprecatedMockComponent) {
1384
1523
  hasWarnedAboutDeprecatedMockComponent = true;
1385
- lowPriorityWarning$1(false, 'ReactTestUtils.mockComponent() is deprecated. ' + 'Use shallow rendering or jest.mock() instead.\n\n' + 'See https://fb.me/test-utils-mock-component for more information.');
1524
+ lowPriorityWarningWithoutStack$1(false, 'ReactTestUtils.mockComponent() is deprecated. ' + 'Use shallow rendering or jest.mock() instead.\n\n' + 'See https://fb.me/test-utils-mock-component for more information.');
1386
1525
  }
1387
1526
 
1388
1527
  mockTagName = mockTagName || module.mockTagName || 'div';
1389
-
1390
1528
  module.prototype.render.mockImplementation(function () {
1391
1529
  return React.createElement(mockTagName, null, this.props.children);
1392
1530
  });
1393
-
1394
1531
  return this;
1395
1532
  },
1396
-
1397
1533
  nativeTouchData: function (x, y) {
1398
1534
  return {
1399
- touches: [{ pageX: x, pageY: y }]
1535
+ touches: [{
1536
+ pageX: x,
1537
+ pageY: y
1538
+ }]
1400
1539
  };
1401
1540
  },
1402
-
1403
1541
  Simulate: null,
1404
1542
  SimulateNative: {},
1405
-
1406
- act: function (callback) {
1407
- if (actContainerElement === null) {
1408
- {
1409
- // warn if we're trying to use this in something like node (without jsdom)
1410
- if (didWarnAboutActInNodejs === false) {
1411
- didWarnAboutActInNodejs = true;
1412
- !(typeof document !== 'undefined' && document !== null) ? warningWithoutStack$1(false, 'It looks like you called ReactTestUtils.act(...) in a non-browser environment. ' + "If you're using TestRenderer for your tests, you should call " + 'ReactTestRenderer.act(...) instead of ReactTestUtils.act(...).') : void 0;
1413
- }
1414
- }
1415
- // now make the stub element
1416
- actContainerElement = document.createElement('div');
1417
- }
1418
- return act(callback);
1419
- }
1543
+ act: act
1420
1544
  };
1421
-
1422
1545
  /**
1423
1546
  * Exports:
1424
1547
  *
@@ -1427,37 +1550,37 @@ var ReactTestUtils = {
1427
1550
  * - `ReactTestUtils.Simulate.change(Element)`
1428
1551
  * - ... (All keys from event plugin `eventTypes` objects)
1429
1552
  */
1553
+
1430
1554
  function makeSimulator(eventType) {
1431
1555
  return function (domNode, eventData) {
1432
1556
  (function () {
1433
1557
  if (!!React.isValidElement(domNode)) {
1434
1558
  {
1435
- 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.'));
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."));
1436
1560
  }
1437
1561
  }
1438
1562
  })();
1563
+
1439
1564
  (function () {
1440
1565
  if (!!ReactTestUtils.isCompositeComponent(domNode)) {
1441
1566
  {
1442
- 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.'));
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."));
1443
1568
  }
1444
1569
  }
1445
1570
  })();
1446
1571
 
1447
1572
  var dispatchConfig = eventNameDispatchConfigs[eventType];
1448
-
1449
1573
  var fakeNativeEvent = new Event();
1450
1574
  fakeNativeEvent.target = domNode;
1451
- fakeNativeEvent.type = eventType.toLowerCase();
1452
-
1453
- // We don't use SyntheticEvent.getPooled in order to not have to worry about
1575
+ fakeNativeEvent.type = eventType.toLowerCase(); // We don't use SyntheticEvent.getPooled in order to not have to worry about
1454
1576
  // properly destroying any properties assigned from `eventData` upon release
1455
- var targetInst = getInstanceFromNode(domNode);
1456
- var event = new SyntheticEvent(dispatchConfig, targetInst, fakeNativeEvent, domNode);
1457
1577
 
1458
- // Since we aren't using pooling, always persist the event. This will make
1578
+ var targetInst = getInstanceFromNode(domNode);
1579
+ var event = new SyntheticEvent(dispatchConfig, targetInst, fakeNativeEvent, domNode); // Since we aren't using pooling, always persist the event. This will make
1459
1580
  // sure it's marked and won't warn when setting additional properties.
1581
+
1460
1582
  event.persist();
1583
+
1461
1584
  _assign(event, eventData);
1462
1585
 
1463
1586
  if (dispatchConfig.phasedRegistrationNames) {
@@ -1478,8 +1601,8 @@ function makeSimulator(eventType) {
1478
1601
 
1479
1602
  function buildSimulators() {
1480
1603
  ReactTestUtils.Simulate = {};
1604
+ var eventType;
1481
1605
 
1482
- var eventType = void 0;
1483
1606
  for (eventType in eventNameDispatchConfigs) {
1484
1607
  /**
1485
1608
  * @param {!Element|ReactDOMComponent} domComponentOrNode
@@ -1490,7 +1613,6 @@ function buildSimulators() {
1490
1613
  }
1491
1614
 
1492
1615
  buildSimulators();
1493
-
1494
1616
  /**
1495
1617
  * Exports:
1496
1618
  *
@@ -1510,7 +1632,9 @@ buildSimulators();
1510
1632
  function makeNativeSimulator(eventType, topLevelType) {
1511
1633
  return function (domComponentOrNode, nativeEventData) {
1512
1634
  var fakeNativeEvent = new Event(eventType);
1635
+
1513
1636
  _assign(fakeNativeEvent, nativeEventData);
1637
+
1514
1638
  if (ReactTestUtils.isDOMComponent(domComponentOrNode)) {
1515
1639
  simulateNativeEventOnDOMComponent(topLevelType, domComponentOrNode, fakeNativeEvent);
1516
1640
  } else if (domComponentOrNode.tagName) {
@@ -1532,7 +1656,6 @@ function makeNativeSimulator(eventType, topLevelType) {
1532
1656
  });
1533
1657
 
1534
1658
 
1535
-
1536
1659
  var ReactTestUtils$2 = Object.freeze({
1537
1660
  default: ReactTestUtils
1538
1661
  });
@@ -1541,6 +1664,8 @@ var ReactTestUtils$3 = ( ReactTestUtils$2 && ReactTestUtils ) || ReactTestUtils$
1541
1664
 
1542
1665
  // TODO: decide on the top-level export form.
1543
1666
  // This is hacky but makes it work with both Rollup and Jest.
1667
+
1668
+
1544
1669
  var testUtils = ReactTestUtils$3.default || ReactTestUtils$3;
1545
1670
 
1546
1671
  module.exports = testUtils;