react-test-renderer 16.6.0-alpha.8af6728 → 16.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/react-test-renderer-shallow.development.js +20 -14
- package/cjs/react-test-renderer-shallow.production.min.js +14 -14
- package/cjs/react-test-renderer.development.js +1073 -585
- package/cjs/react-test-renderer.production.min.js +132 -127
- package/package.json +4 -4
- package/umd/react-test-renderer-shallow.development.js +20 -14
- package/umd/react-test-renderer-shallow.production.min.js +12 -12
- package/umd/react-test-renderer.development.js +1073 -585
- package/umd/react-test-renderer.production.min.js +114 -110
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-test-renderer",
|
|
3
|
-
"version": "16.6.0
|
|
3
|
+
"version": "16.6.0",
|
|
4
4
|
"description": "React package for snapshot testing.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": "facebook/react",
|
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"object-assign": "^4.1.1",
|
|
19
19
|
"prop-types": "^15.6.2",
|
|
20
|
-
"react-is": "^16.6.0
|
|
21
|
-
"scheduler": "^0.10.0
|
|
20
|
+
"react-is": "^16.6.0",
|
|
21
|
+
"scheduler": "^0.10.0"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
|
-
"react": "^16.0.0
|
|
24
|
+
"react": "^16.0.0"
|
|
25
25
|
},
|
|
26
26
|
"files": [
|
|
27
27
|
"LICENSE",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v16.6.0
|
|
1
|
+
/** @license React v16.6.0
|
|
2
2
|
* react-test-renderer-shallow.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -78,6 +78,8 @@ var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
|
|
|
78
78
|
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
|
79
79
|
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
|
80
80
|
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
|
81
|
+
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
|
82
|
+
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
|
81
83
|
|
|
82
84
|
/**
|
|
83
85
|
* Forked from fbjs/warning:
|
|
@@ -273,10 +275,13 @@ var warningWithoutStack$1 = warningWithoutStack;
|
|
|
273
275
|
var Resolved = 1;
|
|
274
276
|
|
|
275
277
|
|
|
278
|
+
function refineResolvedLazyComponent(lazyComponent) {
|
|
279
|
+
return lazyComponent._status === Resolved ? lazyComponent._result : null;
|
|
280
|
+
}
|
|
276
281
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
return
|
|
282
|
+
function getWrappedName(outerType, innerType, wrapperName) {
|
|
283
|
+
var functionName = innerType.displayName || innerType.name || '';
|
|
284
|
+
return outerType.displayName || (functionName !== '' ? wrapperName + '(' + functionName + ')' : wrapperName);
|
|
280
285
|
}
|
|
281
286
|
|
|
282
287
|
function getComponentName(type) {
|
|
@@ -316,16 +321,17 @@ function getComponentName(type) {
|
|
|
316
321
|
case REACT_PROVIDER_TYPE:
|
|
317
322
|
return 'Context.Provider';
|
|
318
323
|
case REACT_FORWARD_REF_TYPE:
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
return type.
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
324
|
+
return getWrappedName(type, type.render, 'ForwardRef');
|
|
325
|
+
case REACT_MEMO_TYPE:
|
|
326
|
+
return getComponentName(type.type);
|
|
327
|
+
case REACT_LAZY_TYPE:
|
|
328
|
+
{
|
|
329
|
+
var thenable = type;
|
|
330
|
+
var resolvedThenable = refineResolvedLazyComponent(thenable);
|
|
331
|
+
if (resolvedThenable) {
|
|
332
|
+
return getComponentName(resolvedThenable);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
329
335
|
}
|
|
330
336
|
}
|
|
331
337
|
return null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v16.6.0
|
|
1
|
+
/** @license React v16.6.0
|
|
2
2
|
* react-test-renderer-shallow.production.min.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -9,14 +9,14 @@
|
|
|
9
9
|
'use strict';(function(g,e){"object"===typeof exports&&"undefined"!==typeof module?module.exports=e(require("react")):"function"===typeof define&&define.amd?define(["react"],e):g.ReactShallowRenderer=e(g.React)})(this,function(g){function e(a,b,f,d,c,h,g,x){if(!a){a=void 0;if(void 0===b)a=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var w=[f,d,c,h,g,x],e=0;a=Error(b.replace(/%s/g,function(){return w[e++]}));
|
|
10
10
|
a.name="Invariant Violation"}a.framesToPop=1;throw a;}}function n(a){for(var b=arguments.length-1,f="https://reactjs.org/docs/error-decoder.html?invariant="+a,d=0;d<b;d++)f+="&args[]="+encodeURIComponent(arguments[d+1]);e(!1,"Minified React error #"+a+"; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",f)}function q(a){if("object"===typeof a&&null!==a){var b=a.$$typeof;switch(b){case y:switch(a=a.type,a){case z:case A:case B:case C:return a;
|
|
11
11
|
default:switch(a=a&&a.$$typeof,a){case D:case p:case E:return a;default:return b}}case F:return b}}}function r(a,b){return a===b?0!==a||0!==b||1/a===1/b:a!==a&&b!==b}function t(a,b){if(r(a,b))return!0;if("object"!==typeof a||null===a||"object"!==typeof b||null===b)return!1;var f=Object.keys(a),d=Object.keys(b);if(f.length!==d.length)return!1;for(d=0;d<f.length;d++)if(!G.call(b,f[d])||!r(a[f[d]],b[f[d]]))return!1;return!0}function u(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");
|
|
12
|
-
}var v=g.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.assign,c="function"===typeof Symbol&&Symbol.for,y=c?Symbol.for("react.element"):60103,F=c?Symbol.for("react.portal"):60106,A=c?Symbol.for("react.fragment"):60107,C=c?Symbol.for("react.strict_mode"):60108,B=c?Symbol.for("react.profiler"):60114,E=c?Symbol.for("react.provider"):60109,D=c?Symbol.for("react.context"):60110,z=c?Symbol.for("react.concurrent_mode"):60111,p=c?Symbol.for("react.forward_ref"):60112;c&&Symbol.for("react.suspense");
|
|
13
|
-
Object.prototype.hasOwnProperty,l={},H=function(){function a(b){u(this,a);this._renderer=b;this._callbacks=[]}a.prototype._enqueueCallback=function(b,a){"function"===typeof b&&a&&this._callbacks.push({callback:b,publicInstance:a})};a.prototype._invokeCallbacks=function(){var b=this._callbacks;this._callbacks=[];b.forEach(function(b){b.callback.call(b.publicInstance)})};a.prototype.isMounted=function(b){return!!this._renderer._element};a.prototype.enqueueForceUpdate=
|
|
14
|
-
b);this._renderer._forcedUpdate=!0;this._renderer.render(this._renderer._element,this._renderer._context)};a.prototype.enqueueReplaceState=function(b,a,d,c){this._enqueueCallback(d,b);this._renderer._newState=a;this._renderer.render(this._renderer._element,this._renderer._context)};a.prototype.enqueueSetState=function(b,a,d,c){this._enqueueCallback(d,b);d=this._renderer._newState||b.state;"function"===typeof a&&(a=a.call(b,d,b.props));null!==a&&void 0!==a&&
|
|
15
|
-
this._renderer._context))};return a}(),m=function(){function a(){u(this,a);this._rendered=this._newState=this._instance=this._element=this._context=null;this._forcedUpdate=this._rendering=!1;this._updater=new H(this)}a.prototype.getMountedInstance=function(){return this._instance};a.prototype.getRenderOutput=function(){return this._rendered};a.prototype.render=function(b){var a=1<arguments.length&&void 0!==arguments[1]?
|
|
16
|
-
"");"string"===typeof b.type?n("13",b.type):void 0;q(b)!==p&&"function"!==typeof b.type?n("249",Array.isArray(b.type)?"array":null===b.type?"null":typeof b.type):void 0;if(!this._rendering){this._rendering=!0;this._element=b;var d=b.type.contextTypes;if(d){var c={},h;for(h in d)c[h]=a[h];a=c}else a=l;this._context=a;this._instance?
|
|
17
|
-
this._context,this._updater),this._updateStateFromStaticLifecycle(b.props),b.type.hasOwnProperty("contextTypes"),this._mountClassComponent(b,this._context)):this._rendered=b.type.call(void 0,b.props,this._context));this._rendering=!1;this._updater._invokeCallbacks();return this.getRenderOutput()}};a.prototype.unmount=
|
|
18
|
-
null};a.prototype._mountClassComponent=function(b,a){this._instance.context=a;this._instance.props=b.props;this._instance.state=this._instance.state||null;this._instance.updater=this._updater;if("function"===typeof this._instance.UNSAFE_componentWillMount||"function"===typeof this._instance.componentWillMount)a=
|
|
19
|
-
"function"===typeof this._instance.UNSAFE_componentWillMount&&this._instance.UNSAFE_componentWillMount()),a!==this._newState&&(this._instance.state=this._newState||l);this._rendered=this._instance.render()};a.prototype._updateClassComponent=function(a,c){var b=a.props,f=a.type,h=this._instance.state||
|
|
20
|
-
this._instance.componentWillReceiveProps(b,c),"function"===typeof this._instance.UNSAFE_componentWillReceiveProps&&this._instance.UNSAFE_componentWillReceiveProps(b,c));this._updateStateFromStaticLifecycle(b);var e=this._newState||h,k=!0;this._forcedUpdate?(k=!0,this._forcedUpdate=!1):"function"===
|
|
21
|
-
"function"!==typeof this._instance.getSnapshotBeforeUpdate&&("function"===typeof this._instance.componentWillUpdate&&this._instance.componentWillUpdate(b,e,c),"function"===typeof this._instance.UNSAFE_componentWillUpdate&&this._instance.UNSAFE_componentWillUpdate(b,e,c));this._instance.context=
|
|
22
|
-
this._newState||this._instance.state;a=b.getDerivedStateFromProps.call(null,a,c);null!=a&&(c=v({},c,a),this._instance.state=this._newState=c)}};return a}();m.createRenderer=function(){return new m};c=(c={default:m},m)||c;return c.default||c});
|
|
12
|
+
}var v=g.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.assign,c="function"===typeof Symbol&&Symbol.for,y=c?Symbol.for("react.element"):60103,F=c?Symbol.for("react.portal"):60106,A=c?Symbol.for("react.fragment"):60107,C=c?Symbol.for("react.strict_mode"):60108,B=c?Symbol.for("react.profiler"):60114,E=c?Symbol.for("react.provider"):60109,D=c?Symbol.for("react.context"):60110,z=c?Symbol.for("react.concurrent_mode"):60111,p=c?Symbol.for("react.forward_ref"):60112;c&&Symbol.for("react.suspense");c&&
|
|
13
|
+
Symbol.for("react.memo");c&&Symbol.for("react.lazy");var G=Object.prototype.hasOwnProperty,l={},H=function(){function a(b){u(this,a);this._renderer=b;this._callbacks=[]}a.prototype._enqueueCallback=function(b,a){"function"===typeof b&&a&&this._callbacks.push({callback:b,publicInstance:a})};a.prototype._invokeCallbacks=function(){var b=this._callbacks;this._callbacks=[];b.forEach(function(b){b.callback.call(b.publicInstance)})};a.prototype.isMounted=function(b){return!!this._renderer._element};a.prototype.enqueueForceUpdate=
|
|
14
|
+
function(b,a,d){this._enqueueCallback(a,b);this._renderer._forcedUpdate=!0;this._renderer.render(this._renderer._element,this._renderer._context)};a.prototype.enqueueReplaceState=function(b,a,d,c){this._enqueueCallback(d,b);this._renderer._newState=a;this._renderer.render(this._renderer._element,this._renderer._context)};a.prototype.enqueueSetState=function(b,a,d,c){this._enqueueCallback(d,b);d=this._renderer._newState||b.state;"function"===typeof a&&(a=a.call(b,d,b.props));null!==a&&void 0!==a&&
|
|
15
|
+
(this._renderer._newState=v({},d,a),this._renderer.render(this._renderer._element,this._renderer._context))};return a}(),m=function(){function a(){u(this,a);this._rendered=this._newState=this._instance=this._element=this._context=null;this._forcedUpdate=this._rendering=!1;this._updater=new H(this)}a.prototype.getMountedInstance=function(){return this._instance};a.prototype.getRenderOutput=function(){return this._rendered};a.prototype.render=function(b){var a=1<arguments.length&&void 0!==arguments[1]?
|
|
16
|
+
arguments[1]:l;g.isValidElement(b)?void 0:n("12","function"===typeof b?" Instead of passing a component class, make sure to instantiate it by passing it to React.createElement.":"");"string"===typeof b.type?n("13",b.type):void 0;q(b)!==p&&"function"!==typeof b.type?n("249",Array.isArray(b.type)?"array":null===b.type?"null":typeof b.type):void 0;if(!this._rendering){this._rendering=!0;this._element=b;var d=b.type.contextTypes;if(d){var c={},h;for(h in d)c[h]=a[h];a=c}else a=l;this._context=a;this._instance?
|
|
17
|
+
this._updateClassComponent(b,this._context):q(b)===p?this._rendered=b.type.render(b.props,b.ref):(a=b.type,a.prototype&&a.prototype.isReactComponent?(this._instance=new b.type(b.props,this._context,this._updater),this._updateStateFromStaticLifecycle(b.props),b.type.hasOwnProperty("contextTypes"),this._mountClassComponent(b,this._context)):this._rendered=b.type.call(void 0,b.props,this._context));this._rendering=!1;this._updater._invokeCallbacks();return this.getRenderOutput()}};a.prototype.unmount=
|
|
18
|
+
function(){this._instance&&"function"===typeof this._instance.componentWillUnmount&&this._instance.componentWillUnmount();this._instance=this._rendered=this._newState=this._element=this._context=null};a.prototype._mountClassComponent=function(b,a){this._instance.context=a;this._instance.props=b.props;this._instance.state=this._instance.state||null;this._instance.updater=this._updater;if("function"===typeof this._instance.UNSAFE_componentWillMount||"function"===typeof this._instance.componentWillMount)a=
|
|
19
|
+
this._newState,"function"!==typeof b.type.getDerivedStateFromProps&&"function"!==typeof this._instance.getSnapshotBeforeUpdate&&("function"===typeof this._instance.componentWillMount&&this._instance.componentWillMount(),"function"===typeof this._instance.UNSAFE_componentWillMount&&this._instance.UNSAFE_componentWillMount()),a!==this._newState&&(this._instance.state=this._newState||l);this._rendered=this._instance.render()};a.prototype._updateClassComponent=function(a,c){var b=a.props,f=a.type,h=this._instance.state||
|
|
20
|
+
l,g=this._instance.props;g!==b&&"function"!==typeof a.type.getDerivedStateFromProps&&"function"!==typeof this._instance.getSnapshotBeforeUpdate&&("function"===typeof this._instance.componentWillReceiveProps&&this._instance.componentWillReceiveProps(b,c),"function"===typeof this._instance.UNSAFE_componentWillReceiveProps&&this._instance.UNSAFE_componentWillReceiveProps(b,c));this._updateStateFromStaticLifecycle(b);var e=this._newState||h,k=!0;this._forcedUpdate?(k=!0,this._forcedUpdate=!1):"function"===
|
|
21
|
+
typeof this._instance.shouldComponentUpdate?k=!!this._instance.shouldComponentUpdate(b,e,c):f.prototype&&f.prototype.isPureReactComponent&&(k=!t(g,b)||!t(h,e));k&&"function"!==typeof a.type.getDerivedStateFromProps&&"function"!==typeof this._instance.getSnapshotBeforeUpdate&&("function"===typeof this._instance.componentWillUpdate&&this._instance.componentWillUpdate(b,e,c),"function"===typeof this._instance.UNSAFE_componentWillUpdate&&this._instance.UNSAFE_componentWillUpdate(b,e,c));this._instance.context=
|
|
22
|
+
c;this._instance.props=b;this._instance.state=e;k&&(this._rendered=this._instance.render())};a.prototype._updateStateFromStaticLifecycle=function(a){var b=this._element.type;if("function"===typeof b.getDerivedStateFromProps){var c=this._newState||this._instance.state;a=b.getDerivedStateFromProps.call(null,a,c);null!=a&&(c=v({},c,a),this._instance.state=this._newState=c)}};return a}();m.createRenderer=function(){return new m};c=(c={default:m},m)||c;return c.default||c});
|