UNPKG

11.6 kBJavaScriptView Raw
1/** @license React v16.9.0
2 * react-dom-test-utils.production.min.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'use strict';(function(l,n){"object"===typeof exports&&"undefined"!==typeof module?module.exports=n(require("react"),require("react-dom")):"function"===typeof define&&define.amd?define(["react","react-dom"],n):l.ReactTestUtils=n(l.React,l.ReactDOM)})(this,function(l,n){function m(a){for(var b=a.message,c="https://reactjs.org/docs/error-decoder.html?invariant="+b,e=1;e<arguments.length;e++)c+="&args[]="+encodeURIComponent(arguments[e]);a.message="Minified React error #"+b+"; visit "+c+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ";
10return a}function F(a){var b=a;if(a.alternate)for(;b.return;)b=b.return;else{if(0!==(b.effectTag&2))return 1;for(;b.return;)if(b=b.return,0!==(b.effectTag&2))return 1}return 3===b.tag?2:3}function G(a){if(2!==F(a))throw m(Error(188));}function Q(a){var b=a.alternate;if(!b){b=F(a);if(3===b)throw m(Error(188));return 1===b?null:a}for(var c=a,e=b;;){var d=c.return;if(null===d)break;var h=d.alternate;if(null===h){e=d.return;if(null!==e){c=e;continue}break}if(d.child===h.child){for(h=d.child;h;){if(h===
11c)return G(d),a;if(h===e)return G(d),b;h=h.sibling}throw m(Error(188));}if(c.return!==e.return)c=d,e=h;else{for(var g=!1,f=d.child;f;){if(f===c){g=!0;c=d;e=h;break}if(f===e){g=!0;e=d;c=h;break}f=f.sibling}if(!g){for(f=h.child;f;){if(f===c){g=!0;c=h;e=d;break}if(f===e){g=!0;e=h;c=d;break}f=f.sibling}if(!g)throw m(Error(189));}}if(c.alternate!==e)throw m(Error(190));}if(3!==c.tag)throw m(Error(188));return c.stateNode.current===c?a:b}function u(){return!0}function v(){return!1}function r(a,b,c,e){this.dispatchConfig=
12a;this._targetInst=b;this.nativeEvent=c;a=this.constructor.Interface;for(var d in a)a.hasOwnProperty(d)&&((b=a[d])?this[d]=b(c):"target"===d?this.target=e:this[d]=c[d]);this.isDefaultPrevented=(null!=c.defaultPrevented?c.defaultPrevented:!1===c.returnValue)?u:v;this.isPropagationStopped=v;return this}function R(a,b,c,e){if(this.eventPool.length){var d=this.eventPool.pop();this.call(d,a,b,c,e);return d}return new this(a,b,c,e)}function S(a){if(!(a instanceof this))throw m(Error(279));a.destructor();
1310>this.eventPool.length&&this.eventPool.push(a)}function H(a){a.eventPool=[];a.getPooled=R;a.release=S}function w(a,b){var c={};c[a.toLowerCase()]=b.toLowerCase();c["Webkit"+a]="webkit"+b;c["Moz"+a]="moz"+b;return c}function x(a){if(A[a])return A[a];if(!p[a])return a;var b=p[a],c;for(c in b)if(b.hasOwnProperty(c)&&c in I)return A[a]=b[c];return a}function J(a){try{B(),T(function(){B()?J(a):a()})}catch(b){a(b)}}function U(a){function b(){y--;C.current=c;D.current=e}!1===K&&(K=!0,console.error("act(...) is not supported in production builds of React, and might not behave as expected."));
14var c=void 0,e=void 0;y++;c=C.current;e=D.current;C.current=!0;D.current=!0;var d=void 0;try{d=V(a)}catch(h){throw b(),h;}if(null!==d&&"object"===typeof d&&"function"===typeof d.then)return{then:function(a,e){d.then(function(){1<y||!0===L&&!0===c?(b(),a()):J(function(c){b();c?e(c):a()})},function(a){b();e(a)})}};try{1!==y||!1!==L&&!1!==c||B(),b()}catch(h){throw b(),h;}return{then:function(a){a()}}}function M(a){}function W(a,b){if(!a)return[];a=Q(a);if(!a)return[];for(var c=a,e=[];;){if(5===c.tag||
156===c.tag||1===c.tag||0===c.tag){var d=c.stateNode;b(d)&&e.push(d)}if(c.child)c.child.return=c,c=c.child;else{if(c===a)return e;for(;!c.sibling;){if(!c.return||c.return===a)return e;c=c.return}c.sibling.return=c.return;c=c.sibling}}}function k(a,b){if(a&&!a._reactInternalFiber){var c=""+a;a=Array.isArray(a)?"an array":a&&1===a.nodeType&&a.tagName?"a DOM node":"[object Object]"===c?"object with keys {"+Object.keys(a).join(", ")+"}":c;throw m(Error(286),b,a);}}function X(a){return function(b,c){if(l.isValidElement(b))throw m(Error(228));
16if(f.isCompositeComponent(b))throw m(Error(229));var e=N[a],d=new M;d.target=b;d.type=a.toLowerCase();var g=Y(b),k=new r(e,g,d,b);k.persist();t(k,c);e.phasedRegistrationNames?Z(k):aa(k);n.unstable_batchedUpdates(function(){ba(b);ca(k)});da()}}function ea(a,b){return function(c,e){var d=new M(a);t(d,e);f.isDOMComponent(c)?(c=fa(c),d.target=c,O(b,1,d)):c.tagName&&(d.target=c,O(b,1,d))}}var t=l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.assign,g=l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
17g.hasOwnProperty("ReactCurrentDispatcher")||(g.ReactCurrentDispatcher={current:null});g.hasOwnProperty("ReactCurrentBatchConfig")||(g.ReactCurrentBatchConfig={suspense:null});t(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():"unknown"!==typeof a.returnValue&&(a.returnValue=!1),this.isDefaultPrevented=u)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():"unknown"!==typeof a.cancelBubble&&
18(a.cancelBubble=!0),this.isPropagationStopped=u)},persist:function(){this.isPersistent=u},isPersistent:v,destructor:function(){var a=this.constructor.Interface,b;for(b in a)this[b]=null;this.nativeEvent=this._targetInst=this.dispatchConfig=null;this.isPropagationStopped=this.isDefaultPrevented=v;this._dispatchInstances=this._dispatchListeners=null}});r.Interface={type:null,target:null,currentTarget:function(){return null},eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(a){return a.timeStamp||
19Date.now()},defaultPrevented:null,isTrusted:null};r.extend=function(a){function b(){return c.apply(this,arguments)}var c=this,e=function(){};e.prototype=c.prototype;e=new e;t(e,b.prototype);b.prototype=e;b.prototype.constructor=b;b.Interface=t({},c.Interface,a);b.extend=c.extend;H(b);return b};H(r);var E=!("undefined"===typeof window||"undefined"===typeof window.document||"undefined"===typeof window.document.createElement),p={animationend:w("Animation","AnimationEnd"),animationiteration:w("Animation",
20"AnimationIteration"),animationstart:w("Animation","AnimationStart"),transitionend:w("Transition","TransitionEnd")},A={},I={};E&&(I=document.createElement("div").style,"AnimationEvent"in window||(delete p.animationend.animation,delete p.animationiteration.animation,delete p.animationstart.animation),"TransitionEvent"in window||delete p.transitionend.transition);E=x("animationend");var ha=x("animationiteration"),ia=x("animationstart"),ja=x("transitionend"),q=void 0;try{var z=("require"+Math.random()).slice(0,
217);q=(module&&module[z])("timers").setImmediate}catch(a){q=function(a){var b=new MessageChannel;b.port1.onmessage=a;b.port2.postMessage(void 0)}}var T=q;z=l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_flushAllWithoutAsserting;q=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Events;var ka=q[11],D=q[12],V=n.unstable_batchedUpdates,C=g.IsSomeRendererActing,L="function"===typeof z,B=z||function(){for(var a=!1;ka();)a=!0;return a},y=0,K=!1,fa=n.findDOMNode;g=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Events;
22var Y=g[0],N=g[4],Z=g[5],aa=g[6],ba=g[7],da=g[8],O=g[9],ca=g[10],P=null,f={renderIntoDocument:function(a){var b=document.createElement("div");return n.render(a,b)},isElement:function(a){return l.isValidElement(a)},isElementOfType:function(a,b){return l.isValidElement(a)&&a.type===b},isDOMComponent:function(a){return!(!a||1!==a.nodeType||!a.tagName)},isDOMComponentElement:function(a){return!!(a&&l.isValidElement(a)&&a.tagName)},isCompositeComponent:function(a){return f.isDOMComponent(a)?!1:null!=a&&
23"function"===typeof a.render&&"function"===typeof a.setState},isCompositeComponentWithType:function(a,b){return f.isCompositeComponent(a)?a._reactInternalFiber.type===b:!1},findAllInRenderedTree:function(a,b){k(a,"findAllInRenderedTree");return a?W(a._reactInternalFiber,b):[]},scryRenderedDOMComponentsWithClass:function(a,b){k(a,"scryRenderedDOMComponentsWithClass");return f.findAllInRenderedTree(a,function(a){if(f.isDOMComponent(a)){var c=a.className;"string"!==typeof c&&(c=a.getAttribute("class")||
24"");var d=c.split(/\s+/);if(!Array.isArray(b)){if(void 0===b)throw m(Error(11));b=b.split(/\s+/)}return b.every(function(a){return-1!==d.indexOf(a)})}return!1})},findRenderedDOMComponentWithClass:function(a,b){k(a,"findRenderedDOMComponentWithClass");a=f.scryRenderedDOMComponentsWithClass(a,b);if(1!==a.length)throw Error("Did not find exactly one match (found: "+a.length+") for class:"+b);return a[0]},scryRenderedDOMComponentsWithTag:function(a,b){k(a,"scryRenderedDOMComponentsWithTag");return f.findAllInRenderedTree(a,
25function(a){return f.isDOMComponent(a)&&a.tagName.toUpperCase()===b.toUpperCase()})},findRenderedDOMComponentWithTag:function(a,b){k(a,"findRenderedDOMComponentWithTag");a=f.scryRenderedDOMComponentsWithTag(a,b);if(1!==a.length)throw Error("Did not find exactly one match (found: "+a.length+") for tag:"+b);return a[0]},scryRenderedComponentsWithType:function(a,b){k(a,"scryRenderedComponentsWithType");return f.findAllInRenderedTree(a,function(a){return f.isCompositeComponentWithType(a,b)})},findRenderedComponentWithType:function(a,
26b){k(a,"findRenderedComponentWithType");a=f.scryRenderedComponentsWithType(a,b);if(1!==a.length)throw Error("Did not find exactly one match (found: "+a.length+") for componentType:"+b);return a[0]},mockComponent:function(a,b){b=b||a.mockTagName||"div";a.prototype.render.mockImplementation(function(){return l.createElement(b,null,this.props.children)});return this},nativeTouchData:function(a,b){return{touches:[{pageX:a,pageY:b}]}},Simulate:null,SimulateNative:{},act:function(a){null===P&&(P=document.createElement("div"));
27return U(a)}};(function(){f.Simulate={};var a=void 0;for(a in N)f.Simulate[a]=X(a)})();[["abort","abort"],[E,"animationEnd"],[ha,"animationIteration"],[ia,"animationStart"],["blur","blur"],["canplaythrough","canPlayThrough"],["canplay","canPlay"],["cancel","cancel"],["change","change"],["click","click"],["close","close"],["compositionend","compositionEnd"],["compositionstart","compositionStart"],["compositionupdate","compositionUpdate"],["contextmenu","contextMenu"],["copy","copy"],["cut","cut"],
28["dblclick","doubleClick"],["dragend","dragEnd"],["dragenter","dragEnter"],["dragexit","dragExit"],["dragleave","dragLeave"],["dragover","dragOver"],["dragstart","dragStart"],["drag","drag"],["drop","drop"],["durationchange","durationChange"],["emptied","emptied"],["encrypted","encrypted"],["ended","ended"],["error","error"],["focus","focus"],["input","input"],["keydown","keyDown"],["keypress","keyPress"],["keyup","keyUp"],["loadstart","loadStart"],["loadstart","loadStart"],["load","load"],["loadeddata",
29"loadedData"],["loadedmetadata","loadedMetadata"],["mousedown","mouseDown"],["mousemove","mouseMove"],["mouseout","mouseOut"],["mouseover","mouseOver"],["mouseup","mouseUp"],["paste","paste"],["pause","pause"],["play","play"],["playing","playing"],["progress","progress"],["ratechange","rateChange"],["scroll","scroll"],["seeked","seeked"],["seeking","seeking"],["selectionchange","selectionChange"],["stalled","stalled"],["suspend","suspend"],["textInput","textInput"],["timeupdate","timeUpdate"],["toggle",
30"toggle"],["touchcancel","touchCancel"],["touchend","touchEnd"],["touchmove","touchMove"],["touchstart","touchStart"],[ja,"transitionEnd"],["volumechange","volumeChange"],["waiting","waiting"],["wheel","wheel"]].forEach(function(a){var b=a[1];f.SimulateNative[b]=ea(b,a[0])});g=(g={default:f},f)||g;return g.default||g});