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