rmwc
Version:
A thin React wrapper for Material Design (Web) Components
35 lines (33 loc) • 10.2 kB
JavaScript
/** @license React v16.3.1
* 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.
*/
;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.extend=function(a){function b(){}function c(){return d.apply(this,arguments)}var d=this;b.prototype=d.prototype;var e=new b;f(e,c.prototype);c.prototype=e;c.prototype.constructor=c;c.Interface=f({},d.Interface,a);c.extend=d.extend;y(c);return c};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 a}
var G={topAnimationEnd:F("animationend"),topAnimationIteration:F("animationiteration"),topAnimationStart:F("animationstart"),topBlur:"blur",topCancel:"cancel",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",topFocus:"focus",topInput:"input",topKeyDown:"keydown",topKeyPress:"keypress",topKeyUp:"keyup",topLoad:"load",topLoadStart:"loadstart",topMouseDown:"mousedown",topMouseMove:"mousemove",topMouseOut:"mouseout",topMouseOver:"mouseover",topMouseUp:"mouseup",topPaste:"paste",topScroll:"scroll",topSelectionChange:"selectionchange",topTextInput:"textInput",topToggle:"toggle",topTouchCancel:"touchcancel",topTouchEnd:"touchend",topTouchMove:"touchmove",
topTouchStart:"touchstart",topTransitionEnd:F("transitionend"),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;function P(){}
function Q(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 R={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 R.isDOMComponent(a)?!1:null!=a&&"function"===typeof a.render&&"function"===typeof a.setState},isCompositeComponentWithType:function(a,
b){return R.isCompositeComponent(a)?a._reactInternalFiber.type===b:!1},findAllInRenderedTree:function(a,b){if(!a)return[];R.isCompositeComponent(a)?void 0:q("10");return Q(a._reactInternalFiber,b)},scryRenderedDOMComponentsWithClass:function(a,b){return R.findAllInRenderedTree(a,function(a){if(R.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=R.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 R.findAllInRenderedTree(a,function(a){return R.isDOMComponent(a)&&a.tagName.toUpperCase()===b.toUpperCase()})},findRenderedDOMComponentWithTag:function(a,b){a=R.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 R.findAllInRenderedTree(a,function(a){return R.isCompositeComponentWithType(a,b)})},findRenderedComponentWithType:function(a,b){a=R.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){R.simulateNativeEventOnNode(a,H(b),c)},nativeTouchData:function(a,b){return{touches:[{pageX:a,pageY:b}]}},Simulate:null,SimulateNative:{}};
function S(a){return function(b,c){h.isValidElement(b)?q("228"):void 0;R.isCompositeComponent(b)?q("229"):void 0;var d=K.eventNameDispatchConfigs[a],e=new P;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.runEventsInBatch(g,!0)});M.restoreStateIfNeeded()}}
function T(){R.Simulate={};var a=void 0;for(a in K.eventNameDispatchConfigs)R.Simulate[a]=S(a)}var U=J.injection.injectEventPluginOrder;J.injection.injectEventPluginOrder=function(){U.apply(this,arguments);T()};var V=J.injection.injectEventPluginsByName;J.injection.injectEventPluginsByName=function(){V.apply(this,arguments);T()};T();
function W(a){return function(b,c){var d=new P(a);f(d,c);R.isDOMComponent(b)?R.simulateNativeEventOnDOMComponent(a,b,d):b.tagName&&R.simulateNativeEventOnNode(a,b,d)}}
[].concat(Object.keys(G),Object.keys({topAbort:"abort",topCanPlay:"canplay",topCanPlayThrough:"canplaythrough",topDurationChange:"durationchange",topEmptied:"emptied",topEncrypted:"encrypted",topEnded:"ended",topError:"error",topLoadedData:"loadeddata",topLoadedMetadata:"loadedmetadata",topLoadStart:"loadstart",topPause:"pause",topPlay:"play",topPlaying:"playing",topProgress:"progress",topRateChange:"ratechange",topSeeked:"seeked",topSeeking:"seeking",topStalled:"stalled",topSuspend:"suspend",topTimeUpdate:"timeupdate",
topVolumeChange:"volumechange",topWaiting:"waiting"})).forEach(function(a){var b=0===a.indexOf("top")?a.charAt(3).toLowerCase()+a.substr(4):a;R.SimulateNative[b]=W(a)});var X=Object.freeze({default:R}),Y=X&&R||X;module.exports=Y["default"]?Y["default"]:Y;