UNPKG

10.7 kBJavaScriptView Raw
1/** @license React v16.9.0-alpha.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(h,l){"object"===typeof exports&&"undefined"!==typeof module?module.exports=l(require("react"),require("react-dom")):"function"===typeof define&&define.amd?define(["react","react-dom"],l):h.ReactTestUtils=l(h.React,h.ReactDOM)})(this,function(h,l){function m(a){for(var b="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=1;c<arguments.length;c++)b+="&args[]="+encodeURIComponent(arguments[c]);return Error("Minified React error #"+a+"; visit "+b+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ")}
10function x(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 I(a){var b=a.alternate;if(!b){b=x(a);if(3===b)throw m(188);return 1===b?null:a}for(var c=a,e=b;;){var d=c.return,f=d?d.alternate:null;if(!d||!f)break;if(d.child===f.child){for(f=d.child;f;){if(f===c){if(2!==x(d))break;return a}if(f===e){if(2!==x(d))break;return b}f=f.sibling}throw m(188);}if(c.return!==e.return)c=
11d,e=f;else{for(var g=!1,h=d.child;h;){if(h===c){g=!0;c=d;e=f;break}if(h===e){g=!0;e=d;c=f;break}h=h.sibling}if(!g){for(h=f.child;h;){if(h===c){g=!0;c=f;e=d;break}if(h===e){g=!0;e=f;c=d;break}h=h.sibling}if(!g)throw m(189);}}if(c.alternate!==e)throw m(190);}if(3!==c.tag)throw m(188);return c.stateNode.current===c?a:b}function t(){return!0}function u(){return!1}function q(a,b,c,e){this.dispatchConfig=a;this._targetInst=b;this.nativeEvent=c;a=this.constructor.Interface;for(var d in a)a.hasOwnProperty(d)&&
12((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)?t:u;this.isPropagationStopped=u;return this}function J(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 K(a){if(!(a instanceof this))throw m(279);a.destructor();10>this.eventPool.length&&this.eventPool.push(a)}function B(a){a.eventPool=[];a.getPooled=J;a.release=K}function v(a,
13b){var c={};c[a.toLowerCase()]=b.toLowerCase();c["Webkit"+a]="webkit"+b;c["Moz"+a]="moz"+b;return c}function w(a){if(y[a])return y[a];if(!n[a])return a;var b=n[a],c;for(c in b)if(b.hasOwnProperty(c)&&c in C)return y[a]=b[c];return a}function D(a){try{z(),L(function(){z()?D(a):a()})}catch(b){a(b)}}function M(a){var b=N(a);if(null!==b&&"object"===typeof b&&"function"===typeof b.then)return{then:function(a,e){b.then(function(){D(function(b){b?e(b):a()})},function(a){e(a)})}};try{for(;z(););}catch(c){throw c;
14}return{then:function(a){a()}}}function E(a){}function O(a,b){if(!a)return[];a=I(a);if(!a)return[];for(var c=a,e=[];;){if(5===c.tag||6===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]"===
15c?"object with keys {"+Object.keys(a).join(", ")+"}":c;throw m(286,b,a);}}function P(a){return function(b,c){if(h.isValidElement(b))throw m(228);if(f.isCompositeComponent(b))throw m(229);var e=F[a],d=new E;d.target=b;d.type=a.toLowerCase();var g=Q(b),k=new q(e,g,d,b);k.persist();r(k,c);e.phasedRegistrationNames?R(k):S(k);l.unstable_batchedUpdates(function(){T(b);U(k)});V()}}function W(a,b){return function(c,e){var d=new E(a);r(d,e);f.isDOMComponent(c)?(c=X(c),d.target=c,G(b,1,d)):c.tagName&&(d.target=
16c,G(b,1,d))}}var r=h.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.assign,p=h.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;p.hasOwnProperty("ReactCurrentDispatcher")||(p.ReactCurrentDispatcher={current:null});r(q.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():"unknown"!==typeof a.returnValue&&(a.returnValue=!1),this.isDefaultPrevented=t)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?
17a.stopPropagation():"unknown"!==typeof a.cancelBubble&&(a.cancelBubble=!0),this.isPropagationStopped=t)},persist:function(){this.isPersistent=t},isPersistent:u,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=u;this._dispatchInstances=this._dispatchListeners=null}});q.Interface={type:null,target:null,currentTarget:function(){return null},eventPhase:null,bubbles:null,
18cancelable:null,timeStamp:function(a){return a.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null};q.extend=function(a){function b(){return c.apply(this,arguments)}var c=this,e=function(){};e.prototype=c.prototype;e=new e;r(e,b.prototype);b.prototype=e;b.prototype.constructor=b;b.Interface=r({},c.Interface,a);b.extend=c.extend;B(b);return b};B(q);p=!("undefined"===typeof window||!window.document||!window.document.createElement);var n={animationend:v("Animation","AnimationEnd"),animationiteration:v("Animation",
19"AnimationIteration"),animationstart:v("Animation","AnimationStart"),transitionend:v("Transition","TransitionEnd")},y={},C={};p&&(C=document.createElement("div").style,"AnimationEvent"in window||(delete n.animationend.animation,delete n.animationiteration.animation,delete n.animationstart.animation),"TransitionEvent"in window||delete n.transitionend.transition);p=w("animationend");var Y=w("animationiteration"),Z=w("animationstart"),aa=w("transitionend"),A=void 0;try{var g=("require"+Math.random()).slice(0,
207);A=(module&&module[g])("timers").setImmediate}catch(a){A=function(a){var b=new MessageChannel;b.port1.onmessage=a;b.port2.postMessage(void 0)}}var L=A,z=l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Events[11],N=l.unstable_batchedUpdates,X=l.findDOMNode;g=l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Events;var Q=g[0],F=g[4],R=g[5],S=g[6],T=g[7],V=g[8],G=g[9],U=g[10],H=null,f={renderIntoDocument:function(a){var b=document.createElement("div");return l.render(a,b)},isElement:function(a){return h.isValidElement(a)},
21isElementOfType:function(a,b){return h.isValidElement(a)&&a.type===b},isDOMComponent:function(a){return!(!a||1!==a.nodeType||!a.tagName)},isDOMComponentElement:function(a){return!!(a&&h.isValidElement(a)&&a.tagName)},isCompositeComponent:function(a){return f.isDOMComponent(a)?!1:null!=a&&"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,
22"findAllInRenderedTree");return a?O(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")||"");var d=c.split(/\s+/);if(!Array.isArray(b)){if(void 0===b)throw m(11);b=b.split(/\s+/)}return b.every(function(a){return-1!==d.indexOf(a)})}return!1})},findRenderedDOMComponentWithClass:function(a,b){k(a,"findRenderedDOMComponentWithClass");
23a=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,function(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: "+
24a.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,b){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";
25a.prototype.render.mockImplementation(function(){return h.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===H&&(H=document.createElement("div"));return M(a)}};(function(){f.Simulate={};var a=void 0;for(a in F)f.Simulate[a]=P(a)})();[["abort","abort"],[p,"animationEnd"],[Y,"animationIteration"],[Z,"animationStart"],["blur","blur"],["canplaythrough","canPlayThrough"],["canplay",
26"canPlay"],["cancel","cancel"],["change","change"],["click","click"],["close","close"],["compositionend","compositionEnd"],["compositionstart","compositionStart"],["compositionupdate","compositionUpdate"],["contextmenu","contextMenu"],["copy","copy"],["cut","cut"],["dblclick","doubleClick"],["dragend","dragEnd"],["dragenter","dragEnter"],["dragexit","dragExit"],["dragleave","dragLeave"],["dragover","dragOver"],["dragstart","dragStart"],["drag","drag"],["drop","drop"],["durationchange","durationChange"],
27["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","loadedData"],["loadedmetadata","loadedMetadata"],["mousedown","mouseDown"],["mousemove","mouseMove"],["mouseout","mouseOut"],["mouseover","mouseOver"],["mouseup","mouseUp"],["paste","paste"],["pause","pause"],["play","play"],["playing",
28"playing"],["progress","progress"],["ratechange","rateChange"],["scroll","scroll"],["seeked","seeked"],["seeking","seeking"],["selectionchange","selectionChange"],["stalled","stalled"],["suspend","suspend"],["textInput","textInput"],["timeupdate","timeUpdate"],["toggle","toggle"],["touchcancel","touchCancel"],["touchend","touchEnd"],["touchmove","touchMove"],["touchstart","touchStart"],[aa,"transitionEnd"],["volumechange","volumeChange"],["waiting","waiting"],["wheel","wheel"]].forEach(function(a){var b=
29a[1];f.SimulateNative[b]=W(b,a[0])});g=(g={default:f},f)||g;return g.default||g});