aboutsummaryrefslogtreecommitdiff
path: root/node_modules/react-dom/umd/react-dom-test-utils.production.min.js
blob: ca91ac61f0db02f6c6b6ce5e587a9c7bfdcc95f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/** @license React v16.2.0
 * react-dom-test-utils.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';(function(m,p){"object"===typeof exports&&"undefined"!==typeof module?module.exports=p(require("react"),require("react-dom")):"function"===typeof define&&define.amd?define(["react","react-dom"],p):m.ReactTestUtils=p(m.React,m.ReactDOM)})(this,function(m,p){function k(a){for(var b=arguments.length-1,c="Minified React error #"+a+"; visit http://facebook.github.io/react/docs/error-decoder.html?invariant\x3d"+a,f=0;f<b;f++)c+="\x26args[]\x3d"+encodeURIComponent(arguments[f+1]);b=Error(c+
" for the full message or use the non-minified dev environment for full errors and additional helpful warnings.");b.name="Invariant Violation";b.framesToPop=1;throw b;}function v(a){return function(){return a}}function A(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 B(a){2!==A(a)?k("188"):void 0}function I(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,f=b;;){var g=c["return"],e=g?g.alternate:null;if(!g||!e)break;if(g.child===e.child){for(var d=g.child;d;){if(d===c)return B(g),a;if(d===f)return B(g),b;d=d.sibling}k("188")}if(c["return"]!==f["return"])c=g,f=e;else{d=!1;for(var l=g.child;l;){if(l===c){d=!0;c=g;f=e;break}if(l===f){d=!0;f=g;c=e;break}l=l.sibling}if(!d){for(l=e.child;l;){if(l===c){d=!0;c=e;f=g;break}if(l===f){d=!0;f=e;c=g;break}l=l.sibling}d?void 0:k("189")}}c.alternate!==f?k("190"):void 0}3!==c.tag?k("188"):
void 0;return c.stateNode.current===c?a:b}function t(a,b,c,f){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=f:this[d]=c[d]);this.isDefaultPrevented=(null!=c.defaultPrevented?c.defaultPrevented:!1===c.returnValue)?n.thatReturnsTrue:n.thatReturnsFalse;this.isPropagationStopped=n.thatReturnsFalse;return this}function J(a,b,c,d){if(this.eventPool.length){var f=this.eventPool.pop();
this.call(f,a,b,c,d);return f}return new this(a,b,c,d)}function K(a){a instanceof this?void 0:k("223");a.destructor();10>this.eventPool.length&&this.eventPool.push(a)}function C(a){a.eventPool=[];a.getPooled=J;a.release=K}function w(a,b){var c={};c[a.toLowerCase()]=b.toLowerCase();c["Webkit"+a]="webkit"+b;c["Moz"+a]="moz"+b;c["ms"+a]="MS"+b;c["O"+a]="o"+b.toLowerCase();return c}function x(a){if(y[a])return y[a];if(!h[a])return a;var b=h[a],c;for(c in b)if(b.hasOwnProperty(c)&&c in D)return y[a]=b[c];
return""}function E(a){}function L(a,b){if(!a)return[];a=I(a);if(!a)return[];for(var c=a,d=[];;){if(5===c.tag||6===c.tag||2===c.tag||1===c.tag){var e=c.stateNode;b(e)&&d.push(e)}if(c.child)c.child["return"]=c,c=c.child;else{if(c===a)return d;for(;!c.sibling;){if(!c["return"]||c["return"]===a)return d;c=c["return"]}c.sibling["return"]=c["return"];c=c.sibling}}}function M(a){return function(b,c){m.isValidElement(b)?k("228"):void 0;e.isCompositeComponent(b)?k("229"):void 0;var d=F.eventNameDispatchConfigs[a],
g=new E;g.target=b;g.type=a.toLowerCase();var n=N.getInstanceFromNode(b),h=new t(d,n,g,b);h.persist();u(h,c);d.phasedRegistrationNames?G.accumulateTwoPhaseDispatches(h):G.accumulateDirectDispatches(h);p.unstable_batchedUpdates(function(){O.enqueueStateRestore(b);q.enqueueEvents(h);q.processEventQueue(!0)})}}function z(){e.Simulate={};for(var a in F.eventNameDispatchConfigs)e.Simulate[a]=M(a)}function P(a){return function(b,c){var d=new E(a);u(d,c);e.isDOMComponent(b)?e.simulateNativeEventOnDOMComponent(a,
b,d):b.tagName&&e.simulateNativeEventOnNode(a,b,d)}}var u=m.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.assign,d=function(){};d.thatReturns=v;d.thatReturnsFalse=v(!1);d.thatReturnsTrue=v(!0);d.thatReturnsNull=v(null);d.thatReturnsThis=function(){return this};d.thatReturnsArgument=function(a){return a};var n=d,H="dispatchConfig _targetInst nativeEvent isDefaultPrevented isPropagationStopped _dispatchListeners _dispatchInstances".split(" ");d={type:null,target:null,currentTarget:n.thatReturnsNull,
eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(a){return a.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null};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=n.thatReturnsTrue)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():"unknown"!==typeof a.cancelBubble&&(a.cancelBubble=
!0),this.isPropagationStopped=n.thatReturnsTrue)},persist:function(){this.isPersistent=n.thatReturnsTrue},isPersistent:n.thatReturnsFalse,destructor:function(){var a=this.constructor.Interface,b;for(b in a)this[b]=null;for(a=0;a<H.length;a++)this[H[a]]=null}});t.Interface=d;t.augmentClass=function(a,b){var c=function(){};c.prototype=this.prototype;c=new c;u(c,a.prototype);a.prototype=c;a.prototype.constructor=a;a.Interface=u({},this.Interface,b);a.augmentClass=this.augmentClass;C(a)};C(t);d=!("undefined"===
typeof window||!window.document||!window.document.createElement);var h={animationend:w("Animation","AnimationEnd"),animationiteration:w("Animation","AnimationIteration"),animationstart:w("Animation","AnimationStart"),transitionend:w("Transition","TransitionEnd")},y={},D={};d&&(D=document.createElement("div").style,"AnimationEvent"in window||(delete h.animationend.animation,delete h.animationiteration.animation,delete h.animationstart.animation),"TransitionEvent"in window||delete h.transitionend.transition);
d={topAbort:"abort",topAnimationEnd:x("animationend")||"animationend",topAnimationIteration:x("animationiteration")||"animationiteration",topAnimationStart:x("animationstart")||"animationstart",topBlur:"blur",topCancel:"cancel",topCanPlay:"canplay",topCanPlayThrough:"canplaythrough",topChange:"change",topClick:"click",topClose:"close",topCompositionEnd:"compositionend",topCompositionStart:"compositionstart",topCompositionUpdate:"compositionupdate",topContextMenu:"contextmenu",topCopy:"copy",topCut:"cut",
topDoubleClick:"dblclick",topDrag:"drag",topDragEnd:"dragend",topDragEnter:"dragenter",topDragExit:"dragexit",topDragLeave:"dragleave",topDragOver:"dragover",topDragStart:"dragstart",topDrop:"drop",topDurationChange:"durationchange",topEmptied:"emptied",topEncrypted:"encrypted",topEnded:"ended",topError:"error",topFocus:"focus",topInput:"input",topKeyDown:"keydown",topKeyPress:"keypress",topKeyUp:"keyup",topLoadedData:"loadeddata",topLoad:"load",topLoadedMetadata:"loadedmetadata",topLoadStart:"loadstart",
topMouseDown:"mousedown",topMouseMove:"mousemove",topMouseOut:"mouseout",topMouseOver:"mouseover",topMouseUp:"mouseup",topPaste:"paste",topPause:"pause",topPlay:"play",topPlaying:"playing",topProgress:"progress",topRateChange:"ratechange",topScroll:"scroll",topSeeked:"seeked",topSeeking:"seeking",topSelectionChange:"selectionchange",topStalled:"stalled",topSuspend:"suspend",topTextInput:"textInput",topTimeUpdate:"timeupdate",topToggle:"toggle",topTouchCancel:"touchcancel",topTouchEnd:"touchend",topTouchMove:"touchmove",
topTouchStart:"touchstart",topTransitionEnd:x("transitionend")||"transitionend",topVolumeChange:"volumechange",topWaiting:"waiting",topWheel:"wheel"};var Q=p.findDOMNode,r=p.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,q=r.EventPluginHub,F=r.EventPluginRegistry,G=r.EventPropagators,O=r.ReactControlledComponent,N=r.ReactDOMComponentTree,R=r.ReactDOMEventListener,e={renderIntoDocument:function(a){var b=document.createElement("div");return p.render(a,b)},isElement:function(a){return m.isValidElement(a)},
isElementOfType:function(a,b){return m.isValidElement(a)&&a.type===b},isDOMComponent:function(a){return!(!a||1!==a.nodeType||!a.tagName)},isDOMComponentElement:function(a){return!!(a&&m.isValidElement(a)&&a.tagName)},isCompositeComponent:function(a){return e.isDOMComponent(a)?!1:null!=a&&"function"===typeof a.render&&"function"===typeof a.setState},isCompositeComponentWithType:function(a,b){return e.isCompositeComponent(a)?a._reactInternalFiber.type===b:!1},findAllInRenderedTree:function(a,b){if(!a)return[];
e.isCompositeComponent(a)?void 0:k("10");return L(a._reactInternalFiber,b)},scryRenderedDOMComponentsWithClass:function(a,b){return e.findAllInRenderedTree(a,function(a){if(e.isDOMComponent(a)){var c=a.className;"string"!==typeof c&&(c=a.getAttribute("class")||"");var d=c.split(/\s+/);Array.isArray(b)||(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){a=e.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){return e.findAllInRenderedTree(a,function(a){return e.isDOMComponent(a)&&a.tagName.toUpperCase()===b.toUpperCase()})},findRenderedDOMComponentWithTag:function(a,b){a=e.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){return e.findAllInRenderedTree(a,function(a){return e.isCompositeComponentWithType(a,b)})},findRenderedComponentWithType:function(a,b){a=e.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 m.createElement(b,null,this.props.children)});return this},simulateNativeEventOnNode:function(a,
b,c){c.target=b;R.dispatchEvent(a,c)},simulateNativeEventOnDOMComponent:function(a,b,c){e.simulateNativeEventOnNode(a,Q(b),c)},nativeTouchData:function(a,b){return{touches:[{pageX:a,pageY:b}]}},Simulate:null,SimulateNative:{}},S=q.injection.injectEventPluginOrder;q.injection.injectEventPluginOrder=function(){S.apply(this,arguments);z()};var T=q.injection.injectEventPluginsByName;q.injection.injectEventPluginsByName=function(){T.apply(this,arguments);z()};z();Object.keys(d).forEach(function(a){var b=
0===a.indexOf("top")?a.charAt(3).toLowerCase()+a.substr(4):a;e.SimulateNative[b]=P(a)});d=(d=Object.freeze({default:e}))&&e||d;return d["default"]?d["default"]:d});