UNPKG

react-palm

Version:

Elm-like architecture for React apps

468 lines (410 loc) 13.8 kB
/** @license React v16.8.4+patch * react-dom-test-utils.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * 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 g = require("object-assign"), l = require("react"), m = require("react-dom"); function n(a, b, c, e, d, k, f, h) { if (!a) { a = void 0; 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 N = [c, e, d, k, f, h], O = 0; a = Error(b.replace(/%s/g, function () { return N[O++]; })); a.name = "Invariant Violation"; } a.framesToPop = 1; throw a; } } function p(a) { for (var b = arguments.length - 1, c = "https://reactjs.org/docs/error-decoder.html?invariant=" + a, e = 0; e < b; e++) { c += "&args[]=" + encodeURIComponent(arguments[e + 1]); } n(!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); } var q = l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; q.hasOwnProperty("ReactCurrentDispatcher") || (q.ReactCurrentDispatcher = { current: null }); 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) ? p("188") : void 0; } function u(a) { var b = a.alternate; if (!b) return b = r(a), 3 === b ? p("188") : void 0, 1 === b ? null : a; for (var c = a, e = b;;) { var d = c.return, k = d ? d.alternate : null; if (!d || !k) break; if (d.child === k.child) { for (var f = d.child; f;) { if (f === c) return t(d), a; if (f === e) return t(d), b; f = f.sibling; } p("188"); } if (c.return !== e.return) c = d, e = k;else { f = !1; for (var h = d.child; h;) { if (h === c) { f = !0; c = d; e = k; break; } if (h === e) { f = !0; e = d; c = k; break; } h = h.sibling; } if (!f) { for (h = k.child; h;) { if (h === c) { f = !0; c = k; e = d; break; } if (h === e) { f = !0; e = k; c = d; break; } h = h.sibling; } f ? void 0 : p("189"); } } c.alternate !== e ? p("190") : void 0; } 3 !== c.tag ? p("188") : void 0; return c.stateNode.current === c ? a : b; } function v() { return !0; } function w() { return !1; } function x(a, b, c, e) { 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 = e : this[d] = c[d]); } this.isDefaultPrevented = (null != c.defaultPrevented ? c.defaultPrevented : !1 === c.returnValue) ? v : w; this.isPropagationStopped = w; return this; } g(x.prototype, { preventDefault: function preventDefault() { this.defaultPrevented = !0; var a = this.nativeEvent; a && (a.preventDefault ? a.preventDefault() : "unknown" !== typeof a.returnValue && (a.returnValue = !1), this.isDefaultPrevented = v); }, stopPropagation: function stopPropagation() { var a = this.nativeEvent; a && (a.stopPropagation ? a.stopPropagation() : "unknown" !== typeof a.cancelBubble && (a.cancelBubble = !0), this.isPropagationStopped = v); }, persist: function persist() { this.isPersistent = v; }, isPersistent: w, destructor: function destructor() { var a = this.constructor.Interface, b; for (b in a) { this[b] = null; } this.nativeEvent = this._targetInst = this.dispatchConfig = null; this.isPropagationStopped = this.isDefaultPrevented = w; this._dispatchInstances = this._dispatchListeners = null; } }); x.Interface = { type: null, target: null, currentTarget: function currentTarget() { return null; }, eventPhase: null, bubbles: null, cancelable: null, timeStamp: function timeStamp(a) { return a.timeStamp || Date.now(); }, defaultPrevented: null, isTrusted: null }; x.extend = function (a) { function b() {} function c() { return e.apply(this, arguments); } var e = this; b.prototype = e.prototype; var d = new b(); g(d, c.prototype); c.prototype = d; c.prototype.constructor = c; c.Interface = g({}, e.Interface, a); c.extend = e.extend; y(c); return c; }; y(x); function z(a, b, c, e) { if (this.eventPool.length) { var d = this.eventPool.pop(); this.call(d, a, b, c, e); return d; } return new this(a, b, c, e); } function A(a) { a instanceof this ? void 0 : p("279"); a.destructor(); 10 > this.eventPool.length && this.eventPool.push(a); } function y(a) { a.eventPool = []; a.getPooled = z; a.release = A; } var B = !("undefined" === typeof window || !window.document || !window.document.createElement); function C(a, b) { var c = {}; c[a.toLowerCase()] = b.toLowerCase(); c["Webkit" + a] = "webkit" + b; c["Moz" + a] = "moz" + b; return c; } var D = { animationend: C("Animation", "AnimationEnd"), animationiteration: C("Animation", "AnimationIteration"), animationstart: C("Animation", "AnimationStart"), transitionend: C("Transition", "TransitionEnd") }, E = {}, F = {}; B && (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 = G("animationend"), I = G("animationiteration"), J = G("animationstart"), K = G("transitionend"), L = m.findDOMNode, M = m.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Events, P = M[0], Q = M[4], R = M[5], aa = M[6], ba = M[7], ca = M[8], S = M[9], da = M[10]; function T() {} function ea(a, b) { if (!a) return []; a = u(a); if (!a) return []; for (var c = a, e = [];;) { if (5 === c.tag || 6 === c.tag || 1 === c.tag || 0 === c.tag) { var d = c.stateNode; b(d) && e.push(d); } if (c.child) c.child.return = c, c = c.child;else { if (c === a) return e; for (; !c.sibling;) { if (!c.return || c.return === a) return e; c = c.return; } c.sibling.return = c.return; c = c.sibling; } } } function U(a, b) { if (a && !a._reactInternalFiber) { var c = "" + a; a = Array.isArray(a) ? "an array" : a && 1 === a.nodeType && a.tagName ? "a DOM node" : "[object Object]" === c ? "object with keys {" + Object.keys(a).join(", ") + "}" : c; p("286", b, a); } } var V = null, W = { renderIntoDocument: function renderIntoDocument(a) { var b = document.createElement("div"); return m.render(a, b); }, isElement: function isElement(a) { return l.isValidElement(a); }, isElementOfType: function isElementOfType(a, b) { return l.isValidElement(a) && a.type === b; }, isDOMComponent: function isDOMComponent(a) { return !(!a || 1 !== a.nodeType || !a.tagName); }, isDOMComponentElement: function isDOMComponentElement(a) { return !!(a && l.isValidElement(a) && a.tagName); }, isCompositeComponent: function isCompositeComponent(a) { return W.isDOMComponent(a) ? !1 : null != a && "function" === typeof a.render && "function" === typeof a.setState; }, isCompositeComponentWithType: function isCompositeComponentWithType(a, b) { return W.isCompositeComponent(a) ? a._reactInternalFiber.type === b : !1; }, findAllInRenderedTree: function findAllInRenderedTree(a, b) { U(a, "findAllInRenderedTree"); return a ? ea(a._reactInternalFiber, b) : []; }, scryRenderedDOMComponentsWithClass: function scryRenderedDOMComponentsWithClass(a, b) { U(a, "scryRenderedDOMComponentsWithClass"); return W.findAllInRenderedTree(a, function (a) { if (W.isDOMComponent(a)) { var c = a.className; "string" !== typeof c && (c = a.getAttribute("class") || ""); var d = c.split(/\s+/); Array.isArray(b) || (void 0 === b ? p("11") : void 0, b = b.split(/\s+/)); return b.every(function (a) { return -1 !== d.indexOf(a); }); } return !1; }); }, findRenderedDOMComponentWithClass: function findRenderedDOMComponentWithClass(a, b) { U(a, "findRenderedDOMComponentWithClass"); a = W.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 scryRenderedDOMComponentsWithTag(a, b) { U(a, "scryRenderedDOMComponentsWithTag"); return W.findAllInRenderedTree(a, function (a) { return W.isDOMComponent(a) && a.tagName.toUpperCase() === b.toUpperCase(); }); }, findRenderedDOMComponentWithTag: function findRenderedDOMComponentWithTag(a, b) { U(a, "findRenderedDOMComponentWithTag"); a = W.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 scryRenderedComponentsWithType(a, b) { U(a, "scryRenderedComponentsWithType"); return W.findAllInRenderedTree(a, function (a) { return W.isCompositeComponentWithType(a, b); }); }, findRenderedComponentWithType: function findRenderedComponentWithType(a, b) { U(a, "findRenderedComponentWithType"); a = W.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 mockComponent(a, b) { b = b || a.mockTagName || "div"; a.prototype.render.mockImplementation(function () { return l.createElement(b, null, this.props.children); }); return this; }, nativeTouchData: function nativeTouchData(a, b) { return { touches: [{ pageX: a, pageY: b }] }; }, Simulate: null, SimulateNative: {}, act: function act(a) { null === V && (V = document.createElement("div")); m.unstable_batchedUpdates(a); m.render(l.createElement("div", null), V); return { then: function then() {} }; } }; function fa(a) { return function (b, c) { l.isValidElement(b) ? p("228") : void 0; W.isCompositeComponent(b) ? p("229") : void 0; var e = Q[a], d = new T(); d.target = b; d.type = a.toLowerCase(); var k = P(b), f = new x(e, k, d, b); f.persist(); g(f, c); e.phasedRegistrationNames ? R(f) : aa(f); m.unstable_batchedUpdates(function () { ba(b); da(f); }); ca(); }; } W.Simulate = {}; var X = void 0; for (X in Q) { W.Simulate[X] = fa(X); } function ha(a, b) { return function (c, e) { var d = new T(a); g(d, e); W.isDOMComponent(c) ? (c = L(c), d.target = c, S(b, d)) : c.tagName && (d.target = c, S(b, d)); }; } [["abort", "abort"], [H, "animationEnd"], [I, "animationIteration"], [J, "animationStart"], ["blur", "blur"], ["canplaythrough", "canPlayThrough"], ["canplay", "canPlay"], ["cancel", "cancel"], ["change", "change"], ["click", "click"], ["close", "close"], ["compositionend", "compositionEnd"], ["compositionstart", "compositionStart"], ["compositionupdate", "compositionUpdate"], ["contextmenu", "contextMenu"], ["copy", "copy"], ["cut", "cut"], ["dblclick", "doubleClick"], ["dragend", "dragEnd"], ["dragenter", "dragEnter"], ["dragexit", "dragExit"], ["dragleave", "dragLeave"], ["dragover", "dragOver"], ["dragstart", "dragStart"], ["drag", "drag"], ["drop", "drop"], ["durationchange", "durationChange"], ["emptied", "emptied"], ["encrypted", "encrypted"], ["ended", "ended"], ["error", "error"], ["focus", "focus"], ["input", "input"], ["keydown", "keyDown"], ["keypress", "keyPress"], ["keyup", "keyUp"], ["loadstart", "loadStart"], ["loadstart", "loadStart"], ["load", "load"], ["loadeddata", "loadedData"], ["loadedmetadata", "loadedMetadata"], ["mousedown", "mouseDown"], ["mousemove", "mouseMove"], ["mouseout", "mouseOut"], ["mouseover", "mouseOver"], ["mouseup", "mouseUp"], ["paste", "paste"], ["pause", "pause"], ["play", "play"], ["playing", "playing"], ["progress", "progress"], ["ratechange", "rateChange"], ["scroll", "scroll"], ["seeked", "seeked"], ["seeking", "seeking"], ["selectionchange", "selectionChange"], ["stalled", "stalled"], ["suspend", "suspend"], ["textInput", "textInput"], ["timeupdate", "timeUpdate"], ["toggle", "toggle"], ["touchcancel", "touchCancel"], ["touchend", "touchEnd"], ["touchmove", "touchMove"], ["touchstart", "touchStart"], [K, "transitionEnd"], ["volumechange", "volumeChange"], ["waiting", "waiting"], ["wheel", "wheel"]].forEach(function (a) { var b = a[1]; W.SimulateNative[b] = ha(b, a[0]); }); var Y = { default: W }, Z = Y && W || Y; module.exports = Z.default || Z;