react-test-renderer 15.5.0 → 15.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/ReactShallowRenderer.js +6 -0
- package/lib/shallow/ARIADOMPropertyConfig.js +73 -0
- package/lib/shallow/AutoFocusUtils.js +23 -0
- package/lib/shallow/BeforeInputEventPlugin.js +384 -0
- package/lib/shallow/CSSProperty.js +147 -0
- package/lib/shallow/CSSPropertyOperations.js +208 -0
- package/lib/shallow/CallbackQueue.js +118 -0
- package/lib/shallow/ChangeEventPlugin.js +345 -0
- package/lib/shallow/DOMChildrenOperations.js +224 -0
- package/lib/shallow/DOMLazyTree.js +117 -0
- package/lib/shallow/DOMNamespaces.js +19 -0
- package/lib/shallow/DOMProperty.js +209 -0
- package/lib/shallow/DOMPropertyOperations.js +236 -0
- package/lib/shallow/Danger.js +47 -0
- package/lib/shallow/DefaultEventPluginOrder.js +25 -0
- package/lib/shallow/EnterLeaveEventPlugin.js +99 -0
- package/lib/shallow/EventConstants.js +91 -0
- package/lib/shallow/EventPluginHub.js +277 -0
- package/lib/shallow/EventPluginRegistry.js +254 -0
- package/lib/shallow/EventPluginUtils.js +225 -0
- package/lib/shallow/EventPropagators.js +133 -0
- package/lib/shallow/FallbackCompositionState.js +94 -0
- package/lib/shallow/HTMLDOMPropertyConfig.js +235 -0
- package/lib/shallow/KeyEscapeUtils.js +58 -0
- package/lib/shallow/LinkedValueUtils.js +137 -0
- package/lib/shallow/PluginModuleType.js +12 -0
- package/lib/shallow/PooledClass.js +111 -0
- package/lib/shallow/ReactBrowserEventEmitter.js +327 -0
- package/lib/shallow/ReactChildFiber.js +243 -0
- package/lib/shallow/ReactChildReconciler.js +153 -0
- package/lib/shallow/ReactComponentBrowserEnvironment.js +29 -0
- package/lib/shallow/ReactComponentEnvironment.js +45 -0
- package/lib/shallow/ReactCompositeComponent.js +901 -0
- package/lib/shallow/ReactCoroutine.js +80 -0
- package/lib/shallow/ReactDOM.js +110 -0
- package/lib/shallow/ReactDOMComponent.js +1000 -0
- package/lib/shallow/ReactDOMComponentFlags.js +17 -0
- package/lib/shallow/ReactDOMComponentTree.js +194 -0
- package/lib/shallow/ReactDOMContainerInfo.js +32 -0
- package/lib/shallow/ReactDOMEmptyComponent.js +59 -0
- package/lib/shallow/ReactDOMFeatureFlags.js +18 -0
- package/lib/shallow/ReactDOMFiber.js +97 -0
- package/lib/shallow/ReactDOMIDOperations.js +33 -0
- package/lib/shallow/ReactDOMInput.js +284 -0
- package/lib/shallow/ReactDOMInvalidARIAHook.js +92 -0
- package/lib/shallow/ReactDOMNullInputValuePropHook.js +42 -0
- package/lib/shallow/ReactDOMOption.js +122 -0
- package/lib/shallow/ReactDOMSelect.js +199 -0
- package/lib/shallow/ReactDOMSelection.js +211 -0
- package/lib/shallow/ReactDOMServer.js +25 -0
- package/lib/shallow/ReactDOMTextComponent.js +163 -0
- package/lib/shallow/ReactDOMTextarea.js +159 -0
- package/lib/shallow/ReactDOMTreeTraversal.js +135 -0
- package/lib/shallow/ReactDOMUnknownPropertyHook.js +111 -0
- package/lib/shallow/ReactDebugTool.js +358 -0
- package/lib/shallow/ReactDefaultBatchingStrategy.js +67 -0
- package/lib/shallow/ReactDefaultInjection.js +85 -0
- package/lib/shallow/ReactElementSymbol.js +19 -0
- package/lib/shallow/ReactEmptyComponent.js +29 -0
- package/lib/shallow/ReactErrorUtils.js +75 -0
- package/lib/shallow/ReactEventEmitterMixin.js +32 -0
- package/lib/shallow/ReactEventListener.js +154 -0
- package/lib/shallow/ReactFeatureFlags.js +21 -0
- package/lib/shallow/ReactFiber.js +190 -0
- package/lib/shallow/ReactFiberBeginWork.js +380 -0
- package/lib/shallow/ReactFiberCommitWork.js +78 -0
- package/lib/shallow/ReactFiberCompleteWork.js +208 -0
- package/lib/shallow/ReactFiberReconciler.js +64 -0
- package/lib/shallow/ReactFiberRoot.js +29 -0
- package/lib/shallow/ReactFiberScheduler.js +331 -0
- package/lib/shallow/ReactFiberUpdateQueue.js +77 -0
- package/lib/shallow/ReactHostComponent.js +67 -0
- package/lib/shallow/ReactHostOperationHistoryHook.js +33 -0
- package/lib/shallow/ReactInjection.js +33 -0
- package/lib/shallow/ReactInputSelection.js +123 -0
- package/lib/shallow/ReactInstanceMap.js +47 -0
- package/lib/shallow/ReactInstanceType.js +12 -0
- package/lib/shallow/ReactInstrumentation.js +23 -0
- package/lib/shallow/ReactInvalidSetStateWarningHook.js +36 -0
- package/lib/shallow/ReactMarkupChecksum.js +49 -0
- package/lib/shallow/ReactMount.js +537 -0
- package/lib/shallow/ReactMultiChild.js +449 -0
- package/lib/shallow/ReactMultiChildUpdateTypes.js +18 -0
- package/lib/shallow/ReactNodeTypes.js +39 -0
- package/lib/shallow/ReactOwner.js +93 -0
- package/lib/shallow/ReactPerf.js +500 -0
- package/lib/shallow/ReactPriorityLevel.js +20 -0
- package/lib/shallow/ReactPropTypeLocationNames.js +24 -0
- package/lib/shallow/ReactPropTypeLocations.js +12 -0
- package/lib/shallow/ReactPropTypesSecret.js +16 -0
- package/lib/shallow/ReactReconcileTransaction.js +177 -0
- package/lib/shallow/ReactReconciler.js +167 -0
- package/lib/shallow/ReactRef.js +88 -0
- package/lib/shallow/ReactReifiedYield.js +30 -0
- package/lib/shallow/ReactServerBatchingStrategy.js +21 -0
- package/lib/shallow/ReactServerRendering.js +89 -0
- package/lib/shallow/ReactServerRenderingTransaction.js +89 -0
- package/lib/shallow/ReactServerUpdateQueue.js +138 -0
- package/lib/shallow/ReactShallowRenderer.js +150 -0
- package/lib/shallow/ReactSimpleEmptyComponent.js +36 -0
- package/lib/shallow/ReactSyntheticEventType.js +14 -0
- package/lib/shallow/ReactTestEmptyComponent.js +36 -0
- package/lib/shallow/ReactTestMount.js +131 -0
- package/lib/shallow/ReactTestReconcileTransaction.js +128 -0
- package/lib/shallow/ReactTestRenderer.js +139 -0
- package/lib/shallow/ReactTestTextComponent.js +40 -0
- package/lib/shallow/ReactTypeOfWork.js +23 -0
- package/lib/shallow/ReactTypes.js +12 -0
- package/lib/shallow/ReactUpdateQueue.js +235 -0
- package/lib/shallow/ReactUpdates.js +250 -0
- package/lib/shallow/ReactVersion.js +13 -0
- package/lib/shallow/ResponderEventPlugin.js +507 -0
- package/lib/shallow/ResponderSyntheticEvent.js +38 -0
- package/lib/shallow/ResponderTouchHistoryStore.js +183 -0
- package/lib/shallow/SVGDOMPropertyConfig.js +301 -0
- package/lib/shallow/SelectEventPlugin.js +190 -0
- package/lib/shallow/SimpleEventPlugin.js +227 -0
- package/lib/shallow/SyntheticAnimationEvent.js +38 -0
- package/lib/shallow/SyntheticClipboardEvent.js +37 -0
- package/lib/shallow/SyntheticCompositionEvent.js +35 -0
- package/lib/shallow/SyntheticDragEvent.js +35 -0
- package/lib/shallow/SyntheticEvent.js +267 -0
- package/lib/shallow/SyntheticFocusEvent.js +35 -0
- package/lib/shallow/SyntheticInputEvent.js +36 -0
- package/lib/shallow/SyntheticKeyboardEvent.js +83 -0
- package/lib/shallow/SyntheticMouseEvent.js +71 -0
- package/lib/shallow/SyntheticTouchEvent.js +44 -0
- package/lib/shallow/SyntheticTransitionEvent.js +38 -0
- package/lib/shallow/SyntheticUIEvent.js +58 -0
- package/lib/shallow/SyntheticWheelEvent.js +53 -0
- package/lib/shallow/TapEventPlugin.js +115 -0
- package/lib/shallow/TouchHistoryMath.js +98 -0
- package/lib/shallow/Transaction.js +224 -0
- package/lib/shallow/ViewportMetrics.js +26 -0
- package/lib/shallow/accumulate.js +45 -0
- package/lib/shallow/accumulateInto.js +57 -0
- package/lib/shallow/adler32.js +43 -0
- package/lib/shallow/canDefineProperty.js +25 -0
- package/lib/shallow/checkReactTypeSpec.js +86 -0
- package/lib/shallow/createMicrosoftUnsafeLocalFunction.js +31 -0
- package/lib/shallow/dangerousStyleValue.js +78 -0
- package/lib/shallow/deprecated.js +56 -0
- package/lib/shallow/escapeTextContentForBrowser.js +122 -0
- package/lib/shallow/findDOMNode.js +59 -0
- package/lib/shallow/flattenChildren.js +75 -0
- package/lib/shallow/forEachAccumulated.js +30 -0
- package/lib/shallow/getEventCharCode.js +49 -0
- package/lib/shallow/getEventKey.js +101 -0
- package/lib/shallow/getEventModifierState.js +42 -0
- package/lib/shallow/getEventTarget.js +34 -0
- package/lib/shallow/getHostComponentFromComposite.js +29 -0
- package/lib/shallow/getIteratorFn.js +40 -0
- package/lib/shallow/getNodeForCharacterOffset.js +73 -0
- package/lib/shallow/getTextContentAccessor.js +32 -0
- package/lib/shallow/getVendorPrefixedEventName.js +100 -0
- package/lib/shallow/instantiateReactComponent.js +128 -0
- package/lib/shallow/isEventSupported.js +59 -0
- package/lib/shallow/isTextInputElement.js +50 -0
- package/lib/shallow/quoteAttributeValueForBrowser.js +25 -0
- package/lib/shallow/reactProdInvariant.js +38 -0
- package/lib/shallow/renderSubtreeIntoContainer.js +15 -0
- package/lib/shallow/setInnerHTML.js +97 -0
- package/lib/shallow/setTextContent.js +51 -0
- package/lib/shallow/shouldUpdateReactComponent.js +41 -0
- package/lib/shallow/traverseAllChildren.js +175 -0
- package/lib/shallow/validateDOMNesting.js +376 -0
- package/package.json +1 -1
- package/shallow.js +1 -1
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2014-present, 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
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
'use strict';
|
|
13
|
+
|
|
14
|
+
// The Symbol used to tag the special React types. If there is no native Symbol
|
|
15
|
+
// nor polyfill, then a plain number is used for performance.
|
|
16
|
+
var REACT_COROUTINE_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.coroutine') || 0xeac8;
|
|
17
|
+
|
|
18
|
+
var REACT_YIELD_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.yield') || 0xeac9;
|
|
19
|
+
|
|
20
|
+
exports.createCoroutine = function (children, handler, props) {
|
|
21
|
+
var key = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
22
|
+
|
|
23
|
+
var coroutine = {
|
|
24
|
+
// This tag allow us to uniquely identify this as a React Coroutine
|
|
25
|
+
$$typeof: REACT_COROUTINE_TYPE,
|
|
26
|
+
key: key == null ? null : '' + key,
|
|
27
|
+
children: children,
|
|
28
|
+
handler: handler,
|
|
29
|
+
props: props
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
33
|
+
// TODO: Add _store property for marking this as validated.
|
|
34
|
+
if (Object.freeze) {
|
|
35
|
+
Object.freeze(coroutine.props);
|
|
36
|
+
Object.freeze(coroutine);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return coroutine;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
exports.createYield = function (props, continuation) {
|
|
44
|
+
var key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
45
|
+
|
|
46
|
+
var yieldNode = {
|
|
47
|
+
// This tag allow us to uniquely identify this as a React Yield
|
|
48
|
+
$$typeof: REACT_YIELD_TYPE,
|
|
49
|
+
key: key == null ? null : '' + key,
|
|
50
|
+
props: props,
|
|
51
|
+
continuation: continuation
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
55
|
+
// TODO: Add _store property for marking this as validated.
|
|
56
|
+
if (Object.freeze) {
|
|
57
|
+
Object.freeze(yieldNode.props);
|
|
58
|
+
Object.freeze(yieldNode);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return yieldNode;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Verifies the object is a coroutine object.
|
|
67
|
+
*/
|
|
68
|
+
exports.isCoroutine = function (object) {
|
|
69
|
+
return typeof object === 'object' && object !== null && object.$$typeof === REACT_COROUTINE_TYPE;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Verifies the object is a yield object.
|
|
74
|
+
*/
|
|
75
|
+
exports.isYield = function (object) {
|
|
76
|
+
return typeof object === 'object' && object !== null && object.$$typeof === REACT_YIELD_TYPE;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
exports.REACT_YIELD_TYPE = REACT_YIELD_TYPE;
|
|
80
|
+
exports.REACT_COROUTINE_TYPE = REACT_COROUTINE_TYPE;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2013-present, 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
|
+
*/
|
|
10
|
+
|
|
11
|
+
/* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/
|
|
12
|
+
|
|
13
|
+
'use strict';
|
|
14
|
+
|
|
15
|
+
var ReactDOMComponentTree = require('./ReactDOMComponentTree');
|
|
16
|
+
var ReactDefaultInjection = require('./ReactDefaultInjection');
|
|
17
|
+
var ReactMount = require('./ReactMount');
|
|
18
|
+
var ReactReconciler = require('./ReactReconciler');
|
|
19
|
+
var ReactUpdates = require('./ReactUpdates');
|
|
20
|
+
var ReactVersion = require('./ReactVersion');
|
|
21
|
+
|
|
22
|
+
var findDOMNode = require('./findDOMNode');
|
|
23
|
+
var getHostComponentFromComposite = require('./getHostComponentFromComposite');
|
|
24
|
+
var renderSubtreeIntoContainer = require('./renderSubtreeIntoContainer');
|
|
25
|
+
var warning = require('fbjs/lib/warning');
|
|
26
|
+
|
|
27
|
+
ReactDefaultInjection.inject();
|
|
28
|
+
|
|
29
|
+
var ReactDOM = {
|
|
30
|
+
findDOMNode: findDOMNode,
|
|
31
|
+
render: ReactMount.render,
|
|
32
|
+
unmountComponentAtNode: ReactMount.unmountComponentAtNode,
|
|
33
|
+
version: ReactVersion,
|
|
34
|
+
|
|
35
|
+
/* eslint-disable camelcase */
|
|
36
|
+
unstable_batchedUpdates: ReactUpdates.batchedUpdates,
|
|
37
|
+
unstable_renderSubtreeIntoContainer: renderSubtreeIntoContainer
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
// Inject the runtime into a devtools global hook regardless of browser.
|
|
41
|
+
// Allows for debugging when the hook is injected on the page.
|
|
42
|
+
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') {
|
|
43
|
+
__REACT_DEVTOOLS_GLOBAL_HOOK__.inject({
|
|
44
|
+
ComponentTree: {
|
|
45
|
+
getClosestInstanceFromNode: ReactDOMComponentTree.getClosestInstanceFromNode,
|
|
46
|
+
getNodeFromInstance: function (inst) {
|
|
47
|
+
// inst is an internal instance (but could be a composite)
|
|
48
|
+
if (inst._renderedComponent) {
|
|
49
|
+
inst = getHostComponentFromComposite(inst);
|
|
50
|
+
}
|
|
51
|
+
if (inst) {
|
|
52
|
+
return ReactDOMComponentTree.getNodeFromInstance(inst);
|
|
53
|
+
} else {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
Mount: ReactMount,
|
|
59
|
+
Reconciler: ReactReconciler
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
64
|
+
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
|
|
65
|
+
if (ExecutionEnvironment.canUseDOM && window.top === window.self) {
|
|
66
|
+
|
|
67
|
+
// First check if devtools is not installed
|
|
68
|
+
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
|
|
69
|
+
// If we're in Chrome or Firefox, provide a download link if not installed.
|
|
70
|
+
if (navigator.userAgent.indexOf('Chrome') > -1 && navigator.userAgent.indexOf('Edge') === -1 || navigator.userAgent.indexOf('Firefox') > -1) {
|
|
71
|
+
// Firefox does not have the issue with devtools loaded over file://
|
|
72
|
+
var showFileUrlMessage = window.location.protocol.indexOf('http') === -1 && navigator.userAgent.indexOf('Firefox') === -1;
|
|
73
|
+
console.debug('Download the React DevTools ' + (showFileUrlMessage ? 'and use an HTTP server (instead of a file: URL) ' : '') + 'for a better development experience: ' + 'https://fb.me/react-devtools');
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
var testFunc = function testFn() {};
|
|
78
|
+
process.env.NODE_ENV !== 'production' ? warning((testFunc.name || testFunc.toString()).indexOf('testFn') !== -1, 'It looks like you\'re using a minified copy of the development build ' + 'of React. When deploying React apps to production, make sure to use ' + 'the production build which skips development warnings and is faster. ' + 'See https://fb.me/react-minification for more details.') : void 0;
|
|
79
|
+
|
|
80
|
+
// If we're in IE8, check to see if we are in compatibility mode and provide
|
|
81
|
+
// information on preventing compatibility mode
|
|
82
|
+
var ieCompatibilityMode = document.documentMode && document.documentMode < 8;
|
|
83
|
+
|
|
84
|
+
process.env.NODE_ENV !== 'production' ? warning(!ieCompatibilityMode, 'Internet Explorer is running in compatibility mode; please add the ' + 'following tag to your HTML to prevent this from happening: ' + '<meta http-equiv="X-UA-Compatible" content="IE=edge" />') : void 0;
|
|
85
|
+
|
|
86
|
+
var expectedFeatures = [
|
|
87
|
+
// shims
|
|
88
|
+
Array.isArray, Array.prototype.every, Array.prototype.forEach, Array.prototype.indexOf, Array.prototype.map, Date.now, Function.prototype.bind, Object.keys, String.prototype.trim];
|
|
89
|
+
|
|
90
|
+
for (var i = 0; i < expectedFeatures.length; i++) {
|
|
91
|
+
if (!expectedFeatures[i]) {
|
|
92
|
+
process.env.NODE_ENV !== 'production' ? warning(false, 'One or more ES5 shims expected by React are not available: ' + 'https://fb.me/react-warning-polyfills') : void 0;
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
100
|
+
var ReactInstrumentation = require('./ReactInstrumentation');
|
|
101
|
+
var ReactDOMUnknownPropertyHook = require('./ReactDOMUnknownPropertyHook');
|
|
102
|
+
var ReactDOMNullInputValuePropHook = require('./ReactDOMNullInputValuePropHook');
|
|
103
|
+
var ReactDOMInvalidARIAHook = require('./ReactDOMInvalidARIAHook');
|
|
104
|
+
|
|
105
|
+
ReactInstrumentation.debugTool.addHook(ReactDOMUnknownPropertyHook);
|
|
106
|
+
ReactInstrumentation.debugTool.addHook(ReactDOMNullInputValuePropHook);
|
|
107
|
+
ReactInstrumentation.debugTool.addHook(ReactDOMInvalidARIAHook);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
module.exports = ReactDOM;
|