{"version":3,"sources":["../src/ShallowWrapper.js"],"names":["NODE","NODES","RENDERER","UNRENDERED","ROOT","OPTIONS","SET_STATE","ROOT_NODES","CHILD_CONTEXT","WRAPPING_COMPONENT","PRIMARY_WRAPPER","ROOT_FINDER","PROVIDER_VALUES","findWhereUnwrapped","wrapper","predicate","filter","treeFilter","flatMap","n","getNodeInternal","filterWhereUnwrapped","wrap","getNodesInternal","Boolean","validateOptions","options","lifecycleExperimental","disableLifecycleMethods","enableComponentDidUpdateOnSetState","supportPrevContextArgumentOfComponentDidUpdate","lifecycles","Error","componentDidUpdate","onSetState","TypeError","prevContext","getAdapterLifecycles","hasLegacySetStateArg","hasLegacyPrevContextArg","originalGDSFP","getDerivedStateFromProps","hasShouldComponentUpdateBug","setState","getChildContext","calledByRenderer","getRootNode","node","nodeType","rendered","getRootNodeInternal","length","nodeParents","privateSetNodes","nodes","Array","isArray","pureComponentShouldComponentUpdate","prevProps","props","prevState","state","isPureComponent","instance","isPureReactComponent","hierarchy","renderer","Component","type","componentName","childContextTypes","console","warn","childContext","Object","keys","forEach","key","checkPropTypes","spyOnGetChildContextInitialRender","adapter","prototype","privateSetChildContext","renderedNode","getChildContextSpy","legacyContextMode","getLastReturnValue","restore","nodeHierarchy","concat","mockSCUIfgDSFPReturnNonNull","originalSCU","shouldComponentUpdate","args","sCUResult","apply","nextState","deepRender","target","element","nodeToElement","dive","children","i","found","at","undefined","getContextFromWrappingComponent","rootFinder","legacyContext","context","providerValues","makeShallowOptions","root","passedOptions","wrappingComponent","wrapWithWrappingComponent","wrappedNode","RootFinder","WrappingComponentWrapper","wrappingComponentLegacyContext","wrappingComponentProviderValues","makeInheritedChildOptions","childOptions","ShallowWrapper","isValidElement","createRenderer","mode","Map","render","getNode","updater","callback","componentDidMount","batchedUpdates","update","single","map","unmount","nextContext","shouldRender","shouldComponentUpdateSpy","gDSFP","getSnapshotBeforeUpdate","snapshot","freeze","arguments","rerender","statePayload","call","maybeHasUpdate","skipsComponentDidUpdateOnNullish","invokeSetStateCallback","nodeOrNodes","other","nodeEqual","elementToNode","rstNode","a","b","every","containsMatchingElement","some","selector","getTextFromNode","html","event","simulateEvent","error","thisNode","simulateError","rootNode","propsOfNode","name","_state","_context","allChildren","index","allParents","parents","get","is","matchingAncestors","first","findWhere","propName","handler","prop","response","RangeError","propValue","wrapped","displayNameOfNode","className","indexOf","fn","initialValue","reduce","accum","reduceRight","begin","end","slice","flattened","getElements","exists","find","fnName","intercepter","el","filterWhere","updatePrimaryRootContext","primaryWrapper","primaryRenderer","primaryNode","prevProviderValues","setContext","isContextConsumer","Consumer","Provider","getProviderFromConsumer","newValue","oldValue","result","ITERATOR_SYMBOL","defineProperty","configurable","value","iterator","iter","next","done","privateWarning","extraMessage","enumerable"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;;;;AACA;;;;AACA;;;;AAEA;;AAmBA;;;;AACA;;AACA;;AAQA;;;;;;;;;;;;;;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,YAAY,gBAAI,cAAJ,CAAlB;AACA,IAAMC,aAAa,gBAAI,eAAJ,CAAnB;AACA,IAAMC,gBAAgB,gBAAI,kBAAJ,CAAtB;AACA,IAAMC,qBAAqB,gBAAI,uBAAJ,CAA3B;AACA,IAAMC,kBAAkB,gBAAI,oBAAJ,CAAxB;AACA,IAAMC,cAAc,gBAAI,gBAAJ,CAApB;AACA,IAAMC,kBAAkB,gBAAI,oBAAJ,CAAxB;;AAEA;;;;;;;;;AASA,SAASC,kBAAT,CAA4BC,OAA5B,EAAqCC,SAArC,EAAqE;AAAA,MAArBC,MAAqB,uEAAZC,wBAAY;;AACnE,SAAOH,QAAQ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port shallowEqual from 'enzyme-shallow-equal';\n\nimport {\n nodeEqual,\n nodeMatches,\n containsChildrenSubArray,\n withSetStateAllowed,\n typeOfNode,\n isReactElementAlike,\n displayNameOfNode,\n isCustomComponent,\n isCustomComponentElement,\n ITERATOR_SYMBOL,\n makeOptions,\n sym,\n privateSet,\n cloneElement,\n spyMethod,\n isEmptyValue,\n loadCheerioRoot,\n} from './Utils';\nimport getAdapter from './getAdapter';\nimport { debugNodes } from './Debug';\nimport {\n propsOfNode,\n getTextFromNode,\n hasClassName,\n childrenOfNode,\n parentsOfNode,\n treeFilter,\n} from './RSTTraversal';\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 SET_STATE = sym('__setState__');\nconst ROOT_NODES = sym('__rootNodes__');\nconst CHILD_CONTEXT = sym('__childContext__');\nconst WRAPPING_COMPONENT = sym('__wrappingComponent__');\nconst PRIMARY_WRAPPER = sym('__primaryWrapper__');\nconst ROOT_FINDER = sym('__rootFinder__');\nconst PROVIDER_VALUES = sym('__providerValues__');\n\n/**\n * Finds all nodes in the current wrapper nodes' render trees that match the provided predicate\n * function.\n *\n * @param {ShallowWrapper} wrapper\n * @param {Function} predicate\n * @param {Function} filter\n * @returns {ShallowWrapper}\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 {ShallowWrapper} wrapper\n * @param {Function} predicate\n * @returns {ShallowWrapper}\n */\nfunction filterWhereUnwrapped(wrapper, predicate) {\n return wrapper.wrap(wrapper.getNodesInternal().filter(predicate).filter(Boolean));\n}\n\n/**\n * Ensure options passed to ShallowWrapper are valid. Throws otherwise.\n * @param {Object} options\n */\nfunction validateOptions(options) {\n const {\n lifecycleExperimental,\n disableLifecycleMethods,\n enableComponentDidUpdateOnSetState,\n supportPrevContextArgumentOfComponentDidUpdate,\n lifecycles,\n } = options;\n if (typeof lifecycleExperimental !== 'undefined' && typeof lifecycleExperimental !== 'boolean') {\n throw new Error('lifecycleExperimental must be either true or false if provided');\n }\n\n if (typeof disableLifecycleMethods !== 'undefined' && typeof disableLifecycleMethods !== 'boolean') {\n throw new Error('disableLifecycleMethods must be either true or false if provided');\n }\n\n if (\n lifecycleExperimental != null\n && disableLifecycleMethods != null\n && lifecycleExperimental === disableLifecycleMethods\n ) {\n throw new Error('lifecycleExperimental and disableLifecycleMethods cannot be set to the same value');\n }\n\n if (\n typeof enableComponentDidUpdateOnSetState !== 'undefined'\n && lifecycles.componentDidUpdate\n && lifecycles.componentDidUpdate.onSetState !== enableComponentDidUpdateOnSetState\n ) {\n throw new TypeError('the legacy enableComponentDidUpdateOnSetState option should be matched by `lifecycles: { componentDidUpdate: { onSetState: true } }`, for compatibility');\n }\n\n if (\n typeof supportPrevContextArgumentOfComponentDidUpdate !== 'undefined'\n && lifecycles.componentDidUpdate\n && lifecycles.componentDidUpdate.prevContext !== supportPrevContextArgumentOfComponentDidUpdate\n ) {\n throw new TypeError('the legacy supportPrevContextArgumentOfComponentDidUpdate option should be matched by `lifecycles: { componentDidUpdate: { prevContext: true } }`, for compatibility');\n }\n}\n\nfunction getAdapterLifecycles({ options }) {\n const {\n lifecycles = {},\n enableComponentDidUpdateOnSetState,\n supportPrevContextArgumentOfComponentDidUpdate,\n } = options;\n\n const hasLegacySetStateArg = typeof enableComponentDidUpdateOnSetState !== 'undefined';\n const hasLegacyPrevContextArg = typeof supportPrevContextArgumentOfComponentDidUpdate !== 'undefined';\n const componentDidUpdate = hasLegacySetStateArg || hasLegacyPrevContextArg\n ? {\n ...(hasLegacySetStateArg && {\n onSetState: !!enableComponentDidUpdateOnSetState,\n }),\n ...(hasLegacyPrevContextArg && {\n prevContext: !!supportPrevContextArgumentOfComponentDidUpdate,\n }),\n }\n : null;\n const { getDerivedStateFromProps: originalGDSFP } = lifecycles;\n const getDerivedStateFromProps = originalGDSFP ? {\n hasShouldComponentUpdateBug: !!originalGDSFP.hasShouldComponentUpdateBug,\n } : false;\n\n return {\n ...lifecycles,\n setState: {\n ...lifecycles.setState,\n },\n getChildContext: {\n calledByRenderer: true,\n ...lifecycles.getChildContext,\n },\n ...(componentDidUpdate && { componentDidUpdate }),\n getDerivedStateFromProps,\n };\n}\n\nfunction getRootNode(node) {\n if (node.nodeType === 'host') {\n return node;\n }\n return node.rendered;\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 (!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\nfunction pureComponentShouldComponentUpdate(prevProps, props, prevState, state) {\n return !shallowEqual(prevProps, props) || !shallowEqual(prevState, state);\n}\n\nfunction isPureComponent(instance) {\n return instance && instance.isPureReactComponent;\n}\n\nfunction getChildContext(node, hierarchy, renderer) {\n const { instance, type: Component } = node;\n const componentName = displayNameOfNode(node);\n // Warn like react if childContextTypes is not defined:\n // https://github.com/facebook/react/blob/1454a8be03794f5e0b23a7e7696cbbbdcf8b0f5d/packages/react-dom/src/server/ReactPartialRenderer.js#L639-L646\n if (typeof Component.childContextTypes !== 'object') {\n // eslint-disable-next-line no-console\n console.warn(\n `${componentName}.getChildContext(): childContextTypes must be defined in order to use getChildContext().`,\n );\n return {};\n }\n // Check childContextTypes like react:\n // https://github.com/facebook/react/blob/1454a8be03794f5e0b23a7e7696cbbbdcf8b0f5d/packages/react-dom/src/server/ReactPartialRenderer.js#L630-L637\n const childContext = instance.getChildContext();\n Object.keys(childContext).forEach((key) => {\n if (!(key in Component.childContextTypes)) {\n throw new Error(\n `${componentName}.getChildContext(): key \"${key}\" is not defined in childContextTypes.`,\n );\n }\n });\n if (typeof renderer.checkPropTypes === 'function') {\n renderer.checkPropTypes(Component.childContextTypes, childContext, 'child context', hierarchy);\n }\n return childContext;\n}\n\nfunction spyOnGetChildContextInitialRender(nodes, adapter) {\n if (\n !isCustomComponentElement(nodes, adapter)\n || !nodes.type.prototype\n || typeof nodes.type.prototype.getChildContext !== 'function'\n ) {\n return null;\n }\n\n return spyMethod(nodes.type.prototype, 'getChildContext');\n}\n\nfunction privateSetChildContext(adapter, wrapper, instance, renderedNode, getChildContextSpy) {\n const renderer = wrapper[RENDERER];\n // We only support parent-based context.\n if (adapter.options.legacyContextMode !== 'parent') { return; }\n if (getChildContextSpy) {\n privateSet(wrapper, CHILD_CONTEXT, getChildContextSpy.getLastReturnValue());\n getChildContextSpy.restore();\n } else if (typeof instance.getChildContext === 'function') {\n // If there's no spy but getChildContext is a function, that means our renderer\n // is not going to call it for us, so we need to call it ourselves.\n const nodeHierarchy = [wrapper[NODE]].concat(nodeParents(wrapper, wrapper[NODE]));\n const childContext = getChildContext(renderedNode, nodeHierarchy, renderer);\n privateSet(wrapper, CHILD_CONTEXT, childContext);\n } else {\n privateSet(wrapper, CHILD_CONTEXT, null);\n }\n}\n\nfunction mockSCUIfgDSFPReturnNonNull(node, state) {\n const { getDerivedStateFromProps } = node.type;\n\n if (typeof getDerivedStateFromProps === 'function') {\n // we try to fix a React shallow renderer bug here.\n // (facebook/react#14607, which has been fixed in react 16.8):\n // when gDSFP return derived state, it will set instance state in shallow renderer before SCU,\n // this will cause `this.state` in sCU be the updated state, which is wrong behavior.\n // so we have to wrap sCU to pass the old state to original sCU.\n const { instance } = node;\n const { restore } = spyMethod(\n instance,\n 'shouldComponentUpdate',\n (originalSCU) => function shouldComponentUpdate(...args) {\n instance.state = state;\n const sCUResult = originalSCU.apply(instance, args);\n const [, nextState] = args;\n instance.state = nextState;\n restore();\n return sCUResult;\n },\n );\n }\n}\n\n/**\n * Recursively dive()s every custom component in a wrapper until\n * the target component is found.\n *\n * @param {ShallowWrapper} wrapper A ShallowWrapper to search\n * @param {ComponentType} target A react custom component that, when found, will end recursion\n * @param {Adapter} adapter An Enzyme adapter\n * @returns {ShallowWrapper|undefined} A ShallowWrapper for the target, or\n * undefined if it can't be found\n */\nfunction deepRender(wrapper, target, adapter) {\n const node = wrapper[NODE];\n const element = node && adapter.nodeToElement(node);\n if (wrapper.type() === target) {\n return wrapper.dive();\n }\n if (element && isCustomComponentElement(element, adapter)) {\n return deepRender(wrapper.dive(), target, adapter);\n }\n const children = wrapper.children();\n for (let i = 0; i < children.length; i += 1) {\n const found = deepRender(children.at(i), target, adapter);\n if (typeof found !== 'undefined') {\n return found;\n }\n }\n return undefined;\n}\n\n/**\n * Deep-renders the `wrappingComponent` and returns the context that should\n * be accessible to the primary wrapper.\n *\n * @param {WrappingComponentWrapper} wrapper The `WrappingComponentWrapper` for a\n * `wrappingComponent`\n * @param {Adapter} adapter An Enzyme adapter\n * @returns {object} An object containing an object of legacy context values and a Map of\n * `createContext()` Provider values.\n */\nfunction getContextFromWrappingComponent(wrapper, adapter) {\n const rootFinder = deepRender(wrapper, wrapper[ROOT_FINDER], adapter);\n if (!rootFinder) {\n throw new Error('`wrappingComponent` must render its children!');\n }\n return {\n legacyContext: rootFinder[OPTIONS].context,\n providerValues: rootFinder[PROVIDER_VALUES],\n };\n}\n\n/**\n * Makes options specifically for `ShallowWrapper`. Most of the logic here is around rendering\n * a `wrappingComponent` (if one was provided) and adding the child context of that component\n * to `options.context`.\n *\n * @param {ReactElement} nodes the nodes passed to `ShallowWrapper`\n * @param {ShallowWrapper} root this `ShallowWrapper`'s parent. If this is passed, options are\n * not transformed.\n * @param {*} passedOptions the options passed to `ShallowWrapper`.\n * @param {*} wrapper the `ShallowWrapper` itself\n * @returns {Object} the decorated and transformed options\n */\nfunction makeShallowOptions(nodes, root, passedOptions, wrapper) {\n const options = makeOptions(passedOptions);\n const adapter = getAdapter(passedOptions);\n privateSet(options, PROVIDER_VALUES, passedOptions[PROVIDER_VALUES]);\n if (root || !isCustomComponent(options.wrappingComponent, adapter)) {\n return options;\n }\n if (typeof adapter.wrapWithWrappingComponent !== 'function') {\n throw new TypeError('your adapter does not support `wrappingComponent`. Try upgrading it!');\n }\n const { node: wrappedNode, RootFinder } = adapter.wrapWithWrappingComponent(nodes, options);\n // eslint-disable-next-line no-use-before-define\n const wrappingComponent = new WrappingComponentWrapper(wrappedNode, wrapper, RootFinder);\n const {\n legacyContext: wrappingComponentLegacyContext,\n providerValues: wrappingComponentProviderValues,\n } = getContextFromWrappingComponent(wrappingComponent, adapter);\n privateSet(wrapper, WRAPPING_COMPONENT, wrappingComponent);\n return {\n ...options,\n context: {\n ...options.context,\n ...wrappingComponentLegacyContext,\n },\n [PROVIDER_VALUES]: wrappingComponentProviderValues,\n };\n}\n\n\nfunction makeInheritedChildOptions(wrapper, options = {}) {\n const childOptions = {\n ...wrapper[OPTIONS],\n ...options,\n context: options.context || {\n ...wrapper[OPTIONS].context,\n ...wrapper[ROOT][CHILD_CONTEXT],\n },\n };\n privateSet(childOptions, PROVIDER_VALUES, wrapper[ROOT][PROVIDER_VALUES]);\n return childOptions;\n}\n\n\n/**\n * @class ShallowWrapper\n */\nclass ShallowWrapper {\n constructor(nodes, root, passedOptions = {}) {\n validateOptions(passedOptions);\n\n const options = makeShallowOptions(nodes, root, passedOptions, this);\n const adapter = getAdapter(options);\n const lifecycles = getAdapterLifecycles(adapter);\n\n // mounting a ShallowRender component\n if (!root) {\n if (!adapter.isValidElement(nodes)) {\n throw new TypeError('ShallowWrapper can only wrap valid elements');\n }\n\n const getChildContextSpy = lifecycles.getChildContext.calledByRenderer\n ? spyOnGetChildContextInitialRender(nodes, adapter)\n : null;\n privateSet(this, ROOT, this);\n privateSet(this, UNRENDERED, nodes);\n const renderer = adapter.createRenderer({ mode: 'shallow', ...options });\n privateSet(this, RENDERER, renderer);\n const providerValues = new Map(options[PROVIDER_VALUES] || []);\n this[RENDERER].render(nodes, options.context, { providerValues });\n const renderedNode = this[RENDERER].getNode();\n privateSetNodes(this, getRootNode(renderedNode));\n privateSet(this, OPTIONS, options);\n privateSet(this, PROVIDER_VALUES, providerValues);\n\n const { instance } = renderedNode;\n if (instance && !options.disableLifecycleMethods) {\n // Ensure to call componentDidUpdate when instance.setState is called\n if (lifecycles.componentDidUpdate.onSetState && !instance[SET_STATE]) {\n privateSet(instance, SET_STATE, instance.setState);\n instance.setState = (updater, callback = undefined) => this.setState(\n ...(callback == null ? [updater] : [updater, callback]),\n );\n }\n\n if (typeof instance.componentDidMount === 'function') {\n this[RENDERER].batchedUpdates(() => {\n instance.componentDidMount();\n });\n }\n privateSetChildContext(adapter, this, instance, renderedNode, getChildContextSpy);\n }\n // creating a child component through enzyme's ShallowWrapper APIs.\n } else {\n privateSet(this, ROOT, root);\n privateSet(this, UNRENDERED, null);\n privateSet(this, RENDERER, root[RENDERER]);\n privateSetNodes(this, nodes);\n privateSet(this, OPTIONS, root[OPTIONS]);\n privateSet(this, ROOT_NODES, root[NODES]);\n privateSet(this, PROVIDER_VALUES, null);\n }\n }\n\n /**\n * Returns the root wrapper\n *\n * @return {ShallowWrapper}\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('ShallowWrapper::getNode() can only be called when wrapping one node');\n }\n if (this[ROOT] === this) {\n this.update();\n }\n return this[NODE];\n }\n\n /**\n * Returns the the wrapped components.\n *\n * @return {Array}\n */\n getNodesInternal() {\n if (this[ROOT] === this && this.length === 1) {\n this.update();\n }\n return this[NODES];\n }\n\n /**\n * Returns the wrapped ReactElement.\n *\n * @return {ReactElement}\n */\n getElement() {\n return this.single('getElement', (n) => getAdapter(this[OPTIONS]).nodeToElement(n));\n }\n\n /**\n * Returns the wrapped ReactElements.\n *\n * @return {Array}\n */\n getElements() {\n return this.getNodesInternal().map((n) => getAdapter(this[OPTIONS]).nodeToElement(n));\n }\n\n // eslint-disable-next-line class-methods-use-this\n getNode() {\n throw new Error('ShallowWrapper::getNode() is no longer supported. Use ShallowWrapper::getElement() instead');\n }\n\n // eslint-disable-next-line class-methods-use-this\n getNodes() {\n throw new Error('ShallowWrapper::getNodes() is no longer supported. Use ShallowWrapper::getElements() instead');\n }\n\n /**\n * Gets the instance of the component being rendered as the root node passed into `shallow()`.\n *\n * NOTE: can only be called on a wrapper instance that is also the root instance.\n *\n * Example:\n * ```\n * const wrapper = shallow();\n * const inst = wrapper.instance();\n * expect(inst).to.be.instanceOf(MyComponent);\n * ```\n * @returns {ReactComponent}\n */\n instance() {\n if (this[ROOT] !== this) {\n throw new Error('ShallowWrapper::instance() can only be called on the root');\n }\n return this[RENDERER].getNode().instance;\n }\n\n /**\n * If a `wrappingComponent` was passed in `options`, this methods returns a `ShallowWrapper`\n * around the rendered `wrappingComponent`. This `ShallowWrapper` can be used to update the\n * `wrappingComponent`'s props, state, etc.\n *\n * @returns ShallowWrapper\n */\n getWrappingComponent() {\n if (this[ROOT] !== this) {\n throw new Error('ShallowWrapper::getWrappingComponent() can only be called on the root');\n }\n if (!this[OPTIONS].wrappingComponent) {\n throw new Error('ShallowWrapper::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: can only be called on a wrapper instance that is also the root instance.\n *\n * @returns {ShallowWrapper}\n */\n update() {\n if (this[ROOT] !== this) {\n throw new Error('ShallowWrapper::update() can only be called on the root');\n }\n if (this.length !== 1) {\n throw new Error('ShallowWrapper::update() can only be called when wrapping one node');\n }\n privateSetNodes(this, getRootNode(this[RENDERER].getNode()));\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 * @returns {ShallowWrapper}\n */\n unmount() {\n this[RENDERER].unmount();\n if (this[ROOT][WRAPPING_COMPONENT]) {\n this[ROOT][WRAPPING_COMPONENT].unmount();\n }\n return this;\n }\n\n /**\n * A method is for re-render with new props and context.\n * This calls componentDidUpdate method if disableLifecycleMethods is not enabled.\n *\n * NOTE: can only be called on a wrapper instance that is also the root instance.\n *\n * @param {Object} props\n * @param {Object} context\n * @returns {ShallowWrapper}\n */\n rerender(props, context) {\n const adapter = getAdapter(this[OPTIONS]);\n this.single('rerender', () => {\n withSetStateAllowed(() => {\n // NOTE(lmr): In react 16, instances will be null for SFCs, but\n // rerendering with props/context is still a valid thing to do. In\n // this case, state will be undefined, but props/context will exist.\n const node = this[RENDERER].getNode();\n const instance = node.instance || {};\n const type = node.type || {};\n const { state } = instance;\n const prevProps = instance.props || this[UNRENDERED].props;\n const prevContext = instance.context || this[OPTIONS].context;\n const nextContext = context || prevContext;\n if (context) {\n this[OPTIONS] = { ...this[OPTIONS], context: nextContext };\n }\n this[RENDERER].batchedUpdates(() => {\n // When shouldComponentUpdate returns false we shouldn't call componentDidUpdate.\n // so we spy shouldComponentUpdate to get the result.\n const lifecycles = getAdapterLifecycles(adapter);\n let shouldRender = true;\n let shouldComponentUpdateSpy;\n let getChildContextSpy;\n if (\n !this[OPTIONS].disableLifecycleMethods\n && instance\n ) {\n if (typeof instance.shouldComponentUpdate === 'function') {\n const { getDerivedStateFromProps: gDSFP } = lifecycles;\n if (gDSFP && gDSFP.hasShouldComponentUpdateBug) {\n mockSCUIfgDSFPReturnNonNull(node, state);\n }\n shouldComponentUpdateSpy = spyMethod(instance, 'shouldComponentUpdate');\n }\n if (\n lifecycles.getChildContext.calledByRenderer\n && typeof instance.getChildContext === 'function'\n ) {\n getChildContextSpy = spyMethod(instance, 'getChildContext');\n }\n }\n if (!shouldComponentUpdateSpy && isPureComponent(instance)) {\n shouldRender = pureComponentShouldComponentUpdate(\n prevProps,\n props,\n state,\n instance.state,\n );\n }\n if (props) this[UNRENDERED] = cloneElement(adapter, this[UNRENDERED], props);\n this[RENDERER].render(this[UNRENDERED], nextContext, {\n providerValues: this[PROVIDER_VALUES],\n });\n if (shouldComponentUpdateSpy) {\n shouldRender = shouldComponentUpdateSpy.getLastReturnValue();\n shouldComponentUpdateSpy.restore();\n }\n if (\n shouldRender\n && !this[OPTIONS].disableLifecycleMethods\n && instance\n ) {\n privateSetChildContext(adapter, this, instance, node, getChildContextSpy);\n if (lifecycles.getSnapshotBeforeUpdate) {\n let snapshot;\n if (typeof instance.getSnapshotBeforeUpdate === 'function') {\n snapshot = instance.getSnapshotBeforeUpdate(prevProps, state);\n }\n if (\n lifecycles.componentDidUpdate\n && typeof instance.componentDidUpdate === 'function'\n && (\n !state\n || shallowEqual(state, this.instance().state)\n || typeof type.getDerivedStateFromProps === 'function'\n )\n ) {\n instance.componentDidUpdate(prevProps, state, snapshot);\n }\n } else if (\n lifecycles.componentDidUpdate\n && typeof instance.componentDidUpdate === 'function'\n ) {\n if (lifecycles.componentDidUpdate.prevContext) {\n instance.componentDidUpdate(prevProps, state, prevContext);\n } else if (!state || shallowEqual(this.instance().state, state)) {\n instance.componentDidUpdate(prevProps, state);\n }\n }\n // If it doesn't need to rerender, update only its props.\n } else if (!shallowEqual(props, instance.props)) {\n instance.props = (Object.freeze || Object)({ ...instance.props, ...props });\n }\n this.update();\n });\n });\n });\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 {ShallowWrapper}\n */\n setProps(props, callback = undefined) {\n if (this[ROOT] !== this) {\n throw new Error('ShallowWrapper::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 this.rerender(props);\n if (callback) {\n callback();\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 {ShallowWrapper}\n */\n setState(state, callback = undefined) {\n if (this[ROOT] !== this) {\n throw new Error('ShallowWrapper::setState() can only be called on the root');\n }\n if (this.instance() === null || this[RENDERER].getNode().nodeType !== 'class') {\n throw new Error('ShallowWrapper::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\n this.single('setState', () => {\n withSetStateAllowed(() => {\n const adapter = getAdapter(this[OPTIONS]);\n\n const lifecycles = getAdapterLifecycles(adapter);\n\n const node = this[RENDERER].getNode();\n const { instance } = node;\n const prevProps = instance.props;\n const prevState = instance.state;\n const prevContext = instance.context;\n\n const statePayload = typeof state === 'function'\n ? state.call(instance, prevState, prevProps)\n : state;\n\n // returning null or undefined prevents the update in React 16+\n // https://github.com/facebook/react/pull/12756\n const maybeHasUpdate = !lifecycles.setState.skipsComponentDidUpdateOnNullish\n || statePayload != null;\n\n // When shouldComponentUpdate returns false we shouldn't call componentDidUpdate.\n // so we spy shouldComponentUpdate to get the result.\n let shouldComponentUpdateSpy;\n let getChildContextSpy;\n let shouldRender = true;\n if (\n !this[OPTIONS].disableLifecycleMethods\n && instance\n ) {\n if (\n lifecycles.componentDidUpdate\n && lifecycles.componentDidUpdate.onSetState\n && typeof instance.shouldComponentUpdate === 'function'\n ) {\n const { getDerivedStateFromProps: gDSFP } = lifecycles;\n if (gDSFP && gDSFP.hasShouldComponentUpdateBug) {\n mockSCUIfgDSFPReturnNonNull(node, state);\n }\n shouldComponentUpdateSpy = spyMethod(instance, 'shouldComponentUpdate');\n }\n if (\n lifecycles.getChildContext.calledByRenderer\n && typeof instance.getChildContext === 'function'\n ) {\n getChildContextSpy = spyMethod(instance, 'getChildContext');\n }\n }\n if (!shouldComponentUpdateSpy && isPureComponent(instance)) {\n shouldRender = pureComponentShouldComponentUpdate(\n prevProps,\n instance.props,\n prevState,\n { ...prevState, ...statePayload },\n );\n }\n\n // We don't pass the setState callback here\n // to guarantee to call the callback after finishing the render\n if (instance[SET_STATE]) {\n instance[SET_STATE](statePayload);\n } else {\n instance.setState(statePayload);\n }\n if (shouldComponentUpdateSpy) {\n shouldRender = shouldComponentUpdateSpy.getLastReturnValue();\n shouldComponentUpdateSpy.restore();\n }\n if (\n maybeHasUpdate\n && shouldRender\n && !this[OPTIONS].disableLifecycleMethods\n ) {\n privateSetChildContext(adapter, this, instance, node, getChildContextSpy);\n if (\n lifecycles.componentDidUpdate\n && lifecycles.componentDidUpdate.onSetState\n ) {\n if (\n lifecycles.getSnapshotBeforeUpdate\n && typeof instance.getSnapshotBeforeUpdate === 'function'\n ) {\n const snapshot = instance.getSnapshotBeforeUpdate(prevProps, prevState);\n if (typeof instance.componentDidUpdate === 'function') {\n instance.componentDidUpdate(prevProps, prevState, snapshot);\n }\n } else if (typeof instance.componentDidUpdate === 'function') {\n if (lifecycles.componentDidUpdate.prevContext) {\n instance.componentDidUpdate(prevProps, prevState, prevContext);\n } else {\n instance.componentDidUpdate(prevProps, prevState);\n }\n }\n }\n }\n this.update();\n // call the setState callback\n if (callback) {\n if (adapter.invokeSetStateCallback) {\n adapter.invokeSetStateCallback(instance, callback);\n } else {\n callback.call(instance);\n }\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 {ShallowWrapper}\n */\n setContext(context) {\n if (this[ROOT] !== this) {\n throw new Error('ShallowWrapper::setContext() can only be called on the root');\n }\n if (!this[OPTIONS].context) {\n throw new Error('ShallowWrapper::setContext() can only be called on a wrapper that was originally passed a context option');\n }\n return this.rerender(null, context);\n }\n\n /**\n * Whether or not a given react element exists in the shallow render tree.\n *\n * Example:\n * ```\n * const wrapper = shallow();\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 if (!isReactElementAlike(nodeOrNodes, adapter)) {\n throw new Error('ShallowWrapper::contains() can only be called with a ReactElement (or an array of them), a string, or a number as an argument.');\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 shallow render tree.\n * Match is based on the expected element and not on wrappers element.\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 = shallow();\n * expect(wrapper.containsMatchingElement(
Hello
)).to.equal(true);\n * ```\n *\n * @param {ReactElement} node\n * @returns {Boolean}\n */\n containsMatchingElement(node) {\n const adapter = getAdapter(this[OPTIONS]);\n const rstNode = adapter.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 shallow render tree.\n * Match is based on the expected element and not on wrappers element.\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 = shallow();\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 shallow render tree.\n * Match is based on the expected element and not on wrappers element.\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 = shallow();\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 = shallow();\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 = shallow();\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 {ShallowWrapper}\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.getNodesInternal();\n\n return nodes.every((n) => isEmptyValue(n));\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. The predicate should receive a wrapped node as its first\n * argument.\n *\n * @param {Function} predicate\n * @returns {ShallowWrapper}\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 {ShallowWrapper}\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 {ShallowWrapper}\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 return this.single('text', getTextFromNode);\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 return this.single('html', (n) => {\n if (this.type() === null) return null;\n const adapter = getAdapter(this[OPTIONS]);\n const renderer = adapter.createRenderer({ ...this[OPTIONS], mode: 'string' });\n return renderer.render(adapter.nodeToElement(n));\n });\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 {Array} args\n * @returns {ShallowWrapper}\n */\n simulate(event, ...args) {\n return this.single('simulate', (n) => {\n this[RENDERER].simulateEvent(n, event, ...args);\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 {ShallowWrapper}\n */\n simulateError(error) {\n // in shallow, the \"root\" is the \"rendered\" thing.\n\n return this.single('simulateError', (thisNode) => {\n if (thisNode.nodeType === 'host') {\n throw new TypeError('ShallowWrapper::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 return this;\n });\n }\n\n /**\n * Returns the props hash for the current 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 if (this[ROOT] !== this) {\n throw new Error('ShallowWrapper::state() can only be called on the root');\n }\n if (this.instance() === null || this[RENDERER].getNode().nodeType !== 'class') {\n throw new Error('ShallowWrapper::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(`ShallowWrapper::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('ShallowWrapper::context() can only be called on the root');\n }\n if (!this[OPTIONS].context) {\n throw new Error('ShallowWrapper::context() can only be called on a wrapper that was originally passed a context option');\n }\n if (this.instance() === null) {\n throw new Error('ShallowWrapper::context() can only be called on wrapped nodes that have a non-null instance');\n }\n const _context = this.single('context', () => this.instance().context);\n if (name) {\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 {ShallowWrapper}\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 {ShallowWrapper}\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 {ShallowWrapper}\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 {ShallowWrapper}\n */\n parent() {\n return this.flatMap((n) => [n.parents().get(0)]);\n }\n\n /**\n *\n * @param {EnzymeSelector} selector\n * @returns {ShallowWrapper}\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 * Shallow renders the current node and returns a shallow wrapper around it.\n *\n * NOTE: can only be called on wrapper of a single node.\n *\n * @param {Object} options\n * @returns {ShallowWrapper}\n */\n shallow(options = {}) {\n return this.single('shallow', (n) => {\n const childOptions = makeInheritedChildOptions(this, options);\n return this.wrap(getAdapter(this[OPTIONS]).nodeToElement(n), null, childOptions);\n });\n }\n\n /**\n * Returns the value of prop with the given name of the current node.\n *\n * @param 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('ShallowWrapper::invoke() requires the name of a prop whose value is a function');\n }\n return (...args) => {\n const response = 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('ShallowWrapper::renderProp() can only be called on custom components');\n }\n if (typeof propName !== 'string') {\n throw new TypeError('ShallowWrapper::renderProp(): `propName` must be a string');\n }\n const props = this.props();\n if (!has(props, propName)) {\n throw new Error(`ShallowWrapper::renderProp(): no prop called “${propName}“ found`);\n }\n const propValue = props[propName];\n if (typeof propValue !== 'function') {\n throw new TypeError(`ShallowWrapper::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 current node of this wrapper. If it's a composite component, this will\n * be the component constructor. If it's a native DOM node, it will be a string of the tag name.\n * If it's null, it will be null.\n *\n * @returns {String|Function|null}\n */\n type() {\n return this.single('type', (n) => typeOfNode(n));\n }\n\n /**\n * Returns the name of the current 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 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 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 `ShallowWrapper::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 {ShallowWrapper}\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 `ShallowWrapper`\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 a value. Each node is passed in as a `ShallowWrapper`\n * 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('ShallowWrapper::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 {ShallowWrapper}\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. The predicate function will receive the nodes inside a ShallowWrapper as its\n * first argument.\n *\n * @param {Function} predicate\n * @returns {ShallowWrapper}\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 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 index\n * @returns {ShallowWrapper}\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 {ShallowWrapper}\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 {ShallowWrapper}\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 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 node\n * @returns {ShallowWrapper}\n */\n wrap(node, root = this[ROOT], ...args) {\n if (node instanceof ShallowWrapper) {\n return node;\n }\n return new ShallowWrapper(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 {ShallowWrapper}\n */\n tap(intercepter) {\n intercepter(this);\n return this;\n }\n\n /**\n * Primarily useful for HOCs (higher-order components), this method may only be\n * run on a single, non-DOM node, and will return the node, shallow-rendered.\n *\n * @param {Object} options\n * @returns {ShallowWrapper}\n */\n dive(options = {}) {\n const adapter = getAdapter(this[OPTIONS]);\n const name = 'dive';\n return this.single(name, (n) => {\n if (n && n.nodeType === 'host') {\n throw new TypeError(`ShallowWrapper::${name}() can not be called on Host Components`);\n }\n const el = getAdapter(this[OPTIONS]).nodeToElement(n);\n if (!isCustomComponentElement(el, adapter)) {\n throw new TypeError(`ShallowWrapper::${name}() can only be called on components`);\n }\n const childOptions = makeInheritedChildOptions(this, options);\n return this.wrap(el, null, childOptions);\n });\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 * Updates the context of the primary wrapper when the\n * `wrappingComponent` re-renders.\n */\nfunction updatePrimaryRootContext(wrappingComponent) {\n const adapter = getAdapter(wrappingComponent[OPTIONS]);\n const primaryWrapper = wrappingComponent[PRIMARY_WRAPPER];\n const primaryRenderer = primaryWrapper[RENDERER];\n const primaryNode = primaryRenderer.getNode();\n const {\n legacyContext,\n providerValues,\n } = getContextFromWrappingComponent(wrappingComponent, adapter);\n const prevProviderValues = primaryWrapper[PROVIDER_VALUES];\n\n primaryWrapper.setContext({\n ...wrappingComponent[PRIMARY_WRAPPER][OPTIONS].context,\n ...legacyContext,\n });\n primaryWrapper[PROVIDER_VALUES] = new Map([...prevProviderValues, ...providerValues]);\n\n if (typeof adapter.isContextConsumer === 'function' && adapter.isContextConsumer(primaryNode.type)) {\n const Consumer = primaryNode.type;\n // Adapters with an `isContextConsumer` method will definitely have a `getProviderFromConsumer`\n // method.\n const Provider = adapter.getProviderFromConsumer(Consumer);\n const newValue = providerValues.get(Provider);\n const oldValue = prevProviderValues.get(Provider);\n\n // Use referential comparison like React\n if (newValue !== oldValue) {\n primaryWrapper.rerender();\n }\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 *\n * @class WrappingComponentWrapper\n */\nclass WrappingComponentWrapper extends ShallowWrapper {\n constructor(nodes, root, RootFinder) {\n super(nodes);\n privateSet(this, PRIMARY_WRAPPER, root);\n privateSet(this, ROOT_FINDER, RootFinder);\n }\n\n /**\n * Like rerender() on ShallowWrapper, except it also does a \"full render\" of\n * itself and updates the primary ShallowWrapper's context.\n */\n rerender(...args) {\n const result = super.rerender(...args);\n updatePrimaryRootContext(this);\n return result;\n }\n\n /**\n * Like setState() on ShallowWrapper, except it also does a \"full render\" of\n * itself and updates the primary ShallowWrapper's context.\n */\n setState(...args) {\n const result = super.setState(...args);\n updatePrimaryRootContext(this);\n return result;\n }\n\n // eslint-disable-next-line class-methods-use-this\n getWrappingComponent() {\n throw new Error('ShallowWrapper::getWrappingComponent() can only be called on the root');\n }\n}\n\nif (ITERATOR_SYMBOL) {\n Object.defineProperty(ShallowWrapper.prototype, ITERATOR_SYMBOL, {\n configurable: true,\n value: function iterator() {\n const iter = this.getNodesInternal()[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(ShallowWrapper.prototype, prop, {\n get() {\n throw new Error(`\n Attempted to access ShallowWrapper::${prop}, which was previously a private property on\n Enzyme ShallowWrapper 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 ShallowWrapper;\n"]}