react 0.13.3 → 0.14.0-beta1

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 (189) hide show
  1. package/README.md +5 -2
  2. package/addons.js +7 -0
  3. package/dist/JSXTransformer.js +4101 -2432
  4. package/dist/react-with-addons.js +4389 -6277
  5. package/dist/react-with-addons.min.js +6 -8
  6. package/dist/react.js +4028 -5697
  7. package/dist/react.min.js +5 -6
  8. package/lib/{AutoFocusMixin.js → AutoFocusUtils.js} +16 -5
  9. package/lib/BeforeInputEventPlugin.js +30 -118
  10. package/lib/CSSCore.js +12 -23
  11. package/lib/CSSProperty.js +4 -3
  12. package/lib/CSSPropertyOperations.js +14 -30
  13. package/lib/CallbackQueue.js +7 -10
  14. package/lib/ChangeEventPlugin.js +26 -88
  15. package/lib/ClientReactRootIndex.js +2 -2
  16. package/lib/DOMChildrenOperations.js +13 -33
  17. package/lib/DOMProperty.js +86 -147
  18. package/lib/DOMPropertyOperations.js +91 -67
  19. package/lib/Danger.js +19 -62
  20. package/lib/DefaultEventPluginOrder.js +2 -12
  21. package/lib/EnterLeaveEventPlugin.js +11 -33
  22. package/lib/EventConstants.js +2 -2
  23. package/lib/EventListener.js +11 -13
  24. package/lib/EventPluginHub.js +44 -47
  25. package/lib/EventPluginRegistry.js +18 -74
  26. package/lib/EventPluginUtils.js +33 -44
  27. package/lib/EventPropagators.js +23 -26
  28. package/lib/ExecutionEnvironment.js +4 -8
  29. package/lib/FallbackCompositionState.js +3 -3
  30. package/lib/HTMLDOMPropertyConfig.js +15 -20
  31. package/lib/LinkedStateMixin.js +3 -6
  32. package/lib/LinkedValueUtils.js +71 -89
  33. package/lib/Object.assign.js +1 -1
  34. package/lib/PooledClass.js +20 -11
  35. package/lib/React.js +9 -129
  36. package/lib/ReactBrowserComponentMixin.js +9 -2
  37. package/lib/ReactBrowserEventEmitter.js +26 -82
  38. package/lib/ReactCSSTransitionGroup.js +13 -24
  39. package/lib/ReactCSSTransitionGroupChild.js +26 -28
  40. package/lib/ReactChildReconciler.js +11 -19
  41. package/lib/ReactChildren.js +24 -31
  42. package/lib/ReactClass.js +96 -267
  43. package/lib/ReactComponent.js +28 -57
  44. package/lib/ReactComponentBrowserEnvironment.js +4 -8
  45. package/lib/ReactComponentEnvironment.js +6 -12
  46. package/lib/ReactComponentWithPureRenderMixin.js +6 -7
  47. package/lib/ReactCompositeComponent.js +115 -381
  48. package/lib/ReactCurrentOwner.js +1 -3
  49. package/lib/ReactDOM.js +4 -2
  50. package/lib/ReactDOMButton.js +16 -28
  51. package/lib/ReactDOMClient.js +90 -0
  52. package/lib/ReactDOMComponent.js +468 -156
  53. package/lib/ReactDOMIDOperations.js +25 -22
  54. package/lib/ReactDOMInput.js +79 -108
  55. package/lib/ReactDOMOption.js +58 -20
  56. package/lib/ReactDOMSelect.js +95 -83
  57. package/lib/ReactDOMSelection.js +5 -20
  58. package/lib/ReactDOMServer.js +24 -0
  59. package/lib/ReactDOMTextComponent.js +17 -18
  60. package/lib/ReactDOMTextarea.js +44 -69
  61. package/lib/ReactDefaultBatchingStrategy.js +9 -13
  62. package/lib/ReactDefaultInjection.js +20 -76
  63. package/lib/ReactDefaultPerf.js +36 -69
  64. package/lib/ReactDefaultPerfAnalysis.js +8 -14
  65. package/lib/ReactElement.js +26 -120
  66. package/lib/ReactElementValidator.js +56 -192
  67. package/lib/ReactEmptyComponent.js +7 -11
  68. package/lib/ReactErrorUtils.js +3 -3
  69. package/lib/ReactEventEmitterMixin.js +3 -13
  70. package/lib/ReactEventListener.js +58 -40
  71. package/lib/ReactFragment.js +33 -59
  72. package/lib/ReactInjection.js +1 -1
  73. package/lib/ReactInputSelection.js +14 -23
  74. package/lib/ReactInstanceHandles.js +29 -58
  75. package/lib/ReactInstanceMap.js +5 -5
  76. package/lib/ReactIsomorphic.js +70 -0
  77. package/lib/ReactLink.js +2 -4
  78. package/lib/ReactMarkupChecksum.js +5 -10
  79. package/lib/ReactMount.js +142 -285
  80. package/lib/ReactMultiChild.js +19 -45
  81. package/lib/ReactMultiChildUpdateTypes.js +1 -1
  82. package/lib/ReactNativeComponent.js +6 -15
  83. package/lib/ReactNoopUpdateQueue.js +118 -0
  84. package/lib/ReactOwner.js +7 -24
  85. package/lib/ReactPerf.js +8 -12
  86. package/lib/ReactPropTransferer.js +4 -4
  87. package/lib/ReactPropTypeLocationNames.js +2 -2
  88. package/lib/ReactPropTypeLocations.js +1 -1
  89. package/lib/ReactPropTypes.js +41 -61
  90. package/lib/ReactReconcileTransaction.js +11 -36
  91. package/lib/ReactReconciler.js +14 -26
  92. package/lib/ReactRef.js +5 -8
  93. package/lib/ReactRootIndex.js +2 -2
  94. package/lib/ReactServerBatchingStrategy.js +23 -0
  95. package/lib/ReactServerRendering.js +20 -15
  96. package/lib/ReactServerRenderingTransaction.js +9 -34
  97. package/lib/ReactStateSetters.js +6 -6
  98. package/lib/ReactTestUtils.js +137 -190
  99. package/lib/ReactTransitionChildMapping.js +5 -7
  100. package/lib/ReactTransitionEvents.js +5 -5
  101. package/lib/ReactTransitionGroup.js +30 -52
  102. package/lib/ReactUpdateQueue.js +69 -107
  103. package/lib/ReactUpdates.js +26 -81
  104. package/lib/ReactWithAddons.js +5 -6
  105. package/lib/SVGDOMPropertyConfig.js +39 -4
  106. package/lib/SelectEventPlugin.js +31 -33
  107. package/lib/ServerReactRootIndex.js +2 -2
  108. package/lib/SimpleEventPlugin.js +138 -130
  109. package/lib/SyntheticClipboardEvent.js +5 -9
  110. package/lib/SyntheticCompositionEvent.js +4 -10
  111. package/lib/SyntheticDragEvent.js +3 -3
  112. package/lib/SyntheticEvent.js +14 -15
  113. package/lib/SyntheticFocusEvent.js +3 -3
  114. package/lib/SyntheticInputEvent.js +4 -10
  115. package/lib/SyntheticKeyboardEvent.js +6 -6
  116. package/lib/SyntheticMouseEvent.js +10 -16
  117. package/lib/SyntheticTouchEvent.js +3 -3
  118. package/lib/SyntheticUIEvent.js +5 -5
  119. package/lib/SyntheticWheelEvent.js +13 -17
  120. package/lib/Transaction.js +22 -28
  121. package/lib/ViewportMetrics.js +2 -2
  122. package/lib/accumulateInto.js +2 -5
  123. package/lib/adler32.js +2 -4
  124. package/lib/camelize.js +4 -2
  125. package/lib/camelizeStyleName.js +2 -2
  126. package/lib/cloneWithProps.js +6 -12
  127. package/lib/containsNode.js +29 -16
  128. package/lib/createArrayFromMixed.js +17 -16
  129. package/lib/createNodesFromMarkup.js +6 -8
  130. package/lib/dangerousStyleValue.js +2 -3
  131. package/lib/deprecated.js +47 -0
  132. package/lib/emptyFunction.js +10 -4
  133. package/lib/emptyObject.js +1 -1
  134. package/lib/escapeTextContentForBrowser.js +1 -1
  135. package/lib/findDOMNode.js +7 -27
  136. package/lib/flattenChildren.js +4 -10
  137. package/lib/focusNode.js +2 -3
  138. package/lib/forEachAccumulated.js +3 -3
  139. package/lib/getActiveElement.js +4 -2
  140. package/lib/getEventCharCode.js +2 -2
  141. package/lib/getEventKey.js +1 -1
  142. package/lib/getEventModifierState.js +1 -2
  143. package/lib/getEventTarget.js +1 -1
  144. package/lib/getIteratorFn.js +2 -4
  145. package/lib/getMarkupWrap.js +18 -40
  146. package/lib/getNodeForCharacterOffset.js +1 -1
  147. package/lib/getTextContentAccessor.js +2 -4
  148. package/lib/getUnboundedScrollPosition.js +1 -1
  149. package/lib/hyphenate.js +3 -1
  150. package/lib/hyphenateStyleName.js +2 -2
  151. package/lib/instantiateReactComponent.js +23 -43
  152. package/lib/invariant.js +8 -12
  153. package/lib/isEventSupported.js +7 -10
  154. package/lib/isNode.js +4 -6
  155. package/lib/isTextInputElement.js +3 -4
  156. package/lib/isTextNode.js +3 -1
  157. package/lib/joinClasses.js +3 -3
  158. package/lib/keyMirror.js +3 -6
  159. package/lib/keyOf.js +4 -3
  160. package/lib/mapObject.js +1 -1
  161. package/lib/memoizeStringOnly.js +2 -2
  162. package/lib/onlyChild.js +2 -5
  163. package/lib/performance.js +2 -5
  164. package/lib/performanceNow.js +3 -1
  165. package/lib/quoteAttributeValueForBrowser.js +1 -1
  166. package/lib/renderSubtreeIntoContainer.js +16 -0
  167. package/lib/setInnerHTML.js +11 -8
  168. package/lib/setTextContent.js +3 -3
  169. package/lib/shallowCompare.js +24 -0
  170. package/lib/shallowEqual.js +17 -11
  171. package/lib/shouldUpdateReactComponent.js +3 -64
  172. package/lib/toArray.js +8 -19
  173. package/lib/traverseAllChildren.js +23 -90
  174. package/lib/update.js +25 -85
  175. package/lib/validateDOMNesting.js +363 -0
  176. package/lib/warning.js +15 -17
  177. package/package.json +3 -3
  178. package/react.js +53 -1
  179. package/lib/LocalEventTrapMixin.js +0 -53
  180. package/lib/MobileSafariClickEventPlugin.js +0 -56
  181. package/lib/ReactContext.js +0 -74
  182. package/lib/ReactDOMForm.js +0 -47
  183. package/lib/ReactDOMIframe.js +0 -43
  184. package/lib/ReactDOMImg.js +0 -44
  185. package/lib/ReactLifeCycle.js +0 -35
  186. package/lib/ReactPutListenerQueue.js +0 -54
  187. package/lib/createFullPageComponent.js +0 -58
  188. package/lib/cx.js +0 -52
  189. package/lib/getReactRootElementInContainer.js +0 -33
