UNPKG

67.9 kBJavaScriptView Raw
1/** @license React v17.0.2
2 * react-dom-test-utils.development.js
3 *
4 * Copyright (c) Facebook, Inc. and its affiliates.
5 *
6 * This source code is licensed under the MIT license found in the
7 * LICENSE file in the root directory of this source tree.
8 */
9
10'use strict';
11
12if (process.env.NODE_ENV !== "production") {
13 (function() {
14'use strict';
15
16var _assign = require('object-assign');
17var React = require('react');
18var ReactDOM = require('react-dom');
19var Scheduler = require('scheduler');
20
21var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
22
23// by calls to these methods by a Babel plugin.
24//
25// In PROD (or in packages without access to React internals),
26// they are left as they are instead.
27
28function warn(format) {
29 {
30 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
31 args[_key - 1] = arguments[_key];
32 }
33
34 printWarning('warn', format, args);
35 }
36}
37function error(format) {
38 {
39 for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
40 args[_key2 - 1] = arguments[_key2];
41 }
42
43 printWarning('error', format, args);
44 }
45}
46
47function printWarning(level, format, args) {
48 // When changing this logic, you might want to also
49 // update consoleWithStackDev.www.js as well.
50 {
51 var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
52 var stack = ReactDebugCurrentFrame.getStackAddendum();
53
54 if (stack !== '') {
55 format += '%s';
56 args = args.concat([stack]);
57 }
58
59 var argsWithFormat = args.map(function (item) {
60 return '' + item;
61 }); // Careful: RN currently depends on this prefix
62
63 argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
64 // breaks IE9: https://github.com/facebook/react/issues/13610
65 // eslint-disable-next-line react-internal/no-production-logging
66
67 Function.prototype.apply.call(console[level], console, argsWithFormat);
68 }
69}
70
71/**
72 * `ReactInstanceMap` maintains a mapping from a public facing stateful
73 * instance (key) and the internal representation (value). This allows public
74 * methods to accept the user facing instance as an argument and map them back
75 * to internal methods.
76 *
77 * Note that this module is currently shared and assumed to be stateless.
78 * If this becomes an actual Map, that will break.
79 */
80function get(key) {
81 return key._reactInternals;
82}
83
84// ATTENTION
85// When adding new symbols to this file,
86// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
87// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
88// nor polyfill, then a plain number is used for performance.
89var REACT_ELEMENT_TYPE = 0xeac7;
90var REACT_PORTAL_TYPE = 0xeaca;
91var REACT_FRAGMENT_TYPE = 0xeacb;
92var REACT_STRICT_MODE_TYPE = 0xeacc;
93var REACT_PROFILER_TYPE = 0xead2;
94var REACT_PROVIDER_TYPE = 0xeacd;
95var REACT_CONTEXT_TYPE = 0xeace;
96var REACT_FORWARD_REF_TYPE = 0xead0;
97var REACT_SUSPENSE_TYPE = 0xead1;
98var REACT_SUSPENSE_LIST_TYPE = 0xead8;
99var REACT_MEMO_TYPE = 0xead3;
100var REACT_LAZY_TYPE = 0xead4;
101var REACT_BLOCK_TYPE = 0xead9;
102var REACT_SERVER_BLOCK_TYPE = 0xeada;
103var REACT_FUNDAMENTAL_TYPE = 0xead5;
104var REACT_SCOPE_TYPE = 0xead7;
105var REACT_OPAQUE_ID_TYPE = 0xeae0;
106var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1;
107var REACT_OFFSCREEN_TYPE = 0xeae2;
108var REACT_LEGACY_HIDDEN_TYPE = 0xeae3;
109
110if (typeof Symbol === 'function' && Symbol.for) {
111 var symbolFor = Symbol.for;
112 REACT_ELEMENT_TYPE = symbolFor('react.element');
113 REACT_PORTAL_TYPE = symbolFor('react.portal');
114 REACT_FRAGMENT_TYPE = symbolFor('react.fragment');
115 REACT_STRICT_MODE_TYPE = symbolFor('react.strict_mode');
116 REACT_PROFILER_TYPE = symbolFor('react.profiler');
117 REACT_PROVIDER_TYPE = symbolFor('react.provider');
118 REACT_CONTEXT_TYPE = symbolFor('react.context');
119 REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref');
120 REACT_SUSPENSE_TYPE = symbolFor('react.suspense');
121 REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list');
122 REACT_MEMO_TYPE = symbolFor('react.memo');
123 REACT_LAZY_TYPE = symbolFor('react.lazy');
124 REACT_BLOCK_TYPE = symbolFor('react.block');
125 REACT_SERVER_BLOCK_TYPE = symbolFor('react.server.block');
126 REACT_FUNDAMENTAL_TYPE = symbolFor('react.fundamental');
127 REACT_SCOPE_TYPE = symbolFor('react.scope');
128 REACT_OPAQUE_ID_TYPE = symbolFor('react.opaque.id');
129 REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode');
130 REACT_OFFSCREEN_TYPE = symbolFor('react.offscreen');
131 REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden');
132}
133
134var FunctionComponent = 0;
135var ClassComponent = 1;
136
137var HostRoot = 3; // Root of a host tree. Could be nested inside another node.
138
139var HostComponent = 5;
140var HostText = 6;
141
142// Don't change these two values. They're used by React Dev Tools.
143var NoFlags =
144/* */
1450;
146
147var Placement =
148/* */
1492;
150var Hydrating =
151/* */
1521024;
153
154var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
155function getNearestMountedFiber(fiber) {
156 var node = fiber;
157 var nearestMounted = fiber;
158
159 if (!fiber.alternate) {
160 // If there is no alternate, this might be a new tree that isn't inserted
161 // yet. If it is, then it will have a pending insertion effect on it.
162 var nextNode = node;
163
164 do {
165 node = nextNode;
166
167 if ((node.flags & (Placement | Hydrating)) !== NoFlags) {
168 // This is an insertion or in-progress hydration. The nearest possible
169 // mounted fiber is the parent but we need to continue to figure out
170 // if that one is still mounted.
171 nearestMounted = node.return;
172 }
173
174 nextNode = node.return;
175 } while (nextNode);
176 } else {
177 while (node.return) {
178 node = node.return;
179 }
180 }
181
182 if (node.tag === HostRoot) {
183 // TODO: Check if this was a nested HostRoot when used with
184 // renderContainerIntoSubtree.
185 return nearestMounted;
186 } // If we didn't hit the root, that means that we're in an disconnected tree
187 // that has been unmounted.
188
189
190 return null;
191}
192
193function assertIsMounted(fiber) {
194 if (!(getNearestMountedFiber(fiber) === fiber)) {
195 {
196 throw Error( "Unable to find node on an unmounted component." );
197 }
198 }
199}
200
201function findCurrentFiberUsingSlowPath(fiber) {
202 var alternate = fiber.alternate;
203
204 if (!alternate) {
205 // If there is no alternate, then we only need to check if it is mounted.
206 var nearestMounted = getNearestMountedFiber(fiber);
207
208 if (!(nearestMounted !== null)) {
209 {
210 throw Error( "Unable to find node on an unmounted component." );
211 }
212 }
213
214 if (nearestMounted !== fiber) {
215 return null;
216 }
217
218 return fiber;
219 } // If we have two possible branches, we'll walk backwards up to the root
220 // to see what path the root points to. On the way we may hit one of the
221 // special cases and we'll deal with them.
222
223
224 var a = fiber;
225 var b = alternate;
226
227 while (true) {
228 var parentA = a.return;
229
230 if (parentA === null) {
231 // We're at the root.
232 break;
233 }
234
235 var parentB = parentA.alternate;
236
237 if (parentB === null) {
238 // There is no alternate. This is an unusual case. Currently, it only
239 // happens when a Suspense component is hidden. An extra fragment fiber
240 // is inserted in between the Suspense fiber and its children. Skip
241 // over this extra fragment fiber and proceed to the next parent.
242 var nextParent = parentA.return;
243
244 if (nextParent !== null) {
245 a = b = nextParent;
246 continue;
247 } // If there's no parent, we're at the root.
248
249
250 break;
251 } // If both copies of the parent fiber point to the same child, we can
252 // assume that the child is current. This happens when we bailout on low
253 // priority: the bailed out fiber's child reuses the current child.
254
255
256 if (parentA.child === parentB.child) {
257 var child = parentA.child;
258
259 while (child) {
260 if (child === a) {
261 // We've determined that A is the current branch.
262 assertIsMounted(parentA);
263 return fiber;
264 }
265
266 if (child === b) {
267 // We've determined that B is the current branch.
268 assertIsMounted(parentA);
269 return alternate;
270 }
271
272 child = child.sibling;
273 } // We should never have an alternate for any mounting node. So the only
274 // way this could possibly happen is if this was unmounted, if at all.
275
276
277 {
278 {
279 throw Error( "Unable to find node on an unmounted component." );
280 }
281 }
282 }
283
284 if (a.return !== b.return) {
285 // The return pointer of A and the return pointer of B point to different
286 // fibers. We assume that return pointers never criss-cross, so A must
287 // belong to the child set of A.return, and B must belong to the child
288 // set of B.return.
289 a = parentA;
290 b = parentB;
291 } else {
292 // The return pointers point to the same fiber. We'll have to use the
293 // default, slow path: scan the child sets of each parent alternate to see
294 // which child belongs to which set.
295 //
296 // Search parent A's child set
297 var didFindChild = false;
298 var _child = parentA.child;
299
300 while (_child) {
301 if (_child === a) {
302 didFindChild = true;
303 a = parentA;
304 b = parentB;
305 break;
306 }
307
308 if (_child === b) {
309 didFindChild = true;
310 b = parentA;
311 a = parentB;
312 break;
313 }
314
315 _child = _child.sibling;
316 }
317
318 if (!didFindChild) {
319 // Search parent B's child set
320 _child = parentB.child;
321
322 while (_child) {
323 if (_child === a) {
324 didFindChild = true;
325 a = parentB;
326 b = parentA;
327 break;
328 }
329
330 if (_child === b) {
331 didFindChild = true;
332 b = parentB;
333 a = parentA;
334 break;
335 }
336
337 _child = _child.sibling;
338 }
339
340 if (!didFindChild) {
341 {
342 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." );
343 }
344 }
345 }
346 }
347
348 if (!(a.alternate === b)) {
349 {
350 throw Error( "Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue." );
351 }
352 }
353 } // If the root is not a host container, we're in a disconnected tree. I.e.
354 // unmounted.
355
356
357 if (!(a.tag === HostRoot)) {
358 {
359 throw Error( "Unable to find node on an unmounted component." );
360 }
361 }
362
363 if (a.stateNode.current === a) {
364 // We've determined that A is the current branch.
365 return fiber;
366 } // Otherwise B has to be current branch.
367
368
369 return alternate;
370}
371
372/**
373 * `charCode` represents the actual "character code" and is safe to use with
374 * `String.fromCharCode`. As such, only keys that correspond to printable
375 * characters produce a valid `charCode`, the only exception to this is Enter.
376 * The Tab-key is considered non-printable and does not have a `charCode`,
377 * presumably because it does not produce a tab-character in browsers.
378 *
379 * @param {object} nativeEvent Native browser event.
380 * @return {number} Normalized `charCode` property.
381 */
382function getEventCharCode(nativeEvent) {
383 var charCode;
384 var keyCode = nativeEvent.keyCode;
385
386 if ('charCode' in nativeEvent) {
387 charCode = nativeEvent.charCode; // FF does not set `charCode` for the Enter-key, check against `keyCode`.
388
389 if (charCode === 0 && keyCode === 13) {
390 charCode = 13;
391 }
392 } else {
393 // IE8 does not implement `charCode`, but `keyCode` has the correct value.
394 charCode = keyCode;
395 } // IE and Edge (on Windows) and Chrome / Safari (on Windows and Linux)
396 // report Enter as charCode 10 when ctrl is pressed.
397
398
399 if (charCode === 10) {
400 charCode = 13;
401 } // Some non-printable keys are reported in `charCode`/`keyCode`, discard them.
402 // Must not discard the (non-)printable Enter-key.
403
404
405 if (charCode >= 32 || charCode === 13) {
406 return charCode;
407 }
408
409 return 0;
410}
411
412function functionThatReturnsTrue() {
413 return true;
414}
415
416function functionThatReturnsFalse() {
417 return false;
418} // This is intentionally a factory so that we have different returned constructors.
419// If we had a single constructor, it would be megamorphic and engines would deopt.
420
421
422function createSyntheticEvent(Interface) {
423 /**
424 * Synthetic events are dispatched by event plugins, typically in response to a
425 * top-level event delegation handler.
426 *
427 * These systems should generally use pooling to reduce the frequency of garbage
428 * collection. The system should check `isPersistent` to determine whether the
429 * event should be released into the pool after being dispatched. Users that
430 * need a persisted event should invoke `persist`.
431 *
432 * Synthetic events (and subclasses) implement the DOM Level 3 Events API by
433 * normalizing browser quirks. Subclasses do not necessarily have to implement a
434 * DOM interface; custom application-specific events can also subclass this.
435 */
436 function SyntheticBaseEvent(reactName, reactEventType, targetInst, nativeEvent, nativeEventTarget) {
437 this._reactName = reactName;
438 this._targetInst = targetInst;
439 this.type = reactEventType;
440 this.nativeEvent = nativeEvent;
441 this.target = nativeEventTarget;
442 this.currentTarget = null;
443
444 for (var _propName in Interface) {
445 if (!Interface.hasOwnProperty(_propName)) {
446 continue;
447 }
448
449 var normalize = Interface[_propName];
450
451 if (normalize) {
452 this[_propName] = normalize(nativeEvent);
453 } else {
454 this[_propName] = nativeEvent[_propName];
455 }
456 }
457
458 var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false;
459
460 if (defaultPrevented) {
461 this.isDefaultPrevented = functionThatReturnsTrue;
462 } else {
463 this.isDefaultPrevented = functionThatReturnsFalse;
464 }
465
466 this.isPropagationStopped = functionThatReturnsFalse;
467 return this;
468 }
469
470 _assign(SyntheticBaseEvent.prototype, {
471 preventDefault: function () {
472 this.defaultPrevented = true;
473 var event = this.nativeEvent;
474
475 if (!event) {
476 return;
477 }
478
479 if (event.preventDefault) {
480 event.preventDefault(); // $FlowFixMe - flow is not aware of `unknown` in IE
481 } else if (typeof event.returnValue !== 'unknown') {
482 event.returnValue = false;
483 }
484
485 this.isDefaultPrevented = functionThatReturnsTrue;
486 },
487 stopPropagation: function () {
488 var event = this.nativeEvent;
489
490 if (!event) {
491 return;
492 }
493
494 if (event.stopPropagation) {
495 event.stopPropagation(); // $FlowFixMe - flow is not aware of `unknown` in IE
496 } else if (typeof event.cancelBubble !== 'unknown') {
497 // The ChangeEventPlugin registers a "propertychange" event for
498 // IE. This event does not support bubbling or cancelling, and
499 // any references to cancelBubble throw "Member not found". A
500 // typeof check of "unknown" circumvents this issue (and is also
501 // IE specific).
502 event.cancelBubble = true;
503 }
504
505 this.isPropagationStopped = functionThatReturnsTrue;
506 },
507
508 /**
509 * We release all dispatched `SyntheticEvent`s after each event loop, adding
510 * them back into the pool. This allows a way to hold onto a reference that
511 * won't be added back into the pool.
512 */
513 persist: function () {// Modern event system doesn't use pooling.
514 },
515
516 /**
517 * Checks if this event should be released back into the pool.
518 *
519 * @return {boolean} True if this should not be released, false otherwise.
520 */
521 isPersistent: functionThatReturnsTrue
522 });
523
524 return SyntheticBaseEvent;
525}
526/**
527 * @interface Event
528 * @see http://www.w3.org/TR/DOM-Level-3-Events/
529 */
530
531
532var EventInterface = {
533 eventPhase: 0,
534 bubbles: 0,
535 cancelable: 0,
536 timeStamp: function (event) {
537 return event.timeStamp || Date.now();
538 },
539 defaultPrevented: 0,
540 isTrusted: 0
541};
542var SyntheticEvent = createSyntheticEvent(EventInterface);
543
544var UIEventInterface = _assign({}, EventInterface, {
545 view: 0,
546 detail: 0
547});
548
549var SyntheticUIEvent = createSyntheticEvent(UIEventInterface);
550var lastMovementX;
551var lastMovementY;
552var lastMouseEvent;
553
554function updateMouseMovementPolyfillState(event) {
555 if (event !== lastMouseEvent) {
556 if (lastMouseEvent && event.type === 'mousemove') {
557 lastMovementX = event.screenX - lastMouseEvent.screenX;
558 lastMovementY = event.screenY - lastMouseEvent.screenY;
559 } else {
560 lastMovementX = 0;
561 lastMovementY = 0;
562 }
563
564 lastMouseEvent = event;
565 }
566}
567/**
568 * @interface MouseEvent
569 * @see http://www.w3.org/TR/DOM-Level-3-Events/
570 */
571
572
573var MouseEventInterface = _assign({}, UIEventInterface, {
574 screenX: 0,
575 screenY: 0,
576 clientX: 0,
577 clientY: 0,
578 pageX: 0,
579 pageY: 0,
580 ctrlKey: 0,
581 shiftKey: 0,
582 altKey: 0,
583 metaKey: 0,
584 getModifierState: getEventModifierState,
585 button: 0,
586 buttons: 0,
587 relatedTarget: function (event) {
588 if (event.relatedTarget === undefined) return event.fromElement === event.srcElement ? event.toElement : event.fromElement;
589 return event.relatedTarget;
590 },
591 movementX: function (event) {
592 if ('movementX' in event) {
593 return event.movementX;
594 }
595
596 updateMouseMovementPolyfillState(event);
597 return lastMovementX;
598 },
599 movementY: function (event) {
600 if ('movementY' in event) {
601 return event.movementY;
602 } // Don't need to call updateMouseMovementPolyfillState() here
603 // because it's guaranteed to have already run when movementX
604 // was copied.
605
606
607 return lastMovementY;
608 }
609});
610
611var SyntheticMouseEvent = createSyntheticEvent(MouseEventInterface);
612/**
613 * @interface DragEvent
614 * @see http://www.w3.org/TR/DOM-Level-3-Events/
615 */
616
617var DragEventInterface = _assign({}, MouseEventInterface, {
618 dataTransfer: 0
619});
620
621var SyntheticDragEvent = createSyntheticEvent(DragEventInterface);
622/**
623 * @interface FocusEvent
624 * @see http://www.w3.org/TR/DOM-Level-3-Events/
625 */
626
627var FocusEventInterface = _assign({}, UIEventInterface, {
628 relatedTarget: 0
629});
630
631var SyntheticFocusEvent = createSyntheticEvent(FocusEventInterface);
632/**
633 * @interface Event
634 * @see http://www.w3.org/TR/css3-animations/#AnimationEvent-interface
635 * @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationEvent
636 */
637
638var AnimationEventInterface = _assign({}, EventInterface, {
639 animationName: 0,
640 elapsedTime: 0,
641 pseudoElement: 0
642});
643
644var SyntheticAnimationEvent = createSyntheticEvent(AnimationEventInterface);
645/**
646 * @interface Event
647 * @see http://www.w3.org/TR/clipboard-apis/
648 */
649
650var ClipboardEventInterface = _assign({}, EventInterface, {
651 clipboardData: function (event) {
652 return 'clipboardData' in event ? event.clipboardData : window.clipboardData;
653 }
654});
655
656var SyntheticClipboardEvent = createSyntheticEvent(ClipboardEventInterface);
657/**
658 * @interface Event
659 * @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents
660 */
661
662var CompositionEventInterface = _assign({}, EventInterface, {
663 data: 0
664});
665
666var SyntheticCompositionEvent = createSyntheticEvent(CompositionEventInterface);
667/**
668 * Normalization of deprecated HTML5 `key` values
669 * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
670 */
671
672var normalizeKey = {
673 Esc: 'Escape',
674 Spacebar: ' ',
675 Left: 'ArrowLeft',
676 Up: 'ArrowUp',
677 Right: 'ArrowRight',
678 Down: 'ArrowDown',
679 Del: 'Delete',
680 Win: 'OS',
681 Menu: 'ContextMenu',
682 Apps: 'ContextMenu',
683 Scroll: 'ScrollLock',
684 MozPrintableKey: 'Unidentified'
685};
686/**
687 * Translation from legacy `keyCode` to HTML5 `key`
688 * Only special keys supported, all others depend on keyboard layout or browser
689 * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
690 */
691
692var translateToKey = {
693 '8': 'Backspace',
694 '9': 'Tab',
695 '12': 'Clear',
696 '13': 'Enter',
697 '16': 'Shift',
698 '17': 'Control',
699 '18': 'Alt',
700 '19': 'Pause',
701 '20': 'CapsLock',
702 '27': 'Escape',
703 '32': ' ',
704 '33': 'PageUp',
705 '34': 'PageDown',
706 '35': 'End',
707 '36': 'Home',
708 '37': 'ArrowLeft',
709 '38': 'ArrowUp',
710 '39': 'ArrowRight',
711 '40': 'ArrowDown',
712 '45': 'Insert',
713 '46': 'Delete',
714 '112': 'F1',
715 '113': 'F2',
716 '114': 'F3',
717 '115': 'F4',
718 '116': 'F5',
719 '117': 'F6',
720 '118': 'F7',
721 '119': 'F8',
722 '120': 'F9',
723 '121': 'F10',
724 '122': 'F11',
725 '123': 'F12',
726 '144': 'NumLock',
727 '145': 'ScrollLock',
728 '224': 'Meta'
729};
730/**
731 * @param {object} nativeEvent Native browser event.
732 * @return {string} Normalized `key` property.
733 */
734
735function getEventKey(nativeEvent) {
736 if (nativeEvent.key) {
737 // Normalize inconsistent values reported by browsers due to
738 // implementations of a working draft specification.
739 // FireFox implements `key` but returns `MozPrintableKey` for all
740 // printable characters (normalized to `Unidentified`), ignore it.
741 var key = normalizeKey[nativeEvent.key] || nativeEvent.key;
742
743 if (key !== 'Unidentified') {
744 return key;
745 }
746 } // Browser does not implement `key`, polyfill as much of it as we can.
747
748
749 if (nativeEvent.type === 'keypress') {
750 var charCode = getEventCharCode(nativeEvent); // The enter-key is technically both printable and non-printable and can
751 // thus be captured by `keypress`, no other non-printable key should.
752
753 return charCode === 13 ? 'Enter' : String.fromCharCode(charCode);
754 }
755
756 if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') {
757 // While user keyboard layout determines the actual meaning of each
758 // `keyCode` value, almost all function keys have a universal value.
759 return translateToKey[nativeEvent.keyCode] || 'Unidentified';
760 }
761
762 return '';
763}
764/**
765 * Translation from modifier key to the associated property in the event.
766 * @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers
767 */
768
769
770var modifierKeyToProp = {
771 Alt: 'altKey',
772 Control: 'ctrlKey',
773 Meta: 'metaKey',
774 Shift: 'shiftKey'
775}; // Older browsers (Safari <= 10, iOS Safari <= 10.2) do not support
776// getModifierState. If getModifierState is not supported, we map it to a set of
777// modifier keys exposed by the event. In this case, Lock-keys are not supported.
778
779function modifierStateGetter(keyArg) {
780 var syntheticEvent = this;
781 var nativeEvent = syntheticEvent.nativeEvent;
782
783 if (nativeEvent.getModifierState) {
784 return nativeEvent.getModifierState(keyArg);
785 }
786
787 var keyProp = modifierKeyToProp[keyArg];
788 return keyProp ? !!nativeEvent[keyProp] : false;
789}
790
791function getEventModifierState(nativeEvent) {
792 return modifierStateGetter;
793}
794/**
795 * @interface KeyboardEvent
796 * @see http://www.w3.org/TR/DOM-Level-3-Events/
797 */
798
799
800var KeyboardEventInterface = _assign({}, UIEventInterface, {
801 key: getEventKey,
802 code: 0,
803 location: 0,
804 ctrlKey: 0,
805 shiftKey: 0,
806 altKey: 0,
807 metaKey: 0,
808 repeat: 0,
809 locale: 0,
810 getModifierState: getEventModifierState,
811 // Legacy Interface
812 charCode: function (event) {
813 // `charCode` is the result of a KeyPress event and represents the value of
814 // the actual printable character.
815 // KeyPress is deprecated, but its replacement is not yet final and not
816 // implemented in any major browser. Only KeyPress has charCode.
817 if (event.type === 'keypress') {
818 return getEventCharCode(event);
819 }
820
821 return 0;
822 },
823 keyCode: function (event) {
824 // `keyCode` is the result of a KeyDown/Up event and represents the value of
825 // physical keyboard key.
826 // The actual meaning of the value depends on the users' keyboard layout
827 // which cannot be detected. Assuming that it is a US keyboard layout
828 // provides a surprisingly accurate mapping for US and European users.
829 // Due to this, it is left to the user to implement at this time.
830 if (event.type === 'keydown' || event.type === 'keyup') {
831 return event.keyCode;
832 }
833
834 return 0;
835 },
836 which: function (event) {
837 // `which` is an alias for either `keyCode` or `charCode` depending on the
838 // type of the event.
839 if (event.type === 'keypress') {
840 return getEventCharCode(event);
841 }
842
843 if (event.type === 'keydown' || event.type === 'keyup') {
844 return event.keyCode;
845 }
846
847 return 0;
848 }
849});
850
851var SyntheticKeyboardEvent = createSyntheticEvent(KeyboardEventInterface);
852/**
853 * @interface PointerEvent
854 * @see http://www.w3.org/TR/pointerevents/
855 */
856
857var PointerEventInterface = _assign({}, MouseEventInterface, {
858 pointerId: 0,
859 width: 0,
860 height: 0,
861 pressure: 0,
862 tangentialPressure: 0,
863 tiltX: 0,
864 tiltY: 0,
865 twist: 0,
866 pointerType: 0,
867 isPrimary: 0
868});
869
870var SyntheticPointerEvent = createSyntheticEvent(PointerEventInterface);
871/**
872 * @interface TouchEvent
873 * @see http://www.w3.org/TR/touch-events/
874 */
875
876var TouchEventInterface = _assign({}, UIEventInterface, {
877 touches: 0,
878 targetTouches: 0,
879 changedTouches: 0,
880 altKey: 0,
881 metaKey: 0,
882 ctrlKey: 0,
883 shiftKey: 0,
884 getModifierState: getEventModifierState
885});
886
887var SyntheticTouchEvent = createSyntheticEvent(TouchEventInterface);
888/**
889 * @interface Event
890 * @see http://www.w3.org/TR/2009/WD-css3-transitions-20090320/#transition-events-
891 * @see https://developer.mozilla.org/en-US/docs/Web/API/TransitionEvent
892 */
893
894var TransitionEventInterface = _assign({}, EventInterface, {
895 propertyName: 0,
896 elapsedTime: 0,
897 pseudoElement: 0
898});
899
900var SyntheticTransitionEvent = createSyntheticEvent(TransitionEventInterface);
901/**
902 * @interface WheelEvent
903 * @see http://www.w3.org/TR/DOM-Level-3-Events/
904 */
905
906var WheelEventInterface = _assign({}, MouseEventInterface, {
907 deltaX: function (event) {
908 return 'deltaX' in event ? event.deltaX : // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).
909 'wheelDeltaX' in event ? -event.wheelDeltaX : 0;
910 },
911 deltaY: function (event) {
912 return 'deltaY' in event ? event.deltaY : // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive).
913 'wheelDeltaY' in event ? -event.wheelDeltaY : // Fallback to `wheelDelta` for IE<9 and normalize (down is positive).
914 'wheelDelta' in event ? -event.wheelDelta : 0;
915 },
916 deltaZ: 0,
917 // Browsers without "deltaMode" is reporting in raw wheel delta where one
918 // notch on the scroll is always +/- 120, roughly equivalent to pixels.
919 // A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or
920 // ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size.
921 deltaMode: 0
922});
923
924var SyntheticWheelEvent = createSyntheticEvent(WheelEventInterface);
925
926/**
927 * HTML nodeType values that represent the type of the node
928 */
929var ELEMENT_NODE = 1;
930
931var didWarnAboutMessageChannel = false;
932var enqueueTaskImpl = null;
933function enqueueTask(task) {
934 if (enqueueTaskImpl === null) {
935 try {
936 // read require off the module object to get around the bundlers.
937 // we don't want them to detect a require and bundle a Node polyfill.
938 var requireString = ('require' + Math.random()).slice(0, 7);
939 var nodeRequire = module && module[requireString]; // assuming we're in node, let's try to get node's
940 // version of setImmediate, bypassing fake timers if any.
941
942 enqueueTaskImpl = nodeRequire.call(module, 'timers').setImmediate;
943 } catch (_err) {
944 // we're in a browser
945 // we can't use regular timers because they may still be faked
946 // so we try MessageChannel+postMessage instead
947 enqueueTaskImpl = function (callback) {
948 {
949 if (didWarnAboutMessageChannel === false) {
950 didWarnAboutMessageChannel = true;
951
952 if (typeof MessageChannel === 'undefined') {
953 error('This browser does not have a MessageChannel implementation, ' + 'so enqueuing tasks via await act(async () => ...) will fail. ' + 'Please file an issue at https://github.com/facebook/react/issues ' + 'if you encounter this warning.');
954 }
955 }
956 }
957
958 var channel = new MessageChannel();
959 channel.port1.onmessage = callback;
960 channel.port2.postMessage(undefined);
961 };
962 }
963 }
964
965 return enqueueTaskImpl(task);
966}
967
968var EventInternals = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Events; // const getInstanceFromNode = EventInternals[0];
969// const getNodeFromInstance = EventInternals[1];
970// const getFiberCurrentPropsFromNode = EventInternals[2];
971// const enqueueStateRestore = EventInternals[3];
972// const restoreStateIfNeeded = EventInternals[4];
973
974var flushPassiveEffects = EventInternals[5];
975var IsThisRendererActing = EventInternals[6];
976var batchedUpdates = ReactDOM.unstable_batchedUpdates;
977var IsSomeRendererActing = ReactSharedInternals.IsSomeRendererActing; // This is the public version of `ReactTestUtils.act`. It is implemented in
978// "userspace" (i.e. not the reconciler), so that it doesn't add to the
979// production bundle size.
980// TODO: Remove this implementation of `act` in favor of the one exported by
981// the reconciler. To do this, we must first drop support for `act` in
982// production mode.
983// TODO: Remove support for the mock scheduler build, which was only added for
984// the purposes of internal testing. Internal tests should use
985// `unstable_concurrentAct` instead.
986
987var isSchedulerMocked = typeof Scheduler.unstable_flushAllWithoutAsserting === 'function';
988
989var flushWork = Scheduler.unstable_flushAllWithoutAsserting || function () {
990 var didFlushWork = false;
991
992 while (flushPassiveEffects()) {
993 didFlushWork = true;
994 }
995
996 return didFlushWork;
997};
998
999function flushWorkAndMicroTasks(onDone) {
1000 try {
1001 flushWork();
1002 enqueueTask(function () {
1003 if (flushWork()) {
1004 flushWorkAndMicroTasks(onDone);
1005 } else {
1006 onDone();
1007 }
1008 });
1009 } catch (err) {
1010 onDone(err);
1011 }
1012} // we track the 'depth' of the act() calls with this counter,
1013// so we can tell if any async act() calls try to run in parallel.
1014
1015
1016var actingUpdatesScopeDepth = 0;
1017function act(callback) {
1018
1019 var previousActingUpdatesScopeDepth = actingUpdatesScopeDepth;
1020 actingUpdatesScopeDepth++;
1021 var previousIsSomeRendererActing = IsSomeRendererActing.current;
1022 var previousIsThisRendererActing = IsThisRendererActing.current;
1023 IsSomeRendererActing.current = true;
1024 IsThisRendererActing.current = true;
1025
1026 function onDone() {
1027 actingUpdatesScopeDepth--;
1028 IsSomeRendererActing.current = previousIsSomeRendererActing;
1029 IsThisRendererActing.current = previousIsThisRendererActing;
1030
1031 {
1032 if (actingUpdatesScopeDepth > previousActingUpdatesScopeDepth) {
1033 // if it's _less than_ previousActingUpdatesScopeDepth, then we can assume the 'other' one has warned
1034 error('You seem to have overlapping act() calls, this is not supported. ' + 'Be sure to await previous act() calls before making a new one. ');
1035 }
1036 }
1037 }
1038
1039 var result;
1040
1041 try {
1042 result = batchedUpdates(callback);
1043 } catch (error) {
1044 // on sync errors, we still want to 'cleanup' and decrement actingUpdatesScopeDepth
1045 onDone();
1046 throw error;
1047 }
1048
1049 if (result !== null && typeof result === 'object' && typeof result.then === 'function') {
1050 // setup a boolean that gets set to true only
1051 // once this act() call is await-ed
1052 var called = false;
1053
1054 {
1055 if (typeof Promise !== 'undefined') {
1056 //eslint-disable-next-line no-undef
1057 Promise.resolve().then(function () {}).then(function () {
1058 if (called === false) {
1059 error('You called act(async () => ...) without await. ' + 'This could lead to unexpected testing behaviour, interleaving multiple act ' + 'calls and mixing their scopes. You should - await act(async () => ...);');
1060 }
1061 });
1062 }
1063 } // in the async case, the returned thenable runs the callback, flushes
1064 // effects and microtasks in a loop until flushPassiveEffects() === false,
1065 // and cleans up
1066
1067
1068 return {
1069 then: function (resolve, reject) {
1070 called = true;
1071 result.then(function () {
1072 if (actingUpdatesScopeDepth > 1 || isSchedulerMocked === true && previousIsSomeRendererActing === true) {
1073 onDone();
1074 resolve();
1075 return;
1076 } // we're about to exit the act() scope,
1077 // now's the time to flush tasks/effects
1078
1079
1080 flushWorkAndMicroTasks(function (err) {
1081 onDone();
1082
1083 if (err) {
1084 reject(err);
1085 } else {
1086 resolve();
1087 }
1088 });
1089 }, function (err) {
1090 onDone();
1091 reject(err);
1092 });
1093 }
1094 };
1095 } else {
1096 {
1097 if (result !== undefined) {
1098 error('The callback passed to act(...) function ' + 'must return undefined, or a Promise. You returned %s', result);
1099 }
1100 } // flush effects until none remain, and cleanup
1101
1102
1103 try {
1104 if (actingUpdatesScopeDepth === 1 && (isSchedulerMocked === false || previousIsSomeRendererActing === false)) {
1105 // we're about to exit the act() scope,
1106 // now's the time to flush effects
1107 flushWork();
1108 }
1109
1110 onDone();
1111 } catch (err) {
1112 onDone();
1113 throw err;
1114 } // in the sync case, the returned thenable only warns *if* await-ed
1115
1116
1117 return {
1118 then: function (resolve) {
1119 {
1120 error('Do not await the result of calling act(...) with sync logic, it is not a Promise.');
1121 }
1122
1123 resolve();
1124 }
1125 };
1126 }
1127}
1128
1129var EventInternals$1 = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Events; // const getInstanceFromNode = EventInternals[0];
1130// const getNodeFromInstance = EventInternals[1];
1131// const getFiberCurrentPropsFromNode = EventInternals[2];
1132// const enqueueStateRestore = EventInternals[3];
1133// const restoreStateIfNeeded = EventInternals[4];
1134// const flushPassiveEffects = EventInternals[5];
1135
1136var IsThisRendererActing$1 = EventInternals$1[6];
1137var batchedUpdates$1 = ReactDOM.unstable_batchedUpdates;
1138var IsSomeRendererActing$1 = ReactSharedInternals.IsSomeRendererActing; // This version of `act` is only used by our tests. Unlike the public version
1139// of `act`, it's designed to work identically in both production and
1140// development. It may have slightly different behavior from the public
1141// version, too, since our constraints in our test suite are not the same as
1142// those of developers using React — we're testing React itself, as opposed to
1143// building an app with React.
1144
1145var actingUpdatesScopeDepth$1 = 0;
1146function unstable_concurrentAct(scope) {
1147 if (Scheduler.unstable_flushAllWithoutAsserting === undefined) {
1148 throw Error('This version of `act` requires a special mock build of Scheduler.');
1149 }
1150
1151 if (setTimeout._isMockFunction !== true) {
1152 throw Error("This version of `act` requires Jest's timer mocks " + '(i.e. jest.useFakeTimers).');
1153 }
1154
1155 var previousActingUpdatesScopeDepth = actingUpdatesScopeDepth$1;
1156 var previousIsSomeRendererActing = IsSomeRendererActing$1.current;
1157 var previousIsThisRendererActing = IsThisRendererActing$1.current;
1158 IsSomeRendererActing$1.current = true;
1159 IsThisRendererActing$1.current = true;
1160 actingUpdatesScopeDepth$1++;
1161
1162 var unwind = function () {
1163 actingUpdatesScopeDepth$1--;
1164 IsSomeRendererActing$1.current = previousIsSomeRendererActing;
1165 IsThisRendererActing$1.current = previousIsThisRendererActing;
1166
1167 {
1168 if (actingUpdatesScopeDepth$1 > previousActingUpdatesScopeDepth) {
1169 // if it's _less than_ previousActingUpdatesScopeDepth, then we can
1170 // assume the 'other' one has warned
1171 error('You seem to have overlapping act() calls, this is not supported. ' + 'Be sure to await previous act() calls before making a new one. ');
1172 }
1173 }
1174 }; // TODO: This would be way simpler if 1) we required a promise to be
1175 // returned and 2) we could use async/await. Since it's only our used in
1176 // our test suite, we should be able to.
1177
1178
1179 try {
1180 var thenable = batchedUpdates$1(scope);
1181
1182 if (typeof thenable === 'object' && thenable !== null && typeof thenable.then === 'function') {
1183 return {
1184 then: function (resolve, reject) {
1185 thenable.then(function () {
1186 flushActWork(function () {
1187 unwind();
1188 resolve();
1189 }, function (error) {
1190 unwind();
1191 reject(error);
1192 });
1193 }, function (error) {
1194 unwind();
1195 reject(error);
1196 });
1197 }
1198 };
1199 } else {
1200 try {
1201 // TODO: Let's not support non-async scopes at all in our tests. Need to
1202 // migrate existing tests.
1203 var didFlushWork;
1204
1205 do {
1206 didFlushWork = Scheduler.unstable_flushAllWithoutAsserting();
1207 } while (didFlushWork);
1208 } finally {
1209 unwind();
1210 }
1211 }
1212 } catch (error) {
1213 unwind();
1214 throw error;
1215 }
1216}
1217
1218function flushActWork(resolve, reject) {
1219 // Flush suspended fallbacks
1220 // $FlowFixMe: Flow doesn't know about global Jest object
1221 jest.runOnlyPendingTimers();
1222 enqueueTask(function () {
1223 try {
1224 var didFlushWork = Scheduler.unstable_flushAllWithoutAsserting();
1225
1226 if (didFlushWork) {
1227 flushActWork(resolve, reject);
1228 } else {
1229 resolve();
1230 }
1231 } catch (error) {
1232 reject(error);
1233 }
1234 });
1235}
1236
1237function invokeGuardedCallbackProd(name, func, context, a, b, c, d, e, f) {
1238 var funcArgs = Array.prototype.slice.call(arguments, 3);
1239
1240 try {
1241 func.apply(context, funcArgs);
1242 } catch (error) {
1243 this.onError(error);
1244 }
1245}
1246
1247var invokeGuardedCallbackImpl = invokeGuardedCallbackProd;
1248
1249{
1250 // In DEV mode, we swap out invokeGuardedCallback for a special version
1251 // that plays more nicely with the browser's DevTools. The idea is to preserve
1252 // "Pause on exceptions" behavior. Because React wraps all user-provided
1253 // functions in invokeGuardedCallback, and the production version of
1254 // invokeGuardedCallback uses a try-catch, all user exceptions are treated
1255 // like caught exceptions, and the DevTools won't pause unless the developer
1256 // takes the extra step of enabling pause on caught exceptions. This is
1257 // unintuitive, though, because even though React has caught the error, from
1258 // the developer's perspective, the error is uncaught.
1259 //
1260 // To preserve the expected "Pause on exceptions" behavior, we don't use a
1261 // try-catch in DEV. Instead, we synchronously dispatch a fake event to a fake
1262 // DOM node, and call the user-provided callback from inside an event handler
1263 // for that fake event. If the callback throws, the error is "captured" using
1264 // a global event handler. But because the error happens in a different
1265 // event loop context, it does not interrupt the normal program flow.
1266 // Effectively, this gives us try-catch behavior without actually using
1267 // try-catch. Neat!
1268 // Check that the browser supports the APIs we need to implement our special
1269 // DEV version of invokeGuardedCallback
1270 if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') {
1271 var fakeNode = document.createElement('react');
1272
1273 invokeGuardedCallbackImpl = function invokeGuardedCallbackDev(name, func, context, a, b, c, d, e, f) {
1274 // If document doesn't exist we know for sure we will crash in this method
1275 // when we call document.createEvent(). However this can cause confusing
1276 // errors: https://github.com/facebookincubator/create-react-app/issues/3482
1277 // So we preemptively throw with a better message instead.
1278 if (!(typeof document !== 'undefined')) {
1279 {
1280 throw Error( "The `document` global was defined when React was initialized, but is not defined anymore. This can happen in a test environment if a component schedules an update from an asynchronous callback, but the test has already finished running. To solve this, you can either unmount the component at the end of your test (and ensure that any asynchronous operations get canceled in `componentWillUnmount`), or you can change the test itself to be asynchronous." );
1281 }
1282 }
1283
1284 var evt = document.createEvent('Event');
1285 var didCall = false; // Keeps track of whether the user-provided callback threw an error. We
1286 // set this to true at the beginning, then set it to false right after
1287 // calling the function. If the function errors, `didError` will never be
1288 // set to false. This strategy works even if the browser is flaky and
1289 // fails to call our global error handler, because it doesn't rely on
1290 // the error event at all.
1291
1292 var didError = true; // Keeps track of the value of window.event so that we can reset it
1293 // during the callback to let user code access window.event in the
1294 // browsers that support it.
1295
1296 var windowEvent = window.event; // Keeps track of the descriptor of window.event to restore it after event
1297 // dispatching: https://github.com/facebook/react/issues/13688
1298
1299 var windowEventDescriptor = Object.getOwnPropertyDescriptor(window, 'event');
1300
1301 function restoreAfterDispatch() {
1302 // We immediately remove the callback from event listeners so that
1303 // nested `invokeGuardedCallback` calls do not clash. Otherwise, a
1304 // nested call would trigger the fake event handlers of any call higher
1305 // in the stack.
1306 fakeNode.removeEventListener(evtType, callCallback, false); // We check for window.hasOwnProperty('event') to prevent the
1307 // window.event assignment in both IE <= 10 as they throw an error
1308 // "Member not found" in strict mode, and in Firefox which does not
1309 // support window.event.
1310
1311 if (typeof window.event !== 'undefined' && window.hasOwnProperty('event')) {
1312 window.event = windowEvent;
1313 }
1314 } // Create an event handler for our fake event. We will synchronously
1315 // dispatch our fake event using `dispatchEvent`. Inside the handler, we
1316 // call the user-provided callback.
1317
1318
1319 var funcArgs = Array.prototype.slice.call(arguments, 3);
1320
1321 function callCallback() {
1322 didCall = true;
1323 restoreAfterDispatch();
1324 func.apply(context, funcArgs);
1325 didError = false;
1326 } // Create a global error event handler. We use this to capture the value
1327 // that was thrown. It's possible that this error handler will fire more
1328 // than once; for example, if non-React code also calls `dispatchEvent`
1329 // and a handler for that event throws. We should be resilient to most of
1330 // those cases. Even if our error event handler fires more than once, the
1331 // last error event is always used. If the callback actually does error,
1332 // we know that the last error event is the correct one, because it's not
1333 // possible for anything else to have happened in between our callback
1334 // erroring and the code that follows the `dispatchEvent` call below. If
1335 // the callback doesn't error, but the error event was fired, we know to
1336 // ignore it because `didError` will be false, as described above.
1337
1338
1339 var error; // Use this to track whether the error event is ever called.
1340
1341 var didSetError = false;
1342 var isCrossOriginError = false;
1343
1344 function handleWindowError(event) {
1345 error = event.error;
1346 didSetError = true;
1347
1348 if (error === null && event.colno === 0 && event.lineno === 0) {
1349 isCrossOriginError = true;
1350 }
1351
1352 if (event.defaultPrevented) {
1353 // Some other error handler has prevented default.
1354 // Browsers silence the error report if this happens.
1355 // We'll remember this to later decide whether to log it or not.
1356 if (error != null && typeof error === 'object') {
1357 try {
1358 error._suppressLogging = true;
1359 } catch (inner) {// Ignore.
1360 }
1361 }
1362 }
1363 } // Create a fake event type.
1364
1365
1366 var evtType = "react-" + (name ? name : 'invokeguardedcallback'); // Attach our event handlers
1367
1368 window.addEventListener('error', handleWindowError);
1369 fakeNode.addEventListener(evtType, callCallback, false); // Synchronously dispatch our fake event. If the user-provided function
1370 // errors, it will trigger our global error handler.
1371
1372 evt.initEvent(evtType, false, false);
1373 fakeNode.dispatchEvent(evt);
1374
1375 if (windowEventDescriptor) {
1376 Object.defineProperty(window, 'event', windowEventDescriptor);
1377 }
1378
1379 if (didCall && didError) {
1380 if (!didSetError) {
1381 // The callback errored, but the error event never fired.
1382 error = new Error('An error was thrown inside one of your components, but React ' + "doesn't know what it was. This is likely due to browser " + 'flakiness. React does its best to preserve the "Pause on ' + 'exceptions" behavior of the DevTools, which requires some ' + "DEV-mode only tricks. It's possible that these don't work in " + 'your browser. Try triggering the error in production mode, ' + 'or switching to a modern browser. If you suspect that this is ' + 'actually an issue with React, please file an issue.');
1383 } else if (isCrossOriginError) {
1384 error = new Error("A cross-origin error was thrown. React doesn't have access to " + 'the actual error object in development. ' + 'See https://reactjs.org/link/crossorigin-error for more information.');
1385 }
1386
1387 this.onError(error);
1388 } // Remove our event listeners
1389
1390
1391 window.removeEventListener('error', handleWindowError);
1392
1393 if (!didCall) {
1394 // Something went really wrong, and our event was not dispatched.
1395 // https://github.com/facebook/react/issues/16734
1396 // https://github.com/facebook/react/issues/16585
1397 // Fall back to the production implementation.
1398 restoreAfterDispatch();
1399 return invokeGuardedCallbackProd.apply(this, arguments);
1400 }
1401 };
1402 }
1403}
1404
1405var invokeGuardedCallbackImpl$1 = invokeGuardedCallbackImpl;
1406
1407var hasError = false;
1408var caughtError = null; // Used by event system to capture/rethrow the first error.
1409
1410var hasRethrowError = false;
1411var rethrowError = null;
1412var reporter = {
1413 onError: function (error) {
1414 hasError = true;
1415 caughtError = error;
1416 }
1417};
1418/**
1419 * Call a function while guarding against errors that happens within it.
1420 * Returns an error if it throws, otherwise null.
1421 *
1422 * In production, this is implemented using a try-catch. The reason we don't
1423 * use a try-catch directly is so that we can swap out a different
1424 * implementation in DEV mode.
1425 *
1426 * @param {String} name of the guard to use for logging or debugging
1427 * @param {Function} func The function to invoke
1428 * @param {*} context The context to use when calling the function
1429 * @param {...*} args Arguments for function
1430 */
1431
1432function invokeGuardedCallback(name, func, context, a, b, c, d, e, f) {
1433 hasError = false;
1434 caughtError = null;
1435 invokeGuardedCallbackImpl$1.apply(reporter, arguments);
1436}
1437/**
1438 * Same as invokeGuardedCallback, but instead of returning an error, it stores
1439 * it in a global so it can be rethrown by `rethrowCaughtError` later.
1440 * TODO: See if caughtError and rethrowError can be unified.
1441 *
1442 * @param {String} name of the guard to use for logging or debugging
1443 * @param {Function} func The function to invoke
1444 * @param {*} context The context to use when calling the function
1445 * @param {...*} args Arguments for function
1446 */
1447
1448function invokeGuardedCallbackAndCatchFirstError(name, func, context, a, b, c, d, e, f) {
1449 invokeGuardedCallback.apply(this, arguments);
1450
1451 if (hasError) {
1452 var error = clearCaughtError();
1453
1454 if (!hasRethrowError) {
1455 hasRethrowError = true;
1456 rethrowError = error;
1457 }
1458 }
1459}
1460/**
1461 * During execution of guarded functions we will capture the first error which
1462 * we will rethrow to be handled by the top level error handler.
1463 */
1464
1465function rethrowCaughtError() {
1466 if (hasRethrowError) {
1467 var error = rethrowError;
1468 hasRethrowError = false;
1469 rethrowError = null;
1470 throw error;
1471 }
1472}
1473function clearCaughtError() {
1474 if (hasError) {
1475 var error = caughtError;
1476 hasError = false;
1477 caughtError = null;
1478 return error;
1479 } else {
1480 {
1481 {
1482 throw Error( "clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue." );
1483 }
1484 }
1485 }
1486}
1487
1488var EventInternals$2 = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Events;
1489var getInstanceFromNode = EventInternals$2[0];
1490var getNodeFromInstance = EventInternals$2[1];
1491var getFiberCurrentPropsFromNode = EventInternals$2[2];
1492var enqueueStateRestore = EventInternals$2[3];
1493var restoreStateIfNeeded = EventInternals$2[4]; // const flushPassiveEffects = EventInternals[5];
1494// TODO: This is related to `act`, not events. Move to separate key?
1495// const IsThisRendererActing = EventInternals[6];
1496
1497function Event(suffix) {}
1498
1499var hasWarnedAboutDeprecatedMockComponent = false;
1500/**
1501 * @class ReactTestUtils
1502 */
1503
1504function findAllInRenderedFiberTreeInternal(fiber, test) {
1505 if (!fiber) {
1506 return [];
1507 }
1508
1509 var currentParent = findCurrentFiberUsingSlowPath(fiber);
1510
1511 if (!currentParent) {
1512 return [];
1513 }
1514
1515 var node = currentParent;
1516 var ret = [];
1517
1518 while (true) {
1519 if (node.tag === HostComponent || node.tag === HostText || node.tag === ClassComponent || node.tag === FunctionComponent) {
1520 var publicInst = node.stateNode;
1521
1522 if (test(publicInst)) {
1523 ret.push(publicInst);
1524 }
1525 }
1526
1527 if (node.child) {
1528 node.child.return = node;
1529 node = node.child;
1530 continue;
1531 }
1532
1533 if (node === currentParent) {
1534 return ret;
1535 }
1536
1537 while (!node.sibling) {
1538 if (!node.return || node.return === currentParent) {
1539 return ret;
1540 }
1541
1542 node = node.return;
1543 }
1544
1545 node.sibling.return = node.return;
1546 node = node.sibling;
1547 }
1548}
1549
1550function validateClassInstance(inst, methodName) {
1551 if (!inst) {
1552 // This is probably too relaxed but it's existing behavior.
1553 return;
1554 }
1555
1556 if (get(inst)) {
1557 // This is a public instance indeed.
1558 return;
1559 }
1560
1561 var received;
1562 var stringified = '' + inst;
1563
1564 if (Array.isArray(inst)) {
1565 received = 'an array';
1566 } else if (inst && inst.nodeType === ELEMENT_NODE && inst.tagName) {
1567 received = 'a DOM node';
1568 } else if (stringified === '[object Object]') {
1569 received = 'object with keys {' + Object.keys(inst).join(', ') + '}';
1570 } else {
1571 received = stringified;
1572 }
1573
1574 {
1575 {
1576 throw Error( methodName + "(...): the first argument must be a React class instance. Instead received: " + received + "." );
1577 }
1578 }
1579}
1580/**
1581 * Utilities for making it easy to test React components.
1582 *
1583 * See https://reactjs.org/docs/test-utils.html
1584 *
1585 * Todo: Support the entire DOM.scry query syntax. For now, these simple
1586 * utilities will suffice for testing purposes.
1587 * @lends ReactTestUtils
1588 */
1589
1590
1591function renderIntoDocument(element) {
1592 var div = document.createElement('div'); // None of our tests actually require attaching the container to the
1593 // DOM, and doing so creates a mess that we rely on test isolation to
1594 // clean up, so we're going to stop honoring the name of this method
1595 // (and probably rename it eventually) if no problems arise.
1596 // document.documentElement.appendChild(div);
1597
1598 return ReactDOM.render(element, div);
1599}
1600
1601function isElement(element) {
1602 return React.isValidElement(element);
1603}
1604
1605function isElementOfType(inst, convenienceConstructor) {
1606 return React.isValidElement(inst) && inst.type === convenienceConstructor;
1607}
1608
1609function isDOMComponent(inst) {
1610 return !!(inst && inst.nodeType === ELEMENT_NODE && inst.tagName);
1611}
1612
1613function isDOMComponentElement(inst) {
1614 return !!(inst && React.isValidElement(inst) && !!inst.tagName);
1615}
1616
1617function isCompositeComponent(inst) {
1618 if (isDOMComponent(inst)) {
1619 // Accessing inst.setState warns; just return false as that'll be what
1620 // this returns when we have DOM nodes as refs directly
1621 return false;
1622 }
1623
1624 return inst != null && typeof inst.render === 'function' && typeof inst.setState === 'function';
1625}
1626
1627function isCompositeComponentWithType(inst, type) {
1628 if (!isCompositeComponent(inst)) {
1629 return false;
1630 }
1631
1632 var internalInstance = get(inst);
1633 var constructor = internalInstance.type;
1634 return constructor === type;
1635}
1636
1637function findAllInRenderedTree(inst, test) {
1638 validateClassInstance(inst, 'findAllInRenderedTree');
1639
1640 if (!inst) {
1641 return [];
1642 }
1643
1644 var internalInstance = get(inst);
1645 return findAllInRenderedFiberTreeInternal(internalInstance, test);
1646}
1647/**
1648 * Finds all instance of components in the rendered tree that are DOM
1649 * components with the class name matching `className`.
1650 * @return {array} an array of all the matches.
1651 */
1652
1653
1654function scryRenderedDOMComponentsWithClass(root, classNames) {
1655 validateClassInstance(root, 'scryRenderedDOMComponentsWithClass');
1656 return findAllInRenderedTree(root, function (inst) {
1657 if (isDOMComponent(inst)) {
1658 var className = inst.className;
1659
1660 if (typeof className !== 'string') {
1661 // SVG, probably.
1662 className = inst.getAttribute('class') || '';
1663 }
1664
1665 var classList = className.split(/\s+/);
1666
1667 if (!Array.isArray(classNames)) {
1668 if (!(classNames !== undefined)) {
1669 {
1670 throw Error( "TestUtils.scryRenderedDOMComponentsWithClass expects a className as a second argument." );
1671 }
1672 }
1673
1674 classNames = classNames.split(/\s+/);
1675 }
1676
1677 return classNames.every(function (name) {
1678 return classList.indexOf(name) !== -1;
1679 });
1680 }
1681
1682 return false;
1683 });
1684}
1685/**
1686 * Like scryRenderedDOMComponentsWithClass but expects there to be one result,
1687 * and returns that one result, or throws exception if there is any other
1688 * number of matches besides one.
1689 * @return {!ReactDOMComponent} The one match.
1690 */
1691
1692
1693function findRenderedDOMComponentWithClass(root, className) {
1694 validateClassInstance(root, 'findRenderedDOMComponentWithClass');
1695 var all = scryRenderedDOMComponentsWithClass(root, className);
1696
1697 if (all.length !== 1) {
1698 throw new Error('Did not find exactly one match (found: ' + all.length + ') ' + 'for class:' + className);
1699 }
1700
1701 return all[0];
1702}
1703/**
1704 * Finds all instance of components in the rendered tree that are DOM
1705 * components with the tag name matching `tagName`.
1706 * @return {array} an array of all the matches.
1707 */
1708
1709
1710function scryRenderedDOMComponentsWithTag(root, tagName) {
1711 validateClassInstance(root, 'scryRenderedDOMComponentsWithTag');
1712 return findAllInRenderedTree(root, function (inst) {
1713 return isDOMComponent(inst) && inst.tagName.toUpperCase() === tagName.toUpperCase();
1714 });
1715}
1716/**
1717 * Like scryRenderedDOMComponentsWithTag but expects there to be one result,
1718 * and returns that one result, or throws exception if there is any other
1719 * number of matches besides one.
1720 * @return {!ReactDOMComponent} The one match.
1721 */
1722
1723
1724function findRenderedDOMComponentWithTag(root, tagName) {
1725 validateClassInstance(root, 'findRenderedDOMComponentWithTag');
1726 var all = scryRenderedDOMComponentsWithTag(root, tagName);
1727
1728 if (all.length !== 1) {
1729 throw new Error('Did not find exactly one match (found: ' + all.length + ') ' + 'for tag:' + tagName);
1730 }
1731
1732 return all[0];
1733}
1734/**
1735 * Finds all instances of components with type equal to `componentType`.
1736 * @return {array} an array of all the matches.
1737 */
1738
1739
1740function scryRenderedComponentsWithType(root, componentType) {
1741 validateClassInstance(root, 'scryRenderedComponentsWithType');
1742 return findAllInRenderedTree(root, function (inst) {
1743 return isCompositeComponentWithType(inst, componentType);
1744 });
1745}
1746/**
1747 * Same as `scryRenderedComponentsWithType` but expects there to be one result
1748 * and returns that one result, or throws exception if there is any other
1749 * number of matches besides one.
1750 * @return {!ReactComponent} The one match.
1751 */
1752
1753
1754function findRenderedComponentWithType(root, componentType) {
1755 validateClassInstance(root, 'findRenderedComponentWithType');
1756 var all = scryRenderedComponentsWithType(root, componentType);
1757
1758 if (all.length !== 1) {
1759 throw new Error('Did not find exactly one match (found: ' + all.length + ') ' + 'for componentType:' + componentType);
1760 }
1761
1762 return all[0];
1763}
1764/**
1765 * Pass a mocked component module to this method to augment it with
1766 * useful methods that allow it to be used as a dummy React component.
1767 * Instead of rendering as usual, the component will become a simple
1768 * <div> containing any provided children.
1769 *
1770 * @param {object} module the mock function object exported from a
1771 * module that defines the component to be mocked
1772 * @param {?string} mockTagName optional dummy root tag name to return
1773 * from render method (overrides
1774 * module.mockTagName if provided)
1775 * @return {object} the ReactTestUtils object (for chaining)
1776 */
1777
1778
1779function mockComponent(module, mockTagName) {
1780 {
1781 if (!hasWarnedAboutDeprecatedMockComponent) {
1782 hasWarnedAboutDeprecatedMockComponent = true;
1783
1784 warn('ReactTestUtils.mockComponent() is deprecated. ' + 'Use shallow rendering or jest.mock() instead.\n\n' + 'See https://reactjs.org/link/test-utils-mock-component for more information.');
1785 }
1786 }
1787
1788 mockTagName = mockTagName || module.mockTagName || 'div';
1789 module.prototype.render.mockImplementation(function () {
1790 return React.createElement(mockTagName, null, this.props.children);
1791 });
1792 return this;
1793}
1794
1795function nativeTouchData(x, y) {
1796 return {
1797 touches: [{
1798 pageX: x,
1799 pageY: y
1800 }]
1801 };
1802} // Start of inline: the below functions were inlined from
1803// EventPropagator.js, as they deviated from ReactDOM's newer
1804// implementations.
1805
1806/**
1807 * Dispatch the event to the listener.
1808 * @param {SyntheticEvent} event SyntheticEvent to handle
1809 * @param {function} listener Application-level callback
1810 * @param {*} inst Internal component instance
1811 */
1812
1813
1814function executeDispatch(event, listener, inst) {
1815 var type = event.type || 'unknown-event';
1816 event.currentTarget = getNodeFromInstance(inst);
1817 invokeGuardedCallbackAndCatchFirstError(type, listener, undefined, event);
1818 event.currentTarget = null;
1819}
1820/**
1821 * Standard/simple iteration through an event's collected dispatches.
1822 */
1823
1824
1825function executeDispatchesInOrder(event) {
1826 var dispatchListeners = event._dispatchListeners;
1827 var dispatchInstances = event._dispatchInstances;
1828
1829 if (Array.isArray(dispatchListeners)) {
1830 for (var i = 0; i < dispatchListeners.length; i++) {
1831 if (event.isPropagationStopped()) {
1832 break;
1833 } // Listeners and Instances are two parallel arrays that are always in sync.
1834
1835
1836 executeDispatch(event, dispatchListeners[i], dispatchInstances[i]);
1837 }
1838 } else if (dispatchListeners) {
1839 executeDispatch(event, dispatchListeners, dispatchInstances);
1840 }
1841
1842 event._dispatchListeners = null;
1843 event._dispatchInstances = null;
1844}
1845/**
1846 * Dispatches an event and releases it back into the pool, unless persistent.
1847 *
1848 * @param {?object} event Synthetic event to be dispatched.
1849 * @private
1850 */
1851
1852
1853var executeDispatchesAndRelease = function (event) {
1854 if (event) {
1855 executeDispatchesInOrder(event);
1856
1857 if (!event.isPersistent()) {
1858 event.constructor.release(event);
1859 }
1860 }
1861};
1862
1863function isInteractive(tag) {
1864 return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea';
1865}
1866
1867function getParent(inst) {
1868 do {
1869 inst = inst.return; // TODO: If this is a HostRoot we might want to bail out.
1870 // That is depending on if we want nested subtrees (layers) to bubble
1871 // events to their parent. We could also go through parentNode on the
1872 // host node but that wouldn't work for React Native and doesn't let us
1873 // do the portal feature.
1874 } while (inst && inst.tag !== HostComponent);
1875
1876 if (inst) {
1877 return inst;
1878 }
1879
1880 return null;
1881}
1882/**
1883 * Simulates the traversal of a two-phase, capture/bubble event dispatch.
1884 */
1885
1886
1887function traverseTwoPhase(inst, fn, arg) {
1888 var path = [];
1889
1890 while (inst) {
1891 path.push(inst);
1892 inst = getParent(inst);
1893 }
1894
1895 var i;
1896
1897 for (i = path.length; i-- > 0;) {
1898 fn(path[i], 'captured', arg);
1899 }
1900
1901 for (i = 0; i < path.length; i++) {
1902 fn(path[i], 'bubbled', arg);
1903 }
1904}
1905
1906function shouldPreventMouseEvent(name, type, props) {
1907 switch (name) {
1908 case 'onClick':
1909 case 'onClickCapture':
1910 case 'onDoubleClick':
1911 case 'onDoubleClickCapture':
1912 case 'onMouseDown':
1913 case 'onMouseDownCapture':
1914 case 'onMouseMove':
1915 case 'onMouseMoveCapture':
1916 case 'onMouseUp':
1917 case 'onMouseUpCapture':
1918 case 'onMouseEnter':
1919 return !!(props.disabled && isInteractive(type));
1920
1921 default:
1922 return false;
1923 }
1924}
1925/**
1926 * @param {object} inst The instance, which is the source of events.
1927 * @param {string} registrationName Name of listener (e.g. `onClick`).
1928 * @return {?function} The stored callback.
1929 */
1930
1931
1932function getListener(inst, registrationName) {
1933 // TODO: shouldPreventMouseEvent is DOM-specific and definitely should not
1934 // live here; needs to be moved to a better place soon
1935 var stateNode = inst.stateNode;
1936
1937 if (!stateNode) {
1938 // Work in progress (ex: onload events in incremental mode).
1939 return null;
1940 }
1941
1942 var props = getFiberCurrentPropsFromNode(stateNode);
1943
1944 if (!props) {
1945 // Work in progress.
1946 return null;
1947 }
1948
1949 var listener = props[registrationName];
1950
1951 if (shouldPreventMouseEvent(registrationName, inst.type, props)) {
1952 return null;
1953 }
1954
1955 if (!(!listener || typeof listener === 'function')) {
1956 {
1957 throw Error( "Expected `" + registrationName + "` listener to be a function, instead got a value of `" + typeof listener + "` type." );
1958 }
1959 }
1960
1961 return listener;
1962}
1963
1964function listenerAtPhase(inst, event, propagationPhase) {
1965 var registrationName = event._reactName;
1966
1967 if (propagationPhase === 'captured') {
1968 registrationName += 'Capture';
1969 }
1970
1971 return getListener(inst, registrationName);
1972}
1973
1974function accumulateDispatches(inst, ignoredDirection, event) {
1975 if (inst && event && event._reactName) {
1976 var registrationName = event._reactName;
1977 var listener = getListener(inst, registrationName);
1978
1979 if (listener) {
1980 if (event._dispatchListeners == null) {
1981 event._dispatchListeners = [];
1982 }
1983
1984 if (event._dispatchInstances == null) {
1985 event._dispatchInstances = [];
1986 }
1987
1988 event._dispatchListeners.push(listener);
1989
1990 event._dispatchInstances.push(inst);
1991 }
1992 }
1993}
1994
1995function accumulateDirectionalDispatches(inst, phase, event) {
1996 {
1997 if (!inst) {
1998 error('Dispatching inst must not be null');
1999 }
2000 }
2001
2002 var listener = listenerAtPhase(inst, event, phase);
2003
2004 if (listener) {
2005 if (event._dispatchListeners == null) {
2006 event._dispatchListeners = [];
2007 }
2008
2009 if (event._dispatchInstances == null) {
2010 event._dispatchInstances = [];
2011 }
2012
2013 event._dispatchListeners.push(listener);
2014
2015 event._dispatchInstances.push(inst);
2016 }
2017}
2018
2019function accumulateDirectDispatchesSingle(event) {
2020 if (event && event._reactName) {
2021 accumulateDispatches(event._targetInst, null, event);
2022 }
2023}
2024
2025function accumulateTwoPhaseDispatchesSingle(event) {
2026 if (event && event._reactName) {
2027 traverseTwoPhase(event._targetInst, accumulateDirectionalDispatches, event);
2028 }
2029} // End of inline
2030
2031
2032var Simulate = {};
2033var directDispatchEventTypes = new Set(['mouseEnter', 'mouseLeave', 'pointerEnter', 'pointerLeave']);
2034/**
2035 * Exports:
2036 *
2037 * - `Simulate.click(Element)`
2038 * - `Simulate.mouseMove(Element)`
2039 * - `Simulate.change(Element)`
2040 * - ... (All keys from event plugin `eventTypes` objects)
2041 */
2042
2043function makeSimulator(eventType) {
2044 return function (domNode, eventData) {
2045 if (!!React.isValidElement(domNode)) {
2046 {
2047 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." );
2048 }
2049 }
2050
2051 if (!!isCompositeComponent(domNode)) {
2052 {
2053 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." );
2054 }
2055 }
2056
2057 var reactName = 'on' + eventType[0].toUpperCase() + eventType.slice(1);
2058 var fakeNativeEvent = new Event();
2059 fakeNativeEvent.target = domNode;
2060 fakeNativeEvent.type = eventType.toLowerCase();
2061 var targetInst = getInstanceFromNode(domNode);
2062 var event = new SyntheticEvent(reactName, fakeNativeEvent.type, targetInst, fakeNativeEvent, domNode); // Since we aren't using pooling, always persist the event. This will make
2063 // sure it's marked and won't warn when setting additional properties.
2064
2065 event.persist();
2066
2067 _assign(event, eventData);
2068
2069 if (directDispatchEventTypes.has(eventType)) {
2070 accumulateDirectDispatchesSingle(event);
2071 } else {
2072 accumulateTwoPhaseDispatchesSingle(event);
2073 }
2074
2075 ReactDOM.unstable_batchedUpdates(function () {
2076 // Normally extractEvent enqueues a state restore, but we'll just always
2077 // do that since we're by-passing it here.
2078 enqueueStateRestore(domNode);
2079 executeDispatchesAndRelease(event);
2080 rethrowCaughtError();
2081 });
2082 restoreStateIfNeeded();
2083 };
2084} // A one-time snapshot with no plans to update. We'll probably want to deprecate Simulate API.
2085
2086
2087var simulatedEventTypes = ['blur', 'cancel', 'click', 'close', 'contextMenu', 'copy', 'cut', 'auxClick', 'doubleClick', 'dragEnd', 'dragStart', 'drop', 'focus', 'input', 'invalid', 'keyDown', 'keyPress', 'keyUp', 'mouseDown', 'mouseUp', 'paste', 'pause', 'play', 'pointerCancel', 'pointerDown', 'pointerUp', 'rateChange', 'reset', 'seeked', 'submit', 'touchCancel', 'touchEnd', 'touchStart', 'volumeChange', 'drag', 'dragEnter', 'dragExit', 'dragLeave', 'dragOver', 'mouseMove', 'mouseOut', 'mouseOver', 'pointerMove', 'pointerOut', 'pointerOver', 'scroll', 'toggle', 'touchMove', 'wheel', 'abort', 'animationEnd', 'animationIteration', 'animationStart', 'canPlay', 'canPlayThrough', 'durationChange', 'emptied', 'encrypted', 'ended', 'error', 'gotPointerCapture', 'load', 'loadedData', 'loadedMetadata', 'loadStart', 'lostPointerCapture', 'playing', 'progress', 'seeking', 'stalled', 'suspend', 'timeUpdate', 'transitionEnd', 'waiting', 'mouseEnter', 'mouseLeave', 'pointerEnter', 'pointerLeave', 'change', 'select', 'beforeInput', 'compositionEnd', 'compositionStart', 'compositionUpdate'];
2088
2089function buildSimulators() {
2090 simulatedEventTypes.forEach(function (eventType) {
2091 Simulate[eventType] = makeSimulator(eventType);
2092 });
2093}
2094
2095buildSimulators();
2096
2097exports.Simulate = Simulate;
2098exports.act = act;
2099exports.findAllInRenderedTree = findAllInRenderedTree;
2100exports.findRenderedComponentWithType = findRenderedComponentWithType;
2101exports.findRenderedDOMComponentWithClass = findRenderedDOMComponentWithClass;
2102exports.findRenderedDOMComponentWithTag = findRenderedDOMComponentWithTag;
2103exports.isCompositeComponent = isCompositeComponent;
2104exports.isCompositeComponentWithType = isCompositeComponentWithType;
2105exports.isDOMComponent = isDOMComponent;
2106exports.isDOMComponentElement = isDOMComponentElement;
2107exports.isElement = isElement;
2108exports.isElementOfType = isElementOfType;
2109exports.mockComponent = mockComponent;
2110exports.nativeTouchData = nativeTouchData;
2111exports.renderIntoDocument = renderIntoDocument;
2112exports.scryRenderedComponentsWithType = scryRenderedComponentsWithType;
2113exports.scryRenderedDOMComponentsWithClass = scryRenderedDOMComponentsWithClass;
2114exports.scryRenderedDOMComponentsWithTag = scryRenderedDOMComponentsWithTag;
2115exports.traverseTwoPhase = traverseTwoPhase;
2116exports.unstable_concurrentAct = unstable_concurrentAct;
2117 })();
2118}