UNPKG

rmwc

Version:

A thin React wrapper for Material Design (Web) Components

35 lines (33 loc) 10.2 kB
/** @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. */ 'use strict';var f=require("object-assign"),h=require("fbjs/lib/invariant"),m=require("react"),n=require("react-dom"),p=require("fbjs/lib/emptyFunction"),q=require("fbjs/lib/ExecutionEnvironment"); function r(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]);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 t(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 u(a){2!==t(a)?r("188"):void 0} function v(a){var b=a.alternate;if(!b)return b=t(a),3===b?r("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 u(e),a;if(g===d)return u(e),b;g=g.sibling}r("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:r("189")}}c.alternate!==d?r("190"):void 0}3!==c.tag?r("188"):void 0;return c.stateNode.current===c?a:b}var w="dispatchConfig _targetInst nativeEvent isDefaultPrevented isPropagationStopped _dispatchListeners _dispatchInstances".split(" "),x={type:null,target:null,currentTarget:p.thatReturnsNull,eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(a){return a.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null}; function y(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)?p.thatReturnsTrue:p.thatReturnsFalse;this.isPropagationStopped=p.thatReturnsFalse;return this} f(y.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():"unknown"!==typeof a.returnValue&&(a.returnValue=!1),this.isDefaultPrevented=p.thatReturnsTrue)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():"unknown"!==typeof a.cancelBubble&&(a.cancelBubble=!0),this.isPropagationStopped=p.thatReturnsTrue)},persist:function(){this.isPersistent=p.thatReturnsTrue},isPersistent:p.thatReturnsFalse, destructor:function(){var a=this.constructor.Interface,b;for(b in a)this[b]=null;for(a=0;a<w.length;a++)this[w[a]]=null}});y.Interface=x;y.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;z(c);return c};z(y); function A(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 B(a){a instanceof this?void 0:r("223");a.destructor();10>this.eventPool.length&&this.eventPool.push(a)}function z(a){a.eventPool=[];a.getPooled=A;a.release=B}function C(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 D={animationend:C("Animation","AnimationEnd"),animationiteration:C("Animation","AnimationIteration"),animationstart:C("Animation","AnimationStart"),transitionend:C("Transition","TransitionEnd")},E={},F={};q.canUseDOM&&(F=document.createElement("div").style,"AnimationEvent"in window||(delete D.animationend.animation,delete D.animationiteration.animation,delete D.animationstart.animation),"TransitionEvent"in window||delete D.transitionend.transition); function G(a){if(E[a])return E[a];if(!D[a])return a;var b=D[a],c;for(c in b)if(b.hasOwnProperty(c)&&c in F)return E[a]=b[c];return a} var H={topAnimationEnd:G("animationend"),topAnimationIteration:G("animationiteration"),topAnimationStart:G("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:G("transitionend"),topWheel:"wheel"},I=n.findDOMNode,J=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,K=J.EventPluginHub,L=J.EventPluginRegistry,M=J.EventPropagators,N=J.ReactControlledComponent,O=J.ReactDOMComponentTree,P=J.ReactDOMEventListener;function Q(){} function R(a,b){if(!a)return[];a=v(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 n.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 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:r("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?r("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 m.createElement(b, null,this.props.children)});return this},simulateNativeEventOnNode:function(a,b,c){c.target=b;P.dispatchEvent(a,c)},simulateNativeEventOnDOMComponent:function(a,b,c){S.simulateNativeEventOnNode(a,I(b),c)},nativeTouchData:function(a,b){return{touches:[{pageX:a,pageY:b}]}},Simulate:null,SimulateNative:{}}; function T(a){return function(b,c){m.isValidElement(b)?r("228"):void 0;S.isCompositeComponent(b)?r("229"):void 0;var d=L.eventNameDispatchConfigs[a],e=new Q;e.target=b;e.type=a.toLowerCase();var l=O.getInstanceFromNode(b),g=new y(d,l,e,b);g.persist();f(g,c);d.phasedRegistrationNames?M.accumulateTwoPhaseDispatches(g):M.accumulateDirectDispatches(g);n.unstable_batchedUpdates(function(){N.enqueueStateRestore(b);K.runEventsInBatch(g,!0)});N.restoreStateIfNeeded()}} function U(){S.Simulate={};var a=void 0;for(a in L.eventNameDispatchConfigs)S.Simulate[a]=T(a)}var V=K.injection.injectEventPluginOrder;K.injection.injectEventPluginOrder=function(){V.apply(this,arguments);U()};var W=K.injection.injectEventPluginsByName;K.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)}} [].concat(Object.keys(H),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;S.SimulateNative[b]=X(a)});var Y=Object.freeze({default:S}),Z=Y&&S||Y;module.exports=Z["default"]?Z["default"]:Z;