package/lib/ReactRef.js CHANGED
@@ -33,14 +33,14 @@ function detachRef(ref, component, owner) {
33
33
  }
34
34
  }
35
35
 
36
- ReactRef.attachRefs = function(instance, element) {
36
+ ReactRef.attachRefs = function (instance, element) {
37
37
  var ref = element.ref;
38
38
  if (ref != null) {
39
39
  attachRef(ref, instance, element._owner);
40
40
  }
41
41
  };
42
42
 
43
- ReactRef.shouldUpdateRefs = function(prevElement, nextElement) {
43
+ ReactRef.shouldUpdateRefs = function (prevElement, nextElement) {
44
44
  // If either the owner or a `ref` has changed, make sure the newest owner
45
45
  // has stored a reference to `this`, and the previous owner (if different)
46
46
  // has forgotten the reference to `this`. We use the element instead
@@ -53,17 +53,14 @@ ReactRef.shouldUpdateRefs = function(prevElement, nextElement) {
53
53
  // is made. It probably belongs where the key checking and
54
54
  // instantiateReactComponent is done.
55
55
 
56
- return (
57
- nextElement._owner !== prevElement._owner ||
58
- nextElement.ref !== prevElement.ref
59
- );
56
+ return nextElement._owner !== prevElement._owner || nextElement.ref !== prevElement.ref;
60
57
  };
61
58
 
62
- ReactRef.detachRefs = function(instance, element) {
59
+ ReactRef.detachRefs = function (instance, element) {
63
60
  var ref = element.ref;
64
61
  if (ref != null) {
65
62
  detachRef(ref, instance, element._owner);
66
63
  }
67
64
  };
68
65
 
69
- module.exports = ReactRef;
66
+ module.exports = ReactRef;
@@ -16,7 +16,7 @@ var ReactRootIndexInjection = {
16
16
  /**
17
17
  * @param {function} _createReactRootIndex
18
18
  */
19
- injectCreateReactRootIndex: function(_createReactRootIndex) {
19
+ injectCreateReactRootIndex: function (_createReactRootIndex) {
20
20
  ReactRootIndex.createReactRootIndex = _createReactRootIndex;
21
21
  }
22
22
  };
@@ -26,4 +26,4 @@ var ReactRootIndex = {
26
26
  injection: ReactRootIndexInjection
27
27
  };
28
28
 
29
- module.exports = ReactRootIndex;
29
+ module.exports = ReactRootIndex;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Copyright 2014-2015, Facebook, Inc.
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
8
+ *
9
+ * @providesModule ReactServerBatchingStrategy
10
+ * @typechecks
11
+ */
12
+
13
+ 'use strict';
14
+
15
+ var ReactServerBatchingStrategy = {
16
+ isBatchingUpdates: false,
17
+ batchedUpdates: function (callback) {}
18
+ };
19
+
20
+ module.exports = ReactServerBatchingStrategy;
21
+
22
+ // Don't do anything here. During the server rendering we don't want to
23
+ // schedule any updates. We will simply ignore them.
@@ -11,11 +11,13 @@
11
11
  */
12
12
  'use strict';
13
13
 
14
+ var ReactDefaultBatchingStrategy = require("./ReactDefaultBatchingStrategy");
14
15
  var ReactElement = require("./ReactElement");
15
16
  var ReactInstanceHandles = require("./ReactInstanceHandles");
16
17
  var ReactMarkupChecksum = require("./ReactMarkupChecksum");
17
- var ReactServerRenderingTransaction =
18
- require("./ReactServerRenderingTransaction");
18
+ var ReactServerBatchingStrategy = require("./ReactServerBatchingStrategy");
19
+ var ReactServerRenderingTransaction = require("./ReactServerRenderingTransaction");
20
+ var ReactUpdates = require("./ReactUpdates");
19
21
 
20
22
  var emptyObject = require("./emptyObject");
21
23
  var instantiateReactComponent = require("./instantiateReactComponent");
@@ -26,24 +28,25 @@ var invariant = require("./invariant");
26
28
  * @return {string} the HTML markup
27
29
  */
28
30
  function renderToString(element) {
29
- ("production" !== process.env.NODE_ENV ? invariant(
30
- ReactElement.isValidElement(element),
31
- 'renderToString(): You must pass a valid ReactElement.'
32
- ) : invariant(ReactElement.isValidElement(element)));
31
+ !ReactElement.isValidElement(element) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'renderToString(): You must pass a valid ReactElement.') : invariant(false) : undefined;
33
32
 
34
33
  var transaction;
35
34
  try {
35
+ ReactUpdates.injection.injectBatchingStrategy(ReactServerBatchingStrategy);
36
+
36
37
  var id = ReactInstanceHandles.createReactRootID();
37
38
  transaction = ReactServerRenderingTransaction.getPooled(false);
38
39
 
39
- return transaction.perform(function() {
40
+ return transaction.perform(function () {
40
41
  var componentInstance = instantiateReactComponent(element, null);
41
- var markup =
42
- componentInstance.mountComponent(id, transaction, emptyObject);
42
+ var markup = componentInstance.mountComponent(id, transaction, emptyObject);
43
43
  return ReactMarkupChecksum.addChecksumToMarkup(markup);
44
44
  }, null);
45
45
  } finally {
46
46
  ReactServerRenderingTransaction.release(transaction);
47
+ // Revert to the DOM batching strategy since these two renderers
48
+ // currently share these stateful modules.
49
+ ReactUpdates.injection.injectBatchingStrategy(ReactDefaultBatchingStrategy);
47
50
  }
48
51
  }
49
52
 
@@ -53,26 +56,28 @@ function renderToString(element) {
53
56
  * (for generating static pages)
54
57
  */
55
58
  function renderToStaticMarkup(element) {
56
- ("production" !== process.env.NODE_ENV ? invariant(
57
- ReactElement.isValidElement(element),
58
- 'renderToStaticMarkup(): You must pass a valid ReactElement.'
59
- ) : invariant(ReactElement.isValidElement(element)));
59
+ !ReactElement.isValidElement(element) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'renderToStaticMarkup(): You must pass a valid ReactElement.') : invariant(false) : undefined;
60
60
 
61
61
  var transaction;
62
62
  try {
63
+ ReactUpdates.injection.injectBatchingStrategy(ReactServerBatchingStrategy);
64
+
63
65
  var id = ReactInstanceHandles.createReactRootID();
64
66
  transaction = ReactServerRenderingTransaction.getPooled(true);
65
67
 
66
- return transaction.perform(function() {
68
+ return transaction.perform(function () {
67
69
  var componentInstance = instantiateReactComponent(element, null);
68
70
  return componentInstance.mountComponent(id, transaction, emptyObject);
69
71
  }, null);
70
72
  } finally {
71
73
  ReactServerRenderingTransaction.release(transaction);
74
+ // Revert to the DOM batching strategy since these two renderers
75
+ // currently share these stateful modules.
76
+ ReactUpdates.injection.injectBatchingStrategy(ReactDefaultBatchingStrategy);
72
77
  }
73
78
  }
74
79
 
75
80
  module.exports = {
76
81
  renderToString: renderToString,
77
82
  renderToStaticMarkup: renderToStaticMarkup
78
- };
83
+ };
@@ -14,7 +14,6 @@
14
14
 
15
15
  var PooledClass = require("./PooledClass");
16
16
  var CallbackQueue = require("./CallbackQueue");
17
- var ReactPutListenerQueue = require("./ReactPutListenerQueue");
18
17
  var Transaction = require("./Transaction");
19
18
 
20
19
  var assign = require("./Object.assign");
@@ -28,30 +27,19 @@ var ON_DOM_READY_QUEUEING = {
28
27
  /**
29
28
  * Initializes the internal `onDOMReady` queue.
30
29
  */
31
- initialize: function() {
30
+ initialize: function () {
32
31
  this.reactMountReady.reset();
33
32
  },
34
33
 
35
34
  close: emptyFunction
36
35
  };
37
36
 
38
- var PUT_LISTENER_QUEUEING = {
39
- initialize: function() {
40
- this.putListenerQueue.reset();
41
- },
42
-
43
- close: emptyFunction
44
- };
45
-
46
37
  /**
47
38
  * Executed within the scope of the `Transaction` instance. Consider these as
48
39
  * being member methods, but with an implied ordering while being isolated from
49
40
  * each other.
50
41
  */
51
- var TRANSACTION_WRAPPERS = [
52
- PUT_LISTENER_QUEUEING,
53
- ON_DOM_READY_QUEUEING
54
- ];
42
+ var TRANSACTION_WRAPPERS = [ON_DOM_READY_QUEUEING];
55
43
 
56
44
  /**
57
45
  * @class ReactServerRenderingTransaction
@@ -61,7 +49,6 @@ function ReactServerRenderingTransaction(renderToStaticMarkup) {
61
49
  this.reinitializeTransaction();
62
50
  this.renderToStaticMarkup = renderToStaticMarkup;
63
51
  this.reactMountReady = CallbackQueue.getPooled(null);
64
- this.putListenerQueue = ReactPutListenerQueue.getPooled();
65
52
  }
66
53
 
67
54
  var Mixin = {
@@ -69,43 +56,31 @@ var Mixin = {
69
56
  * @see Transaction
70
57
  * @abstract
71
58
  * @final
72
- * @return {array} Empty list of operation wrap proceedures.
59
+ * @return {array} Empty list of operation wrap procedures.
73
60
  */
74
- getTransactionWrappers: function() {
61
+ getTransactionWrappers: function () {
75
62
  return TRANSACTION_WRAPPERS;
76
63
  },
77
64
 
78
65
  /**
79
66
  * @return {object} The queue to collect `onDOMReady` callbacks with.
80
67
  */
81
- getReactMountReady: function() {
68
+ getReactMountReady: function () {
82
69
  return this.reactMountReady;
83
70
  },
84
71
 
85
- getPutListenerQueue: function() {
86
- return this.putListenerQueue;
87
- },
88
-
89
72
  /**
90
73
  * `PooledClass` looks for this, and will invoke this before allowing this
91
- * instance to be resused.
74
+ * instance to be reused.
92
75
  */
93
- destructor: function() {
76
+ destructor: function () {
94
77
  CallbackQueue.release(this.reactMountReady);
95
78
  this.reactMountReady = null;
96
-
97
- ReactPutListenerQueue.release(this.putListenerQueue);
98
- this.putListenerQueue = null;
99
79
  }
100
80
  };
101
81
 
102
-
103
- assign(
104
- ReactServerRenderingTransaction.prototype,
105
- Transaction.Mixin,
106
- Mixin
107
- );
82
+ assign(ReactServerRenderingTransaction.prototype, Transaction.Mixin, Mixin);
108
83
 
109
84
  PooledClass.addPoolingTo(ReactServerRenderingTransaction);
110
85
 
111
- module.exports = ReactServerRenderingTransaction;
86
+ module.exports = ReactServerRenderingTransaction;
@@ -22,8 +22,8 @@ var ReactStateSetters = {
22
22
  * @return {function} callback that when invoked uses funcReturningState to
23
23
  * determined the object literal to setState.
24
24
  */
25
- createStateSetter: function(component, funcReturningState) {
26
- return function(a, b, c, d, e, f) {
25
+ createStateSetter: function (component, funcReturningState) {
26
+ return function (a, b, c, d, e, f) {
27
27
  var partialState = funcReturningState.call(component, a, b, c, d, e, f);
28
28
  if (partialState) {
29
29
  component.setState(partialState);
@@ -42,7 +42,7 @@ var ReactStateSetters = {
42
42
  * @return {function} callback of 1 argument which calls setState() with
43
43
  * the provided keyName and callback argument.
44
44
  */
45
- createStateKeySetter: function(component, key) {
45
+ createStateKeySetter: function (component, key) {
46
46
  // Memoize the setters.
47
47
  var cache = component.__keySetters || (component.__keySetters = {});
48
48
  return cache[key] || (cache[key] = createStateKeySetter(component, key));
@@ -77,7 +77,7 @@ ReactStateSetters.Mixin = {
77
77
  * @return {function} callback that when invoked uses funcReturningState to
78
78
  * determined the object literal to setState.
79
79
  */
80
- createStateSetter: function(funcReturningState) {
80
+ createStateSetter: function (funcReturningState) {
81
81
  return ReactStateSetters.createStateSetter(this, funcReturningState);
82
82
  },
83
83
 
@@ -96,9 +96,9 @@ ReactStateSetters.Mixin = {
96
96
  * @return {function} callback of 1 argument which calls setState() with
97
97
  * the provided keyName and callback argument.
98
98
  */
99
- createStateKeySetter: function(key) {
99
+ createStateKeySetter: function (key) {
100
100
  return ReactStateSetters.createStateKeySetter(this, key);
101
101
  }
102
102
  };
103
103
 
104
- module.exports = ReactStateSetters;
104
+ module.exports = ReactStateSetters;
@@ -27,6 +27,8 @@ var SyntheticEvent = require("./SyntheticEvent");
27
27
 
28
28
  var assign = require("./Object.assign");
29
29
  var emptyObject = require("./emptyObject");
30
+ var findDOMNode = require("./findDOMNode");
31
+ var invariant = require("./invariant");
30
32
 
31
33
  var topLevelTypes = EventConstants.topLevelTypes;
32
34
 
@@ -36,13 +38,34 @@ function Event(suffix) {}
36
38
  * @class ReactTestUtils
37
39
  */
38
40
 
41
+ function findAllInRenderedTreeInternal(inst, test) {
42
+ if (!inst || !inst.getPublicInstance) {
43
+ return [];
44
+ }
45
+ var publicInst = inst.getPublicInstance();
46
+ var ret = test(publicInst) ? [publicInst] : [];
47
+ if (ReactTestUtils.isDOMComponent(publicInst)) {
48
+ var renderedChildren = inst._renderedChildren;
49
+ var key;
50
+ for (key in renderedChildren) {
51
+ if (!renderedChildren.hasOwnProperty(key)) {
52
+ continue;
53
+ }
54
+ ret = ret.concat(findAllInRenderedTreeInternal(renderedChildren[key], test));
55
+ }
56
+ } else if (ReactTestUtils.isCompositeComponent(publicInst)) {
57
+ ret = ret.concat(findAllInRenderedTreeInternal(inst._renderedComponent, test));
58
+ }
59
+ return ret;
60
+ }
61
+
39
62
  /**
40
63
  * Todo: Support the entire DOM.scry query syntax. For now, these simple
41
64
  * utilities will suffice for testing purposes.
42
65
  * @lends ReactTestUtils
43
66
  */
44
67
  var ReactTestUtils = {
45
- renderIntoDocument: function(instance) {
68
+ renderIntoDocument: function (instance) {
46
69
  var div = document.createElement('div');
47
70
  // None of our tests actually require attaching the container to the
48
71
  // DOM, and doing so creates a mess that we rely on test isolation to
@@ -52,58 +75,61 @@ var ReactTestUtils = {
52
75
  return React.render(instance, div);
53
76
  },
54
77
 
55
- isElement: function(element) {
78
+ isElement: function (element) {
56
79
  return ReactElement.isValidElement(element);
57
80
  },
58
81
 
59
- isElementOfType: function(inst, convenienceConstructor) {
60
- return (
61
- ReactElement.isValidElement(inst) &&
62
- inst.type === convenienceConstructor
63
- );
82
+ isElementOfType: function (inst, convenienceConstructor) {
83
+ return ReactElement.isValidElement(inst) && inst.type === convenienceConstructor;
64
84
  },
65
85
 
66
- isDOMComponent: function(inst) {
86
+ isDOMComponent: function (inst) {
67
87
  // TODO: Fix this heuristic. It's just here because composites can currently
68
88
  // pretend to be DOM components.
69
- return !!(inst && inst.tagName && inst.getDOMNode);
89
+ return !!(inst && inst.nodeType === 1 && inst.tagName);
70
90
  },
71
91
 
72
- isDOMComponentElement: function(inst) {
73
- return !!(inst &&
74
- ReactElement.isValidElement(inst) &&
75
- !!inst.tagName);
92
+ isDOMComponentElement: function (inst) {
93
+ return !!(inst && ReactElement.isValidElement(inst) && !!inst.tagName);
76
94
  },
77
95
 
78
- isCompositeComponent: function(inst) {
79
- return typeof inst.render === 'function' &&
80
- typeof inst.setState === 'function';
96
+ isCompositeComponent: function (inst) {
97
+ if (ReactTestUtils.isDOMComponent(inst)) {
98
+ // Accessing inst.setState warns; just return false as that'll be what
99
+ // this returns when we have DOM nodes as refs directly
100
+ return false;
101
+ }
102
+ return typeof inst.render === 'function' && typeof inst.setState === 'function';
81
103
  },
82
104
 
83
- isCompositeComponentWithType: function(inst, type) {
84
- return !!(ReactTestUtils.isCompositeComponent(inst) &&
85
- (inst.constructor === type));
105
+ isCompositeComponentWithType: function (inst, type) {
106
+ if (!ReactTestUtils.isCompositeComponent(inst)) {
107
+ return false;
108
+ }
109
+ var internalInstance = ReactInstanceMap.get(inst);
110
+ var constructor = internalInstance._currentElement.type;
111
+
112
+ return constructor === type;
86
113
  },
87
114
 
88
- isCompositeComponentElement: function(inst) {
115
+ isCompositeComponentElement: function (inst) {
89
116
  if (!ReactElement.isValidElement(inst)) {
90
117
  return false;
91
118
  }
92
119
  // We check the prototype of the type that will get mounted, not the
93
120
  // instance itself. This is a future proof way of duck typing.
94
121
  var prototype = inst.type.prototype;
95
- return (
96
- typeof prototype.render === 'function' &&
97
- typeof prototype.setState === 'function'
98
- );
122
+ return typeof prototype.render === 'function' && typeof prototype.setState === 'function';
99
123
  },
100
124
 
101
- isCompositeComponentElementWithType: function(inst, type) {
102
- return !!(ReactTestUtils.isCompositeComponentElement(inst) &&
103
- (inst.constructor === type));
125
+ isCompositeComponentElementWithType: function (inst, type) {
126
+ var internalInstance = ReactInstanceMap.get(inst);
127
+ var constructor = internalInstance._currentElement.type;
128
+
129
+ return !!(ReactTestUtils.isCompositeComponentElement(inst) && constructor === type);
104
130
  },
105
131
 
106
- getRenderedChildOfCompositeComponent: function(inst) {
132
+ getRenderedChildOfCompositeComponent: function (inst) {
107
133
  if (!ReactTestUtils.isCompositeComponent(inst)) {
108
134
  return null;
109
135
  }
@@ -111,53 +137,26 @@ var ReactTestUtils = {
111
137
  return internalInstance._renderedComponent.getPublicInstance();
112
138
  },
113
139
 
114
- findAllInRenderedTree: function(inst, test) {
140
+ findAllInRenderedTree: function (inst, test) {
115
141
  if (!inst) {
116
142
  return [];
117
143
  }
118
- var ret = test(inst) ? [inst] : [];
119
- if (ReactTestUtils.isDOMComponent(inst)) {
120
- var internalInstance = ReactInstanceMap.get(inst);
121
- var renderedChildren = internalInstance
122
- ._renderedComponent
123
- ._renderedChildren;
124
- var key;
125
- for (key in renderedChildren) {
126
- if (!renderedChildren.hasOwnProperty(key)) {
127
- continue;
128
- }
129
- if (!renderedChildren[key].getPublicInstance) {
130
- continue;
131
- }
132
- ret = ret.concat(
133
- ReactTestUtils.findAllInRenderedTree(
134
- renderedChildren[key].getPublicInstance(),
135
- test
136
- )
137
- );
138
- }
139
- } else if (ReactTestUtils.isCompositeComponent(inst)) {
140
- ret = ret.concat(
141
- ReactTestUtils.findAllInRenderedTree(
142
- ReactTestUtils.getRenderedChildOfCompositeComponent(inst),
143
- test
144
- )
145
- );
146
- }
147
- return ret;
144
+ !ReactTestUtils.isCompositeComponent(inst) ? 'production' !== process.env.NODE_ENV ? invariant(false, 'findAllInRenderedTree(...): instance must be a composite component') : invariant(false) : undefined;
145
+ return findAllInRenderedTreeInternal(ReactInstanceMap.get(inst), test);
148
146
  },
149
147
 
150
148
  /**
151
149
  * Finds all instance of components in the rendered tree that are DOM
152
150
  * components with the class name matching `className`.
153
- * @return an array of all the matches.
151
+ * @return {array} an array of all the matches.
154
152
  */
155
- scryRenderedDOMComponentsWithClass: function(root, className) {
156
- return ReactTestUtils.findAllInRenderedTree(root, function(inst) {
157
- var instClassName = inst.props.className;
158
- return ReactTestUtils.isDOMComponent(inst) && (
159
- (instClassName && (' ' + instClassName + ' ').indexOf(' ' + className + ' ') !== -1)
160
- );
153
+ scryRenderedDOMComponentsWithClass: function (root, className) {
154
+ return ReactTestUtils.findAllInRenderedTree(root, function (inst) {
155
+ if (ReactTestUtils.isDOMComponent(inst)) {
156
+ var instClassName = React.findDOMNode(inst).className;
157
+ return instClassName && ('' + instClassName).split(/\s+/).indexOf(className) !== -1;
158
+ }
159
+ return false;
161
160
  });
162
161
  },
163
162
 
@@ -167,27 +166,22 @@ var ReactTestUtils = {
167
166
  * number of matches besides one.
168
167
  * @return {!ReactDOMComponent} The one match.
169
168
  */
170
- findRenderedDOMComponentWithClass: function(root, className) {
171
- var all =
172
- ReactTestUtils.scryRenderedDOMComponentsWithClass(root, className);
169
+ findRenderedDOMComponentWithClass: function (root, className) {
170
+ var all = ReactTestUtils.scryRenderedDOMComponentsWithClass(root, className);
173
171
  if (all.length !== 1) {
174
- throw new Error('Did not find exactly one match ' +
175
- '(found: ' + all.length + ') for class:' + className
176
- );
172
+ throw new Error('Did not find exactly one match ' + '(found: ' + all.length + ') for class:' + className);
177
173
  }
178
174
  return all[0];
179
175
  },
180
176
 
181
-
182
177
  /**
183
178
  * Finds all instance of components in the rendered tree that are DOM
184
179
  * components with the tag name matching `tagName`.
185
- * @return an array of all the matches.
180
+ * @return {array} an array of all the matches.
186
181
  */
187
- scryRenderedDOMComponentsWithTag: function(root, tagName) {
188
- return ReactTestUtils.findAllInRenderedTree(root, function(inst) {
189
- return ReactTestUtils.isDOMComponent(inst) &&
190
- inst.tagName === tagName.toUpperCase();
182
+ scryRenderedDOMComponentsWithTag: function (root, tagName) {
183
+ return ReactTestUtils.findAllInRenderedTree(root, function (inst) {
184
+ return ReactTestUtils.isDOMComponent(inst) && inst.tagName === tagName.toUpperCase();
191
185
  });
192
186
  },
193
187
 
@@ -197,7 +191,7 @@ var ReactTestUtils = {
197
191
  * number of matches besides one.
198
192
  * @return {!ReactDOMComponent} The one match.
199
193
  */
200
- findRenderedDOMComponentWithTag: function(root, tagName) {
194
+ findRenderedDOMComponentWithTag: function (root, tagName) {
201
195
  var all = ReactTestUtils.scryRenderedDOMComponentsWithTag(root, tagName);
202
196
  if (all.length !== 1) {
203
197
  throw new Error('Did not find exactly one match for tag:' + tagName);
@@ -205,17 +199,13 @@ var ReactTestUtils = {
205
199
  return all[0];
206
200
  },
207
201
 
208
-
209
202
  /**
210
203
  * Finds all instances of components with type equal to `componentType`.
211
- * @return an array of all the matches.
204
+ * @return {array} an array of all the matches.
212
205
  */
213
- scryRenderedComponentsWithType: function(root, componentType) {
214
- return ReactTestUtils.findAllInRenderedTree(root, function(inst) {
215
- return ReactTestUtils.isCompositeComponentWithType(
216
- inst,
217
- componentType
218
- );
206
+ scryRenderedComponentsWithType: function (root, componentType) {
207
+ return ReactTestUtils.findAllInRenderedTree(root, function (inst) {
208
+ return ReactTestUtils.isCompositeComponentWithType(inst, componentType);
219
209
  });
220
210
  },
221
211
 
@@ -225,15 +215,10 @@ var ReactTestUtils = {
225
215
  * number of matches besides one.
226
216
  * @return {!ReactComponent} The one match.
227
217
  */
228
- findRenderedComponentWithType: function(root, componentType) {
229
- var all = ReactTestUtils.scryRenderedComponentsWithType(
230
- root,
231
- componentType
232
- );
218
+ findRenderedComponentWithType: function (root, componentType) {
219
+ var all = ReactTestUtils.scryRenderedComponentsWithType(root, componentType);
233
220
  if (all.length !== 1) {
234
- throw new Error(
235
- 'Did not find exactly one match for componentType:' + componentType
236
- );
221
+ throw new Error('Did not find exactly one match for componentType:' + componentType + ' (found ' + all.length + ')');
237
222
  }
238
223
  return all[0];
239
224
  },
@@ -251,15 +236,11 @@ var ReactTestUtils = {
251
236
  * module.mockTagName if provided)
252
237
  * @return {object} the ReactTestUtils object (for chaining)
253
238
  */
254
- mockComponent: function(module, mockTagName) {
255
- mockTagName = mockTagName || module.mockTagName || "div";
256
-
257
- module.prototype.render.mockImplementation(function() {
258
- return React.createElement(
259
- mockTagName,
260
- null,
261
- this.props.children
262
- );
239
+ mockComponent: function (module, mockTagName) {
240
+ mockTagName = mockTagName || module.mockTagName || 'div';
241
+
242
+ module.prototype.render.mockImplementation(function () {
243
+ return React.createElement(mockTagName, null, this.props.children);
263
244
  });
264
245
 
265
246
  return this;
@@ -268,45 +249,33 @@ var ReactTestUtils = {
268
249
  /**
269
250
  * Simulates a top level event being dispatched from a raw event that occured
270
251
  * on an `Element` node.
271
- * @param topLevelType {Object} A type from `EventConstants.topLevelTypes`
252
+ * @param {Object} topLevelType A type from `EventConstants.topLevelTypes`
272
253
  * @param {!Element} node The dom to simulate an event occurring on.
273
254
  * @param {?Event} fakeNativeEvent Fake native event to use in SyntheticEvent.
274
255
  */
275
- simulateNativeEventOnNode: function(topLevelType, node, fakeNativeEvent) {
256
+ simulateNativeEventOnNode: function (topLevelType, node, fakeNativeEvent) {
276
257
  fakeNativeEvent.target = node;
277
- ReactBrowserEventEmitter.ReactEventListener.dispatchEvent(
278
- topLevelType,
279
- fakeNativeEvent
280
- );
258
+ ReactBrowserEventEmitter.ReactEventListener.dispatchEvent(topLevelType, fakeNativeEvent);
281
259
  },
282
260
 
283
261
  /**
284
262
  * Simulates a top level event being dispatched from a raw event that occured
285
263
  * on the `ReactDOMComponent` `comp`.
286
- * @param topLevelType {Object} A type from `EventConstants.topLevelTypes`.
287
- * @param comp {!ReactDOMComponent}
264
+ * @param {Object} topLevelType A type from `EventConstants.topLevelTypes`.
265
+ * @param {!ReactDOMComponent} comp
288
266
  * @param {?Event} fakeNativeEvent Fake native event to use in SyntheticEvent.
289
267
  */
290
- simulateNativeEventOnDOMComponent: function(
291
- topLevelType,
292
- comp,
293
- fakeNativeEvent) {
294
- ReactTestUtils.simulateNativeEventOnNode(
295
- topLevelType,
296
- comp.getDOMNode(),
297
- fakeNativeEvent
298
- );
268
+ simulateNativeEventOnDOMComponent: function (topLevelType, comp, fakeNativeEvent) {
269
+ ReactTestUtils.simulateNativeEventOnNode(topLevelType, findDOMNode(comp), fakeNativeEvent);
299
270
  },
300
271
 
301
- nativeTouchData: function(x, y) {
272
+ nativeTouchData: function (x, y) {
302
273
  return {
303
- touches: [
304
- {pageX: x, pageY: y}
305
- ]
274
+ touches: [{ pageX: x, pageY: y }]
306
275
  };
307
276
  },
308
277
 
309
- createRenderer: function() {
278
+ createRenderer: function () {
310
279
  return new ReactShallowRenderer();
311
280
  },
312
281
 
@@ -317,57 +286,42 @@ var ReactTestUtils = {
317
286
  /**
318
287
  * @class ReactShallowRenderer
319
288
  */
320
- var ReactShallowRenderer = function() {
289
+ var ReactShallowRenderer = function () {
321
290
  this._instance = null;
322
291
  };
323
292
 
324
- ReactShallowRenderer.prototype.getRenderOutput = function() {
325
- return (
326
- (this._instance && this._instance._renderedComponent &&
327
- this._instance._renderedComponent._renderedOutput)
328
- || null
329
- );
293
+ ReactShallowRenderer.prototype.getRenderOutput = function () {
294
+ return this._instance && this._instance._renderedComponent && this._instance._renderedComponent._renderedOutput || null;
330
295
  };
331
296
 
332
- var NoopInternalComponent = function(element) {
297
+ var NoopInternalComponent = function (element) {
333
298
  this._renderedOutput = element;
334
- this._currentElement = element === null || element === false ?
335
- ReactEmptyComponent.emptyElement :
336
- element;
299
+ this._currentElement = element === null || element === false ? ReactEmptyComponent.emptyElement : element;
337
300
  };
338
301
 
339
302
  NoopInternalComponent.prototype = {
340
303
 
341
- mountComponent: function() {
342
- },
304
+ mountComponent: function () {},
343
305
 
344
- receiveComponent: function(element) {
306
+ receiveComponent: function (element) {
345
307
  this._renderedOutput = element;
346
- this._currentElement = element === null || element === false ?
347
- ReactEmptyComponent.emptyElement :
348
- element;
308
+ this._currentElement = element === null || element === false ? ReactEmptyComponent.emptyElement : element;
349
309
  },
350
310
 
351
- unmountComponent: function() {
352
- }
311
+ unmountComponent: function () {}
353
312
 
354
313
  };
355
314
 
356
- var ShallowComponentWrapper = function() { };
357
- assign(
358
- ShallowComponentWrapper.prototype,
359
- ReactCompositeComponent.Mixin, {
360
- _instantiateReactComponent: function(element) {
361
- return new NoopInternalComponent(element);
362
- },
363
- _replaceNodeWithMarkupByID: function() {},
364
- _renderValidatedComponent:
365
- ReactCompositeComponent.Mixin.
366
- _renderValidatedComponentWithoutOwnerOrContext
367
- }
368
- );
315
+ var ShallowComponentWrapper = function () {};
316
+ assign(ShallowComponentWrapper.prototype, ReactCompositeComponent.Mixin, {
317
+ _instantiateReactComponent: function (element) {
318
+ return new NoopInternalComponent(element);
319
+ },
320
+ _replaceNodeWithMarkupByID: function () {},
321
+ _renderValidatedComponent: ReactCompositeComponent.Mixin._renderValidatedComponentWithoutOwnerOrContext
322
+ });
369
323
 
370
- ReactShallowRenderer.prototype.render = function(element, context) {
324
+ ReactShallowRenderer.prototype.render = function (element, context) {
371
325
  if (!context) {
372
326
  context = emptyObject;
373
327
  }
@@ -376,13 +330,13 @@ ReactShallowRenderer.prototype.render = function(element, context) {
376
330
  ReactUpdates.ReactReconcileTransaction.release(transaction);
377
331
  };
378
332
 
379
- ReactShallowRenderer.prototype.unmount = function() {
333
+ ReactShallowRenderer.prototype.unmount = function () {
380
334
  if (this._instance) {
381
335
  this._instance.unmountComponent();
382
336
  }
383
337
  };
384
338
 
385
- ReactShallowRenderer.prototype._render = function(element, transaction, context) {
339
+ ReactShallowRenderer.prototype._render = function (element, transaction, context) {
386
340
  if (!this._instance) {
387
341
  var rootID = ReactInstanceHandles.createReactRootID();
388
342
  var instance = new ShallowComponentWrapper(element.type);
@@ -405,27 +359,30 @@ ReactShallowRenderer.prototype._render = function(element, transaction, context)
405
359
  * - ... (All keys from event plugin `eventTypes` objects)
406
360
  */
407
361
  function makeSimulator(eventType) {
408
- return function(domComponentOrNode, eventData) {
362
+ return function (domComponentOrNode, eventData) {
409
363
  var node;
410
364
  if (ReactTestUtils.isDOMComponent(domComponentOrNode)) {
411
- node = domComponentOrNode.getDOMNode();
365
+ node = findDOMNode(domComponentOrNode);
412
366
  } else if (domComponentOrNode.tagName) {
413
367
  node = domComponentOrNode;
414
368
  }
415
369
 
370
+ var dispatchConfig = ReactBrowserEventEmitter.eventNameDispatchConfigs[eventType];
371
+
416
372
  var fakeNativeEvent = new Event();
417
373
  fakeNativeEvent.target = node;
418
374
  // We don't use SyntheticEvent.getPooled in order to not have to worry about
419
375
  // properly destroying any properties assigned from `eventData` upon release
420
- var event = new SyntheticEvent(
421
- ReactBrowserEventEmitter.eventNameDispatchConfigs[eventType],
422
- ReactMount.getID(node),
423
- fakeNativeEvent
424
- );
376
+ var event = new SyntheticEvent(dispatchConfig, ReactMount.getID(node), fakeNativeEvent, node);
425
377
  assign(event, eventData);
426
- EventPropagators.accumulateTwoPhaseDispatches(event);
427
378
 
428
- ReactUpdates.batchedUpdates(function() {
379
+ if (dispatchConfig.phasedRegistrationNames) {
380
+ EventPropagators.accumulateTwoPhaseDispatches(event);
381
+ } else {
382
+ EventPropagators.accumulateDirectDispatches(event);
383
+ }
384
+
385
+ ReactUpdates.batchedUpdates(function () {
429
386
  EventPluginHub.enqueueEvents(event);
430
387
  EventPluginHub.processEventQueue();
431
388
  });
@@ -438,7 +395,7 @@ function buildSimulators() {
438
395
  var eventType;
439
396
  for (eventType in ReactBrowserEventEmitter.eventNameDispatchConfigs) {
440
397
  /**
441
- * @param {!Element || ReactDOMComponent} domComponentOrNode
398
+ * @param {!Element|ReactDOMComponent} domComponentOrNode
442
399
  * @param {?object} eventData Fake event data to use in SyntheticEvent.
443
400
  */
444
401
  ReactTestUtils.Simulate[eventType] = makeSimulator(eventType);
@@ -447,12 +404,12 @@ function buildSimulators() {
447
404
 
448
405
  // Rebuild ReactTestUtils.Simulate whenever event plugins are injected
449
406
  var oldInjectEventPluginOrder = EventPluginHub.injection.injectEventPluginOrder;
450
- EventPluginHub.injection.injectEventPluginOrder = function() {
407
+ EventPluginHub.injection.injectEventPluginOrder = function () {
451
408
  oldInjectEventPluginOrder.apply(this, arguments);
452
409
  buildSimulators();
453
410
  };
454
411
  var oldInjectEventPlugins = EventPluginHub.injection.injectEventPluginsByName;
455
- EventPluginHub.injection.injectEventPluginsByName = function() {
412
+ EventPluginHub.injection.injectEventPluginsByName = function () {
456
413
  oldInjectEventPlugins.apply(this, arguments);
457
414
  buildSimulators();
458
415
  };
@@ -476,22 +433,14 @@ buildSimulators();
476
433
  */
477
434
 
478
435
  function makeNativeSimulator(eventType) {
479
- return function(domComponentOrNode, nativeEventData) {
436
+ return function (domComponentOrNode, nativeEventData) {
480
437
  var fakeNativeEvent = new Event(eventType);
481
438
  assign(fakeNativeEvent, nativeEventData);
482
439
  if (ReactTestUtils.isDOMComponent(domComponentOrNode)) {
483
- ReactTestUtils.simulateNativeEventOnDOMComponent(
484
- eventType,
485
- domComponentOrNode,
486
- fakeNativeEvent
487
- );
440
+ ReactTestUtils.simulateNativeEventOnDOMComponent(eventType, domComponentOrNode, fakeNativeEvent);
488
441
  } else if (!!domComponentOrNode.tagName) {
489
442
  // Will allow on actual dom nodes.
490
- ReactTestUtils.simulateNativeEventOnNode(
491
- eventType,
492
- domComponentOrNode,
493
- fakeNativeEvent
494
- );
443
+ ReactTestUtils.simulateNativeEventOnNode(eventType, domComponentOrNode, fakeNativeEvent);
495
444
  }
496
445
  };
497
446
  }
@@ -499,14 +448,12 @@ function makeNativeSimulator(eventType) {
499
448
  var eventType;
500
449
  for (eventType in topLevelTypes) {
501
450
  // Event type is stored as 'topClick' - we transform that to 'click'
502
- var convenienceName = eventType.indexOf('top') === 0 ?
503
- eventType.charAt(3).toLowerCase() + eventType.substr(4) : eventType;
451
+ var convenienceName = eventType.indexOf('top') === 0 ? eventType.charAt(3).toLowerCase() + eventType.substr(4) : eventType;
504
452
  /**
505
- * @param {!Element || ReactDOMComponent} domComponentOrNode
453
+ * @param {!Element|ReactDOMComponent} domComponentOrNode
506
454
  * @param {?Event} nativeEventData Fake native event to use in SyntheticEvent.
507
455
  */
508
- ReactTestUtils.SimulateNative[convenienceName] =
509
- makeNativeSimulator(eventType);
456
+ ReactTestUtils.SimulateNative[convenienceName] = makeNativeSimulator(eventType);
510
457
  }
511
458
 
512
- module.exports = ReactTestUtils;
459
+ module.exports = ReactTestUtils;