UNPKG

10.2 kBJavaScriptView Raw
1/** @license React v16.7.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 H(a,b,c,e,d,f,g,h){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 I=[c,e,d,f,g,h],k=0;a=Error(b.replace(/%s/g,
10function(){return I[k++]}));a.name="Invariant Violation"}a.framesToPop=1;throw a;}}function k(a){for(var b=arguments.length-1,c="https://reactjs.org/docs/error-decoder.html?invariant="+a,e=0;e<b;e++)c+="&args[]="+encodeURIComponent(arguments[e+1]);H(!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. ",c)}function A(a){var b=a;if(a.alternate)for(;b.return;)b=b.return;else{if(0!==(b.effectTag&2))return 1;
11for(;b.return;)if(b=b.return,0!==(b.effectTag&2))return 1}return 3===b.tag?2:3}function B(a){2!==A(a)?k("188"):void 0}function J(a){var b=a.alternate;if(!b)return b=A(a),3===b?k("188"):void 0,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(var g=d.child;g;){if(g===c)return B(d),a;if(g===e)return B(d),b;g=g.sibling}k("188")}if(c.return!==e.return)c=d,e=f;else{g=!1;for(var h=d.child;h;){if(h===c){g=!0;c=d;e=f;break}if(h===e){g=!0;e=d;c=f;
12break}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}g?void 0:k("189")}}c.alternate!==e?k("190"):void 0}3!==c.tag?k("188"):void 0;return c.stateNode.current===c?a:b}function v(){return!0}function w(){return!1}function t(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)&&((b=a[d])?this[d]=b(c):"target"===d?this.target=e:this[d]=c[d]);this.isDefaultPrevented=
13(null!=c.defaultPrevented?c.defaultPrevented:!1===c.returnValue)?v:w;this.isPropagationStopped=w;return this}function K(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 L(a){a instanceof this?void 0:k("279");a.destructor();10>this.eventPool.length&&this.eventPool.push(a)}function C(a){a.eventPool=[];a.getPooled=K;a.release=L}function x(a,b){var c={};c[a.toLowerCase()]=b.toLowerCase();c["Webkit"+a]="webkit"+b;c["Moz"+a]="moz"+
14b;return c}function y(a){if(z[a])return z[a];if(!r[a])return a;var b=r[a],c;for(c in b)if(b.hasOwnProperty(c)&&c in D)return z[a]=b[c];return a}function E(a){}function M(a,b){if(!a)return[];a=J(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 q(a,b){if(a&&
15!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;k("286",b,a)}}function N(a){return function(b,c){l.isValidElement(b)?k("228"):void 0;f.isCompositeComponent(b)?k("229"):void 0;var e=F[a],d=new E;d.target=b;d.type=a.toLowerCase();var m=O(b),g=new t(e,m,d,b);g.persist();u(g,c);e.phasedRegistrationNames?P(g):Q(g);n.unstable_batchedUpdates(function(){R(b);S(g)});T()}}function U(a,
16b){return function(c,e){var d=new E(a);u(d,e);f.isDOMComponent(c)?(c=V(c),d.target=c,G(b,d)):c.tagName&&(d.target=c,G(b,d))}}var u=l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.assign;u(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():"unknown"!==typeof a.returnValue&&(a.returnValue=!1),this.isDefaultPrevented=v)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():"unknown"!==
17typeof a.cancelBubble&&(a.cancelBubble=!0),this.isPropagationStopped=v)},persist:function(){this.isPersistent=v},isPersistent:w,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=w;this._dispatchInstances=this._dispatchListeners=null}});t.Interface={type:null,target:null,currentTarget:function(){return null},eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(a){return a.timeStamp||
18Date.now()},defaultPrevented:null,isTrusted:null};t.extend=function(a){function b(){return c.apply(this,arguments)}var c=this,e=function(){};e.prototype=c.prototype;e=new e;u(e,b.prototype);b.prototype=e;b.prototype.constructor=b;b.Interface=u({},c.Interface,a);b.extend=c.extend;C(b);return b};C(t);var m=!("undefined"===typeof window||!window.document||!window.document.createElement),r={animationend:x("Animation","AnimationEnd"),animationiteration:x("Animation","AnimationIteration"),animationstart:x("Animation",
19"AnimationStart"),transitionend:x("Transition","TransitionEnd")},z={},D={};m&&(D=document.createElement("div").style,"AnimationEvent"in window||(delete r.animationend.animation,delete r.animationiteration.animation,delete r.animationstart.animation),"TransitionEvent"in window||delete r.transitionend.transition);m=y("animationend");var W=y("animationiteration"),X=y("animationstart"),Y=y("transitionend"),V=n.findDOMNode,p=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Events,O=p[0],F=p[4],P=p[5],
20Q=p[6],R=p[7],T=p[8],G=p[9],S=p[10],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&&"function"===typeof a.render&&"function"===
21typeof a.setState},isCompositeComponentWithType:function(a,b){return f.isCompositeComponent(a)?a._reactInternalFiber.type===b:!1},findAllInRenderedTree:function(a,b){q(a,"findAllInRenderedTree");return a?M(a._reactInternalFiber,b):[]},scryRenderedDOMComponentsWithClass:function(a,b){q(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+/);Array.isArray(b)||
22(void 0===b?k("11"):void 0,b=b.split(/\s+/));return b.every(function(a){return-1!==d.indexOf(a)})}return!1})},findRenderedDOMComponentWithClass:function(a,b){q(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){q(a,"scryRenderedDOMComponentsWithTag");return f.findAllInRenderedTree(a,function(a){return f.isDOMComponent(a)&&
23a.tagName.toUpperCase()===b.toUpperCase()})},findRenderedDOMComponentWithTag:function(a,b){q(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){q(a,"scryRenderedComponentsWithType");return f.findAllInRenderedTree(a,function(a){return f.isCompositeComponentWithType(a,b)})},findRenderedComponentWithType:function(a,b){q(a,
24"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:{}};(function(){f.Simulate={};var a=void 0;for(a in F)f.Simulate[a]=
25N(a)})();[["abort","abort"],[m,"animationEnd"],[W,"animationIteration"],[X,"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"],["dblclick","doubleClick"],["dragend","dragEnd"],["dragenter","dragEnter"],["dragexit",
26"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","loadedData"],["loadedmetadata","loadedMetadata"],["mousedown","mouseDown"],["mousemove",
27"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","toggle"],["touchcancel","touchCancel"],["touchend","touchEnd"],["touchmove","touchMove"],
28["touchstart","touchStart"],[Y,"transitionEnd"],["volumechange","volumeChange"],["waiting","waiting"],["wheel","wheel"]].forEach(function(a){var b=a[1];f.SimulateNative[b]=U(b,a[0])});m=(m={default:f},f)||m;return m.default||m});