aboutsummaryrefslogtreecommitdiff
path: root/node_modules/react-dom/cjs/react-dom-test-utils.production.min.js
blob: cc431e13469604558cfd6dcf14e474f35956c7fd (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
30
31
32
33
/** @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';var f=require("object-assign"),h=require("react"),m=require("react-dom"),n=require("fbjs/lib/emptyFunction"),p=require("fbjs/lib/ExecutionEnvironment");
function q(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,d=0;d<b;d++)c+="\x26args[]\x3d"+encodeURIComponent(arguments[d+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 r(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 t(a){2!==r(a)?q("188"):void 0}
function u(a){var b=a.alternate;if(!b)return b=r(a),3===b?q("188"):void 0,1===b?null:a;for(var c=a,d=b;;){var e=c["return"],l=e?e.alternate:null;if(!e||!l)break;if(e.child===l.child){for(var g=e.child;g;){if(g===c)return t(e),a;if(g===d)return t(e),b;g=g.sibling}q("188")}if(c["return"]!==d["return"])c=e,d=l;else{g=!1;for(var k=e.child;k;){if(k===c){g=!0;c=e;d=l;break}if(k===d){g=!0;d=e;c=l;break}k=k.sibling}if(!g){for(k=l.child;k;){if(k===c){g=!0;c=l;d=e;break}if(k===d){g=!0;d=l;c=e;break}k=k.sibling}g?
void 0:q("189")}}c.alternate!==d?q("190"):void 0}3!==c.tag?q("188"):void 0;return c.stateNode.current===c?a:b}var v="dispatchConfig _targetInst nativeEvent isDefaultPrevented isPropagationStopped _dispatchListeners _dispatchInstances".split(" "),w={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};
function x(a,b,c,d){this.dispatchConfig=a;this._targetInst=b;this.nativeEvent=c;a=this.constructor.Interface;for(var e in a)a.hasOwnProperty(e)&&((b=a[e])?this[e]=b(c):"target"===e?this.target=d:this[e]=c[e]);this.isDefaultPrevented=(null!=c.defaultPrevented?c.defaultPrevented:!1===c.returnValue)?n.thatReturnsTrue:n.thatReturnsFalse;this.isPropagationStopped=n.thatReturnsFalse;return this}
f(x.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<v.length;a++)this[v[a]]=null}});x.Interface=w;x.augmentClass=function(a,b){function c(){}c.prototype=this.prototype;var d=new c;f(d,a.prototype);a.prototype=d;a.prototype.constructor=a;a.Interface=f({},this.Interface,b);a.augmentClass=this.augmentClass;y(a)};y(x);function z(a,b,c,d){if(this.eventPool.length){var e=this.eventPool.pop();this.call(e,a,b,c,d);return e}return new this(a,b,c,d)}
function A(a){a instanceof this?void 0:q("223");a.destructor();10>this.eventPool.length&&this.eventPool.push(a)}function y(a){a.eventPool=[];a.getPooled=z;a.release=A}function B(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}
var C={animationend:B("Animation","AnimationEnd"),animationiteration:B("Animation","AnimationIteration"),animationstart:B("Animation","AnimationStart"),transitionend:B("Transition","TransitionEnd")},D={},E={};p.canUseDOM&&(E=document.createElement("div").style,"AnimationEvent"in window||(delete C.animationend.animation,delete C.animationiteration.animation,delete C.animationstart.animation),"TransitionEvent"in window||delete C.transitionend.transition);
function F(a){if(D[a])return D[a];if(!C[a])return a;var b=C[a],c;for(c in b)if(b.hasOwnProperty(c)&&c in E)return D[a]=b[c];return""}
var G={topLevelTypes:{topAbort:"abort",topAnimationEnd:F("animationend")||"animationend",topAnimationIteration:F("animationiteration")||"animationiteration",topAnimationStart:F("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:F("transitionend")||"transitionend",topVolumeChange:"volumechange",topWaiting:"waiting",topWheel:"wheel"}},H=m.findDOMNode,I=m.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,J=I.EventPluginHub,K=I.EventPluginRegistry,L=I.EventPropagators,M=I.ReactControlledComponent,N=I.ReactDOMComponentTree,O=I.ReactDOMEventListener,P=G.topLevelTypes;function Q(){}
function R(a,b){if(!a)return[];a=u(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}}}
var S={renderIntoDocument:function(a){var b=document.createElement("div");return m.render(a,b)},isElement:function(a){return h.isValidElement(a)},isElementOfType: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 S.isDOMComponent(a)?!1:null!=a&&"function"===typeof a.render&&"function"===typeof a.setState},isCompositeComponentWithType:function(a,
b){return S.isCompositeComponent(a)?a._reactInternalFiber.type===b:!1},findAllInRenderedTree:function(a,b){if(!a)return[];S.isCompositeComponent(a)?void 0:q("10");return R(a._reactInternalFiber,b)},scryRenderedDOMComponentsWithClass:function(a,b){return S.findAllInRenderedTree(a,function(a){if(S.isDOMComponent(a)){var c=a.className;"string"!==typeof c&&(c=a.getAttribute("class")||"");var e=c.split(/\s+/);Array.isArray(b)||(void 0===b?q("11"):void 0,b=b.split(/\s+/));return b.every(function(a){return-1!==
e.indexOf(a)})}return!1})},findRenderedDOMComponentWithClass:function(a,b){a=S.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 S.findAllInRenderedTree(a,function(a){return S.isDOMComponent(a)&&a.tagName.toUpperCase()===b.toUpperCase()})},findRenderedDOMComponentWithTag:function(a,b){a=S.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 S.findAllInRenderedTree(a,function(a){return S.isCompositeComponentWithType(a,b)})},findRenderedComponentWithType:function(a,b){a=S.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 h.createElement(b,
null,this.props.children)});return this},simulateNativeEventOnNode:function(a,b,c){c.target=b;O.dispatchEvent(a,c)},simulateNativeEventOnDOMComponent:function(a,b,c){S.simulateNativeEventOnNode(a,H(b),c)},nativeTouchData:function(a,b){return{touches:[{pageX:a,pageY:b}]}},Simulate:null,SimulateNative:{}};
function T(a){return function(b,c){h.isValidElement(b)?q("228"):void 0;S.isCompositeComponent(b)?q("229"):void 0;var d=K.eventNameDispatchConfigs[a],e=new Q;e.target=b;e.type=a.toLowerCase();var l=N.getInstanceFromNode(b),g=new x(d,l,e,b);g.persist();f(g,c);d.phasedRegistrationNames?L.accumulateTwoPhaseDispatches(g):L.accumulateDirectDispatches(g);m.unstable_batchedUpdates(function(){M.enqueueStateRestore(b);J.enqueueEvents(g);J.processEventQueue(!0)})}}
function U(){S.Simulate={};for(var a in K.eventNameDispatchConfigs)S.Simulate[a]=T(a)}var V=J.injection.injectEventPluginOrder;J.injection.injectEventPluginOrder=function(){V.apply(this,arguments);U()};var W=J.injection.injectEventPluginsByName;J.injection.injectEventPluginsByName=function(){W.apply(this,arguments);U()};U();function X(a){return function(b,c){var d=new Q(a);f(d,c);S.isDOMComponent(b)?S.simulateNativeEventOnDOMComponent(a,b,d):b.tagName&&S.simulateNativeEventOnNode(a,b,d)}}
Object.keys(P).forEach(function(a){var b=0===a.indexOf("top")?a.charAt(3).toLowerCase()+a.substr(4):a;S.SimulateNative[b]=X(a)});var Y=Object.freeze({default:S}),Z=Y&&S||Y;module.exports=Z["default"]?Z["default"]:Z;