{"version":3,"sources":["../src/ReactWrapper.js"],"names":["NODE","NODES","RENDERER","UNRENDERED","ROOT","OPTIONS","ROOT_NODES","WRAPPING_COMPONENT","LINKED_ROOTS","UPDATED_BY","findWhereUnwrapped","wrapper","predicate","filter","treeFilter","flatMap","n","getNodeInternal","filterWhereUnwrapped","wrap","getNodesInternal","Boolean","getRootNodeInternal","length","Error","nodeParents","node","privateSetNodes","nodes","Array","isArray","ReactWrapper","root","passedOptions","global","window","document","options","adapter","isValidElement","TypeError","renderer","createRenderer","mode","render","context","getNode","wrappingComponent","getWrappingComponentRenderer","WrappingComponentWrapper","push","single","nodeToElement","map","nodeToHostNode","refname","instance","refs","update","forEach","linkedRoot","unmount","props","callback","undefined","arguments","state","nodeType","setState","invokeSetStateCallback","call","nodeOrNodes","other","nodeEqual","elementToNode","rstNode","a","b","every","containsMatchingElement","some","selector","html","event","mock","simulateEvent","error","thisNode","simulateError","rootNode","nodeHierarchy","concat","propsOfNode","name","_state","_context","allChildren","index","children","at","allParents","parents","get","is","matchingAncestors","first","findWhere","propName","handler","prop","args","response","wrapInvoke","RangeError","propValue","element","wrapped","key","displayNameOfNode","className","indexOf","console","warn","fn","i","initialValue","reduce","accum","reduceRight","begin","end","slice","flattened","getElements","exists","find","fnName","intercepter","attachTo","filterWhere","type","ITERATOR_SYMBOL","Object","defineProperty","prototype","configurable","value","iterator","iter","next","done","privateWarning","extraMessage","enumerable"],"mappings":";;;;;;;;;;;;;;AAAA;;;;AACA;;;;AAEA;;AAeA;;;;AACA;;AACA;;AAUA;;;;;;;;;;;;AAEA,IAAMA,OAAO,gBAAI,UAAJ,CAAb;AACA,IAAMC,QAAQ,gBAAI,WAAJ,CAAd;AACA,IAAMC,WAAW,gBAAI,cAAJ,CAAjB;AACA,IAAMC,aAAa,gBAAI,gBAAJ,CAAnB;AACA,IAAMC,OAAO,gBAAI,UAAJ,CAAb;AACA,IAAMC,UAAU,gBAAI,aAAJ,CAAhB;AACA,IAAMC,aAAa,gBAAI,e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;AAEDM,eAAe,MAAf,EAAuB,iDAAvB;AACAA,eAAe,OAAf,EAAwB,kDAAxB;AACAA,eAAe,UAAf,EAA2B,EAA3B;AACAA,eAAe,SAAf,EAA0B,EAA1B;AACAA,eAAe,iBAAf,EAAkC,EAAlC;;qBAEexH,Y","file":"ReactWrapper.js","sourcesContent":["import flat from 'array.prototype.flat';\nimport has from 'has';\n\nimport {\n containsChildrenSubArray,\n typeOfNode,\n displayNameOfNode,\n ITERATOR_SYMBOL,\n nodeEqual,\n nodeMatches,\n makeOptions,\n sym,\n privateSet,\n cloneElement,\n renderedDive,\n isCustomComponent,\n loadCheerioRoot,\n} from './Utils';\nimport getAdapter from './getAdapter';\nimport { debugNodes } from './Debug';\nimport {\n propsOfNode,\n hasClassName,\n childrenOfNode,\n parentsOfNode,\n treeFilter,\n getTextFromHostNodes,\n getHTMLFromHostNodes,\n} from './RSTTraversal';\n\nimport { buildPredicate, reduceTreesBySelector } from './selectors';\n\nconst NODE = sym('__node__');\nconst NODES = sym('__nodes__');\nconst RENDERER = sym('__renderer__');\nconst UNRENDERED = sym('__unrendered__');\nconst ROOT = sym('__root__');\nconst OPTIONS = sym('__options__');\nconst ROOT_NODES = sym('__rootNodes__');\nconst WRAPPING_COMPONENT = sym('__wrappingComponent__');\nconst LINKED_ROOTS = sym('__linkedRoots__');\nconst UPDATED_BY = sym('__updatedBy__');\n\n/**\n * Finds all nodes in the current wrapper nodes' render trees that match the provided predicate\n * function.\n *\n * @param {ReactWrapper} wrapper\n * @param {Function} predicate\n * @param {Function} filter\n * @returns {ReactWrapper}\n */\nfunction findWhereUnwrapped(wrapper, predicate, filter = treeFilter) {\n return wrapper.flatMap((n) => filter(n.getNodeInternal(), predicate));\n}\n\n/**\n * Returns a new wrapper instance with only the nodes of the current wrapper instance that match\n * the provided predicate function.\n *\n * @param {ReactWrapper} wrapper\n * @param {Function} predicate\n * @returns {ReactWrapper}\n */\nfunction filterWhereUnwrapped(wrapper, predicate) {\n return wrapper.wrap(wrapper.getNodesInternal().filter(predicate).filter(Boolean));\n}\n\nfunction getRootNodeInternal(wrapper) {\n if (wrapper[ROOT].length !== 1) {\n throw new Error('getRootNodeInternal(wrapper) can only be called when wrapper wraps one node');\n }\n if (wrapper[ROOT] !== wrapper) {\n return wrapper[ROOT_NODES][0];\n }\n return wrapper[ROOT][NODE];\n}\n\nfunction nodeParents(wrapper, node) {\n return parentsOfNode(node, getRootNodeInternal(wrapper));\n}\n\nfunction privateSetNodes(wrapper, nodes) {\n if (!nodes) {\n privateSet(wrapper, NODE, null);\n privateSet(wrapper, NODES, []);\n } else if (!Array.isArray(nodes)) {\n privateSet(wrapper, NODE, nodes);\n privateSet(wrapper, NODES, [nodes]);\n } else {\n privateSet(wrapper, NODE, nodes[0]);\n privateSet(wrapper, NODES, nodes);\n }\n privateSet(wrapper, 'length', wrapper[NODES].length);\n}\n\n/**\n * @class ReactWrapper\n */\nclass ReactWrapper {\n constructor(nodes, root, passedOptions = {}) {\n if (!global.window && !global.document) {\n throw new Error('It looks like you called `mount()` without a global document being loaded.');\n }\n const options = makeOptions(passedOptions);\n\n if (!root) {\n const adapter = getAdapter(options);\n if (!adapter.isValidElement(nodes)) {\n throw new TypeError('ReactWrapper can only wrap valid elements');\n }\n\n const renderer = adapter.createRenderer({ mode: 'mount', ...options });\n privateSet(this, RENDERER, renderer);\n renderer.render(nodes, options.context);\n privateSet(this, ROOT, this);\n privateSetNodes(this, this[RENDERER].getNode());\n privateSet(this, OPTIONS, options);\n privateSet(this, LINKED_ROOTS, []);\n\n if (isCustomComponent(options.wrappingComponent, adapter)) {\n if (typeof this[RENDERER].getWrappingComponentRenderer !== 'function') {\n throw new TypeError('your adapter does not support `wrappingComponent`. Try upgrading it!');\n }\n\n // eslint-disable-next-line no-use-before-define\n privateSet(this, WRAPPING_COMPONENT, new WrappingComponentWrapper(\n this, this[RENDERER].getWrappingComponentRenderer(),\n ));\n this[LINKED_ROOTS].push(this[WRAPPING_COMPONENT]);\n }\n } else {\n privateSet(this, RENDERER, root[RENDERER]);\n privateSet(this, ROOT, root);\n privateSetNodes(this, nodes);\n privateSet(this, ROOT_NODES, root[NODES]);\n privateSet(this, OPTIONS, root[OPTIONS]);\n privateSet(this, LINKED_ROOTS, []);\n }\n privateSet(this, UNRENDERED, nodes);\n privateSet(this, UPDATED_BY, null);\n }\n\n /**\n * Returns the root wrapper\n *\n * @return {ReactWrapper}\n */\n root() {\n return this[ROOT];\n }\n\n /**\n * Returns the wrapped component.\n *\n * @return {ReactComponent}\n */\n getNodeInternal() {\n if (this.length !== 1) {\n throw new Error('ReactWrapper::getNode() can only be called when wrapping one node');\n }\n return this[NODES][0];\n }\n\n /**\n * Returns the the wrapped components.\n *\n * @return {Array}\n */\n getNodesInternal() {\n return this[NODES];\n }\n\n /**\n * Returns the wrapped ReactElement.\n *\n * @return {ReactElement}\n */\n getElement() {\n return this.single('getElement', () => getAdapter(this[OPTIONS]).nodeToElement(this[NODE]));\n }\n\n /**\n * Returns the wrapped ReactElements.\n *\n * @return {Array}\n */\n getElements() {\n return this[NODES].map((n) => getAdapter(this[OPTIONS]).nodeToElement(n));\n }\n\n // eslint-disable-next-line class-methods-use-this\n getNode() {\n throw new Error('ReactWrapper::getNode() is no longer supported. Use ReactWrapper::instance() instead');\n }\n\n // eslint-disable-next-line class-methods-use-this\n getNodes() {\n throw new Error('ReactWrapper::getNodes() is no longer supported.');\n }\n\n /**\n * Returns the outer most DOMComponent of the current wrapper.\n *\n * NOTE: can only be called on a wrapper of a single node.\n *\n * @returns {DOMComponent}\n */\n getDOMNode() {\n const adapter = getAdapter(this[OPTIONS]);\n return this.single('getDOMNode', (n) => adapter.nodeToHostNode(n, true));\n }\n\n /**\n * If the root component contained a ref, you can access it here and get the relevant\n * react component instance or HTML element instance.\n *\n * NOTE: can only be called on a wrapper instance that is also the root instance.\n *\n * @param {String} refname\n * @returns {ReactComponent | HTMLElement}\n */\n ref(refname) {\n if (this[ROOT] !== this) {\n throw new Error('ReactWrapper::ref(refname) can only be called on the root');\n }\n return this.instance().refs[refname];\n }\n\n /**\n * Returns the wrapper's underlying instance.\n *\n * Example:\n * ```\n * const wrapper = mount();\n * const inst = wrapper.instance();\n * expect(inst).to.be.instanceOf(MyComponent);\n * ```\n * @returns {ReactComponent|DOMComponent}\n */\n instance() {\n return this.single('instance', () => this[NODE].instance);\n }\n\n /**\n * If a `wrappingComponent` was passed in `options`, this methods returns a `ReactWrapper` around\n * the rendered `wrappingComponent`. This `ReactWrapper` can be used to update the\n * `wrappingComponent`'s props, state, etc.\n *\n * @returns ReactWrapper\n */\n getWrappingComponent() {\n if (this[ROOT] !== this) {\n throw new Error('ReactWrapper::getWrappingComponent() can only be called on the root');\n }\n if (!this[OPTIONS].wrappingComponent) {\n throw new Error('ReactWrapper::getWrappingComponent() can only be called on a wrapper that was originally passed a `wrappingComponent` option');\n }\n return this[WRAPPING_COMPONENT];\n }\n\n /**\n * Forces a re-render. Useful to run before checking the render output if something external\n * may be updating the state of the component somewhere.\n *\n * NOTE: no matter what instance this is called on, it will always update the root.\n *\n * @returns {ReactWrapper}\n */\n update() {\n const root = this[ROOT];\n if (this !== root) {\n return root.update();\n }\n privateSetNodes(this, this[RENDERER].getNode());\n this[LINKED_ROOTS].forEach((linkedRoot) => {\n if (linkedRoot !== this[UPDATED_BY]) {\n /* eslint-disable no-param-reassign */\n // Only update a linked it root if it is not the originator of our update().\n // This is needed to prevent infinite recursion when there is a bi-directional\n // link between two roots.\n linkedRoot[UPDATED_BY] = this;\n try {\n linkedRoot.update();\n } finally {\n linkedRoot[UPDATED_BY] = null;\n }\n }\n });\n return this;\n }\n\n /**\n * A method that unmounts the component. This can be used to simulate a component going through\n * and unmount/mount lifecycle.\n *\n * @returns {ReactWrapper}\n */\n unmount() {\n if (this[ROOT] !== this) {\n throw new Error('ReactWrapper::unmount() can only be called on the root');\n }\n this.single('unmount', () => {\n this[RENDERER].unmount();\n this.update();\n });\n return this;\n }\n\n /**\n * A method that re-mounts the component, if it is not currently mounted.\n * This can be used to simulate a component going through\n * an unmount/mount lifecycle.\n *\n * @returns {ReactWrapper}\n */\n mount() {\n if (this[ROOT] !== this) {\n throw new Error('ReactWrapper::mount() can only be called on the root');\n }\n this[RENDERER].render(this[UNRENDERED], this[OPTIONS].context, () => this.update());\n return this;\n }\n\n /**\n * A method that sets the props of the root component, and re-renders. Useful for when you are\n * wanting to test how the component behaves over time with changing props. Calling this, for\n * instance, will call the `componentWillReceiveProps` lifecycle method.\n *\n * Similar to `setState`, this method accepts a props object and will merge it in with the already\n * existing props.\n *\n * NOTE: can only be called on a wrapper instance that is also the root instance.\n *\n * @param {Object} props object\n * @param {Function} cb - callback function\n * @returns {ReactWrapper}\n */\n setProps(props, callback = undefined) {\n if (this[ROOT] !== this) {\n throw new Error('ReactWrapper::setProps() can only be called on the root');\n }\n if (arguments.length > 1 && typeof callback !== 'function') {\n throw new TypeError('ReactWrapper::setProps() expects a function as its second argument');\n }\n const adapter = getAdapter(this[OPTIONS]);\n this[UNRENDERED] = cloneElement(adapter, this[UNRENDERED], props);\n this[RENDERER].render(this[UNRENDERED], null, () => {\n this.update();\n if (callback) {\n callback();\n }\n });\n return this;\n }\n\n /**\n * A method to invoke `setState` on the root component instance similar to how you might in the\n * definition of the component, and re-renders. This method is useful for testing your component\n * in hard to achieve states, however should be used sparingly. If possible, you should utilize\n * your component's external API in order to get it into whatever state you want to test, in order\n * to be as accurate of a test as possible. This is not always practical, however.\n *\n * NOTE: can only be called on a wrapper instance that is also the root instance.\n *\n * @param {Object} state to merge\n * @param {Function} cb - callback function\n * @returns {ReactWrapper}\n */\n setState(state, callback = undefined) {\n if (this.instance() === null || this.getNodeInternal().nodeType !== 'class') {\n throw new Error('ReactWrapper::setState() can only be called on class components');\n }\n if (arguments.length > 1 && typeof callback !== 'function') {\n throw new TypeError('ReactWrapper::setState() expects a function as its second argument');\n }\n this.instance().setState(state, () => {\n this.update();\n if (callback) {\n const adapter = getAdapter(this[OPTIONS]);\n const instance = this.instance();\n if (adapter.invokeSetStateCallback) {\n adapter.invokeSetStateCallback(instance, callback);\n } else {\n callback.call(instance);\n }\n }\n });\n return this;\n }\n\n /**\n * A method that sets the context of the root component, and re-renders. Useful for when you are\n * wanting to test how the component behaves over time with changing contexts.\n *\n * NOTE: can only be called on a wrapper instance that is also the root instance.\n *\n * @param {Object} context object\n * @returns {ReactWrapper}\n */\n setContext(context) {\n if (this[ROOT] !== this) {\n throw new Error('ReactWrapper::setContext() can only be called on the root');\n }\n if (!this[OPTIONS].context) {\n throw new Error('ReactWrapper::setContext() can only be called on a wrapper that was originally passed a context option');\n }\n this[RENDERER].render(this[UNRENDERED], context, () => this.update());\n return this;\n }\n\n /**\n * Whether or not a given react element exists in the mount render tree.\n *\n * Example:\n * ```\n * const wrapper = mount();\n * expect(wrapper.contains(
)).to.equal(true);\n * ```\n *\n * @param {ReactElement|Array} nodeOrNodes\n * @returns {Boolean}\n */\n contains(nodeOrNodes) {\n const adapter = getAdapter(this[OPTIONS]);\n\n const predicate = Array.isArray(nodeOrNodes)\n ? (other) => containsChildrenSubArray(\n nodeEqual,\n other,\n nodeOrNodes.map((node) => adapter.elementToNode(node)),\n )\n : (other) => nodeEqual(adapter.elementToNode(nodeOrNodes), other);\n\n return findWhereUnwrapped(this, predicate).length > 0;\n }\n\n /**\n * Whether or not a given react element exists in the current render tree.\n * It will determine if one of the wrappers element \"looks like\" the expected\n * element by checking if all props of the expected element are present\n * on the wrappers element and equals to each other.\n *\n * Example:\n * ```\n * // MyComponent outputs
Hello
\n * const wrapper = mount();\n * expect(wrapper.containsMatchingElement(
Hello
)).to.equal(true);\n * ```\n *\n * @param {ReactElement} node\n * @returns {Boolean}\n */\n containsMatchingElement(node) {\n const rstNode = getAdapter(this[OPTIONS]).elementToNode(node);\n const predicate = (other) => nodeMatches(rstNode, other, (a, b) => a <= b);\n return findWhereUnwrapped(this, predicate).length > 0;\n }\n\n /**\n * Whether or not all the given react elements exist in the current render tree.\n * It will determine if one of the wrappers element \"looks like\" the expected\n * element by checking if all props of the expected element are present\n * on the wrappers element and equals to each other.\n *\n * Example:\n * ```\n * const wrapper = mount();\n * expect(wrapper.containsAllMatchingElements([\n *
Hello
,\n *
Goodbye
,\n * ])).to.equal(true);\n * ```\n *\n * @param {Array} nodes\n * @returns {Boolean}\n */\n containsAllMatchingElements(nodes) {\n if (!Array.isArray(nodes)) {\n throw new TypeError('nodes should be an Array');\n }\n\n return nodes.every((node) => this.containsMatchingElement(node));\n }\n\n /**\n * Whether or not one of the given react elements exists in the current render tree.\n * It will determine if one of the wrappers element \"looks like\" the expected\n * element by checking if all props of the expected element are present\n * on the wrappers element and equals to each other.\n *\n * Example:\n * ```\n * const wrapper = mount();\n * expect(wrapper.containsAnyMatchingElements([\n *
Hello
,\n *
Goodbye
,\n * ])).to.equal(true);\n * ```\n *\n * @param {Array} nodes\n * @returns {Boolean}\n */\n containsAnyMatchingElements(nodes) {\n return Array.isArray(nodes) && nodes.some((node) => this.containsMatchingElement(node));\n }\n\n /**\n * Whether or not a given react element exists in the render tree.\n *\n * Example:\n * ```\n * const wrapper = mount();\n * expect(wrapper.contains(
)).to.equal(true);\n * ```\n *\n * @param {ReactElement} node\n * @returns {Boolean}\n */\n equals(node) {\n return this.single('equals', () => nodeEqual(this.getNodeInternal(), node));\n }\n\n /**\n * Whether or not a given react element matches the render tree.\n * Match is based on the expected element and not on wrapper root node.\n * It will determine if the wrapper root node \"looks like\" the expected\n * element by checking if all props of the expected element are present\n * on the wrapper root node and equals to each other.\n *\n * Example:\n * ```\n * // MyComponent outputs
Hello
\n * const wrapper = mount();\n * expect(wrapper.matchesElement(
Hello
)).to.equal(true);\n * ```\n *\n * @param {ReactElement} node\n * @returns {Boolean}\n */\n matchesElement(node) {\n return this.single('matchesElement', () => {\n const adapter = getAdapter(this[OPTIONS]);\n const rstNode = adapter.elementToNode(node);\n return nodeMatches(rstNode, this.getNodeInternal(), (a, b) => a <= b);\n });\n }\n\n /**\n * Finds every node in the render tree of the current wrapper that matches the provided selector.\n *\n * @param {EnzymeSelector} selector\n * @returns {ReactWrapper}\n */\n find(selector) {\n return this.wrap(reduceTreesBySelector(selector, this.getNodesInternal()));\n }\n\n /**\n * Returns whether or not current node matches a provided selector.\n *\n * NOTE: can only be called on a wrapper of a single node.\n *\n * @param {EnzymeSelector} selector\n * @returns {boolean}\n */\n is(selector) {\n const predicate = buildPredicate(selector);\n return this.single('is', (n) => predicate(n));\n }\n\n /**\n * Returns true if the component rendered nothing, i.e., null or false.\n *\n * @returns {boolean}\n */\n isEmptyRender() {\n const nodes = this.getNodeInternal();\n\n return renderedDive(nodes);\n }\n\n /**\n * Returns a new wrapper instance with only the nodes of the current wrapper instance that match\n * the provided predicate function.\n *\n * @param {Function} predicate\n * @returns {ReactWrapper}\n */\n filterWhere(predicate) {\n return filterWhereUnwrapped(this, (n) => predicate(this.wrap(n)));\n }\n\n /**\n * Returns a new wrapper instance with only the nodes of the current wrapper instance that match\n * the provided selector.\n *\n * @param {EnzymeSelector} selector\n * @returns {ReactWrapper}\n */\n filter(selector) {\n const predicate = buildPredicate(selector);\n return filterWhereUnwrapped(this, predicate);\n }\n\n /**\n * Returns a new wrapper instance with only the nodes of the current wrapper that did not match\n * the provided selector. Essentially the inverse of `filter`.\n *\n * @param {EnzymeSelector} selector\n * @returns {ReactWrapper}\n */\n not(selector) {\n const predicate = buildPredicate(selector);\n return filterWhereUnwrapped(this, (n) => !predicate(n));\n }\n\n /**\n * Returns a string of the rendered text of the current render tree. This function should be\n * looked at with skepticism if being used to test what the actual HTML output of the component\n * will be. If that is what you would like to test, use enzyme's `render` function instead.\n *\n * NOTE: can only be called on a wrapper of a single node.\n *\n * @returns {String}\n */\n text() {\n const adapter = getAdapter(this[OPTIONS]);\n return this.single('text', (n) => getTextFromHostNodes(n, adapter));\n }\n\n /**\n * Returns the HTML of the node.\n *\n * NOTE: can only be called on a wrapper of a single node.\n *\n * @returns {String}\n */\n html() {\n const adapter = getAdapter(this[OPTIONS]);\n return this.single('html', (n) => getHTMLFromHostNodes(n, adapter));\n }\n\n /**\n * Returns the current node rendered to HTML and wrapped in a CheerioWrapper.\n *\n * NOTE: can only be called on a wrapper of a single node.\n *\n * @returns {CheerioWrapper}\n */\n render() {\n const html = this.html();\n return loadCheerioRoot(html);\n }\n\n /**\n * Used to simulate events. Pass an eventname and (optionally) event arguments. This method of\n * testing events should be met with some skepticism.\n *\n * @param {String} event\n * @param {Object} mock (optional)\n * @returns {ReactWrapper}\n */\n simulate(event, mock = {}) {\n return this.single('simulate', (n) => {\n this[RENDERER].simulateEvent(n, event, mock);\n this[ROOT].update();\n return this;\n });\n }\n\n /**\n * Used to simulate throwing a rendering error. Pass an error to throw.\n *\n * @param {String} error\n * @returns {ReactWrapper}\n */\n simulateError(error) {\n if (this[ROOT] === this) {\n throw new Error('ReactWrapper::simulateError() may not be called on the root');\n }\n\n return this.single('simulateError', (thisNode) => {\n if (thisNode.nodeType === 'host') {\n throw new Error('ReactWrapper::simulateError() can only be called on custom components');\n }\n\n const renderer = this[RENDERER];\n if (typeof renderer.simulateError !== 'function') {\n throw new TypeError('your adapter does not support `simulateError`. Try upgrading it!');\n }\n\n const rootNode = getRootNodeInternal(this);\n const nodeHierarchy = [thisNode].concat(nodeParents(this, thisNode));\n renderer.simulateError(nodeHierarchy, rootNode, error);\n\n this[ROOT].update();\n return this;\n });\n }\n\n /**\n * Returns the props hash for the root node of the wrapper.\n *\n * NOTE: can only be called on a wrapper of a single node.\n *\n * @returns {Object}\n */\n props() {\n return this.single('props', propsOfNode);\n }\n\n /**\n * Returns the state hash for the root node of the wrapper. Optionally pass in a prop name and it\n * will return just that value.\n *\n * NOTE: can only be called on a wrapper of a single node.\n *\n * @param {String} name (optional)\n * @returns {*}\n */\n state(name) {\n const thisNode = this[ROOT] === this ? this[RENDERER].getNode() : this.getNodeInternal();\n if (this.instance() === null || thisNode.nodeType !== 'class') {\n throw new Error('ReactWrapper::state() can only be called on class components');\n }\n const _state = this.single('state', () => this.instance().state);\n if (typeof name !== 'undefined') {\n if (_state == null) {\n throw new TypeError(`ReactWrapper::state(\"${name}\") requires that \\`state\\` not be \\`null\\` or \\`undefined\\``);\n }\n return _state[name];\n }\n return _state;\n }\n\n /**\n * Returns the context hash for the root node of the wrapper.\n * Optionally pass in a prop name and it will return just that value.\n *\n * NOTE: can only be called on a wrapper of a single node.\n *\n * @param {String} name (optional)\n * @returns {*}\n */\n context(name) {\n if (this[ROOT] !== this) {\n throw new Error('ReactWrapper::context() can only be called on the root');\n }\n const instance = this.single('context', () => this.instance());\n if (instance === null) {\n throw new Error('ReactWrapper::context() can only be called on components with instances');\n }\n const _context = instance.context;\n if (typeof name !== 'undefined') {\n return _context[name];\n }\n return _context;\n }\n\n /**\n * Returns a new wrapper with all of the children of the current wrapper.\n *\n * @param {EnzymeSelector} [selector]\n * @returns {ReactWrapper}\n */\n children(selector) {\n const allChildren = this.flatMap((n) => childrenOfNode(n.getNodeInternal()));\n return selector ? allChildren.filter(selector) : allChildren;\n }\n\n /**\n * Returns a new wrapper with a specific child\n *\n * @param {Number} [index]\n * @returns {ReactWrapper}\n */\n childAt(index) {\n return this.single('childAt', () => this.children().at(index));\n }\n\n /**\n * Returns a wrapper around all of the parents/ancestors of the wrapper. Does not include the node\n * in the current wrapper.\n *\n * NOTE: can only be called on a wrapper of a single node.\n *\n * @param {EnzymeSelector} [selector]\n * @returns {ReactWrapper}\n */\n parents(selector) {\n return this.single('parents', (n) => {\n const allParents = this.wrap(nodeParents(this, n));\n return selector ? allParents.filter(selector) : allParents;\n });\n }\n\n /**\n * Returns a wrapper around the immediate parent of the current node.\n *\n * @returns {ReactWrapper}\n */\n parent() {\n return this.flatMap((n) => [n.parents().get(0)]);\n }\n\n /**\n *\n * @param {EnzymeSelector} selector\n * @returns {ReactWrapper}\n */\n closest(selector) {\n if (this.is(selector)) {\n return this;\n }\n const matchingAncestors = this.parents().filter(selector);\n return matchingAncestors.length > 0 ? matchingAncestors.first() : this.findWhere(() => false);\n }\n\n /**\n * Returns the value of prop with the given name of the root node.\n *\n * @param {String} propName\n * @returns {*}\n */\n prop(propName) {\n return this.props()[propName];\n }\n\n /**\n * Used to invoke a function prop.\n * Will invoke an function prop and return its value.\n *\n * @param {String} propName\n * @returns {Any}\n */\n invoke(propName) {\n return this.single('invoke', () => {\n const handler = this.prop(propName);\n if (typeof handler !== 'function') {\n throw new TypeError('ReactWrapper::invoke() requires the name of a prop whose value is a function');\n }\n return (...args) => {\n const response = typeof this[RENDERER].wrapInvoke === 'function'\n ? this[RENDERER].wrapInvoke(() => handler(...args))\n : handler(...args);\n this[ROOT].update();\n return response;\n };\n });\n }\n\n /**\n * Returns a wrapper of the node rendered by the provided render prop.\n *\n * @param {String} propName\n * @returns {Function}\n */\n renderProp(propName) {\n const adapter = getAdapter(this[OPTIONS]);\n if (typeof adapter.wrap !== 'function') {\n throw new RangeError('your adapter does not support `wrap`. Try upgrading it!');\n }\n\n return this.single('renderProp', (n) => {\n if (n.nodeType === 'host') {\n throw new TypeError('ReactWrapper::renderProp() can only be called on custom components');\n }\n if (typeof propName !== 'string') {\n throw new TypeError('ReactWrapper::renderProp(): `propName` must be a string');\n }\n const props = this.props();\n if (!has(props, propName)) {\n throw new Error(`ReactWrapper::renderProp(): no prop called “${propName}“ found`);\n }\n const propValue = props[propName];\n if (typeof propValue !== 'function') {\n throw new TypeError(`ReactWrapper::renderProp(): expected prop “${propName}“ to contain a function, but it holds “${typeof propValue}“`);\n }\n\n return (...args) => {\n const element = propValue(...args);\n const wrapped = adapter.wrap(element);\n return this.wrap(wrapped, null, this[OPTIONS]);\n };\n });\n }\n\n /**\n * Returns the key assigned to the current node.\n *\n * @returns {String}\n */\n key() {\n return this.single('key', (n) => (n.key === undefined ? null : n.key));\n }\n\n /**\n * Returns the type of the root node of this wrapper. If it's a composite component, this will be\n * the component constructor. If it's native DOM node, it will be a string.\n *\n * @returns {String|Function}\n */\n type() {\n return this.single('type', (n) => typeOfNode(n));\n }\n\n /**\n * Returns the name of the root node of this wrapper.\n *\n * In order of precedence => type.displayName -> type.name -> type.\n *\n * @returns {String}\n */\n name() {\n const adapter = getAdapter(this[OPTIONS]);\n return this.single('name', (n) => (\n adapter.displayNameOfNode ? adapter.displayNameOfNode(n) : displayNameOfNode(n)\n ));\n }\n\n /**\n * Returns whether or not the current root node has the given class name or not.\n *\n * NOTE: can only be called on a wrapper of a single node.\n *\n * @param {String} className\n * @returns {Boolean}\n */\n hasClass(className) {\n if (typeof className === 'string' && className.indexOf('.') !== -1) {\n // eslint-disable-next-line no-console\n console.warn('It looks like you\\'re calling `ReactWrapper::hasClass()` with a CSS selector. hasClass() expects a class name, not a CSS selector.');\n }\n return this.single('hasClass', (n) => hasClassName(n, className));\n }\n\n /**\n * Iterates through each node of the current wrapper and executes the provided function with a\n * wrapper around the corresponding node passed in as the first argument.\n *\n * @param {Function} fn\n * @returns {ReactWrapper}\n */\n forEach(fn) {\n this.getNodesInternal().forEach((n, i) => fn.call(this, this.wrap(n), i));\n return this;\n }\n\n /**\n * Maps the current array of nodes to another array. Each node is passed in as a `ReactWrapper`\n * to the map function.\n *\n * @param {Function} fn\n * @returns {Array}\n */\n map(fn) {\n return this.getNodesInternal().map((n, i) => fn.call(this, this.wrap(n), i));\n }\n\n /**\n * Reduces the current array of nodes to another array.\n * Each node is passed in as a `ShallowWrapper` to the reducer function.\n *\n * @param {Function} fn - the reducer function\n * @param {*} initialValue - the initial value\n * @returns {*}\n */\n reduce(fn, initialValue = undefined) {\n if (arguments.length > 1) {\n return this.getNodesInternal().reduce(\n (accum, n, i) => fn.call(this, accum, this.wrap(n), i),\n initialValue,\n );\n }\n return this.getNodesInternal().reduce((accum, n, i) => fn.call(\n this,\n i === 1 ? this.wrap(accum) : accum,\n this.wrap(n),\n i,\n ));\n }\n\n /**\n * Reduces the current array of nodes to another array, from right to left. Each node is passed\n * in as a `ShallowWrapper` to the reducer function.\n *\n * @param {Function} fn - the reducer function\n * @param {*} initialValue - the initial value\n * @returns {*}\n */\n reduceRight(fn, initialValue = undefined) {\n if (arguments.length > 1) {\n return this.getNodesInternal().reduceRight(\n (accum, n, i) => fn.call(this, accum, this.wrap(n), i),\n initialValue,\n );\n }\n return this.getNodesInternal().reduceRight((accum, n, i) => fn.call(\n this,\n i === 1 ? this.wrap(accum) : accum,\n this.wrap(n),\n i,\n ));\n }\n\n /**\n * Returns a new wrapper with a subset of the nodes of the original wrapper, according to the\n * rules of `Array#slice`.\n *\n * @param {Number} begin\n * @param {Number} end\n * @returns {ShallowWrapper}\n */\n slice(begin, end) {\n return this.wrap(this.getNodesInternal().slice(begin, end));\n }\n\n /**\n * Returns whether or not any of the nodes in the wrapper match the provided selector.\n *\n * @param {EnzymeSelector} selector\n * @returns {Boolean}\n */\n some(selector) {\n if (this[ROOT] === this) {\n throw new Error('ReactWrapper::some() can not be called on the root');\n }\n const predicate = buildPredicate(selector);\n return this.getNodesInternal().some(predicate);\n }\n\n /**\n * Returns whether or not any of the nodes in the wrapper pass the provided predicate function.\n *\n * @param {Function} predicate\n * @returns {Boolean}\n */\n someWhere(predicate) {\n return this.getNodesInternal().some((n, i) => predicate.call(this, this.wrap(n), i));\n }\n\n /**\n * Returns whether or not all of the nodes in the wrapper match the provided selector.\n *\n * @param {EnzymeSelector} selector\n * @returns {Boolean}\n */\n every(selector) {\n const predicate = buildPredicate(selector);\n return this.getNodesInternal().every(predicate);\n }\n\n /**\n * Returns whether or not any of the nodes in the wrapper pass the provided predicate function.\n *\n * @param {Function} predicate\n * @returns {Boolean}\n */\n everyWhere(predicate) {\n return this.getNodesInternal().every((n, i) => predicate.call(this, this.wrap(n), i));\n }\n\n /**\n * Utility method used to create new wrappers with a mapping function that returns an array of\n * nodes in response to a single node wrapper. The returned wrapper is a single wrapper around\n * all of the mapped nodes flattened (and de-duplicated).\n *\n * @param {Function} fn\n * @returns {ReactWrapper}\n */\n flatMap(fn) {\n const nodes = this.getNodesInternal().map((n, i) => fn.call(this, this.wrap(n), i));\n const flattened = flat(nodes, 1);\n return this.wrap(flattened.filter(Boolean));\n }\n\n /**\n * Finds all nodes in the current wrapper nodes' render trees that match the provided predicate\n * function.\n *\n * @param {Function} predicate\n * @returns {ReactWrapper}\n */\n findWhere(predicate) {\n return findWhereUnwrapped(this, (n) => {\n const node = this.wrap(n);\n return node.length > 0 && predicate(node);\n });\n }\n\n /**\n * Returns the node at a given index of the current wrapper.\n *\n * @param {Number} index\n * @returns {ReactElement}\n */\n get(index) {\n return this.getElements()[index];\n }\n\n /**\n * Returns a wrapper around the node at a given index of the current wrapper.\n *\n * @param {Number} index\n * @returns {ReactWrapper}\n */\n at(index) {\n const nodes = this.getNodesInternal();\n if (index < nodes.length) {\n return this.wrap(nodes[index]);\n }\n return this.wrap([]);\n }\n\n /**\n * Returns a wrapper around the first node of the current wrapper.\n *\n * @returns {ReactWrapper}\n */\n first() {\n return this.at(0);\n }\n\n /**\n * Returns a wrapper around the last node of the current wrapper.\n *\n * @returns {ReactWrapper}\n */\n last() {\n return this.at(this.length - 1);\n }\n\n /**\n * Delegates to exists()\n *\n * @returns {boolean}\n */\n isEmpty() {\n // eslint-disable-next-line no-console\n console.warn('Enzyme::Deprecated method isEmpty() called, use exists() instead.');\n return !this.exists();\n }\n\n /**\n * Returns true if the current wrapper has nodes. False otherwise.\n * If called with a selector it returns `.find(selector).exists()` instead.\n *\n * @param {EnzymeSelector} selector (optional)\n * @returns {boolean}\n */\n exists(selector = null) {\n return arguments.length > 0 ? this.find(selector).exists() : this.length > 0;\n }\n\n /**\n * Utility method that throws an error if the current instance has a length other than one.\n * This is primarily used to enforce that certain methods are only run on a wrapper when it is\n * wrapping a single node.\n *\n * @param {Function} fn\n * @returns {*}\n */\n single(name, fn) {\n const fnName = typeof name === 'string' ? name : 'unknown';\n const callback = typeof fn === 'function' ? fn : name;\n if (this.length !== 1) {\n throw new Error(`Method “${fnName}” is meant to be run on 1 node. ${this.length} found instead.`);\n }\n return callback.call(this, this.getNodeInternal());\n }\n\n /**\n * Helpful utility method to create a new wrapper with the same root as the current wrapper, with\n * any nodes passed in as the first parameter automatically wrapped.\n *\n * @param {ReactWrapper|ReactElement|Array} node\n * @returns {ReactWrapper}\n */\n wrap(node, root = this[ROOT], ...args) {\n if (node instanceof ReactWrapper) {\n return node;\n }\n return new ReactWrapper(node, root, ...args);\n }\n\n /**\n * Returns an HTML-like string of the shallow render for debugging purposes.\n *\n * @param {Object} [options] - Property bag of additional options.\n * @param {boolean} [options.ignoreProps] - if true, props are omitted from the string.\n * @param {boolean} [options.verbose] - if true, arrays and objects to be verbosely printed.\n * @returns {String}\n */\n debug(options = {}) {\n return debugNodes(this.getNodesInternal(), options);\n }\n\n /**\n * Invokes intercepter and returns itself. intercepter is called with itself.\n * This is helpful when debugging nodes in method chains.\n * @param fn\n * @returns {ReactWrapper}\n */\n tap(intercepter) {\n intercepter(this);\n return this;\n }\n\n /**\n * Detaches the react tree from the DOM. Runs `ReactDOM.unmountComponentAtNode()` under the hood.\n *\n * This method will most commonly be used as a \"cleanup\" method if you decide to use the\n * `attachTo` option in `mount(node, options)`.\n *\n * The method is intentionally not \"fluent\" (in that it doesn't return `this`) because you should\n * not be doing anything with this wrapper after this method is called.\n */\n detach() {\n if (this[ROOT] !== this) {\n throw new Error('ReactWrapper::detach() can only be called on the root');\n }\n if (!this[OPTIONS].attachTo) {\n throw new Error('ReactWrapper::detach() can only be called on when the `attachTo` option was passed into `mount()`.');\n }\n this[RENDERER].unmount();\n }\n\n /**\n * Strips out all the not host-nodes from the list of nodes\n *\n * This method is useful if you want to check for the presence of host nodes\n * (actually rendered HTML elements) ignoring the React nodes.\n */\n hostNodes() {\n return this.filterWhere((n) => typeof n.type() === 'string');\n }\n}\n\n/**\n * A *special* \"root\" wrapper that represents the component passed as `wrappingComponent`.\n * It is linked to the primary root such that updates to it will update the primary,\n * and vice versa.\n *\n * @class WrappingComponentWrapper\n */\nclass WrappingComponentWrapper extends ReactWrapper {\n /* eslint-disable class-methods-use-this */\n constructor(root, renderer) {\n super(renderer.getNode(), root);\n\n privateSet(this, ROOT, this);\n privateSet(this, RENDERER, renderer);\n this[LINKED_ROOTS].push(root);\n }\n\n getWrappingComponent() {\n throw new TypeError('ReactWrapper::getWrappingComponent() can only be called on the root');\n }\n}\n\nif (ITERATOR_SYMBOL) {\n Object.defineProperty(ReactWrapper.prototype, ITERATOR_SYMBOL, {\n configurable: true,\n value: function iterator() {\n const iter = this[NODES][ITERATOR_SYMBOL]();\n const adapter = getAdapter(this[OPTIONS]);\n return {\n [ITERATOR_SYMBOL]() { return this; },\n next() {\n const next = iter.next();\n if (next.done) {\n return { done: true };\n }\n return {\n done: false,\n value: adapter.nodeToElement(next.value),\n };\n },\n };\n },\n });\n}\n\nfunction privateWarning(prop, extraMessage) {\n Object.defineProperty(ReactWrapper.prototype, prop, {\n get() {\n throw new Error(`\n Attempted to access ReactWrapper::${prop}, which was previously a private property on\n Enzyme ReactWrapper instances, but is no longer and should not be relied upon.\n ${extraMessage}\n `);\n },\n enumerable: false,\n configurable: false,\n });\n}\n\nprivateWarning('node', 'Consider using the getElement() method instead.');\nprivateWarning('nodes', 'Consider using the getElements() method instead.');\nprivateWarning('renderer', '');\nprivateWarning('options', '');\nprivateWarning('complexSelector', '');\n\nexport default ReactWrapper;\n"]}