22 lines
5.0 KiB
JavaScript
22 lines
5.0 KiB
JavaScript
/** @license React v16.2.0
|
|
* react-test-renderer-shallow.production.min.js
|
|
*
|
|
* Copyright (c) 2013-present, Facebook, Inc.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
'use strict';var d=require("object-assign"),h=require("react"),l=require("fbjs/lib/emptyObject"),m=require("fbjs/lib/shallowEqual"),n=require("prop-types/checkPropTypes");
|
|
function p(b){for(var a=arguments.length-1,c="Minified React error #"+b+"; visit http://facebook.github.io/react/docs/error-decoder.html?invariant\x3d"+b,f=0;f<a;f++)c+="\x26args[]\x3d"+encodeURIComponent(arguments[f+1]);a=Error(c+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings.");a.name="Invariant Violation";a.framesToPop=1;throw a;}function q(b,a){if(!(b instanceof a))throw new TypeError("Cannot call a class as a function");}
|
|
var w=function(){function b(){q(this,b);this._rendered=this._newState=this._instance=this._element=this._context=null;this._forcedUpdate=this._rendering=!1;this._updater=new t(this)}b.prototype.getMountedInstance=function(){return this._instance};b.prototype.getRenderOutput=function(){return this._rendered};b.prototype.render=function(a){var c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:l;h.isValidElement(a)?void 0:p("12","function"===typeof a?" Instead of passing a component class, make sure to instantiate it by passing it to React.createElement.":
|
|
"");"string"===typeof a.type?p("13",a.type):void 0;"function"!==typeof a.type?p("249",Array.isArray(a.type)?"array":null===a.type?"null":typeof a.type):void 0;if(!this._rendering){this._rendering=!0;this._element=a;this._context=c;if(this._instance)this._updateClassComponent(a.type,a.props,c);else{var b=a.type;if(b.prototype&&b.prototype.isReactComponent){this._instance=new a.type(a.props,c,this._updater);if(a.type.hasOwnProperty("contextTypes")){u=a;b=a.type;var e=this._instance;e=e&&e.constructor;
|
|
n(a.type.contextTypes,c,"context",b.displayName||e&&e.displayName||b.name||e&&e.name||null,v);u=null}this._mountClassComponent(a.props,c)}else this._rendered=a.type(a.props,c)}this._rendering=!1;this._updater._invokeCallbacks();return this.getRenderOutput()}};b.prototype.unmount=function(){this._instance&&"function"===typeof this._instance.componentWillUnmount&&this._instance.componentWillUnmount();this._instance=this._rendered=this._newState=this._element=this._context=null};b.prototype._mountClassComponent=
|
|
function(a,c){this._instance.context=c;this._instance.props=a;this._instance.state=this._instance.state||l;this._instance.updater=this._updater;"function"===typeof this._instance.componentWillMount&&(a=this._newState,this._instance.componentWillMount(),a!==this._newState&&(this._instance.state=this._newState||l));this._rendered=this._instance.render()};b.prototype._updateClassComponent=function(a,c,b){var f=this._instance.state||l,r=this._instance.props;r!==c&&"function"===typeof this._instance.componentWillReceiveProps&&
|
|
this._instance.componentWillReceiveProps(c,b);var k=this._newState||f,g=!0;this._forcedUpdate?(g=!0,this._forcedUpdate=!1):"function"===typeof this._instance.shouldComponentUpdate?g=!!this._instance.shouldComponentUpdate(c,k,b):a.prototype&&a.prototype.isPureReactComponent&&(g=!m(r,c)||!m(f,k));g&&"function"===typeof this._instance.componentWillUpdate&&this._instance.componentWillUpdate(c,k,b);this._instance.context=b;this._instance.props=c;this._instance.state=k;g&&(this._rendered=this._instance.render())};
|
|
return b}();w.createRenderer=function(){return new w};
|
|
var t=function(){function b(a){q(this,b);this._renderer=a;this._callbacks=[]}b.prototype._enqueueCallback=function(a,c){"function"===typeof a&&c&&this._callbacks.push({callback:a,publicInstance:c})};b.prototype._invokeCallbacks=function(){var a=this._callbacks;this._callbacks=[];a.forEach(function(a){a.callback.call(a.publicInstance)})};b.prototype.isMounted=function(){return!!this._renderer._element};b.prototype.enqueueForceUpdate=function(a,c){this._enqueueCallback(c,a);this._renderer._forcedUpdate=
|
|
!0;this._renderer.render(this._renderer._element,this._renderer._context)};b.prototype.enqueueReplaceState=function(a,c,b){this._enqueueCallback(b,a);this._renderer._newState=c;this._renderer.render(this._renderer._element,this._renderer._context)};b.prototype.enqueueSetState=function(a,c,b){this._enqueueCallback(b,a);b=this._renderer._newState||a.state;"function"===typeof c&&(c=c(b,a.props));this._renderer._newState=d({},b,c);this._renderer.render(this._renderer._element,this._renderer._context)};
|
|
return b}(),u=null;function v(){var b="";if(u){var a=null==u?"#empty":"string"===typeof u||"number"===typeof u?"#text":"string"===typeof u.type?u.type:u.type.displayName||u.type.name||"Unknown",c=u._owner,f=u._source,e;if(e=c)c=c.type,e="string"===typeof c?c:"function"===typeof c?c.displayName||c.name:null;c=e;a="\n in "+(a||"Unknown")+(f?" (at "+f.fileName.replace(/^.*[\\\/]/,"")+":"+f.lineNumber+")":c?" (created by "+c+")":"");b+=a}return b}var x=Object.freeze({default:w}),y=x&&w||x;
|
|
module.exports=y["default"]?y["default"]:y;
|