rmwc
Version:
A thin React wrapper for Material Design (Web) Components
30 lines (29 loc) • 10.9 kB
JavaScript
/** @license React v16.3.2
* 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.
*/
;(function(l,m){"object"===typeof exports&&"undefined"!==typeof module?module.exports=m(require("react"),require("react-dom")):"function"===typeof define&&define.amd?define(["react","react-dom"],m):l.ReactTestUtils=m(l.React,l.ReactDOM)})(this,function(l,m){function k(a){for(var b=arguments.length-1,c="http://reactjs.org/docs/error-decoder.html?invariant\x3d"+a,d=0;d<b;d++)c+="\x26args[]\x3d"+encodeURIComponent(arguments[d+1]);J(!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 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 K(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,d=b;;){var g=c["return"],f=g?g.alternate:null;if(!g||!f)break;if(g.child===f.child){for(var h=g.child;h;){if(h===c)return B(g),
a;if(h===d)return B(g),b;h=h.sibling}k("188")}if(c["return"]!==d["return"])c=g,d=f;else{h=!1;for(var e=g.child;e;){if(e===c){h=!0;c=g;d=f;break}if(e===d){h=!0;d=g;c=f;break}e=e.sibling}if(!h){for(e=f.child;e;){if(e===c){h=!0;c=f;d=g;break}if(e===d){h=!0;d=f;c=g;break}e=e.sibling}h?void 0:k("189")}}c.alternate!==d?k("190"):void 0}3!==c.tag?k("188"):void 0;return c.stateNode.current===c?a:b}function r(a,b,c,d){this.dispatchConfig=a;this._targetInst=b;this.nativeEvent=c;a=this.constructor.Interface;
for(var g in a)a.hasOwnProperty(g)&&((b=a[g])?this[g]=b(c):"target"===g?this.target=d:this[g]=c[g]);this.isDefaultPrevented=(null!=c.defaultPrevented?c.defaultPrevented:!1===c.returnValue)?n.thatReturnsTrue:n.thatReturnsFalse;this.isPropagationStopped=n.thatReturnsFalse;return this}function L(a,b,c,d){if(this.eventPool.length){var g=this.eventPool.pop();this.call(g,a,b,c,d);return g}return new this(a,b,c,d)}function M(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=L;a.release=M}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(!p[a])return a;var b=p[a],c;for(c in b)if(b.hasOwnProperty(c)&&c in D)return y[a]=b[c];return a}function E(a){}function N(a,b){if(!a)return[];a=K(a);if(!a)return[];for(var c=a,d=[];;){if(5===c.tag||6===c.tag||2===c.tag||1===c.tag){var g=c.stateNode;b(g)&&
d.push(g)}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 O(a){return function(b,c){l.isValidElement(b)?k("228"):void 0;f.isCompositeComponent(b)?k("229"):void 0;var d=F.eventNameDispatchConfigs[a],g=new E;g.target=b;g.type=a.toLowerCase();var e=P.getInstanceFromNode(b),h=new r(d,e,g,b);h.persist();t(h,c);d.phasedRegistrationNames?G.accumulateTwoPhaseDispatches(h):
G.accumulateDirectDispatches(h);m.unstable_batchedUpdates(function(){H.enqueueStateRestore(b);u.runEventsInBatch(h,!0)});H.restoreStateIfNeeded()}}function z(){f.Simulate={};var a=void 0;for(a in F.eventNameDispatchConfigs)f.Simulate[a]=O(a)}function Q(a){return function(b,c){var d=new E(a);t(d,c);f.isDOMComponent(b)?f.simulateNativeEventOnDOMComponent(a,b,d):b.tagName&&f.simulateNativeEventOnNode(a,b,d)}}var t=l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.assign,J=function(a,b,c,d,g,e,f,k){if(!a){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 h=[c,d,g,e,f,k],l=0;a=Error(b.replace(/%s/g,function(){return h[l++]}));a.name="Invariant Violation"}a.framesToPop=1;throw a;}},e=function(){};e.thatReturns=v;e.thatReturnsFalse=v(!1);e.thatReturnsTrue=v(!0);e.thatReturnsNull=v(null);e.thatReturnsThis=function(){return this};e.thatReturnsArgument=function(a){return a};var n=e,I="dispatchConfig _targetInst nativeEvent isDefaultPrevented isPropagationStopped _dispatchListeners _dispatchInstances".split(" ");
e={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};t(r.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<I.length;a++)this[I[a]]=null}});r.Interface=e;r.extend=function(a){function b(){return c.apply(this,arguments)}var c=this,d=function(){};d.prototype=c.prototype;d=new d;t(d,b.prototype);b.prototype=d;b.prototype.constructor=
b;b.Interface=t({},c.Interface,a);b.extend=c.extend;C(b);return b};C(r);e=!("undefined"===typeof window||!window.document||!window.document.createElement);var p={animationend:w("Animation","AnimationEnd"),animationiteration:w("Animation","AnimationIteration"),animationstart:w("Animation","AnimationStart"),transitionend:w("Transition","TransitionEnd")},y={},D={};e&&(D=document.createElement("div").style,"AnimationEvent"in window||(delete p.animationend.animation,delete p.animationiteration.animation,
delete p.animationstart.animation),"TransitionEvent"in window||delete p.transitionend.transition);e={topAnimationEnd:x("animationend"),topAnimationIteration:x("animationiteration"),topAnimationStart:x("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:x("transitionend"),topWheel:"wheel"};var R=m.findDOMNode,q=m.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,u=q.EventPluginHub,F=q.EventPluginRegistry,G=q.EventPropagators,H=q.ReactControlledComponent,P=q.ReactDOMComponentTree,S=q.ReactDOMEventListener,f={renderIntoDocument:function(a){var b=document.createElement("div");return m.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"===typeof a.setState},isCompositeComponentWithType:function(a,b){return f.isCompositeComponent(a)?a._reactInternalFiber.type===b:!1},findAllInRenderedTree:function(a,b){if(!a)return[];
f.isCompositeComponent(a)?void 0:k("10");return N(a._reactInternalFiber,b)},scryRenderedDOMComponentsWithClass:function(a,b){return f.findAllInRenderedTree(a,function(a){if(f.isDOMComponent(a)){var c=a.className;"string"!==typeof c&&(c=a.getAttribute("class")||"");var e=c.split(/\s+/);Array.isArray(b)||(void 0===b?k("11"):void 0,b=b.split(/\s+/));return b.every(function(a){return-1!==e.indexOf(a)})}return!1})},findRenderedDOMComponentWithClass:function(a,b){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){return f.findAllInRenderedTree(a,function(a){return f.isDOMComponent(a)&&a.tagName.toUpperCase()===b.toUpperCase()})},findRenderedDOMComponentWithTag:function(a,b){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){return f.findAllInRenderedTree(a,function(a){return f.isCompositeComponentWithType(a,b)})},findRenderedComponentWithType:function(a,b){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},simulateNativeEventOnNode:function(a,
b,c){c.target=b;S.dispatchEvent(a,c)},simulateNativeEventOnDOMComponent:function(a,b,c){f.simulateNativeEventOnNode(a,R(b),c)},nativeTouchData:function(a,b){return{touches:[{pageX:a,pageY:b}]}},Simulate:null,SimulateNative:{}},T=u.injection.injectEventPluginOrder;u.injection.injectEventPluginOrder=function(){T.apply(this,arguments);z()};var U=u.injection.injectEventPluginsByName;u.injection.injectEventPluginsByName=function(){U.apply(this,arguments);z()};z();[].concat(Object.keys(e),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;f.SimulateNative[b]=Q(a)});e=(e=Object.freeze({default:f}))&&f||e;return e["default"]?e["default"]:e});