[
  {
    "path": ".babelrc",
    "content": "{\n  \"presets\": [\"airbnb\"],\n  \"plugins\": [\n    [\"transform-replace-object-assign\", { \"moduleSpecifier\": \"object.assign\" }],\n    [\"add-module-exports\"],\n  ],\n  \"ignore\": [\n    \"packages/enzyme-test-suite/test/_helpers/untranspiled*\",\n  ],\n  \"sourceMaps\": \"both\",\n}\n"
  },
  {
    "path": ".eslintrc",
    "content": "{\n  \"extends\": \"airbnb\",\n  \"root\": true,\n  \"env\": {\n    \"node\": true,\n  },\n  \"parser\": \"@babel/eslint-parser\",\n  \"ignorePatterns\": [\n    \"/build\",\n    \"_book\",\n    \"packages/*/build/\",\n    // Temporarily copied\n    \"packages/*/LICENSE.md\",\n    \"packages/enzyme/README.md\",\n    \"packages/enzyme-adapter-react-*/README.md\",\n    \"packages/enzyme-adapter-utils*/README.md\",\n  ],\n  \"rules\": {\n    \"id-length\": 0,\n    \"react/no-find-dom-node\": 1,\n    \"import/first\": 0,\n    \"max-len\": 0,\n  },\n  \"overrides\": [\n    { // things that run in older envs, without babel\n      \"files\": [\n        \"env.js\",\n        \"karma.conf.js\",\n        \"since.js\",\n      ],\n      \"rules\": {\n        \"import/no-extraneous-dependencies\": [2, {\n          \"devDependencies\": true,\n        }],\n        \"comma-dangle\": [2, {\n          \"arrays\": \"always-multiline\",\n          \"objects\": \"always-multiline\",\n          \"imports\": \"always-multiline\",\n          \"exports\": \"always-multiline\",\n          \"functions\": \"ignore\",\n        }],\n        \"strict\": [2, \"safe\"],\n        \"prefer-destructuring\": 0,\n        \"prefer-template\": 0,\n      },\n      \"parserOptions\": {\n        \"sourceType\": \"script\",\n      },\n    },\n    {\n      \"files\": [\n        \"**/*.md\",\n        \"**/*.md/**\"\n      ],\n      \"extends\": [\"plugin:markdown/recommended\"],\n      \"rules\": {\n        \"class-methods-use-this\": 0,\n        \"import/extensions\": 0,\n        \"import/no-extraneous-dependencies\": 0,\n        \"import/no-unresolved\": 0,\n        \"import/prefer-default-export\": 0,\n        \"max-len\": 0,\n        \"no-console\": 0,\n        \"no-undef\": 0,\n        \"no-unused-vars\": 0,\n        \"react/jsx-filename-extension\": 0,\n        \"react/jsx-fragments\": 0,\n        \"react/jsx-no-undef\": 0,\n        \"react/jsx-no-useless-fragment\": 0,\n        \"react/jsx-one-expression-per-line\": 0,\n        \"react/no-multi-comp\": 0,\n        \"react/no-unknown-property\": 0,\n        \"react/no-unused-class-component-methods\": 0,\n        \"react/react-in-jsx-scope\": 0,\n      },\n    },\n  ],\n}\n"
  },
  {
    "path": ".github/FUNDING.yml",
    "content": "# These are supported funding model platforms\n\ngithub: [ljharb]\npatreon: # Replace with a single Patreon username\nopen_collective: # Replace with a single Open Collective username\nko_fi: # Replace with a single Ko-fi username\ntidelift: npm/enzyme\ncommunity_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry\nliberapay: # Replace with a single Liberapay username\nissuehunt: # Replace with a single IssueHunt username\notechie: # Replace with a single Otechie username\ncustom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/Bug_report.md",
    "content": "---\nname: 🐛 Bug report\nabout: Create a report to help us improve\n\n---\nThanks for reporting an issue to us! We're glad you are using and invested in Enzyme.\nBefore submitting, please read over our commonly reported issues to prevent duplicates!\n\n### All common issues\n\n* [common issues](../blob/master/docs/common-issues.md)\n\n### Notoriously common issues\n\n* [Webpack build issues](../blob/master/docs/common-issues.md#webpack-build-issues)\n* [Cannot find module 'react-dom/lib/ReactTestUtils'](../blob/master/docs/common-issues.md#error-cannot-find-module-react-domlibreacttestutils)\n* [Query Selector fails](../blob/master/docs/common-issues.md#query-selector-fails)\n* [Testing third party libraries](../blob/master/docs/common-issues.md#testing-third-party-libraries)\n\nIf you haven't found any duplicated issues, please report it with your environment!\n\n### Current behavior\n\n### Expected behavior\n\n### Your environment\n\n#### API\n\n- [ ] shallow\n- [ ] mount\n- [ ] render\n\n#### Version\n\n| library             | version\n| ------------------- | -------\n| enzyme              | \n| react               | \n| react-dom           | \n| react-test-renderer | \n| adapter (below)     | \n\n#### Adapter\n\n- [ ] enzyme-adapter-react-16\n- [ ] enzyme-adapter-react-16.3\n- [ ] enzyme-adapter-react-16.2\n- [ ] enzyme-adapter-react-16.1\n- [ ] enzyme-adapter-react-15\n- [ ] enzyme-adapter-react-15.4\n- [ ] enzyme-adapter-react-14\n- [ ] enzyme-adapter-react-13\n- [ ] enzyme-adapter-react-helper\n- [ ] others ( ) \n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/Feature_request.md",
    "content": "---\nname: 🙏 Feature request\nabout: Suggest an idea for this project\n\n---\n\n**Is your feature request related to a problem? Please describe.**\nA clear and concise description of what the problem is. e.g. I'm always frustrated when [...]\n\n**Describe the solution you'd like**\nA clear and concise description of what you want to happen.\n\n**Describe alternatives you've considered**\nA clear and concise description of any alternative solutions or features you've considered.\n\n**Additional context**\nAdd any other context or screenshots about the feature request here.\n"
  },
  {
    "path": ".github/workflows/node-pretest.yml",
    "content": "name: 'Tests: pretest/posttest'\n\non: [pull_request, push]\n\njobs:\n  pretest:\n    runs-on: ubuntu-latest\n\n    steps:\n      - uses: actions/checkout@v3\n      - uses: ljharb/actions/node/install@main\n        with:\n          skip-ls-check: true\n      - run: sh install-relevant-react.sh\n      - run: npx lerna bootstrap\n      - run: npm run build\n      - run: npm run pretest\n\n  # posttest:\n  #   runs-on: ubuntu-latest\n\n  #   steps:\n  #     - uses: actions/checkout@v3\n  #     - uses: ljharb/actions/node/install@main\n  #     - run: npm run build\n  #     - run: npm run posttest\n"
  },
  {
    "path": ".github/workflows/node.yml",
    "content": "name: 'Tests: node.js'\n\non: [pull_request, push]\n\njobs:\n  build:\n    name: 'install deps and build'\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v3\n      - uses: ljharb/actions/node/install@main\n        with:\n          skip-ls-check: true\n      - run: npx lerna bootstrap\n      - run: npm run build\n      - uses: actions/cache@v3\n        with:\n          path: |\n            packages/*/build\n            node_modules\n            packages/*/node_modules\n          key: enzyme-${{ github.workflow }}-${{ github.action }}-${{ github.run_id }}\n\n  karma-matrix:\n    needs: [build]\n    name: 'karma tests'\n    runs-on: ubuntu-latest\n    continue-on-error: true\n    strategy:\n      fail-fast: false\n      matrix:\n        react:\n          - '16'\n          - '16.3'\n          - '16.2'\n          - '16.1'\n          - '15'\n          - '15.4'\n          - '0.14'\n          - '0.13'\n    steps:\n      - uses: actions/checkout@v3\n      - uses: actions/cache@v3\n        with:\n          path: |\n            packages/*/build\n            node_modules\n            packages/*/node_modules\n          key: enzyme-${{ github.workflow }}-${{ github.action }}-${{ github.run_id }}\n      - run: sudo chmod -R a+w .\n      - uses: ljharb/actions/node/install@main\n        with:\n          node-version: 'lts/*'\n          skip-install: true\n          after_install: '(nvm install node && REACT=${{ matrix.react }} TRAVIS=1 sh install-relevant-react.sh)'\n          skip-ls-check: true\n      - run: npm run test:karma -- --single-run\n        continue-on-error: true\n        env:\n          CHROME_BIN: chromium-browser\n          DISPLAY: 99.0\n      - run: echo 'karma tests expected to fail'\n\n  tests:\n    needs: [build]\n    name: 'tests'\n    runs-on: ubuntu-latest\n    continue-on-error: ${{ matrix.continue-on-error == 'true' }}\n\n    strategy:\n      fail-fast: false\n      matrix:\n        node-version:\n          - '18'\n          - '4'\n        react:\n          - '16.14'\n          - '16.13'\n          - '16.12'\n          - '16.11'\n          - '16.10'\n          - '16.9'\n          - '16.8'\n          - '16.7'\n          - '16.6'\n          - '16.5'\n          - '16.4'\n          - '16.3'\n          - '16.2'\n          - '16.1'\n          - '16.0'\n          - '15.5'\n          - '15.4'\n          - '15.3'\n          - '15.2'\n          - '15.1'\n          - '15.0'\n          - '0.14'\n          - '0.13'\n        include:\n          - node-version: '16'\n            react: '16'\n          - node-version: '14'\n            react: '16'\n          - node-version: '12'\n            react: '16'\n          - node-version: '10'\n            react: '16'\n          - node-version: '8'\n            react: '16'\n          - node-version: '6'\n            react: '16'\n          - node-version: 'lts/*'\n            react: '16.8.3'\n          - node-version: 'lts/*'\n            react: '16.8.5'\n            env:\n              RENDERER: '16.8.5'\n          - node-version: 'lts/*'\n            react: '16.8.5'\n            env:\n              RENDERER: '16.8.3'\n          - node-version: 'lts/*'\n            react: '16.3'\n            env:\n              ADAPTER: '16'\n          - node-version: 'lts/*'\n            react: '16.8'\n            env:\n              RENDERER: '16.7'\n          - node-version: 'lts/*'\n            react: '16.7'\n            env:\n              RENDERER: '16.8'\n          - node-version: 'lts/*'\n            react: '16.7'\n            env:\n              RENDERER: '16.7'\n\n    steps:\n      - uses: actions/checkout@v3\n      - uses: actions/cache@v3\n        with:\n          path: |\n            packages/*/build\n            node_modules\n            packages/*/node_modules\n          key: enzyme-${{ github.workflow }}-${{ github.action }}-${{ github.run_id }}\n      - run: sudo chmod -R a+w .\n      - uses: ljharb/actions/node/install@main\n        with:\n          node-version: ${{ matrix.node-version || 'lts/* '}}\n          skip-install: true\n          after_install: '(nvm install node && sh install-relevant-react.sh)'\n          skip-ls-check: true\n        env:\n          REACT: ${{ matrix.react }}\n      - run: npm run travis\n      - uses: codecov/codecov-action@v3\n\n  node:\n    name: 'node + react'\n    needs: [tests]\n    runs-on: ubuntu-latest\n    steps:\n      - run: 'echo tests completed'\n  \n  karma:\n    name: 'node + react + karma'\n    needs: [karma-matrix]\n    runs-on: ubuntu-latest\n    steps:\n      - run: 'echo tests completed'\n"
  },
  {
    "path": ".github/workflows/rebase.yml",
    "content": "name: Automatic Rebase\n\non: [pull_request_target]\n\njobs:\n  _:\n    name: \"Automatic Rebase\"\n\n    runs-on: ubuntu-latest\n\n    steps:\n    - uses: actions/checkout@v3\n    - uses: ljharb/rebase@master\n      env:\n        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n"
  },
  {
    "path": ".github/workflows/require-allow-edits.yml",
    "content": "name: Require “Allow Edits”\n\non: [pull_request_target]\n\njobs:\n  _:\n    name: \"Require “Allow Edits”\"\n\n    runs-on: ubuntu-latest\n\n    steps:\n    - uses: ljharb/require-allow-edits@main\n"
  },
  {
    "path": ".gitignore",
    "content": "# Logs\nlogs\n*.log\n\n# Runtime data\npids\n*.pid\n*.seed\n\n# Directory for instrumented libs generated by jscoverage/JSCover\nlib-cov\n\n# Coverage directory used by tools like istanbul\ncoverage\n.nyc_output\n\n# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)\n.grunt\n\n# node-waf configuration\n.lock-wscript\n\n# Compiled binary addons (https://nodejs.org/api/addons.html)\nbuild/Release\n\n# Dependency directory\n# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git\nnode_modules\n\n# Jetbrains IDEs\n.idea\n\n/build\n_book\n\n# Only apps should have lockfiles\nnpm-shrinkwrap.json\npackage-lock.json\nyarn.lock\n\n.DS_Store\n._.DS_Store\n\npackages/*/build/\n\n# Temporarily copied\npackages/*/LICENSE.md\npackages/enzyme/README.md\npackages/enzyme-adapter-react-*/README.md\npackages/enzyme-adapter-utils*/README.md\n\n.npmignore\n"
  },
  {
    "path": ".lgtm",
    "content": "approvals = 1\npattern = \"(?i):shipit:|:\\\\+1:|LGTM\"\n"
  },
  {
    "path": ".npmrc",
    "content": "package-lock=false\nupdate-notifier=false\nlegacy-peer-deps=true\n"
  },
  {
    "path": ".nycrc",
    "content": "{\n  \"extension\": [\n    \".js\",\n    \".jsx\"\n  ],\n  \"include\": [\n    \"*\",\n    \"packages/*/*\",\n    \"packages/*/src\"\n  ],\n  \"exclude\": [\n    \"packages/enzyme-test-suite\",\n    \"_book\",\n    \"coverage\",\n    \"packages/*/node_modules\"\n  ],\n  \"require\": [\n  ],\n  \"reporter\": [\n    \"text\",\n    \"html\",\n    \"json\",\n    \"lcov\"\n  ],\n  \"all\": false,\n  \"check-coverage\": false,\n  \"statements\": 100,\n  \"branches\": 100,\n  \"lines\": 100,\n  \"functions\": 100,\n  \"sourceMap\": true,\n  \"instrument\": true\n}\n"
  },
  {
    "path": "CHANGELOG.md",
    "content": "# Change Log\n\n## 3.11.0\n\n### New Stuff\n - `render`: handle Fiber strings and numbers (#2221)\n\n### Fixes\n - `shallow`: Share child context logic between `shallow` and `dive` (#2296)\n - `mount`: `children`: include text nodes ($2269)\n - `mount`: `invoke`: use adapter’s `wrapInvoke` if present (#2158)\n\n### Docs\n - `mount`/`shallow`: `closest`/`parent`: Add missing arguments description (#2264)\n - `mount`/`shallow`: fix pluralization of “exist” (#2262)\n - `shallow`/`mount`: `simulate`: added functional component example to simulate doc (#2248)\n - `mount`: `debug`: add missing verbose option flag (#2184)\n - `mount`/`shallow`: `update`: fix semantics description (#2194)\n - add missing backticks to linked method names (#2170)\n - `invoke`: Add missing backticks to end of codeblock (#2160)\n - `invoke`: Fix typo (#2167)\n - Explicit React CSS selector syntax description (#2178)\n\n### Meta Stuff\n - [meta] add `funding` field\n - [meta] Update airbnb.io URLs to use https (#2222)\n - [deps] update `is-boolean-object`, `is-callable`, `is-number-object`, `is-string`, `enzyme-shallow-equal`, `array.prototype.flat`, `function.prototype.name`, `html-element-map`, `is-regex`, `object-inspect`, `object-is`, `object.entries`, `object.vales`, `raf`, `string.prototype.trim`\n - [dev deps] update `eslint`, `eslint-plugin-import`, `eslint-plugin-markdown`, `eslint-plugin-react`, `safe-publish-latest`, `eslint-config-airbnb`, `rimraf`, `safe-publish-latest`, `karma-firefox-launcher`, `babel-preset-airbnb`, `glob-gitignore`, `semver`, `eslint-plugin-jsx-a11y`\n\n## 3.10.0\n\n### New Stuff\n - `shallow` add `suspenseFallback` option; support `Suspense`/`Lazy` (#1975)\n - `shallow`/`mount`: add `invoke(propName)(...args)` (#1856, #945)\n - `shallow`: Support rendering and `dive()`ing `createContext()` providers and consumers (#1966)\n - `mount`/`shallow`: add `getWrappingComponent` (#1960)\n - `Utils`: add `isCustomComponent` (#1960)\n - `Utils`: add `stub` argument to `spyMethod`\n - `EnzymeAdapter`: add `matchesElementType` (#2146)\n - `RSTTraversal`: add `getHTMLFromHostNodes`\n\n### Fixes\n - `selectors`: unwrap `memo` elements - in both directions (#2146)\n - `shallow`: properly determine \"should render\" for `PureComponent`s (#2096)\n - `mount`/`shallow`: `renderProp`: improve error messages (#2070)\n - `mount`: `setContext`: use proper wrapper name in error message\n - `shallow`: `.contains()`: clean up error message\n - `shallow`/`mount`: `hasClass`: avoid a crash with a non-string argument (#2057)\n - `mount`: properly handle HTML of multiple nodes (#2052)\n - `shallow`: ensure that if gDSFP exists, cDU is called. (#2027)\n - `shallow`: Mock sCU if gDSFP defined in shallow renderer rerender (#1981)\n - `mount`: `.state()`: allow getting state from stateful children of a stateless root (#2043)\n - `mount`: `.text()`: properly recurse through fragments and arrays (#2028)\n\n### Refactors\n - `ReactWrapper`/`ShallowWrapper`: ensure calling an adapter‘s nodeToElement preserves the receiver\n - `mount`: use `getHTMLFromHostNodes`\n\n### Docs\n - explain why need to re-call .find() after update (#2140)\n - `shallow`: fix childAt (#2134)\n - Update v2 -> v3 migration guide re props after a stage change (#1300)\n - `debug`: Added documentation for `verbose` flag (#2104)\n - Add on the fly JSDOM include example (#2072)\n - `reduce`/`reduceRight`: fix example code (#2066, #2065, #2064)\n - update `simulateError` with `getDerivedStateFromError` (#2036)\n - `shallow`: `.hasClass`: fix use of `mount`\n - add link to Cheerio API and another example (#756)\n - `jest`: Update deprecated jest config key (#2024)\n\n## 3.9.0\n\n### New Stuff\n - `shallow`: `isEmptyRender`: allow on multiple elements (#1924)\n - `mount`: support `:focus` selector (#1965)\n - `shallow`: Support `getChildContext()` (#1971)\n - `shallow`/`mount`: `.find`: find HTML elements by their constructor (#1933)\n - `shallow`/`mount`: `selectors`: support universal selector (#1945)\n - `mount`/`shallow`: add regex support to `.hasClass` (#1987)\n\n### Fixes\n - `mount`/`shallow`: `.text`/`.html`: handle an array of nodes properly (#2001)\n - `shallow`: `.setProps()`: only call cDU once (#2007)\n - `mount`: ensure `findWhere` doesn‘t abort early on an empty string (#1995)\n - `mount`: `findWhere`: avoid passing empty wrappers to predicate\n - `mount`: `text()` via `findWhere`: return the string for a wrapper around a string\n - `mount`/`shallow`: Fix .exists not accepting any EnzymeSelector (#1934)\n - `mount`: Recursive `isEmptyRender` (#1924)\n - `mount`: `setState`: allow setting state on a class child of an SFC root\n\n### Documentation\n - [jest] update Jest to setupFilesAfterEnv (#2015)\n - [jest] Change deprecated `setupTestFrameworkScriptFile` to `setupFilesAfterEnv` (#2013)\n - `mount`: `setState`: note that you can now call it on \"not the root\" (#2010)\n - general improvements (#1947)\n - Fix typos (#1992)\n - Added missing pages: `isEmptyRender`, `renderProp`, `equals`, SystemJS guide (#1984, #1985)\n - Fix link to .shallow() (#1951)\n - update jsdoc to use \"EnzymeSelector\" where applicable\n\n### Meta Stuff\n - add \"directory\" field to package.json\n\n## 3.8.0\n\n### New Stuff\n - `shallow`/`mount`: add `renderProp` (#1863, #1891)\n\n### Fixes\n - `shallow`/`mount`: improve error message for \"single node\" assertion (#1904)\n - `shallow`: shallow compare, not deep compare, state and props to determine rerendering (#1915)\n\n### Documentation\n - `shallow`: `dive`: add a note about throwing an error (#1905)\n - `selectors: update re `displayName` (#1932)\n - `shallow`: `get`: fixed wrong `props()` usage (#1921)\n - `shallow`: `html`: shallow renders full tree (#1912)\n - Updated broken link for “.hostNodes()” in migration guide from enzyme 2 to 3 (#1909)\n - Add tape example project link (#1898)\n - `prop`: fix typo (#1883)\n - Document full support for attribute selectors (#1881)\n - Documentation update for testing React Native with jsdom (#1873)\n - Update JSDOM docs to include {request|cancel}AnimationFrame polyfills (#1867)\n - `mount`: `ref`: use correct type (#1865)\n\n## 3.7.0\n\n### New Stuff\n - `mount`: `.state()`/`.setState()`: allow calling on children ([#1802](https://github.com/enzymejs/enzyme/pull/1802), @ljharb)\n - `configuration`: add `reset` ([commit](https://github.com/enzymejs/enzyme/commit/d91d95b8da8900c8f4b7090d2256422a82398ca9))\n\n### Fixes\n - `makeOptions`: ensure that config-level `attachTo`/`hydrateIn` are inherited into wrapper options ([#1836](https://github.com/enzymejs/enzyme/issues/1836), @ljharb)\n - `shallow`/`Utils`: call into adapter’s `isCustomComponentElement` if present ([#1832](https://github.com/enzymejs/enzyme/pull/1832), @SinHouse)\n - `shallow`/`mount`: throw an explicit error when state is null/undefined ([commit](https://github.com/enzymejs/enzyme/commit/9ea33d7667a93885d6f1d6e12b0c2661d6d47cd1))\n - freeze `ROOT_NODES` for child wrappers ([#1811](https://github.com/enzymejs/enzyme/pull/1811), @jgzuke)\n - `shallow`: `.parents`: ensure that one `.find` call does not affect another ([#1781](https://github.com/enzymejs/enzyme/pull/1781), @ljharb)\n - `mount`: update after `simulateError` ([#1812](https://github.com/enzymejs/enzyme/pull/1812), @jgzuke)\n\n### Refactors\n - `mount`/`shallow`: `getElement`: use `this.single` ([commit](https://github.com/enzymejs/enzyme/commit/6b63db3b002a419076c82d34554916400ef392fa))\n\n## 3.6.0\n\n### New Stuff\n - `shallow`/`mount`: add `simulateError` ([#1797](https://github.com/enzymejs/enzyme/pull/1797), @ljharb)\n\n## 3.5.1\n\n### Fixes\n- `shallow`/`mount`: `containsMatchingElement`: trim whitespace ([commit](https://github.com/enzymejs/enzyme/commit/171e952), [#636](https://github.com/enzymejs/enzyme/issues/636))\n- `debug`: inspect objects instead of showing them as `<Component />` ([commit](https://github.com/enzymejs/enzyme/commit/a7b6e78))\n\n### Documentation\n- `mount`: `ref`: Update docs to be consistent with v3 ([#1242](https://github.com/enzymejs/enzyme/pull/1242), @adam-golab)\n\n### Refactors\n- `shallow`/`mount`: make tests and method ordering more consistent ([commit](https://github.com/enzymejs/enzyme/commit/d0fccaf))\n- RSTTraversal: remove unnecessary `adapter` truthiness check ([commit](https://github.com/enzymejs/enzyme/commit/394a327))\n\n## 3.5.0\n\n### New Stuff\n- Add forwardRef support ([#1592](https://github.com/enzymejs/enzyme/pull/1592), @jquense)\n- Add Portal support ([#1760](https://github.com/enzymejs/enzyme/pull/1760), [#1761](https://github.com/enzymejs/enzyme/pull/1760), [#1772](https://github.com/enzymejs/enzyme/pull/1772), [#1774](https://github.com/enzymejs/enzyme/pull/1774), @jgzuke)\n- Add pointer events support ([#1753](https://github.com/enzymejs/enzyme/pull/1753), @ljharb)\n\n### Fixes\n- preemptively fix compat with React v16.4.3 ([#1790](https://github.com/enzymejs/enzyme/pull/1790), [#1778](https://github.com/enzymejs/enzyme/pull/1778), @gaearon, @aweary)\n- `shallow`: prevent rerenders with PureComponents ([#1786](https://github.com/enzymejs/enzyme/pull/1786), @koba04)\n- `shallow`: skip updates when nextState is `null` or `undefined` ([#1785](https://github.com/enzymejs/enzyme/pull/1785), @koba04)\n- `shallow`: `setState` after `setProps` calls `componentWillReceiveProps` ([#1779](https://github.com/enzymejs/enzyme/pull/1779), @peanutenthusiast)\n- `mount`/`shallow`: be stricter on the wrapper’s setState/setProps callback ([commit](https://github.com/enzymejs/enzyme/commit/ff11d2219da575d09ca8edfa19df42b8f78b506f))\n- `shallow`/`mount`: improve error message when wrapping invalid elements ([#1759](https://github.com/enzymejs/enzyme/pull/1759), @jgzuke)\n\n### Refactors\n- remove most uses of lodash ([commit](https://github.com/enzymejs/enzyme/commit/89b39b6f1c59aa771f4452a27b159f7aa2616e84))\n\n### Meta Stuff\n- ensure a license and readme is present in all packages when published\n\n## 3.4.4\n\n### Fixes\n- @koba04: `shallow`: fix unexpected call to componentDidMount ([#1768](https://github.com/enzymejs/enzyme/pull/1768))\n\n## 3.4.3\n\n### Fixes\n- @ljharb/@koba04: `shallow`: `.setState()`: stub out `setState` on non-root code paths as well ([#1763](https://github.com/enzymejs/enzyme/pull/1763))\n- @ljharb: `shallow`/`mount`: restore fallback when adapter lacks `invokeSetStateCallback` ([commit](https://github.com/enzymejs/enzyme/commit/093b2edb98d3abfe6b61d800503e04aac08e7496))\n- @ljharb: `mount`: `setState`: invoke callback with the proper receiver ([commit](https://github.com/enzymejs/enzyme/commit/ec3beef3ba86c4352fe6e9ab2848b3b4f61ac1da))\n- @ljharb: `mount`: `state` and `setState` should throw an explicit error message when called on an SFC ([commit](https://github.com/enzymejs/enzyme/commit/8feee5a89e9091636e9ec0ec3814d287ced20136))\n\n## 3.4.2\n\n### Fixes\n- @koba04: `shallow`: call cDU when an instance calls setState ([#1742](https://github.com/enzymejs/enzyme/pull/1742))\n- @ReactiveRaven: `selectors`: fix descendant selector ([#1680](https://github.com/enzymejs/enzyme/pull/1680))\n\n## 3.4.1\n\n### Fixes\n\n- @ljharb: `shallow`: `setProps`: merge instead of replace props ([commit](https://github.com/enzymejs/enzyme/commit/9b4d0276f57e54be06aca6c3636120b3c4053310))\n\n### Documentation\n\n- @koba04: Fix an adapter table style in README.md and a migration guide ([#1734](https://github.com/enzymejs/enzyme/pull/1734))\n\n## 3.4.0\n\n### New Stuff\n\n- @madicap: `shallow`/`mount`: account for React.Fragment nodes ([#1733](https://github.com/enzymejs/enzyme/pull/1733))\n- @jquense: Debug: `debugNode` now returns `[function]` for function children ([commit](https://github.com/enzymejs/enzyme/commit/9745de0bf25e826186be07e7846f4ecd7c685592))\n- @ljharb: `mount`: add `hydrateIn` option ([#1707](https://github.com/enzymejs/enzyme/pull/1707))\n- @ljharb: `shallow`: add “lifecycles” adapter option ([#1696](https://github.com/enzymejs/enzyme/pull/1696))\n- @krawaller: `shallow`/`mount`: allow `.exists()` to take an optional selector ([#1695](https://github.com/enzymejs/enzyme/pull/1695))\n- @koba04: `shallow`: Add getSnapshotBeforeUpdate support ([#1657](https://github.com/enzymejs/enzyme/pull/1657))\n- @jquense: `shallow`/`mount`: Add support for some pseudo selectors ([#1537](https://github.com/enzymejs/enzyme/pull/1537))\n- @blainekasten: `debug`: Implement verbose debug output ([#1547](https://github.com/enzymejs/enzyme/pull/1547))\n- @jquense/@ljharb: `Debug`: `typeName` now calls the adapter’s `displayNameOfNode` if available ([#1701](https://github.com/enzymejs/enzyme/pull/1701))\n- @jquense/@ljharb: `mount`/`shallow`: `.name()`: call into adapter’s `displayNameOfNode`, if present ([#1701](https://github.com/enzymejs/enzyme/pull/1701))\n- @jquense/@ljharb: `Utils`: `nodeHasType`: call into adapter’s `displayNameOfNode`, if present ([#1701](https://github.com/enzymejs/enzyme/pull/1701))\n- @jquense/@ljharb: `selectors`: `buildPredicate`: call into adapter’s `isValidElementType`, if present ([#1701](https://github.com/enzymejs/enzyme/pull/1701))\n- @emuraton/@ljharb: `shallow`: `setProps()`: Add callback argument ([#1721](https://github.com/enzymejs/enzyme/pull/1721))\n- @ljharb: `mount`: add `.equals()` ([commit](https://github.com/enzymejs/enzyme/commit/dcc8ab10fde06a963364f6cc79b89aa967d9bef2))\n- @madicap: Extract `getAdapter` from `Utils` into its own file ([#1732](https://github.com/enzymejs/enzyme/pull/1732))\n\n### Fixes\n\n- @ljharb: `shallow`/`mount`: `matchesElement`/`containsMatchingElement`: get adapter with options ([commit](https://github.com/enzymejs/enzyme/commit/e954e4610d1ad89ae94b8f7c7baa8835cd331662))\n- @ljharb: `RSTTraversal`: remove `nodeHasProperty` export; broken since #1157 ([commit](https://github.com/enzymejs/enzyme/commit/edabb1b6b4648fb6469da43feb1d15c1b55666f7))\n- @ljharb/@KordonDev: `shallow`: `.at()`: return an empty wrapper when an index does not exist ([#1478](https://github.com/enzymejs/enzyme/pull/1478))\n- @ljharb: `shallow`: `.equals()`: flatten children when comparing ([commit](https://github.com/enzymejs/enzyme/commit/18de4ed2e68c25f9fff9983d996b024704183801))\n- @ljharb: `mount`/`shallow`: do not dedupe in flatMap ([commit](https://github.com/enzymejs/enzyme/commit/72341740e1e650b16ca2e377fa4e3e144b35a558))\n- @ljharb: `shallow`: `.closest()`: ensure an empty wrapper is returned for no match ([commit](https://github.com/enzymejs/enzyme/commit/ce1e1132d080948265567e88417dface9c0c45e7))\n- @krawaller: `selectors`: make general sibling not throw on root ([#1698](https://github.com/enzymejs/enzyme/pull/1698))\n- @ljharb/@angelikatyborska : `mount`: `text()`: null nodes return null ([#1582](https://github.com/enzymejs/enzyme/pull/1582))\n- @ljharb: `shallow`: `simulate`: ensure it returns itself ([commit](https://github.com/enzymejs/enzyme/commit/1c2c58b4e554f3b0c5f862f8de79f15a62bef5cf))\n- @koba04: `shallow`: ShallowWrapper calls update() automatically ([#1499](https://github.com/enzymejs/enzyme/pull/1499))\n- @bdwain: `mount`/`shallow`: return null for missing keys ([#1536](https://github.com/enzymejs/enzyme/pull/1536))\n- @vsiao: Fix ShallowWrapper for array-rendering components ([#1498](https://github.com/enzymejs/enzyme/pull/1498))\n- @koba04: Call `setState` callback after finishing the render ([#1453](https://github.com/enzymejs/enzyme/pull/1453))\n- @eddyerburgh: Convert nodes to RST nodes before comparing ([#1423](https://github.com/enzymejs/enzyme/pull/1423))\n- @ljharb: improve \"bad adapter\" error message ([#1477](https://github.com/enzymejs/enzyme/pull/1477))\n- @ljharb: `shallow`/`mount`: default iterator should be iterable ([commit](https://github.com/enzymejs/enzyme/commit/cfc5a3e47efa812f7a2c4fa5ad2b0687daacd280))\n\n### Refactors\n\n- @ReactiveRaven: `selectors`: fix typos; avoid reusing variable unnecessarily ([#1681](https://github.com/enzymejs/enzyme/pull/1681))\n- @koba04/@ljharb: `shallow`: Use `spyMethod` to inspect the result of `shouldComponentUpdate`/`getSnapshotBeforeUpdate` ([#1192](https://github.com/enzymejs/enzyme/pull/1192))\n- @ljharb: `Utils`: `configuration`: change to named exports. ([commit](https://github.com/enzymejs/enzyme/commit/d7f32617e6ea93b739f4e4c3f6228a8e382aeb06))\n- @ljharb: use `array.prototype.flat` ([commit](https://github.com/enzymejs/enzyme/commit/e52a02ddac0fab0d1d93fd57d7f073f8bdc850bf))\n\n### Documentation\n\n- @jack-lewin: Clarify dev workflow in CONTRIBUTING.md ([#1207](https://github.com/enzymejs/enzyme/pull/1207))\n- @robrichard: Provide migration instructions for `ref(refName)` ([#1470](https://github.com/enzymejs/enzyme/pull/1470))\n- @DannyDelott: `shallow`/`mount`: Add callback arg to setProps header ([#1361](https://github.com/enzymejs/enzyme/pull/1361))\n- @conor-cafferkey-sociomantic: `mount`: Updated docs for ReactWrapper.instance(); remove docs for v2's `getNode()`/`getNodes()` ([#1714](https://github.com/enzymejs/enzyme/pull/1714))\n- @koba04: Make clearer the docs for .mount() ([#1540](https://github.com/enzymejs/enzyme/pull/1540))\n- @ialexryan: Update signature of .type() in shallow.md (#1492]([https://github.com/enzymejs/enzyme/pull/1492))\n\n### Meta Stuff\n\n- @ljharb: ensure a license and readme is present in all packages when published\n- @ljharb: [meta] fix package.json scripts\n\n## 3.3.0\n\n### New Stuff\n\n- @ljharb/@joeldenning: `debug`: handle boxed primitives ([#1450](https://github.com/enzymejs/enzyme/pull/1450))\n\n### Refactors\n- @eddyerburgh: Use RSTTraversal childrenOfNode in Utils ([#1381](https://github.com/enzymejs/enzyme/pull/1381))\n\n### Fixes\n- @nicoder: Fix typo in error message ([#1379](https://github.com/enzymejs/enzyme/pull/1379))\n\n## 3.2.0\n\n### New Stuff\n\n- @aweary: Support all attribute selector operators ([#1157](https://github.com/enzymejs/enzyme/pull/1157))\n\n### Fixes\n\n- @idanilt: Change ShallowWrapper.text() trim spaces with same behavior as ReactWrapper.text() ([#1350](https://github.com/enzymejs/enzyme/pull/1350))\n\n## 3.1.1\n\n### Fixes\n\n- @koba04: Fix to call componentDidUpdate on setState of React v16 ([#1261](https://github.com/enzymejs/enzyme/pull/1261))\n\n## 3.1.0\n\n### New Stuff\n\n- @FezVrasta: Added hostNodes method to ReactWrapper ([#1179](https://github.com/enzymejs/enzyme/pull/1179))\n\n### Fixes\n\n- @lelandrichardson: Add an npmignore file to all packages ([#1204](https://github.com/enzymejs/enzyme/pull/1204))\n\n- @neoziro: Fix node resolving in React 16 adapter ([#100](https://github.com/enzymejs/enzyme/pull/100))\n\n- @graingert: upgrade to rst-selector-parser@^2.2.2 ([#1146](https://github.com/enzymejs/enzyme/pull/1146))\n\n### Documentation\n\n- @lelandrichardson: Symlink readme to all packages ([#1205](https://github.com/enzymejs/enzyme/pull/1205))\n\n- @AndersDJohnson: fix some typos ([#1165](https://github.com/enzymejs/enzyme/pull/1165))\n\n- @dubbha: ES5 setup file correction ([#1194](https://github.com/enzymejs/enzyme/pull/1194))\n\n- @morrowr08: updated component name being used in example ([#1180](https://github.com/enzymejs/enzyme/pull/1180))\n\n- @apandichi: Fixing a few typos... ([#1171](https://github.com/enzymejs/enzyme/pull/1171))\n\n- @nuc: Fix typo ([#1142](https://github.com/enzymejs/enzyme/pull/1142))\n\n## 3.0.0\n\n### Breaking Changes\n\nEnzyme has several breaking changes from v2 to v3. Please check out our [migration guide](/docs/guides/migration-from-2-to-3.md) for more info. Since there was a rewrite of the core\nlibrary from v2 to v3, it is hard to categorize changes in terms of sem\n\n - @lelandrichardson: Refactor enzyme to use Adapters, initial React 16 support ([#1007](https://github.com/enzymejs/enzyme/pull/1007))\n\n - @lelandrichardson: Make private properties more private and harder to use ([#1083](https://github.com/enzymejs/enzyme/pull/1083))\n\n - @ljharb: [breaking] update `cheerio` to v1 ([#1093](https://github.com/enzymejs/enzyme/pull/1093))\n\n - @aweary: Integrate with a CSS parser for selector parsing ([#1086](https://github.com/enzymejs/enzyme/pull/1086))\n\n - @vadimdemedes: Skip undefined props when comparing nodes ([#662](https://github.com/enzymejs/enzyme/pull/662))\n\n - @koba04: Breaking: lifecycleExperimental by default ([#1140](https://github.com/enzymejs/enzyme/pull/1140))\n\n\n### New Stuff\n\n - @lelandrichardson: Move to lerna repo structure, multiple modules ([#1074](https://github.com/enzymejs/enzyme/pull/1074))\n\n - @lelandrichardson: Remove all React dependencies from enzyme ([#1084](https://github.com/enzymejs/enzyme/pull/1084))\n\n - @lelandrichardson: Add public root method ([#1127](https://github.com/enzymejs/enzyme/pull/1127))\n\n\n\n ### Fixes\n\n - @aweary: Remove isFunctionalComponent, use nodeType instead ([#1076](https://github.com/enzymejs/enzyme/pull/1076))\n\n - @LarsHassler: props not merged when shallow rendering in lifecycleExperimental ([#1088](https://github.com/enzymejs/enzyme/pull/1088))\n\n - @ljharb: [Fix] `mount`: do not mutate `Component.contextTypes` ([#1099](https://github.com/enzymejs/enzyme/pull/1099))\n\n - @ljharb: [Fix] `reduce`/`reduceRight`: follow `Array#reduce` when omitting initialValue ([#673](https://github.com/enzymejs/enzyme/pull/673))\n\n - @koba04: Fix componentDidUpdate when updating by setState on v16 ([#1133](https://github.com/enzymejs/enzyme/pull/1133))\n\n - @koba04: Fix componentDidUpdate no longer receives prevContext on React v16 ([#1139](https://github.com/enzymejs/enzyme/pull/1139))\n\n\n\n ### Documentation\n\n - @ghost: added sinon to mocha guide ([#1075](https://github.com/enzymejs/enzyme/pull/1075))\n\n - @samit4me: Update to GitBook 3 ([#1039](https://github.com/enzymejs/enzyme/pull/1039))\n\n - @therewillbecode: Removed extraneous brackets from example in readme ([#1117](https://github.com/enzymejs/enzyme/pull/1117))\n\n - @silvenon: Add note that mount() requires cleanup ([#1043](https://github.com/enzymejs/enzyme/pull/1043))\n\n - @lelandrichardson: Add docs reflecting v3 ([#1121](https://github.com/enzymejs/enzyme/pull/1121))\n\n\n\n\n## 2.9.1\n\n### Fixes\n\n - [Deps] Require uuid at least 3.0.1 ([#1001](https://github.com/enzymejs/enzyme/pull/1001))\n\n## 2.9.0\n\n### New Stuff\n\n - `mount`/`shallow`: `debug`: add `ignoreProps` option ([#960](https://github.com/enzymejs/enzyme/pull/960))\n\n### Fixes\n\n - `shallow`: debug: fix indentation ([#926](https://github.com/enzymejs/enzyme/pull/926))\n - react-compat: Make sure dependency error reporting always work ([#929](https://github.com/enzymejs/enzyme/pull/929))\n - react-compat: correct error message ([#904](https://github.com/enzymejs/enzyme/pull/904))\n\n### Documentation\n\n - lint our markdown ([#988](https://github.com/enzymejs/enzyme/pull/988))\n - correct `nvm` install instructions (never install it with homebrew) ([#988](https://github.com/enzymejs/enzyme/pull/988))\n - fix typos ([#979](https://github.com/enzymejs/enzyme/pull/979)), ([#983](https://github.com/enzymejs/enzyme/pull/983))\n - Added missing isEmptyRender() docs\n - update jsdom guides for v10 and later ([#921](https://github.com/enzymejs/enzyme/pull/921))\n\n### Refactors\n\n - `shallow`/`mount`: Make all references to the wrapper `class` call into `this.wrap`\n - update `uuid` from v2 to v3 ([#998](https://github.com/enzymejs/enzyme/pull/998))\n\n## 2.8.2\n\n### Fixes\n\n - Loosen react-compat implicit dependency logic for React 15.4 ([#896](https://github.com/enzymejs/enzyme/pull/896))\n\n### Documentation\n\n - Update docs to use `prop-types` ([#894](https://github.com/enzymejs/enzyme/pull/894), [#890](https://github.com/enzymejs/enzyme/issues/890))\n\n## 2.8.1\n\n### Fixes\n\n- support React@15.5 ([#876](https://github.com/enzymejs/enzyme/pull/876))\n- no longer depend on `React.createClass` ([#877](https://github.com/enzymejs/enzyme/pull/877))\n- Throw for malformed compound selectors ([#868](https://github.com/enzymejs/enzyme/pull/868))\n\n## 2.8.0\n\n### New Stuff\n\n- add disableLifecycleMethods for shallow ([#789](https://github.com/enzymejs/enzyme/pull/789))\n- Match children before and after interpolation ([#512](https://github.com/enzymejs/enzyme/pull/512))\n- Supporting passing context to static rendering ([#429](https://github.com/enzymejs/enzyme/pull/429))\n\n\n### Fixes\n\n- Fix an issue w/ cleaning up global.document ([#855](https://github.com/enzymejs/enzyme/pull/855))\n- Update props when shouldComponentUpdate returns `false` and `lifecycleExperimental` is on ([#807](https://github.com/enzymejs/enzyme/pull/807))\n- Properly pass along options in `dive` ([#771](https://github.com/enzymejs/enzyme/pull/771))\n\n## 2.7.1 (January 22, 2017)\n\n### Fixes\n\n- `mount`: Fix bug from ([#677](https://github.com/enzymejs/enzyme/pull/677) ([#680](https://github.com/enzymejs/enzyme/pull/680))\n- `mount`: ignore text nodes in childrenOfInst ([#604](https://github.com/enzymejs/enzyme/pull/604))\n\n### Documentation\n\n- Update Docs for .getNode and .getNodes ([#743](https://github.com/enzymejs/enzyme/pull/743))\n- Add a link for `ShallowWrapper#dive()` ([#759](https://github.com/enzymejs/enzyme/pull/759)\n- Fix alphabetical order of API lists ([#761](https://github.com/enzymejs/enzyme/pull/761))\n\n## 2.7.0 (December 21, 2016)\n\n### New Stuff\n\n- `shallow`/`mount`: Add `.slice()` method ([#661](https://github.com/enzymejs/enzyme/pull/661))\n- `mount`: implement ReactWrapper#getDOMNode ([#679](https://github.com/enzymejs/enzyme/pull/679))\n- `shallow`/`mount`: Add `exists`; deprecate isEmpty() ([#722](https://github.com/enzymejs/enzyme/pull/722))\n\n### Fixes\n\n- `mount`: extract MountedTraversal.hasClassName from MountedTraversal.instHasClassName, which allows ReactWrapper.hasClass to bypass the !isDOMComponent(inst) call ([#677](https://github.com/enzymejs/enzyme/pull/677))\n- `withDom`: Display a useful error when `withDom` fails to find \"jsdom\" ([#686](https://github.com/enzymejs/enzyme/pull/686))\n- `mount`: ensure that `react-text` comment nodes don’t break `.find` ([#691](https://github.com/enzymejs/enzyme/pull/691))\n- `mount`: `.parents()` now filters out sibling path trees ([#713](https://github.com/enzymejs/enzyme/pull/713))\n\n## 2.6.0 (November 9, 2016)\n\n### New Stuff\n\n- ensure ShallowWrapper render output can't get stale ([#490](https://github.com/enzymejs/enzyme/pull/490))\n\n### Fixes\n\n- Use shim to detect constructor function name ([#659](https://github.com/enzymejs/enzyme/pull/659))\n- `mount`/`shallow`: fix ID selectors ([#670](https://github.com/enzymejs/enzyme/pull/670))\n\n\n## 2.5.2 (November 9, 2016)\n\n### Fixes\n\n- Use shim to detect constructor function name ([#659](https://github.com/enzymejs/enzyme/pull/659))\n- `mount`/`shallow`: fix ID selectors ([#670](https://github.com/enzymejs/enzyme/pull/670))\n\n\n## 2.5.1 (October 17, 2016)\n\n### Patches\n\n- continue to support one-argument `single` ([#632](https://github.com/enzymejs/enzyme/pull/632))\n\n\n## 2.5.0 (October 17, 2016)\n\n### Minor Changes\n\n- pass callback on setState and setProps ([#617](https://github.com/enzymejs/enzyme/pull/617))\n\n- Make ReactWrapper and ShallowWrapper iterable ([#594](https://github.com/enzymejs/enzyme/pull/594))\n\n- add `.dive()` method to `shallow` ([#618](https://github.com/enzymejs/enzyme/pull/618))\n\n\n### Patches\n\n- Warn if selector contains a pseudo-class ([#591](https://github.com/enzymejs/enzyme/pull/591))\n\n- change isCompoundSelector to not match prop selector ([#595](https://github.com/enzymejs/enzyme/pull/595))\n\n- fixed hasClassName in case className is not a string and has toString method ([#518](https://github.com/enzymejs/enzyme/pull/518))\n\n- Throw if some() is called on a root wrapper ([#523](https://github.com/enzymejs/enzyme/pull/523))\n\n- Fix valid + falsy propvalues ([#563](https://github.com/enzymejs/enzyme/pull/563))\n\n\n## 2.4.2 (November 9, 2016)\n\n### Fixes\n\n- Use shim to detect constructor function name ([#659](https://github.com/enzymejs/enzyme/pull/659))\n- `mount`/`shallow`: fix ID selectors ([#670](https://github.com/enzymejs/enzyme/pull/670))\n\n\n## 2.4.1 (July 8, 2016)\n\n### Patches\n\n- Fix backwards incompatible `shouldComponentUpdate` call ([#491](https://github.com/enzymejs/enzyme/pull/491))\n\n\n## 2.4.0 (July 7, 2016)\n\n### Minor Changes\n\n- Support all Component Lifecycle methods in ShallowRenderer (behind an experimental flag) ([#318](https://github.com/enzymejs/enzyme/pull/318))\n\n- Add an `isEmptyRender()` method to both `ShallowWrapper` and `ReactWrapper` ([#339](https://github.com/enzymejs/enzyme/pull/339))\n\n- Add support for batched updates with `ShallowRender.simulate` ([#342](https://github.com/enzymejs/enzyme/pull/342))\n\n\n### Patches\n\n- Switch to using classList instead of className ([#448](https://github.com/enzymejs/enzyme/pull/448))\n\n- fixes mount().debug() output with mixed children ([#476](https://github.com/enzymejs/enzyme/pull/476))\n\n- Support additional characters in attribute selectors ([#412](https://github.com/enzymejs/enzyme/pull/412))\n\n- fix id selector not working when combined with a tag selector ([#387](https://github.com/enzymejs/enzyme/pull/387))\n\n- Support spaces in attribute selector values ([#427](https://github.com/enzymejs/enzyme/pull/427))\n\n\n\n## 2.3.0 (May 9, 2016)\n\n### Minor Changes\n\n- add `.tap()` method to `ShallowWrapper` and `ReactWrapper` ([#299](https://github.com/enzymejs/enzyme/pull/299))\n\n- add `.key()` method to `ShallowWrapper` and `ReactWrapper` ([#327](https://github.com/enzymejs/enzyme/pull/327))\n\n- add support for descendent selectors, `>`, `~` and `+` ([#217](https://github.com/enzymejs/enzyme/pull/217))\n\n- new `containsMatchingElement`, `containsAllMatchingElements`, and `containsAnyMatchingElements` APIs ([#362](https://github.com/enzymejs/enzyme/pull/362))\n\n- new `.name()` method ([#335](https://github.com/enzymejs/enzyme/pull/335))\n\n\n### Patches\n\n- add `dblclick` to eventType map for simulate ([#317](https://github.com/enzymejs/enzyme/pull/317))\n\n- fix `pathToNode` bug with child-containing children ([#296](https://github.com/enzymejs/enzyme/pull/296))\n\n- prioritize `displayName` over `name` for consistency in `.debug()` ([#332](https://github.com/enzymejs/enzyme/pull/332))\n\n- handle insignificant whitespace in className ([#348](https://github.com/enzymejs/enzyme/pull/348))\n\n- fix handling of SFC components and `.instance()` ([#359](https://github.com/enzymejs/enzyme/pull/359))\n\n- reduce false positives by using argument validation for `.contains` ([#259](https://github.com/enzymejs/enzyme/pull/259))\n\n- fix equality algorithm so that non-renderable nodes are equivalent ([#192](https://github.com/enzymejs/enzyme/pull/192))\n\n- add better error handling for `state`, `setState`, and `context` ([#373](https://github.com/enzymejs/enzyme/pull/373))\n\n\n\n\n## 2.2.0 (March 21, 2016)\n\n### Minor Changes\n\n- add `options` param to `ShallowWrapper::shallow` ([#275](https://github.com/enzymejs/enzyme/pull/275))\n\n\n### Patches\n\n- make enzyme compatible with all React 15 RCs ([#272](https://github.com/enzymejs/enzyme/pull/272))\n\n- increase coverage for Stateless Functional Components ([#267](https://github.com/enzymejs/enzyme/pull/267))\n\n- improve context support for Stateless Functional Components ([#256](https://github.com/enzymejs/enzyme/pull/256))\n\n- fix tree traversal for Stateless Functional Components ([#257](https://github.com/enzymejs/enzyme/pull/257))\n\n- fix `.find` for nested Stateless Functional Components ([#274](https://github.com/enzymejs/enzyme/pull/274))\n\n- fix `.props()` and `.debug()` methods for Stateless Functional Components ([#255](https://github.com/enzymejs/enzyme/pull/255))\n\n- prevent falsy nodes from being counted as children ([#251](https://github.com/enzymejs/enzyme/pull/251))\n\n\n## 2.1.0 (March 10, 2016)\n\n### Minor Changes\n\n- add support for React 15.0.0-rc.1 ([#240](https://github.com/enzymejs/enzyme/pull/240))\n\n- add `.unmount()` method for ShallowWrapper ([#215](https://github.com/enzymejs/enzyme/pull/215))\n\n- add direct imports for `mount`, `shallow`, and `render` ([#198](https://github.com/enzymejs/enzyme/pull/198))\n\n- add a `.childAt(n)` shorthand method ([#187](https://github.com/enzymejs/enzyme/pull/187))\n\n\n### Patches\n\n- fix bug in .contains() for matching sub-arrays ([#226](https://github.com/enzymejs/enzyme/pull/226))\n\n- fix bug in matching by type displayName ([#230](https://github.com/enzymejs/enzyme/pull/230))\n\n- add more useful warnings for missing implicit dependencies ([#228](https://github.com/enzymejs/enzyme/pull/228))\n\n- improve SFC support for `.type()` ([#196](https://github.com/enzymejs/enzyme/pull/196))\n\n- fix null handling for `.html()` and `.render()` ([#196](https://github.com/enzymejs/enzyme/pull/196))\n\n- moved from `underscore` to `lodash` ([#189](https://github.com/enzymejs/enzyme/pull/189))\n\n\n## 2.0.0 (February 10, 2016)\n\n### Major Changes (breaking)\n\n- removed `describeWithDOM` utility ([#159](https://github.com/enzymejs/enzyme/pull/159))\n\n- removed `useSinon`, `spyPrototype` and `spyLifecycle` utilities ([#159](https://github.com/enzymejs/enzyme/pull/159))\n\n- removed `sinon` dependency ([#159](https://github.com/enzymejs/enzyme/pull/159))\n\n- removed `jsdom` dependency ([#159](https://github.com/enzymejs/enzyme/pull/159))\n\n\n## 1.6.0 (February 10, 2016)\n\n### Minor Changes\n\n- add option for childContextTypes of `ReactWrapper` ([#171](https://github.com/enzymejs/enzyme/pull/171))\n\n\n### Patches\n\n- Prevent null or false nodes from being passed into tree traversal ([#174](https://github.com/enzymejs/enzyme/pull/174))\n\n- setProps no longer swallows exceptions ([#170](https://github.com/enzymejs/enzyme/pull/170))\n\n- `.type()` and `.props()` should not fail on null now ([#162](https://github.com/enzymejs/enzyme/pull/162))\n\n\n\n## 1.5.0 (February 2, 2016)\n\n### Minor Changes\n\n- Add `attachTo` option to `mount` to mount to a specific element ([#160](https://github.com/enzymejs/enzyme/pull/160))\n\n- Add `.debug()` method to `ReactWrapper` ([#158](https://github.com/enzymejs/enzyme/pull/158))\n\n- Add `.mount()` and `.unmount()` APIs to `ReactWrapper` ([#155](https://github.com/enzymejs/enzyme/pull/155))\n\n- Add `.render()` method to `ReactWrapper` ([#156](https://github.com/enzymejs/enzyme/pull/156))\n\n- Allow `.contains()` to accept an array of nodes ([#154](https://github.com/enzymejs/enzyme/pull/154))\n\n- Add `.context()` method to `ReactWrapper` and `ShallowWrapper` ([#152](https://github.com/enzymejs/enzyme/pull/152))\n\n### Patches\n\n- Fixed some behavior with `.contains()` matching on strings ([#148](https://github.com/enzymejs/enzyme/pull/148))\n\n- Fixed `.debug()`'s output for numeric children ([#149](https://github.com/enzymejs/enzyme/pull/149))\n\n- Documentation fixes\n\n- Update versions of dependencies\n\n\n\n## 1.4.1 (January 24, 2016)\n\n### Patches\n\n- Upgrade to babel 6 ([#81](https://github.com/enzymejs/enzyme/pull/81))\n\n- Fix event naming bug in ShallowWrapper ([#135](https://github.com/enzymejs/enzyme/pull/135))\n\n- Documentation fixes\n\n\n## 1.4.0 (January 21, 2016)\n\n### Minor Changes\n\n- `describeWithDOM` enhancement ([#126](https://github.com/enzymejs/enzyme/pull/126))\n\n- add `.equals()` method to `ShallowWrapper` ([#124](https://github.com/enzymejs/enzyme/pull/124))\n\n- add object selector syntax ([#110](https://github.com/enzymejs/enzyme/pull/110))\n\n### Patches\n\n- Fixed confusing behavior of prop selector syntax ([#130](https://github.com/enzymejs/enzyme/pull/130))\n\n- Documentation fixes\n\n\n\n## 1.3.1 (January 15, 2016)\n\n### Patches\n\n- Fix setProps not passing old context ([#121](https://github.com/enzymejs/enzyme/pull/121))\n\n- Map lowercase mouse events in simulate ([#77](https://github.com/enzymejs/enzyme/pull/77))\n\n\n\n## 1.3.0 (January 13, 2016)\n\n### Minor Changes\n\n- Added `.html()` method to `ReactWrapper` ([#71](https://github.com/enzymejs/enzyme/pull/71))\n\n- Support property selector (i.e. `[prop=\"foo\"]`) ([#70](https://github.com/enzymejs/enzyme/pull/70))\n\n- jsdom dependency now allows a range of supported versions ([#95](https://github.com/enzymejs/enzyme/pull/95))\n\n### Patches\n\n- Normalized `setProps()` behavior between `mount`/`shallow` to merge props ([#103](https://github.com/enzymejs/enzyme/pull/103))\n\n- Exclude `_book` from published package ([#85](https://github.com/enzymejs/enzyme/pull/85))\n\n- Various documentation, tests, and style changes\n\n\n## 1.2.0 (December 10, 2015)\n\n### Minor Changes\n\n- Support for context ([#62](https://github.com/enzymejs/enzyme/pull/62))\n\n### Patches\n\n- `nodeHasId` fix for some 0.14 corner cases ([#65](https://github.com/enzymejs/enzyme/pull/65))\n\n\n\n## 1.1.0 (December 7, 2015)\n\n### Minor Changes\n\n- Support for Stateless Functional Components ([#53](https://github.com/enzymejs/enzyme/pull/53))\n\n### Patches\n\n- Tweak `describeWithDOM` messaging ([#48](https://github.com/enzymejs/enzyme/pull/48))\n- Documentation Fixes\n\n\n\n\n## 1.0.0 (December 3, 2015)\n\n- Official Release!\n"
  },
  {
    "path": "CONTRIBUTING.md",
    "content": "# Contributing Guide\n\nContributions are welcome and are greatly appreciated! Every little bit helps, and credit will\nalways be given.\n\n\n\n\n## Setting up your environment\n\nAfter forking enzyme to your own github org, do the following steps to get started:\n\n```bash\n# clone your fork to your local machine\ngit clone https://github.com/enzymejs/enzyme.git\n\n# step into local repo\ncd enzyme\n\n# install dependencies (use `react 13` if you want to use React 0.13)\nnpm install\n\n# install react version\n# accepts `13` for v0.13, `14` for v0.14, and for versions 15+,\n# accepts either a major (`15`, `16`) or a minor (`15.4`, `16.8`)\nnpm run react 16\n```\n\n\n### Switching between React 16, React 15, React 0.14 and React 0.13\n\n```bash\n# switch to React 0.13\nnpm run react 13\n```\n\n```bash\n# switch to React 0.14\nnpm run react 14\n```\n\n```bash\n# switch to React 15\nnpm run react 15\n```\n\n```bash\n# switch to React 16\nnpm run react 16\n```\n\nSpecific versions can also be specified\n\n```bash\n# switch to React 16.5\nnpm run react 16.5\n```\n\n### Running Tests\n\nThe test suite runs on *built* Enzyme.\n\n```bash\n# build Enzyme locally before testing\nnpm run build\n\n# run tests on whatever version of React is currently installed\nnpm test\n```\n\n```bash\n# run tests on all supported versions of React\nnpm run test:all\n```\n\nIf you are actively developing, Enzyme will always need to be built with the latest changes.\n\nFor this, the recommended workflow is to have the build and tests watching for changes in separate terminals. This should provide you with ~realtime feedback:\n\n```bash\n# build Enzyme locally upon save\nnpm run build:watch\n\n# faster feedback for TDD\nnpm run test:watch\n```\n\n### Tests for functionality shared between `shallow` and `mount`\n\nTests for a method \"foo\" are stored in `packages/enzyme-test-suite/test/shared/methods/foo`. The file default exports a function that receives an injected object argument, containing the following properties:\n - `Wrap`: e.g. `shallow`, `mount`\n - `WrapRendered`: this abstracts around the differences between `shallow` and `mount` - e.g., that the root of a shallow wrapper around `Foo` is what `Foo` *renders*, where the root of a mount wrapper around `Foo` is `Foo` itself. Thus, this function produces a wrapper around what `Foo` renders, regardless of the `Wrap` method used.\n - `Wrapper`: e.g. `ShallowWrapper`, `ReactWrapper`\n - `WrapperName`: e.g. `\"ShallowWrapper\"`, `\"ReactWrapper\"`\n - `isShallow`: true if `shallow`. note: needing to use this is a code smell, please avoid.\n - `isMount`: true if `mount`. note: needing to use this is a code smell, please avoid.\n - `makeDOMElement`: in `mount`, makes a real DOM element; in `shallow`, makes a mock object.\n\n These tests are ran via an explicit list in a `describeMethods` call in the ReactWrapper and ShallowWrapper test files. If you add a new test file for a shared method, you'll need to add its name to both calls.\n\n### Style & Linting\n\nThis codebase adheres to the [Airbnb Styleguide](https://github.com/airbnb/javascript) and is\nenforced using [ESLint](https://eslint.org).\n\nAs with the test suite, the linter will not fully pass unless it is running on *built* Enzyme. This is because the ESLint `import/*` rules rely on finding the target files in the filesystem (which won't be there unless they've been built).\n\nIt is recommended that you install an ESLint plugin for your editor of choice when working on this\ncodebase, however you can always check to see if the source code is compliant by running:\n\n```bash\n# build Enzyme locally before linting\nnpm run build\n\nnpm run lint\n```\n\n### Publishing\n\nEnzyme uses [lerna](https://github.com/lerna/lerna) to structure its repo, and has multiple packages\nto publish out of this one repo. We use lerna's \"independent\" mode, which means that the versioning\nof each package in the repo is versioned independently.\n\nWe are waiting on [this issue](https://github.com/lerna/lerna/issues/955) to be fixed, so that\n`peerDependencies` do not get updated with patch updates.\n\nUntil this issue is fixed, we will publish each package manually instead of with `lerna publish`. In\norder to do this, we will:\n\nFor enzyme:\n\n```bash\n# ... update version in enzyme/package.json, make changes to CHANGELOG, etc.\ncd packages/enzyme\ngit commit -m v{version}\ngit tag -a -m v{version}\ngit push --follow-tags\nnpm publish\n```\n\nFor other packages\n\n```bash\n# ... update version in {package}/package.json, make changes to CHANGELOG, etc.\ncd packages/{package}\ngit commit -m \"{package}: v{version}\"\ngit tag -a -m \"{package}: v{version}\"\ngit push --follow-tags\nnpm publish\n```\n\nOnce we are able to use `lerna publish`, the process will be as follows:\n\nLerna by default will only publish packages that have changed since the last release. It will also\ncreate a tagged commit for each release.\n\nTo publish, run:\n\n```bash\nlerna publish -m \"{tag name}\"\n```\n\nThe tag name is determined by the `-m` CLI option. If `enzyme` is one of the packages that has\nupdates, we default to just using that version as the tag name. For instance, when publishing\n`enzyme@3.1.1` and `enzyme-adapter-react-16@1.2.3` we would run:\n\n```bash\nlerna publish -m \"v3.1.1\"\n```\n\nIf `enzyme` is *not* one of the packages being updated, use the other package's name and the version:\n\n```bash\nlerna publish -m \"enzyme-adapter-react-16: v1.2.3\"\n```\n\nThe `lerna publish` command will present interactive prompts asking which version to use for each\npackage independently. Just choose whichever\n\n\n### Building Docs\n\nBuilding the docs locally is extremely simple. First execute the following command:\n\n```bash\nnpm run docs:watch\n```\n\nAfter this, you can open up your browser to the specified port (usually http://localhost:4000 )\n\nThe browser will automatically refresh when there are changes to any of the source files.\n\n\n\n## Pull Request Guidelines\n\nBefore you submit a pull request from your forked repo, check that it meets these guidelines:\n\n1. If the pull request fixes a bug, it should include tests that fail without the changes, and pass\nwith them.\n1. If the pull request adds functionality, the docs should be updated as part of the same PR.\n1. The pull request should work for React 15, React 0.14 and React 0.13. The CI server should run the\ntests in all versions automatically when you push the PR, but if you'd like to check locally, you\ncan do so (see above).\n1. Please rebase and resolve all conflicts before submitting.\n\n"
  },
  {
    "path": "INTHEWILD.md",
    "content": "Please use [pull requests](https://github.com/enzymejs/enzyme/pull/new/master) to add your organization and/or project to this document!\n\nOrganizations\n----------\n - [Airbnb](https://github.com/airbnb)\n - [Cerner](https://github.com/cerner)\n - [OpenGov](https://github.com/opengov)\n - [Pinterest](https://github.com/pinterest)\n - [Product Hunt](https://github.com/producthunt)\n - [Walmart Labs](https://github.com/walmartlabs)\n - [Hudl](http://hudl.github.io/)\n - [NET-A-PORTER](https://github.com/NET-A-PORTER)\n - [Rangle.io](https://github.com/rangle)\n - [GoDaddy](https://github.com/godaddy)\n - [Airware](https://github.com/airware)\n - [Flatiron School](https://github.com/flatiron-labs)\n - [Outreach.io](https://github.com/getoutreach)\n - [crowdSPRING](https://crowdspring.com)\n - [nteract](https://nteract.io)\n - [Brave](https://brave.com)\n - [Simple](https://github.com/simplefinance)\n - [Grab](https://github.com/grab)\n - [Megalytic](https://megalytic.com/)\n - [Chroma](https://www.chromatic.com)\n - [Mavens](https://github.com/mavens)\n - [Cucumber](https://cucumber.io)\n - [Genoa Telepsychiatry](https://genoatelepsychiatry.com)\n - [IBM X-Force Exchange](https://exchange.xforce.ibmcloud.com)\n - [Zendesk](https://zendesk.com/)\n - [idealo](https://www.idealo.de/)\n - [LendingHome](https://www.lendinghome.com)\n - [Diffia](https://diffia.com)\n - [MinuteMedia](https://www.minutemedia.com)\n - [Webex Teams](https://www.webex.com/team-collaboration.html)\n - [reformma](https://www.reformma.com)\n\nProjects\n----------\n - [Rheostat](https://github.com/airbnb/rheostat)\n - [React Boilerplate](https://github.com/mxstbr/react-boilerplate/tree/v3.0.0)\n - [Reactstrap](https://github.com/reactstrap/reactstrap)\n - [Recompose](https://github.com/acdlite/recompose)\n - [Reapop](https://github.com/LouisBarranqueiro/reapop)\n - [React Dates](https://github.com/airbnb/react-dates)\n - [nteract notebook](https://github.com/nteract/nteract)\n"
  },
  {
    "path": "LICENSE.md",
    "content": "\nThe MIT License (MIT)\n\nCopyright (c) 2015 Airbnb, Inc. and contributors\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "MAINTAINERS",
    "content": "ljharb\nlelandrichardson\nblainekasten\nAweary\nnfcampos\n"
  },
  {
    "path": "README.md",
    "content": "Enzyme\n=======\n\n[![Join the chat at https://gitter.im/enzymejs/enzyme](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/enzymejs/enzyme?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)\n\n[![npm Version](https://img.shields.io/npm/v/enzyme.svg)](https://www.npmjs.com/package/enzyme) [![License](https://img.shields.io/npm/l/enzyme.svg)](https://github.com/enzymejs/enzyme/blob/master/LICENSE.md) [![Build Status](https://travis-ci.org/enzymejs/enzyme.svg)](https://travis-ci.org/enzymejs/enzyme) [![Coverage Status](https://codecov.io/gh/enzymejs/enzyme/branch/master/graph/badge.svg)](https://codecov.io/gh/enzymejs/enzyme/branch/master)\n\n\nEnzyme is a JavaScript Testing utility for React that makes it easier to test your React Components' output.\nYou can also manipulate, traverse, and in some ways simulate runtime given the output.\n\nEnzyme's API is meant to be intuitive and flexible by mimicking jQuery's API for DOM manipulation\nand traversal.\n\nUpgrading from Enzyme 2.x or React < 16\n===========\n\nAre you here to check whether or not Enzyme is compatible with React 16? Are you currently using\nEnzyme 2.x? Great! Check out our [migration guide](/docs/guides/migration-from-2-to-3.md) for help\nmoving on to Enzyme v3 where React 16 is supported.\n\n### [Installation](/docs/installation/README.md)\n\nTo get started with enzyme, you can simply install it via npm. You will need to install enzyme\nalong with an Adapter corresponding to the version of react (or other UI Component library) you\nare using. For instance, if you are using enzyme with React 16, you can run:\n\n```bash\nnpm i --save-dev enzyme enzyme-adapter-react-16\n```\n\nEach adapter may have additional peer dependencies which you will need to install as well. For instance,\n`enzyme-adapter-react-16` has peer dependencies on `react` and `react-dom`.\n\nAt the moment, Enzyme has adapters that provide compatibility with `React 16.x`, `React 15.x`,\n`React 0.14.x` and `React 0.13.x`.\n\nThe following adapters are officially provided by enzyme, and have the following compatibility with\nReact:\n\n| Enzyme Adapter Package | React semver compatibility |\n| --- | --- |\n| `enzyme-adapter-react-16` | `^16.4.0-0` |\n| `enzyme-adapter-react-16.3` | `~16.3.0-0` |\n| `enzyme-adapter-react-16.2` | `~16.2` |\n| `enzyme-adapter-react-16.1` | <code>~16.0.0-0 &#124;&#124; ~16.1</code> |\n| `enzyme-adapter-react-15` | `^15.5.0` |\n| `enzyme-adapter-react-15.4` | `15.0.0-0 - 15.4.x` |\n| `enzyme-adapter-react-14` | `^0.14.0` |\n| `enzyme-adapter-react-13` | `^0.13.0` |\n\nFinally, you need to configure enzyme to use the adapter you want it to use. To do this, you can use\nthe top level `configure(...)` API.\n\n```js\nimport Enzyme from 'enzyme';\nimport Adapter from 'enzyme-adapter-react-16';\n\nEnzyme.configure({ adapter: new Adapter() });\n```\n\n3rd Party Adapters\n=============\n\nIt is possible for the community to create additional (non-official) adapters that will make enzyme\nwork with other libraries. If you have made one and it's not included in the list below, feel free\nto make a PR to this README and add a link to it! The known 3rd party adapters are:\n\n| Adapter Package | For Library | Status |\n| --- | --- | --- |\n| [`enzyme-adapter-preact-pure`](https://github.com/preactjs/enzyme-adapter-preact-pure) | [`preact`](https://github.com/developit/preact) | (stable) |\n|[`enzyme-adapter-inferno`](https://github.com/bbc/enzyme-adapter-inferno)|[`inferno`](https://github.com/infernojs/inferno)|(work in progress)|\n\nRunning Enzyme Tests\n===========\n\nEnzyme is unopinionated regarding which test runner or assertion library you use, and should be\ncompatible with all major test runners and assertion libraries out there. The documentation and\nexamples for enzyme use [Mocha](https://mochajs.org) and [Chai](https://chaijs.com), but you\nshould be able to extrapolate to your framework of choice.\n\nIf you are interested in using enzyme with custom assertions and convenience functions for\ntesting your React components, you can consider using:\n\n* [`chai-enzyme`](https://github.com/producthunt/chai-enzyme) with Mocha/Chai.\n* [`jasmine-enzyme`](https://github.com/FormidableLabs/enzyme-matchers/tree/master/packages/jasmine-enzyme) with Jasmine.\n* [`jest-enzyme`](https://github.com/FormidableLabs/enzyme-matchers/tree/master/packages/jest-enzyme) with Jest.\n* [`should-enzyme`](https://github.com/rkotze/should-enzyme) for should.js.\n* [`expect-enzyme`](https://github.com/PsychoLlama/expect-enzyme) for expect.\n\n\n[Using Enzyme with Mocha](/docs/guides/mocha.md)\n\n[Using Enzyme with Karma](/docs/guides/karma.md)\n\n[Using Enzyme with Browserify](/docs/guides/browserify.md)\n\n[Using Enzyme with SystemJS](/docs/guides/systemjs.md)\n\n[Using Enzyme with Webpack](/docs/guides/webpack.md)\n\n[Using Enzyme with JSDOM](/docs/guides/jsdom.md)\n\n[Using Enzyme with React Native](/docs/guides/react-native.md)\n\n[Using Enzyme with Jest](/docs/guides/jest.md)\n\n[Using Enzyme with Lab](/docs/guides/lab.md)\n\n[Using Enzyme with Tape and AVA](/docs/guides/tape-ava.md)\n\nBasic Usage\n===========\n\n## [Shallow Rendering](/docs/api/shallow.md)\n\n```javascript\nimport React from 'react';\nimport { expect } from 'chai';\nimport { shallow } from 'enzyme';\nimport sinon from 'sinon';\n\nimport MyComponent from './MyComponent';\nimport Foo from './Foo';\n\ndescribe('<MyComponent />', () => {\n  it('renders three <Foo /> components', () => {\n    const wrapper = shallow(<MyComponent />);\n    expect(wrapper.find(Foo)).to.have.lengthOf(3);\n  });\n\n  it('renders an `.icon-star`', () => {\n    const wrapper = shallow(<MyComponent />);\n    expect(wrapper.find('.icon-star')).to.have.lengthOf(1);\n  });\n\n  it('renders children when passed in', () => {\n    const wrapper = shallow((\n      <MyComponent>\n        <div className=\"unique\" />\n      </MyComponent>\n    ));\n    expect(wrapper.contains(<div className=\"unique\" />)).to.equal(true);\n  });\n\n  it('simulates click events', () => {\n    const onButtonClick = sinon.spy();\n    const wrapper = shallow(<Foo onButtonClick={onButtonClick} />);\n    wrapper.find('button').simulate('click');\n    expect(onButtonClick).to.have.property('callCount', 1);\n  });\n});\n```\n\nRead the full [API Documentation](/docs/api/shallow.md)\n\n\n\n## [Full DOM Rendering](/docs/api/mount.md)\n\n```javascript\nimport React from 'react';\nimport sinon from 'sinon';\nimport { expect } from 'chai';\nimport { mount } from 'enzyme';\n\nimport Foo from './Foo';\n\ndescribe('<Foo />', () => {\n  it('allows us to set props', () => {\n    const wrapper = mount(<Foo bar=\"baz\" />);\n    expect(wrapper.props().bar).to.equal('baz');\n    wrapper.setProps({ bar: 'foo' });\n    expect(wrapper.props().bar).to.equal('foo');\n  });\n\n  it('simulates click events', () => {\n    const onButtonClick = sinon.spy();\n    const wrapper = mount((\n      <Foo onButtonClick={onButtonClick} />\n    ));\n    wrapper.find('button').simulate('click');\n    expect(onButtonClick).to.have.property('callCount', 1);\n  });\n\n  it('calls componentDidMount', () => {\n    sinon.spy(Foo.prototype, 'componentDidMount');\n    const wrapper = mount(<Foo />);\n    expect(Foo.prototype.componentDidMount).to.have.property('callCount', 1);\n    Foo.prototype.componentDidMount.restore();\n  });\n});\n```\n\nRead the full [API Documentation](/docs/api/mount.md)\n\n\n## [Static Rendered Markup](/docs/api/render.md)\n\n```javascript\nimport React from 'react';\nimport { expect } from 'chai';\nimport { render } from 'enzyme';\n\nimport Foo from './Foo';\n\ndescribe('<Foo />', () => {\n  it('renders three `.foo-bar`s', () => {\n    const wrapper = render(<Foo />);\n    expect(wrapper.find('.foo-bar')).to.have.lengthOf(3);\n  });\n\n  it('renders the title', () => {\n    const wrapper = render(<Foo title=\"unique\" />);\n    expect(wrapper.text()).to.contain('unique');\n  });\n});\n```\n\nRead the full [API Documentation](/docs/api/render.md)\n\n### React Hooks support\n\nEnzyme supports [react hooks](https://reactjs.org/docs/hooks-intro.html) with some limitations in [`.shallow()`](https://enzymejs.github.io/enzyme/docs/api/shallow.html) due to upstream issues in React's shallow renderer:\n\n* `useEffect()` and `useLayoutEffect()` don't get called in the React shallow renderer. [Related issue](https://github.com/facebook/react/issues/15275)\n\n* `useCallback()` doesn't memoize callback in React shallow renderer. [Related issue](https://github.com/facebook/react/issues/15774)\n\n#### [`ReactTestUtils.act()`](https://reactjs.org/docs/test-utils.html#act) wrap\n\nIf you're using React 16.8+ and `.mount()`, Enzyme will wrap apis including [`.simulate()`](https://enzymejs.github.io/enzyme/docs/api/ReactWrapper/simulate.html), [`.setProps()`](https://enzymejs.github.io/enzyme/docs/api/ReactWrapper/setProps.html), [`.setContext()`](https://enzymejs.github.io/enzyme/docs/api/ReactWrapper/setContext.html), [`.invoke()`](https://enzymejs.github.io/enzyme/docs/api/ReactWrapper/invoke.html) with [`ReactTestUtils.act()`](https://reactjs.org/docs/test-utils.html#act) so you don't need to manually wrap it.\n\nA common pattern to trigger handlers with `.act()` and assert is:\n\n```javascript\nconst wrapper = mount(<SomeComponent />);\nact(() => wrapper.prop('handler')());\nwrapper.update();\nexpect(/* ... */);\n```\n\nWe cannot wrap the result of `.prop()` (or `.props()`) with `.act()` in Enzyme internally since it will break the equality of the returned value.\nHowever, you could use `.invoke()` to simplify the code:\n\n```javascript\nconst wrapper = mount(<SomeComponent />);\nwrapper.invoke('handler')();\nexpect(/* ... */);\n```\n\n### Future\n\n[Enzyme Future](/docs/future.md)\n\n\n### Contributing\n\nSee the [Contributors Guide](/CONTRIBUTING.md)\n\n### In the wild\n\nOrganizations and projects using `enzyme` can list themselves [here](INTHEWILD.md).\n\n### License\n\n[MIT](/LICENSE.md)\n"
  },
  {
    "path": "SUMMARY.md",
    "content": "## Table of Contents\n\n* [Introduction](/README.md)\n* [Guides](/docs/guides.md)\n  * [Migration from 2.x to 3.x](/docs/guides/migration-from-2-to-3.md)\n  * [Browserify](/docs/guides/browserify.md)\n  * [SystemJS](/docs/guides/systemjs.md)\n  * [Webpack](/docs/guides/webpack.md)\n  * [JSDOM](/docs/guides/jsdom.md)\n  * [Jest](/docs/guides/jest.md)\n  * [Karma](/docs/guides/karma.md)\n  * [Mocha](/docs/guides/mocha.md)\n  * [React Native](/docs/guides/react-native.md)\n  * [Lab](/docs/guides/lab.md)\n  * [Tape and AVA](/docs/guides/tape-ava.md)\n* [Installation](/docs/installation/README.md)\n  * [Working with React 16.x](/docs/installation/react-16.md)\n  * [Working with React 15.x](/docs/installation/react-15.md)\n  * [Working with React 0.14.x](/docs/installation/react-014.md)\n  * [Working with React 0.13.x](/docs/installation/react-013.md)\n* [API Reference](/docs/api/README.md)\n  * [Shallow Rendering](/docs/api/shallow.md)\n    * [at(index)](/docs/api/ShallowWrapper/at.md)\n    * [childAt()](/docs/api/ShallowWrapper/childAt.md)\n    * [children()](/docs/api/ShallowWrapper/children.md)\n    * [closest(selector)](/docs/api/ShallowWrapper/closest.md)\n    * [contains(nodeOrNodes)](/docs/api/ShallowWrapper/contains.md)\n    * [containsAllMatchingElements(nodes)](/docs/api/ShallowWrapper/containsAllMatchingElements.md)\n    * [containsAnyMatchingElements(nodes)](/docs/api/ShallowWrapper/containsAnyMatchingElements.md)\n    * [containsMatchingElement(node)](/docs/api/ShallowWrapper/containsMatchingElement.md)\n    * [context([key])](/docs/api/ShallowWrapper/context.md)\n    * [debug()](/docs/api/ShallowWrapper/debug.md)\n    * [dive()](/docs/api/ShallowWrapper/dive.md)\n    * [equals(node)](/docs/api/ShallowWrapper/equals.md)\n    * [every(selector)](/docs/api/ShallowWrapper/every.md)\n    * [everyWhere(predicate)](/docs/api/ShallowWrapper/everyWhere.md)\n    * [exists([selector])](/docs/api/ShallowWrapper/exists.md)\n    * [filter(selector)](/docs/api/ShallowWrapper/filter.md)\n    * [filterWhere(predicate)](/docs/api/ShallowWrapper/filterWhere.md)\n    * [find(selector)](/docs/api/ShallowWrapper/find.md)\n    * [findWhere(predicate)](/docs/api/ShallowWrapper/findWhere.md)\n    * [first()](/docs/api/ShallowWrapper/first.md)\n    * [forEach(fn)](/docs/api/ShallowWrapper/forEach.md)\n    * [get(index)](/docs/api/ShallowWrapper/get.md)\n    * [getWrappingComponent()](/docs/api/ShallowWrapper/getWrappingComponent.md)\n    * [getElement(index)](/docs/api/ShallowWrapper/getElement.md)\n    * [getElements(index)](/docs/api/ShallowWrapper/getElements.md)\n    * [hasClass(className)](/docs/api/ShallowWrapper/hasClass.md)\n    * [hostNodes()](/docs/api/ShallowWrapper/hostNodes.md)\n    * [html()](/docs/api/ShallowWrapper/html.md)\n    * [instance()](/docs/api/ShallowWrapper/instance.md)\n    * [invoke(propName)](/docs/api/ShallowWrapper/invoke.md)\n    * [is(selector)](/docs/api/ShallowWrapper/is.md)\n    * [isEmpty()](/docs/api/ShallowWrapper/isEmpty.md)\n    * [isEmptyRender()](/docs/api/ShallowWrapper/isEmptyRender.md)\n    * [key()](/docs/api/ShallowWrapper/key.md)\n    * [last()](/docs/api/ShallowWrapper/last.md)\n    * [map(fn)](/docs/api/ShallowWrapper/map.md)\n    * [matchesElement(node)](/docs/api/ShallowWrapper/matchesElement.md)\n    * [name()](/docs/api/ShallowWrapper/name.md)\n    * [not(selector)](/docs/api/ShallowWrapper/not.md)\n    * [parent()](/docs/api/ShallowWrapper/parent.md)\n    * [parents()](/docs/api/ShallowWrapper/parents.md)\n    * [prop(key)](/docs/api/ShallowWrapper/prop.md)\n    * [props()](/docs/api/ShallowWrapper/props.md)\n    * [reduce(fn[, initialValue])](/docs/api/ShallowWrapper/reduce.md)\n    * [reduceRight(fn[, initialValue])](/docs/api/ShallowWrapper/reduceRight.md)\n    * [render()](/docs/api/ShallowWrapper/render.md)\n    * [renderProp(key)](/docs/api/ShallowWrapper/renderProp.md)\n    * [setContext(context)](/docs/api/ShallowWrapper/setContext.md)\n    * [setProps(nextProps)](/docs/api/ShallowWrapper/setProps.md)\n    * [setState(nextState[, callback])](/docs/api/ShallowWrapper/setState.md)\n    * [shallow([options])](/docs/api/ShallowWrapper/shallow.md)\n    * [simulate(event[, data])](/docs/api/ShallowWrapper/simulate.md)\n    * [simulateError(error)](/docs/api/ShallowWrapper/simulateError.md)\n    * [slice([begin[, end]])](/docs/api/ShallowWrapper/slice.md)\n    * [some(selector)](/docs/api/ShallowWrapper/some.md)\n    * [someWhere(predicate)](/docs/api/ShallowWrapper/someWhere.md)\n    * [state([key])](/docs/api/ShallowWrapper/state.md)\n    * [tap(intercepter)](/docs/api/ShallowWrapper/tap.md)\n    * [text()](/docs/api/ShallowWrapper/text.md)\n    * [type()](/docs/api/ShallowWrapper/type.md)\n    * [unmount()](/docs/api/ShallowWrapper/unmount.md)\n    * [update()](/docs/api/ShallowWrapper/update.md)\n  * [Full DOM Rendering](/docs/api/mount.md)\n    * [at(index)](/docs/api/ReactWrapper/at.md)\n    * [childAt()](/docs/api/ReactWrapper/childAt.md)\n    * [children()](/docs/api/ReactWrapper/children.md)\n    * [contains(nodeOrNodes)](/docs/api/ReactWrapper/contains.md)\n    * [containsAllMatchingElements(nodes)](/docs/api/ReactWrapper/containsAllMatchingElements.md)\n    * [containsAnyMatchingElements(nodes)](/docs/api/ReactWrapper/containsAnyMatchingElements.md)\n    * [containsMatchingElement(node)](/docs/api/ReactWrapper/containsMatchingElement.md)\n    * [closest(selector)](/docs/api/ReactWrapper/closest.md)\n    * [context([key])](/docs/api/ReactWrapper/context.md)\n    * [debug()](/docs/api/ReactWrapper/debug.md)\n    * [detach()](/docs/api/ReactWrapper/detach.md)\n    * [equals(node)](/docs/api/ReactWrapper/equals.md)\n    * [every(selector)](/docs/api/ReactWrapper/every.md)\n    * [everyWhere(predicate)](/docs/api/ReactWrapper/everyWhere.md)\n    * [exists([selector])](/docs/api/ReactWrapper/exists.md)\n    * [filter(selector)](/docs/api/ReactWrapper/filter.md)\n    * [filterWhere(predicate)](/docs/api/ReactWrapper/filterWhere.md)\n    * [find(selector)](/docs/api/ReactWrapper/find.md)\n    * [findWhere(predicate)](/docs/api/ReactWrapper/findWhere.md)\n    * [first()](/docs/api/ReactWrapper/first.md)\n    * [forEach(fn)](/docs/api/ReactWrapper/forEach.md)\n    * [get(index)](/docs/api/ReactWrapper/get.md)\n    * [getDOMNode()](/docs/api/ReactWrapper/getDOMNode.md)\n    * [getWrappingComponent()](/docs/api/ReactWrapper/getWrappingComponent.md)\n    * [hasClass(className)](/docs/api/ReactWrapper/hasClass.md)\n    * [hostNodes()](/docs/api/ReactWrapper/hostNodes.md)\n    * [html()](/docs/api/ReactWrapper/html.md)\n    * [instance()](/docs/api/ReactWrapper/instance.md)\n    * [invoke(propName)](/docs/api/ReactWrapper/invoke.md)\n    * [is(selector)](/docs/api/ReactWrapper/is.md)\n    * [isEmpty()](/docs/api/ReactWrapper/isEmpty.md)\n    * [isEmptyRender()](/docs/api/ReactWrapper/isEmptyRender.md)\n    * [key()](/docs/api/ReactWrapper/key.md)\n    * [last()](/docs/api/ReactWrapper/last.md)\n    * [map(fn)](/docs/api/ReactWrapper/map.md)\n    * [matchesElement(node)](/docs/api/ReactWrapper/matchesElement.md)\n    * [mount()](/docs/api/ReactWrapper/mount.md)\n    * [name()](/docs/api/ReactWrapper/name.md)\n    * [not(selector)](/docs/api/ReactWrapper/not.md)\n    * [parent()](/docs/api/ReactWrapper/parent.md)\n    * [parents()](/docs/api/ReactWrapper/parents.md)\n    * [prop(key)](/docs/api/ReactWrapper/prop.md)\n    * [props()](/docs/api/ReactWrapper/props.md)\n    * [reduce(fn[, initialValue])](/docs/api/ReactWrapper/reduce.md)\n    * [reduceRight(fn[, initialValue])](/docs/api/ReactWrapper/reduceRight.md)\n    * [ref(refName)](/docs/api/ReactWrapper/ref.md)\n    * [render()](/docs/api/ReactWrapper/render.md)\n    * [renderProp(key)](/docs/api/ReactWrapper/renderProp.md)\n    * [setContext(context)](/docs/api/ReactWrapper/setContext.md)\n    * [setProps(nextProps[, callback])](/docs/api/ReactWrapper/setProps.md)\n    * [setState(nextState[, callback])](/docs/api/ReactWrapper/setState.md)\n    * [simulate(event[, data])](/docs/api/ReactWrapper/simulate.md)\n    * [simulateError(error)](/docs/api/ReactWrapper/simulateError.md)\n    * [slice([begin[, end]])](/docs/api/ReactWrapper/slice.md)\n    * [some(selector)](/docs/api/ReactWrapper/some.md)\n    * [someWhere(predicate)](/docs/api/ReactWrapper/someWhere.md)\n    * [state([key])](/docs/api/ReactWrapper/state.md)\n    * [tap(intercepter)](/docs/api/ReactWrapper/tap.md)\n    * [text()](/docs/api/ReactWrapper/text.md)\n    * [type()](/docs/api/ReactWrapper/type.md)\n    * [unmount()](/docs/api/ReactWrapper/unmount.md)\n    * [update()](/docs/api/ReactWrapper/update.md)\n  * [Static Rendering](/docs/api/render.md)\n  * [Selectors](/docs/api/selector.md)\n* [Change Log](/CHANGELOG.md)\n* [Future](/docs/future.md)\n* [Contributing Guide](/CONTRIBUTING.md)\n"
  },
  {
    "path": "book.json",
    "content": "{\n  \"gitbook\": \"3.2.2\",\n  \"title\": \"Enzyme\",\n  \"description\": \"React Testing\",\n  \"plugins\": [\n    \"edit-link\",\n    \"github\",\n    \"-search\",\n    \"codeblock-disable-glossary\",\n    \"collapsible-menu\",\n    \"anchors\"\n  ],\n  \"pluginsConfig\": {\n    \"edit-link\": {\n      \"base\": \"https://github.com/enzymejs/enzyme/tree/master\",\n      \"label\": \"Edit This Page\"\n    },\n    \"github\": {\n      \"url\": \"https://github.com/enzymejs/enzyme/\"\n    }\n  }\n}\n"
  },
  {
    "path": "docs/GLOSSARY.md",
    "content": "# selector\n\nA Selector in enzyme is similar to a CSS selector, but can be a number of other things as well in\norder to easily specify a criteria by which you want to find nodes in an enzyme wrapper. See the\n[Selector page](/docs/api/selector.md) for more information.\n\n# wrapper\n\nA wrapper refers to the enzyme wrapper class that provides the API.\n\n\n# predicate\n\nA function that returns true or false\n"
  },
  {
    "path": "docs/api/README.md",
    "content": "# API Reference\n\n\n\n### [Shallow Rendering](shallow.md)\n\n```jsx\nimport { shallow } from 'enzyme';\n\nconst wrapper = shallow(<MyComponent />);\n// ...\n```\n\n\n### [Full Rendering](mount.md)\n\n```jsx\nimport { mount } from 'enzyme';\n\nconst wrapper = mount(<MyComponent />);\n// ...\n```\n\n\n### [Static Rendering](render.md)\n\n```jsx\nimport { render } from 'enzyme';\n\nconst wrapper = render(<MyComponent />);\n// ...\n```\n"
  },
  {
    "path": "docs/api/ReactWrapper/at.md",
    "content": "# `.at(index) => ReactWrapper`\n\nReturns a wrapper around the node at a given index of the current wrapper.\n\n\n#### Arguments\n\n1. `index` (`Number`): A zero-based integer indicating which node to retrieve.\n\n\n\n#### Returns\n\n`ReactWrapper`: A new wrapper that wraps the retrieved node.\n\n\n\n#### Examples\n\n```jsx\nconst wrapper = mount(<MyComponent />);\nexpect(wrapper.find(Foo).at(0).props().foo).to.equal('bar');\n```\n\n\n\n#### Related Methods\n\n- [`.get(index) => ReactElement`](get.md) - same, but returns the React node itself, with no wrapper.\n- [`.first() => ReactWrapper`](first.md) - same as at(0)\n- [`.last() => ReactWrapper`](last.md)\n"
  },
  {
    "path": "docs/api/ReactWrapper/childAt.md",
    "content": "# `.childAt(index) => ReactWrapper`\n\nReturns a new wrapper with child at the specified index.\n\n#### Arguments\n\n1. `index` (`number`): A zero-based integer indicating which node to retrieve.\n\n\n#### Returns\n\n`ReactWrapper`: A new wrapper that wraps the resulting node.\n\n\n\n#### Examples\n\n```jsx\nconst wrapper = mount(<ToDoList items={items} />);\nexpect(wrapper.find('ul').childAt(0).type()).to.equal('li');\n```\n\n#### Related Methods\n\n- [`.parents([selector]) => ReactWrapper`](parents.md)\n- [`.parent() => ReactWrapper`](parent.md)\n- [`.closest(selector) => ReactWrapper`](closest.md)\n- [`.children([selector]) => ReactWrapper`](children.md)\n"
  },
  {
    "path": "docs/api/ReactWrapper/children.md",
    "content": "# `.children([selector]) => ReactWrapper`\n\nReturns a new wrapper with all of the children of the node(s) in the current wrapper. Optionally, a\nselector can be provided and it will filter the children by this selector\n\n\n#### Arguments\n\n1. `selector` ([`EnzymeSelector`](../selector.md) [optional]): A selector to filter the children by.\n\n\n#### Returns\n\n`ReactWrapper`: A new wrapper that wraps the resulting nodes.\n\n\n\n#### Examples\n\n```jsx\nconst wrapper = mount(<ToDoList items={items} />);\nexpect(wrapper.find('ul').children()).to.have.lengthOf(items.length);\n```\n\n#### Related Methods\n\n- [`.parents([selector]) => ReactWrapper`](parents.md)\n- [`.parent() => ReactWrapper`](parent.md)\n- [`.closest(selector) => ReactWrapper`](closest.md)\n"
  },
  {
    "path": "docs/api/ReactWrapper/closest.md",
    "content": "# `.closest(selector) => ReactWrapper`\n\nReturns a wrapper of the first element that matches the selector by traversing up through the\nwrapped node's ancestors in the tree, starting with itself. It must be a single-node wrapper.\n\n#### Arguments\n\n1. `selector` ([`EnzymeSelector`](../selector.md)): The selector to match.\n\n#### Returns\n\n`ReactWrapper`: A new wrapper that wraps the resulting node.\n\n\n\n#### Examples\n\n```jsx\nconst wrapper = mount(<MyComponent />);\nexpect(wrapper.find(Foo).closest('.bar')).to.have.lengthOf(1);\n```\n\n#### Related Methods\n\n- [`.children([selector]) => ReactWrapper`](children.md)\n- [`.parent() => ReactWrapper`](parent.md)\n- [`.parents([selector]) => ReactWrapper`](parents.md)\n"
  },
  {
    "path": "docs/api/ReactWrapper/contains.md",
    "content": "# `.contains(nodeOrNodes) => Boolean`\n\nReturns whether or not all given react elements match elements in the render tree.\nIt will determine if an element in the wrapper matches the expected element by checking if the expected element has the same props as the wrapper's element and share the same values.\n\n\n#### Arguments\n\n1. `nodeOrNodes` (`ReactElement|Array<ReactElement>`): The node or array of nodes whose presence you are detecting in the current instance's\nrender tree.\n\n\n\n#### Returns\n\n`Boolean`: whether or not the current wrapper has nodes anywhere in its render tree that match\nthe ones passed in.\n\n\n\n#### Example\n\n\n```jsx\nconst wrapper = mount((\n  <div>\n    <div data-foo=\"foo\" data-bar=\"bar\">Hello</div>\n  </div>\n));\n\nexpect(wrapper.contains(<div data-foo=\"foo\" data-bar=\"bar\">Hello</div>)).to.equal(true);\n\nexpect(wrapper.contains(<div data-foo=\"foo\">Hello</div>)).to.equal(false);\nexpect(wrapper.contains(<div data-foo=\"foo\" data-bar=\"bar\" data-baz=\"baz\">Hello</div>)).to.equal(false);\nexpect(wrapper.contains(<div data-foo=\"foo\" data-bar=\"Hello\">Hello</div>)).to.equal(false);\nexpect(wrapper.contains(<div data-foo=\"foo\" data-bar=\"bar\" />)).to.equal(false);\n```\n\n```jsx\nconst wrapper = mount((\n  <div>\n    <span>Hello</span>\n    <div>Goodbye</div>\n    <span>Again</span>\n  </div>\n));\n\nexpect(wrapper.contains([\n  <span>Hello</span>,\n  <div>Goodbye</div>,\n])).to.equal(true);\n\nexpect(wrapper.contains([\n  <span>Hello</span>,\n  <div>World</div>,\n])).to.equal(false);\n```\n\n\n#### Common Gotchas\n\n- `.contains()` expects a ReactElement, not a selector (like many other methods). Make sure that\nwhen you are calling it you are calling it with a ReactElement or a JSX expression.\n- Keep in mind that this method determines equality based on the equality of the node's children as\nwell.\n- Every attribute of the wrapped element must be matched by the element you're checking. To permit (and ignore) additional attributes on the wrapped element, use containsMatchingElement() instead.\n"
  },
  {
    "path": "docs/api/ReactWrapper/containsAllMatchingElements.md",
    "content": "# `.containsAllMatchingElements(patternNodes) => Boolean`\n\nReturns whether or not all of the given react elements in `patternNodes` match an element in the wrapper's render tree. Every single element of `patternNodes` must be matched one or more times. Matching follows the rules for `containsMatchingElement`.\n\n\n#### Arguments\n\n1. `patternNodes` (`Array<ReactElement>`): The array of nodes whose presence you are detecting in the current instance's\nrender tree.\n\n\n#### Returns\n\n`Boolean`: whether or not the current wrapper has nodes anywhere in its render tree that looks\nlike the nodes passed in.\n\n\n#### Example\n\n\n```jsx\nconst style = { fontSize: 13 };\nconst wrapper = mount((\n  <div>\n    <span className=\"foo\">Hello</span>\n    <div style={style}>Goodbye</div>\n    <span>Again</span>\n  </div>\n));\n\nexpect(wrapper.containsAllMatchingElements([\n  <span>Hello</span>,\n  <div>Goodbye</div>,\n])).to.equal(true);\n```\n\n\n#### Common Gotchas\n\n- `.containsAllMatchingElements()` expects an array of ReactElement, not a selector (like many other methods). Make sure that\nwhen you are calling it you are calling it with an array of ReactElement or a JSX expression.\n- Keep in mind that this method determines matching based on the matching of the node's children as\nwell.\n\n\n#### Related Methods\n\n- [`.matchesElement() => ReactWrapper`](matchesElement.md) - rules for matching each node\n- [`.containsMatchingElement() => ReactWrapper`](containsMatchingElement.md) - rules for matching whole wrapper\n- [`.containsAnyMatchingElements() => ReactWrapper`](containsAnyMatchingElements.md) - must match at least one in patternNodes\n"
  },
  {
    "path": "docs/api/ReactWrapper/containsAnyMatchingElements.md",
    "content": "# `.containsAnyMatchingElements(patternNodes) => Boolean`\n\nReturns whether or not at least one of the given react elements in `patternNodes` matches an element in the wrapper's render tree. One or more elements of `patternNodes` must be matched one or more times. Matching follows the rules for `containsMatchingElement`.\n\n\n#### Arguments\n\n1. `patternNodes` (`Array<ReactElement>`): The array of nodes whose presence you are detecting in the current instance's\nrender tree.\n\n\n#### Returns\n\n`Boolean`: whether or not the current wrapper has a node anywhere in its render tree that looks\nlike one of the array passed in.\n\n\n#### Example\n\n\n```jsx\nconst style = { fontSize: 13 };\nconst wrapper = mount((\n  <div>\n    <span className=\"foo\">Hello</span>\n    <div style={style}>Goodbye</div>\n    <span>Again</span>\n  </div>\n));\n\nexpect(wrapper.containsAnyMatchingElements([\n  <span>Bonjour</span>,\n  <div>Goodbye</div>,\n])).to.equal(true);\n```\n\n\n#### Common Gotchas\n\n- `.containsAnyMatchingElements()` expects an array of ReactElement, not a selector (like many other methods). Make sure that\nwhen you are calling it you are calling it with an array ReactElement or a JSX expression.\n- Keep in mind that this method determines equality based on the equality of the node's children as\nwell.\n\n\n#### Related Methods\n\n- [`.matchesElement() => ReactWrapper`](matchesElement.md) - rules for matching each node\n- [`.containsMatchingElement() => ReactWrapper`](containsMatchingElement.md) - rules for matching whole wrapper\n- [`.containsAllMatchingElements() => ReactWrapper`](containsAllMatchingElements.md) - must match all nodes in patternNodes\n"
  },
  {
    "path": "docs/api/ReactWrapper/containsMatchingElement.md",
    "content": "# `.containsMatchingElement(patternNode) => Boolean`\n\nReturns whether or not a `patternNode` react element matches any element in the render tree.\n* the matches can happen anywhere in the wrapper's contents\n* the wrapper can contain more than one node; all are searched\n\nOtherwise, the match follows the same rules as `matchesElement`.\n\n\n#### Arguments\n\n1. `patternNode` (`ReactElement`): The node whose presence you are detecting in the current instance's\nrender tree.\n\n\n#### Returns\n\n`Boolean`: whether or not the current wrapper has a node anywhere in its render tree that matches\nthe one passed in.\n\n\n\n#### Example\n\n\n```jsx\nconst wrapper = mount((\n  <div>\n    <div data-foo=\"foo\" data-bar=\"bar\">Hello</div>\n  </div>\n));\n\nexpect(wrapper.containsMatchingElement(<div data-foo=\"foo\" data-bar=\"bar\">Hello</div>)).to.equal(true);\nexpect(wrapper.containsMatchingElement(<div data-foo=\"foo\">Hello</div>)).to.equal(true);\n\nexpect(wrapper.containsMatchingElement(<div data-foo=\"foo\" data-bar=\"bar\" data-baz=\"baz\">Hello</div>)).to.equal(false);\nexpect(wrapper.containsMatchingElement(<div data-foo=\"foo\" data-bar=\"Hello\">Hello</div>)).to.equal(false);\nexpect(wrapper.containsMatchingElement(<div data-foo=\"foo\" data-bar=\"bar\" />)).to.equal(false);\n```\n\n#### Common Gotchas\n\n- `.containsMatchingElement()` expects a ReactElement, not a selector (like many other methods). Make sure that\nwhen you are calling it you are calling it with a ReactElement or a JSX expression.\n- Keep in mind that this method determines equality based on the equality of the node's children as\nwell.\n\n\n#### Related Methods\n\n- [`.containsAllMatchingElements() => ReactWrapper`](containsAllMatchingElements.md) - must match all nodes in patternNodes\n- [`.containsAnyMatchingElements() => ReactWrapper`](containsAnyMatchingElements.md) - must match at least one in patternNodes\n"
  },
  {
    "path": "docs/api/ReactWrapper/context.md",
    "content": "# `.context([key]) => Any`\n\nReturns the context hash for the root node of the wrapper. Optionally pass in a prop name and it\nwill return just that value.\n\n\n#### Arguments\n\n1. `key` (`String` [optional]): If provided, the return value will be the `this.context[key]` of the\nroot component instance.\n\n\n\n#### Example\n\n\n```jsx\nconst wrapper = mount(\n  <MyComponent />,\n  { context: { foo: 10 } },\n);\n\nexpect(wrapper.context().foo).to.equal(10);\nexpect(wrapper.context('foo')).to.equal(10);\n```\n\n\n#### Related Methods\n\n- [`.state([key]) => Any`](state.md)\n- [`.props() => Object`](props.md)\n- [`.prop(key) => Any`](prop.md)\n"
  },
  {
    "path": "docs/api/ReactWrapper/debug.md",
    "content": "# `.debug([options]) => String`\n\nReturns an HTML-like string of the wrapper for debugging purposes. Useful to print out to the\nconsole when tests are not passing when you expect them to.\n\n\n#### Arguments\n\n`options` (`Object` [optional]):\n- `options.ignoreProps`: (`Boolean` [optional]): Whether props should be omitted in the resulting string. Props are included by default.\n- `options.verbose`: (`Boolean` [optional]): Whether arrays and objects passed as props should be verbosely printed.\n\n#### Returns\n\n`String`: The resulting string.\n\n\n\n#### Examples\n\nSay we have the following components:\n```jsx\nfunction Foo() {\n  return (\n    <div className=\"foo\">\n      <span>Foo</span>\n    </div>\n  );\n}\n\nfunction Bar() {\n  return (\n    <div className=\"bar\">\n      <span>Non-Foo</span>\n      <Foo baz=\"bax\" object={{ a: 1, b: 2 }} />\n    </div>\n  );\n}\n```\n\nIn this case, running:\n```jsx\nconsole.log(mount(<Bar id=\"2\" />).debug());\n```\n\nWould output the following to the console:\n<!-- eslint-disable -->\n```text\n<Bar id=\"2\">\n  <div className=\"bar\">\n    <span>\n      Non-Foo\n    </span>\n    <Foo baz=\"bax\" object={{...}}>\n      <div className=\"foo\">\n        <span>\n          Foo\n        </span>\n      </div>\n    </Foo>\n  </div>\n</Bar>\n```\n\nLikewise, running:\n\n```jsx\nconsole.log(mount(<Bar id=\"2\" />).find(Foo).debug());\n```\nWould output the following to the console:\n<!-- eslint-disable -->\n```text\n<Foo baz=\"bax\">\n  <div className=\"foo\">\n    <span>\n      Foo\n    </span>\n  </div>\n</Foo>\n```\nand:\n```jsx\nconsole.log(mount(<Bar id=\"2\" />).find(Foo).debug({ ignoreProps: true }));\n```\nWould output the following to the console:\n<!-- eslint-disable -->\n```text\n<Foo>\n  <div>\n    <span>\n      Foo\n    </span>\n  </div>\n</Foo>\n```\n\nand:\n```jsx\nconsole.log(mount(<Bar id=\"2\" />).find(Foo).debug({ verbose: true }));\n```\nWould output the following to the console:\n<!-- eslint-disable -->\n```text\n<Foo baz=\"bax\" object={{ a: 1, b: 2 }}>\n  <div className=\"foo\">\n    <span>\n      Foo\n    </span>\n  </div>\n</Foo>\n```\n"
  },
  {
    "path": "docs/api/ReactWrapper/detach.md",
    "content": "# `.detach() => void`\n\nDetaches the react tree from the DOM. Runs `ReactDOM.unmountComponentAtNode()` under the hood.\n\nThis method will most commonly be used as a \"cleanup\" method if you decide to use the\n`attachTo` or `hydrateIn` option in `mount(node, options)`.\n\nThe method is intentionally not \"fluent\" (in that it doesn't return `this`) because you should\nnot be doing anything with this wrapper after this method is called.\n\nUsing `attachTo`/`hydrateIn` is not generally recommended unless it is absolutely necessary to test\nsomething. It is your responsibility to clean up after yourself at the end of the test if you do\ndecide to use it, though.\n\n\n#### Examples\n\n\nWith the `attachTo` option, you can mount components to attached DOM elements:\n```jsx\n// render a component directly into document.body\nconst wrapper = mount(<Bar />, { attachTo: document.body });\n\n// Or, with the `hydrateIn` option, you can mount components on top of existing DOM elements:\n// hydrate a component directly onto document.body\nconst hydratedWrapper = mount(<Bar />, { hydrateIn: document.body });\n\n// we can see that the component is rendered into the document\nexpect(wrapper.find('.in-bar')).to.have.lengthOf(1);\nexpect(document.body.childNodes).to.have.lengthOf(1);\n\n// detach it to clean up after yourself\nwrapper.detach();\n\n// now we can see that\nexpect(document.body.childNodes).to.have.lengthOf(0);\n```\n\nSimilarly, if you want to create some one-off elements for your test to mount into:\n```jsx\n// create a div in the document to mount into\nconst div = global.document.createElement('div');\nglobal.document.body.appendChild(div);\n\n// div is empty. body has the div attached.\nexpect(document.body.childNodes).to.have.lengthOf(1);\nexpect(div.childNodes).to.have.lengthOf(0);\n\n// mount a component passing div into the `attachTo` option\nconst wrapper = mount(<Foo />, { attachTo: div });\n// or, mount a component passing div into the `hydrateIn` option\nconst hydratedWrapper = mount(<Foo />, { hydrateIn: div });\n\n// we can see now the component is rendered into the document\nexpect(wrapper.find('.in-foo')).to.have.lengthOf(1);\nexpect(document.body.childNodes).to.have.lengthOf(1);\nexpect(div.childNodes).to.have.lengthOf(1);\n\n// call detach to clean up\nwrapper.detach();\n\n// div is now empty, but still attached to the document\nexpect(document.body.childNodes).to.have.lengthOf(1);\nexpect(div.childNodes).to.have.lengthOf(0);\n\n// remove div if you want\nglobal.document.body.removeChild(div);\n\nexpect(document.body.childNodes).to.have.lengthOf(0);\nexpect(div.childNodes).to.have.lengthOf(0);\n```\n"
  },
  {
    "path": "docs/api/ReactWrapper/equals.md",
    "content": "# `.equals(node) => Boolean`\n\nReturns whether or not the current wrapper root node render tree looks like the one passed in.\n\n\n#### Arguments\n\n1. `node` (`ReactElement`): The node whose presence you are detecting in the current instance's\nrender tree.\n\n\n\n#### Returns\n\n`Boolean`: whether or not the current wrapper has a node anywhere in it's render tree that looks\nlike the one passed in.\n\n\n\n#### Example\n\n\n```jsx\nfunction MyComponent() {\n  return <div className=\"foo bar\" />;\n}\n\nconst wrapper = mount(<MyComponent />).childAt(0);\nexpect(wrapper.equals(<div className=\"foo bar\" />)).to.equal(true);\n```\n\n\n#### Common Gotchas\n\n- `.equals()` expects a ReactElement, not a selector (like many other methods). Make sure that\nwhen you are calling it you are calling it with a ReactElement or a JSX expression.\n- Keep in mind that this method determines equality based on the equality of the node's children as\nwell.\n- Following React's behavior, `.equals()` ignores properties whose values are `undefined`.\n"
  },
  {
    "path": "docs/api/ReactWrapper/every.md",
    "content": "# `.every(selector) => Boolean`\n\nReturns whether or not all of the nodes in the wrapper match the provided selector.\n\n\n#### Arguments\n\n1. `selector` ([`EnzymeSelector`](../selector.md)): The selector to match.\n\n\n\n#### Returns\n\n`Boolean`: True if every node in the current wrapper matched the provided selector.\n\n\n\n#### Examples\n\n```jsx\nconst wrapper = mount((\n  <div>\n    <div className=\"foo qoo\" />\n    <div className=\"foo boo\" />\n    <div className=\"foo hoo\" />\n  </div>\n));\nexpect(wrapper.find('.foo').every('.foo')).to.equal(true);\nexpect(wrapper.find('.foo').every('.qoo')).to.equal(false);\nexpect(wrapper.find('.foo').every('.bar')).to.equal(false);\n```\n\n#### Related Methods\n\n- [`.someWhere(predicate) => Boolean`](someWhere.md)\n- [`.everyWhere(predicate) => Boolean`](everyWhere.md)\n"
  },
  {
    "path": "docs/api/ReactWrapper/everyWhere.md",
    "content": "# `.everyWhere(fn) => Boolean`\n\nReturns whether or not all of the nodes in the wrapper pass the provided predicate function.\n\n\n#### Arguments\n\n1. `predicate` (`ReactWrapper => Boolean`): A predicate function to match the nodes.\n\n\n\n#### Returns\n\n`Boolean`: True if every node in the current wrapper passed the predicate function.\n\n\n\n#### Example\n\n```jsx\nconst wrapper = mount((\n  <div>\n    <div className=\"foo qoo\" />\n    <div className=\"foo boo\" />\n    <div className=\"foo hoo\" />\n  </div>\n));\nexpect(wrapper.find('.foo').everyWhere((n) => n.hasClass('foo'))).to.equal(true);\nexpect(wrapper.find('.foo').everyWhere((n) => n.hasClass('qoo'))).to.equal(false);\nexpect(wrapper.find('.foo').everyWhere((n) => n.hasClass('bar'))).to.equal(false);\n```\n\n\n#### Related Methods\n\n- [`.some(selector) => Boolean`](some.md)\n- [`.every(selector) => Boolean`](every.md)\n\n"
  },
  {
    "path": "docs/api/ReactWrapper/exists.md",
    "content": "# `.exists([selector]) => Boolean`\n\nReturns whether or not any nodes exist in the wrapper. Or, if a selector is passed in, whether that selector has any matches in the wrapper.\n\n\n\n#### Arguments\n\n1. `selector` ([`EnzymeSelector`](../selector.md) [optional]): The selector to check existence for.\n\n\n\n#### Returns\n\n`Boolean`: whether or not any nodes are on the list, or the selector had any matches.\n\n\n\n#### Example\n\n\n```jsx\nconst wrapper = mount(<div className=\"some-class\" />);\nexpect(wrapper.exists('.some-class')).to.equal(true);\nexpect(wrapper.find('.other-class').exists()).to.equal(false);\n```\n"
  },
  {
    "path": "docs/api/ReactWrapper/filter.md",
    "content": "# `.filter(selector) => ReactWrapper`\n\nReturns a new wrapper with only the nodes of the current wrapper that match the provided selector.\n\n\n#### Arguments\n\n1. `selector` ([`EnzymeSelector`](../selector.md)): The selector to match.\n\n\n\n#### Returns\n\n`ReactWrapper`: A new wrapper that wraps the filtered nodes.\n\n\n\n#### Examples\n\n```jsx\nconst wrapper = mount(<MyComponent />);\nexpect(wrapper.find('.foo').filter('.bar')).to.have.lengthOf(1);\n```\n\n#### Related Methods\n\n- [`.filterWhere(predicate) => ReactWrapper`](filterWhere.md)\n"
  },
  {
    "path": "docs/api/ReactWrapper/filterWhere.md",
    "content": "# `.filterWhere(fn) => ReactWrapper`\n\nReturns a new wrapper with only the nodes of the current wrapper that, when passed into the\nprovided predicate function, return true.\n\n\n#### Arguments\n\n1. `predicate` (`ReactWrapper => Boolean`): A predicate function that is passed a wrapped node.\n\n\n\n#### Returns\n\n`ReactWrapper`: A new wrapper that wraps the filtered nodes.\n\n\n\n#### Example\n\n```jsx\nconst wrapper = mount(<MyComponent />);\nconst complexComponents = wrapper.find('.foo').filterWhere((n) => typeof n.type() !== 'string');\nexpect(complexComponents).to.have.lengthOf(4);\n```\n\n\n#### Related Methods\n\n- [`.filter(selector) => ReactWrapper`](filter.md)\n"
  },
  {
    "path": "docs/api/ReactWrapper/find.md",
    "content": "# `.find(selector) => ReactWrapper`\n\nFinds every node in the render tree of the current wrapper that matches the provided selector.\n\n\n#### Arguments\n\n1. `selector` ([`EnzymeSelector`](../selector.md)): The selector to match.\n\n\n\n#### Returns\n\n`ReactWrapper`: A new wrapper that wraps the found nodes.\n\n\n\n#### Examples\n\nCSS Selectors:\n```jsx\nconst wrapper = mount(<MyComponent />);\nexpect(wrapper.find('.foo')).to.have.lengthOf(1);\nexpect(wrapper.find('.bar')).to.have.lengthOf(3);\n\n// compound selector\nexpect(wrapper.find('div.some-class')).to.have.lengthOf(3);\n\n// CSS id selector\nexpect(wrapper.find('#foo')).to.have.lengthOf(1);\n\n// property selector\nexpect(wrapper.find('[htmlFor=\"checkbox\"]')).to.have.lengthOf(1);\n```\n\nComponent Constructors:\n```jsx\nimport Foo from '../components/Foo';\n\nconst wrapper = mount(<MyComponent />);\nexpect(wrapper.find(Foo)).to.have.lengthOf(1);\n```\n\nComponent Display Name:\n```jsx\nconst wrapper = mount(<MyComponent />);\nexpect(wrapper.find('Foo')).to.have.lengthOf(1);\n```\n\nObject Property Selector:\n```jsx\nconst wrapper = mount(<MyComponent />);\nexpect(wrapper.find({ prop: 'value' })).to.have.lengthOf(1);\n```\n\n#### Related Methods\n\n- [`.findWhere(predicate) => ReactWrapper`](findWhere.md)\n"
  },
  {
    "path": "docs/api/ReactWrapper/findWhere.md",
    "content": "# `.findWhere(fn) => ReactWrapper`\n\nFinds every node in the render tree that returns true for the provided predicate function.\n\n\n#### Arguments\n\n1. `predicate` (`ReactWrapper => Boolean`): A predicate function called with the passed in wrapped\nnodes.\n\n\n\n#### Returns\n\n`ReactWrapper`: A new wrapper that wraps the found nodes.\n\n\n\n#### Example\n\n```jsx\nconst wrapper = mount(<MyComponent />);\nconst complexComponents = wrapper.findWhere((n) => typeof n.type() !== 'string');\nexpect(complexComponents).to.have.lengthOf(8);\n```\n\n\n#### Related Methods\n\n- [`.find(selector) => ReactWrapper`](find.md)\n"
  },
  {
    "path": "docs/api/ReactWrapper/first.md",
    "content": "# `.first() => ReactWrapper`\n\nReduce the set of matched nodes to the first in the set, just like `.at(0)`.\n\n\n#### Returns\n\n`ReactWrapper`: A new wrapper that wraps the first node in the set.\n\n\n#### Examples\n\n```jsx\nconst wrapper = mount(<MyComponent />);\nexpect(wrapper.find(Foo).first().props().foo).to.equal('bar');\n```\n\n\n#### Related Methods\n\n- [`.at(index) => ReactWrapper`](at.md) - retrieve a wrapper node at given index\n- [`.last() => ReactWrapper`](last.md)\n"
  },
  {
    "path": "docs/api/ReactWrapper/forEach.md",
    "content": "# `.forEach(fn) => Self`\n\nIterates through each node of the current wrapper and executes the provided function with a\nwrapper around the corresponding node passed in as the first argument.\n\n\n#### Arguments\n\n1. `fn` (`Function ( ReactWrapper node, Number index )`): A callback to be run for every node in the collection.\nShould expect a ReactWrapper as the first argument, and will be run with a context of the original\ninstance.\n\n\n\n#### Returns\n\n`ReactWrapper`: Returns itself.\n\n\n\n#### Example\n\n```jsx\nconst wrapper = mount((\n  <div>\n    <div className=\"foo bax\" />\n    <div className=\"foo bar\" />\n    <div className=\"foo baz\" />\n  </div>\n));\n\nwrapper.find('.foo').forEach((node) => {\n  expect(node.hasClass('foo')).to.equal(true);\n});\n```\n\n\n#### Related Methods\n\n- [`.map(fn) => ReactWrapper`](map.md)\n"
  },
  {
    "path": "docs/api/ReactWrapper/get.md",
    "content": "# `.get(index) => ReactElement`\n\nReturns the node at a given index of the current wrapper.\n\n\n#### Arguments\n\n1. `index` (`Number`): A zero-based integer indicating which node to retrieve.\n\n\n#### Returns\n\n`ReactElement`: The retrieved node.\n\n\n#### Examples\n\n```jsx\nconst wrapper = mount(<MyComponent />);\nexpect(wrapper.find(Foo).get(0).props.foo).to.equal('bar');\n```\n\n\n#### Related Methods\n\n- [`.at(index) => ReactWrapper`](at.md) - same, but returns the React node in a single-node wrapper.\n"
  },
  {
    "path": "docs/api/ReactWrapper/getDOMNode.md",
    "content": "# `.getDOMNode() => DOMComponent`\n\nReturns the outer most DOMComponent of the current wrapper.\n\nNotes:\n- can only be called on a wrapper of a single node.\n- will raise if called on a wrapper of a stateless functional component.\n\n\n#### Returns\n\n`DOMComponent`: The retrieved DOM component.\n\n\n\n#### Examples\n\n```jsx\nconst wrapper = mount(<MyComponent />);\nexpect(wrapper.getDOMNode()).to.have.property('className');\n```\n"
  },
  {
    "path": "docs/api/ReactWrapper/getElement.md",
    "content": "# `.getElement() => ReactElement`\n\nReturns the wrapped ReactElement.\n\nIf the current wrapper is wrapping the root component, returns the root component's latest render output.\n\n\n#### Returns\n\n`ReactElement`: The retrieved ReactElement.\n\n\n\n#### Examples\n\n```jsx\nconst element = (\n  <div>\n    <span />\n    <span />\n  </div>\n);\n\nfunction MyComponent() {\n  return element;\n}\n\nconst wrapper = mount(<MyComponent />);\nexpect(wrapper.getElement()).to.equal(element);\n```\n\n\n\n#### Related Methods\n\n- [`.getElements() => Array<ReactElement>`](getElements.md)\n"
  },
  {
    "path": "docs/api/ReactWrapper/getElements.md",
    "content": "# `.getElements() => Array<ReactElement>`\n\nReturns the wrapped ReactElements\n\nIf the current wrapper is wrapping the root component, returns the root component's latest render output wrapped in an array.\n\n\n#### Returns\n\n`Array<ReactElement>`: The retrieved ReactElements.\n\n\n\n#### Examples\n\n```jsx\nconst one = <span />;\nconst two = <span />;\n\nfunction Test() {\n  return (\n    <div>\n      {one}\n      {two}\n    </div>\n  );\n}\n\nconst wrapper = mount(<Test />);\nexpect(wrapper.find('span').getElements()).to.deep.equal([one, two]);\n```\n\n\n\n#### Related Methods\n\n- [`.getElement() => ReactElement`](getElement.md)\n"
  },
  {
    "path": "docs/api/ReactWrapper/getWrappingComponent.md",
    "content": "# `.getWrappingComponent() => ReactWrapper`\n\nIf a `wrappingComponent` was passed in `options`, this methods returns a `ReactWrapper` around the rendered `wrappingComponent`. This `ReactWrapper` can be used to update the `wrappingComponent`'s props, state, etc.\n\n\n#### Returns\n\n`ReactWrapper`: A `ReactWrapper` around the rendered `wrappingComponent`\n\n\n\n#### Examples\n\n```jsx\nimport { Provider } from 'react-redux';\nimport { Router } from 'react-router';\nimport store from './my/app/store';\nimport mockStore from './my/app/mockStore';\n\nfunction MyProvider(props) {\n  const { children, customStore } = props;\n\n  return (\n    <Provider store={customStore || store}>\n      <Router>\n        {children}\n      </Router>\n    </Provider>\n  );\n}\nMyProvider.propTypes = {\n  children: PropTypes.node,\n  customStore: PropTypes.shape({}),\n};\nMyProvider.defaultProps = {\n  children: null,\n  customStore: null,\n};\n\nconst wrapper = mount(<MyComponent />, {\n  wrappingComponent: MyProvider,\n});\nconst provider = wrapper.getWrappingComponent();\nprovider.setProps({ customStore: mockStore });\n```\n"
  },
  {
    "path": "docs/api/ReactWrapper/hasClass.md",
    "content": "# `.hasClass(className) => Boolean`\n\nReturns whether or not the wrapped node has a `className` prop including the passed in class name. It must be a single-node wrapper.\n\n\n#### Arguments\n\n1. `className` (`String` | `RegExp`): A single class name or a regex expression.\n\n\n#### Returns\n\n`Boolean`: whether or not the wrapped node has found the class name.\n\n\n#### Examples\n\n\n```jsx\nconst wrapper = mount(<MyComponent />);\nexpect(wrapper.find('.my-button').hasClass('disabled')).to.equal(true);\n```\n\n```jsx\n// Searching using RegExp works fine when classes were injected by a jss decorator\nconst wrapper = mount(<MyComponent />);\nexpect(wrapper.find('.my-button').hasClass(/(ComponentName)-(other)-(\\d+)/)).to.equal(true);\n```\n\n### Common Gotchas\n\n- `.hasClass()` expects a class name, NOT a CSS selector. `.hasClass('.foo')` should be\n`.hasClass('foo')`\n"
  },
  {
    "path": "docs/api/ReactWrapper/hostNodes.md",
    "content": "# `.hostNodes() => ReactWrapper`\n\nReturns a new wrapper with only host nodes.\nWhen using `react-dom`, host nodes are HTML elements rather than custom React components, e.g. `<div>` versus `<MyComponent>`.\n\n\n#### Returns\n\n`ReactWrapper`: A new wrapper that wraps the filtered nodes.\n\n\n#### Examples\n\nThe following code takes a wrapper with two nodes, one a `<MyComponent>` React component, and the other a `<span>`, and filters out the React component.\n\n```jsx\nconst wrapper = mount((\n  <div>\n    <MyComponent className=\"foo\" />\n    <span className=\"foo\" />\n  </div>\n));\nconst twoNodes = wrapper.find('.foo');\nexpect(twoNodes.hostNodes()).to.have.lengthOf(1);\n```\n"
  },
  {
    "path": "docs/api/ReactWrapper/html.md",
    "content": "# `.html() => String`\n\nReturns a string of the rendered HTML markup of the current render tree. See also [`.debug()`](debug.md)\n\nNote: can only be called on a wrapper of a single node.\n\n\n#### Returns\n\n`String`: The resulting HTML string\n\n\n\n#### Examples\n\n```jsx\nfunction Foo() {\n  return (<div className=\"in-foo\" />);\n}\n```\n\n```jsx\nfunction Bar() {\n  return (\n    <div className=\"in-bar\">\n      <Foo />\n    </div>\n  );\n}\n```\n\n```jsx\nconst wrapper = mount(<Bar />);\nexpect(wrapper.html()).to.equal('<div class=\"in-bar\"><div class=\"in-foo\"></div></div>');\nexpect(wrapper.find(Foo).html()).to.equal('<div class=\"in-foo\"></div>');\n```\n\n```jsx\nconst wrapper = mount(<div><b>important</b></div>);\nexpect(wrapper.html()).to.equal('<div><b>important</b></div>');\n```\n\n\n#### Related Methods\n\n[`.text() => String`](text.md)\n"
  },
  {
    "path": "docs/api/ReactWrapper/instance.md",
    "content": "# `.instance() => ReactComponent`\n\nReturns the single-node wrapper's node's underlying class instance; `this` in its methods. It must be a single-node wrapper.\n\nNOTE: can only be called on a wrapper instance that is also the root instance. With React `16` and above, `instance()` returns `null` for functional components, regardless of [hooks](https://reactjs.org/docs/hooks-intro.html) usage.\n\n#### Returns\n\n`ReactComponent|DOMComponent`: The retrieved instance.\n\n#### Example\n\n<!-- eslint react/prop-types: 0, react/prefer-stateless-function: 0 -->\n\n```jsx\nfunction SFC() {\n  return <div>MyFunction</div>;\n}\n\nclass Stateful extends React.Component {\n  render() {\n    return <div>MyClass</div>;\n  }\n}\n```\n\n#### React 16.x\n\n```jsx\ntest('wrapper instance is null', () => {\n  const wrapper = mount(<SFC />);\n  const instance = wrapper.instance();\n\n  expect(instance).to.equal(null);\n});\n\ntest('wrapper instance is not null', () => {\n  const wrapper = mount(<Stateful />);\n  const instance = wrapper.instance();\n\n  expect(instance).to.be.instanceOf(MyCStatefullass);\n});\n```\n\n#### React 15.x\n\n```jsx\ntest('wrapper instance is not null', () => {\n  const wrapper = mount(<SFC />);\n  const instance = wrapper.instance();\n\n  expect(instance).to.be.instanceOf(SFC);\n});\n\ntest('wrapper instance is not null', () => {\n  const wrapper = mount(<Stateful />);\n  const instance = wrapper.instance();\n\n  expect(instance).to.be.instanceOf(Stateful);\n});\n```\n"
  },
  {
    "path": "docs/api/ReactWrapper/invoke.md",
    "content": "# `.invoke(propName)(...args) => Any`\n\nInvokes a function prop.\nNote that in React 16.8+, `.invoke` will wrap your handler with [`ReactTestUtils.act`](https://reactjs.org/docs/test-utils.html#act) and call `.update()` automatically.\n\n#### Arguments\n\n1. `propName` (`String`): The function prop that is invoked\n2. `...args` (`Any` [optional]): Arguments that is passed to the prop function\n\n\n\n#### Returns\n\n`Any`: Returns the value from the prop function\n\n#### Example\n\n```jsx\nclass Foo extends React.Component {\n  loadData() {\n    return fetch();\n  }\n\n  render() {\n    return (\n      <div>\n        <button\n          type=\"button\"\n          onClick={() => this.loadData()}\n        >\n          Load more\n        </button>\n      </div>\n    );\n  }\n}\nconst wrapper = mount(<Foo />);\nwrapper.find('button').invoke('onClick')().then(() => {\n  // expect()\n});\n```\n"
  },
  {
    "path": "docs/api/ReactWrapper/is.md",
    "content": "# `.is(selector) => Boolean`\n\nReturns whether or not the single wrapped node matches the provided selector. It must be a single-node wrapper.\n\n\n#### Arguments\n\n1. `selector` ([`EnzymeSelector`](../selector.md)): The selector to match.\n\n\n#### Returns\n\n`Boolean`: whether or not the wrapped node matches the provided selector.\n\n\n#### Example\n\n\n```jsx\nconst wrapper = mount(<div className=\"some-class other-class\" />);\nexpect(wrapper.is('.some-class')).to.equal(true);\n```\n"
  },
  {
    "path": "docs/api/ReactWrapper/isEmpty.md",
    "content": "# `.isEmpty() => Boolean`\n**Deprecated**: Use [`.exists()`](exists.md) instead.\n\nReturns whether or not the wrapper is empty.\n\n\n#### Returns\n\n`Boolean`: whether or not the wrapper is empty.\n\n\n#### Example\n\n\n```jsx\nconst wrapper = mount(<div className=\"some-class\" />);\nexpect(wrapper.find('.other-class').isEmpty()).to.equal(true);\n```\n"
  },
  {
    "path": "docs/api/ReactWrapper/isEmptyRender.md",
    "content": "# `.isEmptyRender() => Boolean`\n\nReturns whether or not the wrapper would ultimately render only the allowed falsy values: `false` or `null`.\n\n#### Returns\n\n`Boolean`: whether the return is falsy\n\n#### Example\n\n```jsx\nfunction Foo() {\n  return null;\n}\n\nconst wrapper = mount(<Foo />);\nexpect(wrapper.isEmptyRender()).to.equal(true);\n```\n"
  },
  {
    "path": "docs/api/ReactWrapper/key.md",
    "content": "# `.key() => String`\n\nReturns the key value for the node of the current wrapper. It must be a single-node wrapper.\n\n#### Example\n\n\n```jsx\nconst wrapper = mount((\n  <ul>\n    {['foo', 'bar'].map((s) => <li key={s}>{s}</li>)}\n  </ul>\n)).find('li');\nexpect(wrapper.at(0).key()).to.equal('foo');\nexpect(wrapper.at(1).key()).to.equal('bar');\n```\n"
  },
  {
    "path": "docs/api/ReactWrapper/last.md",
    "content": "# `.last() => ReactWrapper`\n\nReduce the set of matched nodes to the last in the set, just like `.at(length - 1)`.\n\n\n#### Returns\n\n`ReactWrapper`: A new wrapper that wraps the last node in the set.\n\n\n#### Examples\n\n```jsx\nconst wrapper = mount(<MyComponent />);\nexpect(wrapper.find(Foo).last().props().foo).to.equal('bar');\n```\n\n\n#### Related Methods\n\n- [`.at(index) => ReactWrapper`](at.md) - retrieve a wrapper node by index\n- [`.first() => ReactWrapper`](first.md)\n"
  },
  {
    "path": "docs/api/ReactWrapper/length.md",
    "content": "# `.length => number`\n\nReturns the number of React nodes enclosed in this wrapper.\n\n\n\n#### Returns\n\n`Number`: count of nodes in the list in this wrapper.\n\n\n\n#### Example\n\n\n```jsx\nconst wrapper = mount(<div />);\nexpect(wrapper.length).to.equal(1);\n```\n"
  },
  {
    "path": "docs/api/ReactWrapper/map.md",
    "content": "# `.map(fn) => Array<Any>`\n\nMaps the current array of nodes to another array. Each node is passed in as a `ReactWrapper`\nto the map function.\n\n\n#### Arguments\n\n1. `fn` (`Function ( ReactWrapper node, Number index ) => Any`): A mapping function to be run for every node in\nthe collection, the results of which will be mapped to the returned array. Should expect a ReactWrapper as the first argument, and will be run with a context of\nthe original instance.\n\n\n\n#### Returns\n\n`Array<Any>`: Returns an array of the returned values from the mapping function..\n\n\n\n#### Example\n\n```jsx\nconst wrapper = mount((\n  <div>\n    <div className=\"foo\">bax</div>\n    <div className=\"foo\">bar</div>\n    <div className=\"foo\">baz</div>\n  </div>\n));\n\nconst texts = wrapper.find('.foo').map((node) => node.text());\nexpect(texts).to.eql(['bax', 'bar', 'baz']);\n```\n\n\n#### Related Methods\n\n- [`.forEach(fn) => ReactWrapper`](forEach.md)\n- [`.reduce(fn[, initialValue]) => Any`](reduce.md)\n- [`.reduceRight(fn[, initialValue]) => Any`](reduceRight.md)\n"
  },
  {
    "path": "docs/api/ReactWrapper/matchesElement.md",
    "content": "# `.matchesElement(patternNode) => Boolean`\n\nReturns whether or not a given react element `patternNode` matches the wrapper's render tree. It must be a single-node wrapper, and only the root node is checked.\n\nThe `patternNode` acts like a wildcard. For it to match a node in the wrapper:\n* tag names must match\n* contents must match:  In text nodes, leading and trailing spaces are ignored, but not space in the middle. Child elements must match according to these rules, recursively.\n* `patternNode` props (attributes) must appear in the wrapper's nodes, but not the other way around. Their values must match if they do appear.\n* `patternNode` style CSS properties must appear in the wrapper's node's style, but not the other way around. Their values must match if they do appear.\n\n\n#### Arguments\n\n1. `patternNode` (`ReactElement`): The node whose presence you are detecting in the wrapper's single node.\n\n\n#### Returns\n\n`Boolean`: whether or not the current wrapper match the one passed in.\n\n\n#### Example\n\n<!-- eslint-disable react/button-has-type -->\n```jsx\nclass MyComponent extends React.Component {\n  constructor(props) {\n    super(props);\n    this.handleClick = this.handleClick.bind(this);\n  }\n\n  handleClick() {\n    // ...\n  }\n\n  render() {\n    return (\n      <button type=\"button\" onClick={this.handleClick} className=\"foo bar\">Hello</button>\n    );\n  }\n}\n\nconst wrapper = mount(<MyComponent />).childAt(0);\nexpect(wrapper.matchesElement(<button>Hello</button>)).to.equal(true);\nexpect(wrapper.matchesElement(<button className=\"foo bar\">Hello</button>)).to.equal(true);\n```\n\n\n#### Common Gotchas\n\n- `.matchesElement()` expects a ReactElement, not a selector (like many other methods). Make sure that\nwhen you are calling it you are calling it with a ReactElement or a JSX expression.\n- Keep in mind that this method determines matching based on the matching of the node's children as\nwell.\n\n\n#### Related Methods\n\n- [`.containsMatchingElement() => ReactWrapper`](containsMatchingElement.md) - searches all nodes in the wrapper, and searches their entire depth\n"
  },
  {
    "path": "docs/api/ReactWrapper/mount.md",
    "content": "# `.mount() => Self`\n\nA method that re-mounts the component, if it is not currently mounted. This can be used to simulate a component going through\nan unmount/mount lifecycle.\n\nNo equivalent for ShallowWrappers.\n\n#### Returns\n\n`ReactWrapper`: Returns itself.\n\n\n#### Example\n\n```jsx\nimport PropTypes from 'prop-types';\nimport sinon from 'sinon';\n\nconst willMount = sinon.spy();\nconst didMount = sinon.spy();\nconst willUnmount = sinon.spy();\n\nclass Foo extends React.Component {\n  constructor(props) {\n    super(props);\n    this.componentWillUnmount = willUnmount;\n    this.componentWillMount = willMount;\n    this.componentDidMount = didMount;\n  }\n\n  render() {\n    const { id } = this.props;\n    return (\n      <div className={id}>\n        {id}\n      </div>\n    );\n  }\n}\nFoo.propTypes = {\n  id: PropTypes.string.isRequired,\n};\n\nconst wrapper = mount(<Foo id=\"foo\" />);\nexpect(willMount).to.have.property('callCount', 1);\nexpect(didMount).to.have.property('callCount', 1);\nexpect(willUnmount).to.have.property('callCount', 0);\nwrapper.unmount();\nexpect(willMount).to.have.property('callCount', 1);\nexpect(didMount).to.have.property('callCount', 1);\nexpect(willUnmount).to.have.property('callCount', 1);\nwrapper.mount();\nexpect(willMount).to.have.property('callCount', 2);\nexpect(didMount).to.have.property('callCount', 2);\nexpect(willUnmount).to.have.property('callCount', 1);\n```\n\n\n#### Related Methods\n\n- [`.unmount() => Self`](unmount.md)\n"
  },
  {
    "path": "docs/api/ReactWrapper/name.md",
    "content": "# `.name() => String|null`\n\nReturns the name of the current node of this wrapper. If it's a composite component, this will be\nthe name of the component. If it's a native DOM node, it will be a string of the tag name. If it's\n`null`, it will be `null`.\n\nThe order of precedence on returning the name is: `type.displayName` -> `type.name` -> `type`.\n\nNote: can only be called on a wrapper of a single node.\n\n\n#### Returns\n\n`String|null`: The name of the current node\n\n\n\n#### Examples\n\n```jsx\nconst wrapper = mount(<div />);\nexpect(wrapper.name()).to.equal('div');\n```\n\n```jsx\nconst wrapper = mount(<Foo />);\nexpect(wrapper.name()).to.equal('Foo');\n```\n\n```jsx\nFoo.displayName = 'A cool custom name';\nconst wrapper = mount(<Foo />);\nexpect(wrapper.name()).to.equal('A cool custom name');\n```\n"
  },
  {
    "path": "docs/api/ReactWrapper/not.md",
    "content": "# `.not(selector) => ReactWrapper`\n\nReturns a new wrapper with only the nodes of the current wrapper that don't match the provided\nselector.\n\nThis method is effectively the negation or inverse of [`filter`](filter.md).\n\n\n#### Arguments\n\n1. `selector` ([`EnzymeSelector`](../selector.md)): The selector to match.\n\n\n\n#### Returns\n\n`ReactWrapper`: A new wrapper that wraps the filtered nodes.\n\n\n\n#### Examples\n\n```jsx\nconst wrapper = mount(<MyComponent />);\nexpect(wrapper.find('.foo').not('.bar')).to.have.lengthOf(1);\n```\n\n#### Related Methods\n\n- [`.filterWhere(predicate) => ReactWrapper`](filterWhere.md)\n- [`.filter(selector) => ReactWrapper`](filter.md)\n"
  },
  {
    "path": "docs/api/ReactWrapper/parent.md",
    "content": "# `.parent() => ReactWrapper`\n\nReturns a wrapper with the direct parent of the node in the current wrapper.\n\n\n#### Returns\n\n`ReactWrapper`: A new wrapper that wraps the resulting nodes.\n\n\n#### Examples\n\n```jsx\nconst wrapper = mount(<ToDoList />);\nexpect(wrapper.find('ul').parent().is('div')).to.equal(true);\n```\n\n#### Related Methods\n\n- [`.parents([selector]) => ReactWrapper`](parents.md)\n- [`.children([selector]) => ReactWrapper`](children.md)\n- [`.closest(selector) => ReactWrapper`](closest.md)\n"
  },
  {
    "path": "docs/api/ReactWrapper/parents.md",
    "content": "# `.parents([selector]) => ReactWrapper`\n\nReturns a wrapper around all of the parents/ancestors of the single node in the wrapper. Does not include the node itself.\nOptionally, a selector can be provided and it will filter the parents by this selector. It must be a single-node wrapper.\n\n\n#### Arguments\n\n1. `selector` ([`EnzymeSelector`](../selector.md) [optional]): The selector to filter the parents by.\n\n\n#### Returns\n\n`ReactWrapper`: A new wrapper that wraps the resulting nodes.\n\n\n#### Examples\n\n```jsx\nconst wrapper = mount(<ToDoList />);\nexpect(wrapper.find('ul').parents()).to.have.lengthOf(2);\n```\n\n#### Related Methods\n\n- [`.children([selector]) => ReactWrapper`](children.md)\n- [`.parent() => ReactWrapper`](parent.md)\n- [`.closest(selector) => ReactWrapper`](closest.md)\n"
  },
  {
    "path": "docs/api/ReactWrapper/prop.md",
    "content": "# `.prop(key) => Any`\n\nReturns the prop value for the root node of the wrapper with the provided key. It must be a single-node wrapper.\n\n#### Arguments\n\n1. `key` (`String`): The prop name, that is, `this.props[key]` or `props[key]` for the root node of the wrapper.\n\n\n#### Example\n\n\n```jsx\nconst wrapper = mount(<MyComponent foo={10} />);\nexpect(wrapper.prop('foo')).to.equal(10);\n```\n\n\n#### Related Methods\n\n- [`.props() => Object`](props.md)\n- [`.state([key]) => Any`](state.md)\n- [`.context([key]) => Any`](context.md)\n"
  },
  {
    "path": "docs/api/ReactWrapper/props.md",
    "content": "# `.props() => Object`\n\nReturns the props object for the root node of the wrapper. It must be a single-node wrapper.\n\nThis method is a reliable way of accessing the props of a node; `wrapper.instance().props` will work as well, but in React 16+, stateless functional components do not have an instance. See [`.instance() => ReactComponent`](instance.md)\n\n\n#### Example\n```jsx\nimport PropTypes from 'prop-types';\n\nfunction MyComponent(props) {\n  const { includedProp } = props;\n  return (\n    <div className=\"foo bar\" includedProp={includedProp}>Hello</div>\n  );\n}\nMyComponent.propTypes = {\n  includedProp: PropTypes.string.isRequired,\n};\n\nconst wrapper = mount(<MyComponent includedProp=\"Success!\" excludedProp=\"I'm not included\" />);\nexpect(wrapper.props().includedProp).to.equal('Success!');\n\n// Warning: .props() only returns props that are passed to the root node,\n// which does not include excludedProp in this example.\n// See the note above about wrapper.instance().props.\n\nconsole.log(wrapper.props());\n// {children: \"Hello\", className: \"foo bar\", includedProp=\"Success!\"}\n\nconsole.log(wrapper.instance().props); // React 15.x - working as expected\n// {children: \"Hello\", className: \"foo bar\", includedProp:\"Success!\", excludedProp: \"I'm not included\"}\n\nconsole.log(wrapper.instance().props);\n// React 16.* - Uncaught TypeError: Cannot read property 'props' of null\n```\n\n#### Related Methods\n\n- [`.prop(key) => Any`](prop.md)\n- [`.state([key]) => Any`](state.md)\n- [`.context([key]) => Any`](context.md)\n"
  },
  {
    "path": "docs/api/ReactWrapper/reduce.md",
    "content": "# `.reduce(fn[, initialValue]) => Any`\n\nApplies the provided reducing function to every node in the wrapper to reduce to a single value.\nEach node is passed in as a `ReactWrapper`, and is processed from left to right.\n\n\n#### Arguments\n\n1. `fn` (`Function`): A reducing function to be run for every node in the collection, with the\nfollowing arguments:\n  - `value` (`T`): The value returned by the previous invocation of this function\n  - `node` (`ReactWrapper`): A wrapper around the node being processed\n  - `index` (`Number`): The index of the node being processed\n\n2. `initialValue` (`T` [optional]): If provided, this will be passed in as the first argument to the first invocation of the reducing function. If omitted, the first `node` will be provided and the iteration will begin on the second node in the collection.\n\n\n#### Returns\n\n`T`: Returns an array of the returned values from the mapping function...\n\n\n#### Example\n\n```jsx\nfunction Foo() {\n  return (\n    <div>\n      <Bar amount={2} />\n      <Bar amount={4} />\n      <Bar amount={8} />\n    </div>\n  );\n}\n```\n\n```jsx\nconst wrapper = mount(<Foo />);\nconst total = wrapper.find(Bar).reduce((amount, n) => amount + n.prop('amount'), 0);\nexpect(total).to.equal(14);\n```\n\n\n#### Related Methods\n\n- [`.reduceRight(fn[, initialValue]) => Any`](reduceRight.md)\n- [`.forEach(fn) => ReactWrapper`](forEach.md)\n- [`.map(fn) => Array<Any>`](map.md)\n"
  },
  {
    "path": "docs/api/ReactWrapper/reduceRight.md",
    "content": "# `.reduceRight(fn[, initialValue]) => Any`\n\nApplies the provided reducing function to every node in the wrapper to reduce to a single value.\nEach node is passed in as a `ReactWrapper`, and is processed from right to left.\n\n\n#### Arguments\n\n1. `fn` (`Function`): A reducing function to be run for every node in the collection, with the\nfollowing arguments:\n  - `value` (`T`): The value returned by the previous invocation of this function\n  - `node` (`ReactWrapper`): A single-node wrapper around the node being processed\n  - `index` (`Number`): The index of the node being processed\n\n2. `initialValue` (`T` [optional]): If provided, this will be passed in as the first argument to the first invocation of the reducing function. If omitted, the first `node` will be provided and the iteration will begin on the second node in the collection.\n\n\n#### Returns\n\n`T`: Returns an array of the returned values from the mapping function...\n\n\n#### Example\n\n```jsx\nfunction Foo() {\n  return (\n    <div>\n      <Bar amount={2} />\n      <Bar amount={4} />\n      <Bar amount={8} />\n    </div>\n  );\n}\n```\n\n```jsx\nconst wrapper = mount(<Foo />);\nconst total = wrapper.find(Bar).reduceRight((amount, n) => amount + n.prop('amount'), 0);\nexpect(total).to.equal(14);\n```\n\n\n#### Related Methods\n\n- [`.reduce(fn[, initialValue]) => Any`](reduce.md)\n- [`.forEach(fn) => ReactWrapper`](forEach.md)\n- [`.map(fn) => Array<Any>`](map.md)\n"
  },
  {
    "path": "docs/api/ReactWrapper/ref.md",
    "content": "# `.ref(refName) => ReactComponent | HTMLElement`\n\nReturns the node that matches the provided reference name.\n\n\nNOTE: can only be called on a wrapper instance that is also the root instance.\n\n#### Arguments\n\n1. `refName` (`String`): The ref attribute of the node\n\n\n#### Returns\n\n`ReactComponent | HTMLElement`: The node that matches the provided reference name. This can be a react component instance, or an HTML element instance.\n\n\n#### Examples\n\n<!-- eslint react/no-string-refs: 1 -->\n```jsx\nclass Foo extends React.Component {\n  render() {\n    return (\n      <div>\n        <span ref=\"firstRef\" amount={2}>First</span>\n        <span ref=\"secondRef\" amount={4}>Second</span>\n        <span ref=\"thirdRef\" amount={8}>Third</span>\n      </div>\n    );\n  }\n}\n```\n\n```jsx\nconst wrapper = mount(<Foo />);\nexpect(wrapper.ref('secondRef').innerText).to.equal('Second');\n```\n\n\n#### Related Methods\n\n- [`.find(selector) => ReactWrapper`](find.md)\n- [`.findWhere(predicate) => ReactWrapper`](findWhere.md)\n"
  },
  {
    "path": "docs/api/ReactWrapper/render.md",
    "content": "# `.render() => CheerioWrapper`\n\nReturns a CheerioWrapper around the rendered HTML of the single node's subtree.\nIt must be a single-node wrapper.\n\n\n#### Returns\n\n`CheerioWrapper`: The resulting Cheerio object\n\n\n#### Examples\n\n```jsx\nfunction Foo() {\n  return (<div className=\"in-foo\" />);\n}\n```\n\n```jsx\nfunction Bar() {\n  return (\n    <div className=\"in-bar\">\n      <Foo />\n    </div>\n  );\n}\n```\n\n```jsx\nconst wrapper = mount(<Bar />);\nexpect(wrapper.find('.in-foo')).to.have.lengthOf(1);\nexpect(wrapper.render().find('.in-foo')).to.have.lengthOf(1);\n```\n"
  },
  {
    "path": "docs/api/ReactWrapper/renderProp.md",
    "content": "# `.renderProp(propName)(...args) => ReactWrapper`\n\nReturns a function that, when called with arguments `args`, will return a new wrapper based on the render prop in the original wrapper's prop `propName`.\n\nNOTE: can only be called on wrapper of a single non-DOM component element node.\n\n#### Arguments\n\n1. `propName` (`String`):\n1. `...args` (`Array<Any>`):\n\nThis essentially calls `wrapper.prop(propName)(...args)`.\n\n#### Returns\n\n`ReactWrapper`: A new wrapper that wraps the node returned from the render prop.\n\n#### Examples\n\n##### Test Setup\n\n```jsx\nclass Mouse extends React.Component {\n  constructor() {\n    super();\n    this.state = { x: 0, y: 0 };\n  }\n\n  render() {\n    const { render } = this.props;\n    return (\n      <div\n        style={{ height: '100%' }}\n        onMouseMove={(event) => {\n          this.setState({\n            x: event.clientX,\n            y: event.clientY,\n          });\n        }}\n      >\n        {render(this.state)}\n      </div>\n    );\n  }\n}\n\nMouse.propTypes = {\n  render: PropTypes.func.isRequired,\n};\n```\n\n```jsx\nfunction App() {\n  return (\n    <div style={{ height: '100%' }}>\n      <Mouse\n        render={(x = 0, y = 0) => (\n          <h1>\n            The mouse position is ({x}, {y})\n          </h1>\n        )}\n      />\n    </div>\n  );\n}\n```\n\n##### Testing with no arguments\n\n```jsx\nconst wrapper = mount(<App />)\n  .find(Mouse)\n  .renderProp('render')();\n\nexpect(wrapper.equals(<h1>The mouse position is 0, 0</h1>)).to.equal(true);\n```\n\n##### Testing with multiple arguments\n\n```jsx\nconst wrapper = mount(<App />)\n  .find(Mouse)\n  .renderProp('render')(10, 20);\n\nexpect(wrapper.equals(<h1>The mouse position is 10, 20</h1>)).to.equal(true);\n```\n"
  },
  {
    "path": "docs/api/ReactWrapper/setContext.md",
    "content": "# `.setContext(context) => Self`\n\nA method that sets the context of the root component, and re-renders. Useful for when you are\nwanting to test how the component behaves over time with changing contexts.\n\nNOTE: can only be called on a wrapper instance that is also the root instance.\n\n\n#### Arguments\n\n1. `context` (`Object`): An object containing new props to merge in with the current state\n\n\n\n#### Returns\n\n`ReactWrapper`: Returns itself.\n\n\n\n#### Example\n\n```jsx\nimport React from 'react';\nimport PropTypes from 'prop-types';\n\nfunction SimpleComponent(props, context) {\n  const { name } = context;\n  return <div>{name}</div>;\n}\nSimpleComponent.contextTypes = {\n  name: PropTypes.string,\n};\n```\n```jsx\nconst context = { name: 'foo' };\nconst wrapper = mount(<SimpleComponent />, { context });\nexpect(wrapper.text()).to.equal('foo');\nwrapper.setContext({ name: 'bar' });\nexpect(wrapper.text()).to.equal('bar');\nwrapper.setContext({ name: 'baz' });\nexpect(wrapper.text()).to.equal('baz');\n```\n\n#### Common Gotchas\n\n- `.setContext()` can only be used on a wrapper that was initially created with a call to `mount()`\nthat includes a `context` specified in the options argument.\n- The root component you are rendering must have a `contextTypes` static property.\n\n\n#### Related Methods\n\n- [`.setState(state[, callback]) => Self`](setState.md)\n- [`.setProps(props[, callback]) => Self`](setProps.md)\n\n\n"
  },
  {
    "path": "docs/api/ReactWrapper/setProps.md",
    "content": "# `.setProps(nextProps[, callback]) => Self`\n\nA method that sets the props of the root component, and re-renders. Useful for when you are\nwanting to test how the component behaves over time with changing props. Calling this, for\ninstance, will call the `componentWillReceiveProps` lifecycle method.\n\nSimilar to `setState`, this method accepts a props object and will merge it in with the already\nexisting props.\n\nNOTE: can only be called on a wrapper instance that is also the root instance.\n\n\n#### Arguments\n\n1. `nextProps` (`Object`): An object containing new props to merge in with the current props\n2. `callback` (`Function` [optional]): If provided, the callback function will be executed once setProps has completed\n\n\n#### Returns\n\n`ReactWrapper`: Returns itself.\n\n\n#### Example\n\n```jsx\nimport React from 'react';\nimport PropTypes from 'prop-types';\n\nfunction Foo({ name }) {\n  return (\n    <div className={name} />\n  );\n}\nFoo.propTypes = {\n  name: PropTypes.string.isRequired,\n};\n```\n```jsx\nconst wrapper = mount(<Foo name=\"foo\" />);\nexpect(wrapper.find('.foo')).to.have.lengthOf(1);\nexpect(wrapper.find('.bar')).to.have.lengthOf(0);\nwrapper.setProps({ name: 'bar' });\nexpect(wrapper.find('.foo')).to.have.lengthOf(0);\nexpect(wrapper.find('.bar')).to.have.lengthOf(1);\n```\n\n```jsx\nimport sinon from 'sinon';\n\nconst spy = sinon.spy(MyComponent.prototype, 'componentWillReceiveProps');\n\nconst wrapper = mount(<MyComponent foo=\"bar\" />);\nexpect(spy).to.have.property('callCount', 0);\nwrapper.setProps({ foo: 'foo' });\nexpect(spy).to.have.property('callCount', 1);\n```\n\n\n#### Related Methods\n\n- [`.setState(state) => Self`](setState.md)\n- [`.setContext(context) => Self`](setContext.md)\n"
  },
  {
    "path": "docs/api/ReactWrapper/setState.md",
    "content": "# `.setState(nextState[, callback]) => Self`\n\nA method to invoke `setState()` on the root component instance, similar to how you might in the\nmethods of the component, and re-renders. This method is useful for testing your component\nin hard-to-achieve states, however should be used sparingly. If possible, you should utilize\nyour component's external API (which is often accessible via [`.instance()`](instance.md)) in order\nto get it into whatever state you want to test, in order to be as accurate of a test as possible.\nThis is not always practical, however.\n\nNOTE: Prior to v3.8.0 of enzyme, can only be called on a wrapper instance that is also the root instance.\n\n#### Arguments\n\n1. `nextState` (`Object`): An object containing new state to merge in with the current state\n2. `callback` (`Function` [optional]): If provided, the callback function will be executed once setState has completed\n\n\n#### Returns\n\n`ReactWrapper`: Returns itself.\n\n\n#### Example\n\n```jsx\nclass Foo extends React.Component {\n  constructor(props) {\n    super(props);\n    this.state = { name: 'foo' };\n  }\n\n  render() {\n    const { name } = this.state;\n    return (\n      <div className={name} />\n    );\n  }\n}\n```\n```jsx\nconst wrapper = mount(<Foo />);\nexpect(wrapper.find('.foo')).to.have.lengthOf(1);\nexpect(wrapper.find('.bar')).to.have.lengthOf(0);\nwrapper.setState({ name: 'bar' });\nexpect(wrapper.find('.foo')).to.have.lengthOf(0);\nexpect(wrapper.find('.bar')).to.have.lengthOf(1);\n```\n\n\n#### Related Methods\n\n- [`.setProps(props[, callback]) => Self`](setProps.md)\n- [`.setContext(context) => Self`](setContext.md)\n"
  },
  {
    "path": "docs/api/ReactWrapper/simulate.md",
    "content": "# `.simulate(event[, mock]) => Self`\n\nSimulate events on the root node in the wrapper. It must be a single-node wrapper.\n\n\n#### Arguments\n\n1. `event` (`String`): The event name to be simulated\n2. `mock` (`Object` [optional]): A mock event object that will be merged with the event object passed to the handlers.\n\n\n#### Returns\n\n`ReactWrapper`: Returns itself.\n\n\n#### Example `class component`\n\n```jsx\nclass Foo extends React.Component {\n  constructor(props) {\n    super(props);\n    this.state = { count: 0 };\n  }\n\n  render() {\n    const { count } = this.state;\n    return (\n      <div>\n        <div className={`clicks-${count}`}>\n          {count} clicks\n        </div>\n        <a href=\"url\" onClick={() => { this.setState({ count: count + 1 }); }}>\n          Increment\n        </a>\n      </div>\n    );\n  }\n}\n\nconst wrapper = mount(<Foo />);\n\nexpect(wrapper.find('.clicks-0').length).to.equal(1);\nwrapper.find('a').simulate('click');\nexpect(wrapper.find('.clicks-1').length).to.equal(1);\n```\n\n#### Example `functional component`\n\n```jsx\nfunction Foo({ width, height, onChange }) {\n  return (\n    <div>\n      <input name=\"width\" value={width} onChange={onChange} />\n      <input name=\"height\" value={height} onChange={onChange} />\n    </div>\n  );\n}\nFoo.propTypes = {\n  width: PropTypes.number.isRequired,\n  height: PropTypes.number.isRequired,\n  onChange: PropTypes.func.isRequired,\n};\n\nconst testState = { width: 10, height: 20 };\nconst wrapper = mount((\n  <Foo\n    width={testState.width}\n    height={testState.height}\n    onChange={(e) => {\n      testState[e.target.name] = e.target.value;\n    }}\n  />\n));\n\nexpect(wrapper.find('input').at(0).props().value).to.equal(10);\nexpect(wrapper.find('input').at(1).props().value).to.equal(20);\nwrapper.find('input').at(0).simulate('change', { target: { name: 'width', value: 50 } });\nwrapper.find('input').at(1).simulate('change', { target: { name: 'height', value: 70 } });\nexpect(testState.width).to.equal(50);\nexpect(testState.height).to.equal(70);\n```\n\n#### Common Gotchas\n\n- As noted in the function signature above passing a mock event is optional. It is worth noting that `ReactWrapper` will pass a `SyntheticEvent` object to the event handler in your code. Keep in mind that if the code you are testing uses properties that are not included in the `SyntheticEvent`, for instance `event.target.value`, you will need to provide a mock event like so `.simulate(\"change\", { target: { value: \"foo\" }})` for it to work.\n\n"
  },
  {
    "path": "docs/api/ReactWrapper/simulateError.md",
    "content": "# `.simulateError(error) => Self`\n\nSimulate a component throwing an error as part of its rendering lifecycle.\n\nThis is particularly useful in combination with React 16 error boundaries (ie, the `componentDidCatch` and `static getDerivedStateFromError` lifecycle methods).\n\n\n#### Arguments\n\n1. `error` (`Any`): The error to throw.\n\n\n\n#### Returns\n\n`ReactWrapper`: Returns itself.\n\n\n\n#### Example\n\n```jsx\nfunction Something() {\n  // this is just a placeholder\n  return null;\n}\n\nclass ErrorBoundary extends React.Component {\n  static getDerivedStateFromError(error) {\n    return {\n      hasError: true,\n    };\n  }\n\n  constructor(props) {\n    super(props);\n    this.state = { hasError: false };\n  }\n\n  componentDidCatch(error, info) {\n    const { spy } = this.props;\n    spy(error, info);\n  }\n\n  render() {\n    const { children } = this.props;\n    const { hasError } = this.state;\n    return (\n      <React.Fragment>\n        {hasError ? 'Error' : children}\n      </React.Fragment>\n    );\n  }\n}\nErrorBoundary.propTypes = {\n  children: PropTypes.node.isRequired,\n  spy: PropTypes.func.isRequired,\n};\n\nconst spy = sinon.spy();\nconst wrapper = mount(<ErrorBoundary spy={spy}><Something /></ErrorBoundary>);\nconst error = new Error('hi!');\nwrapper.find(Something).simulateError(error);\n\nexpect(wrapper.state()).to.have.property('hasError', true);\nexpect(spy).to.have.property('callCount', 1);\nexpect(spy.args).to.deep.equal([\n  error,\n  {\n    componentStack: `\n    in Something (created by ErrorBoundary)\n    in ErrorBoundary (created by WrapperComponent)\n    in WrapperComponent`,\n  },\n]);\n```\n"
  },
  {
    "path": "docs/api/ReactWrapper/slice.md",
    "content": "# `.slice([begin[, end]]) => ReactWrapper`\n\nReturns a new wrapper with a subset of the nodes of the original wrapper, according to the rules of `Array#slice`.\n\n\n#### Arguments\n\n1. `begin` (`Number` [optional]): Index from which to slice (defaults to `0`). If negative, this is treated as `length+begin`.\n1. `end` (`Number` [optional]): Index at which to end slicing (defaults to `length`). If negative, this is treated as `length+end`.\n\n\n\n#### Returns\n\n`ReactWrapper`: A new wrapper with the subset of nodes specified.\n\n\n\n#### Examples\n\n```jsx\nconst wrapper = mount((\n  <div>\n    <div className=\"foo bax\" />\n    <div className=\"foo bar\" />\n    <div className=\"foo baz\" />\n  </div>\n));\nexpect(wrapper.find('.foo').slice(1)).to.have.lengthOf(2);\nexpect(wrapper.find('.foo').slice(1).at(0).hasClass('bar')).to.equal(true);\nexpect(wrapper.find('.foo').slice(1).at(1).hasClass('baz')).to.equal(true);\n```\n\n```jsx\nconst wrapper = mount((\n  <div>\n    <div className=\"foo bax\" />\n    <div className=\"foo bar\" />\n    <div className=\"foo baz\" />\n  </div>\n));\nexpect(wrapper.find('.foo').slice(1, 2)).to.have.lengthOf(1);\nexpect(wrapper.find('.foo').slice(1, 2).at(0).hasClass('bar')).to.equal(true);\n```\n"
  },
  {
    "path": "docs/api/ReactWrapper/some.md",
    "content": "# `.some(selector) => Boolean`\n\nReturns whether or not any of the nodes in the wrapper match the provided selector.\n\n\n#### Arguments\n\n1. `selector` ([`EnzymeSelector`](../selector.md)): The selector to match.\n\n\n\n#### Returns\n\n`Boolean`: True if at least one of the nodes in the current wrapper matched the provided selector.\n\n\n\n#### Examples\n\n```jsx\nconst wrapper = mount((\n  <div>\n    <div className=\"foo qoo\" />\n    <div className=\"foo boo\" />\n    <div className=\"foo hoo\" />\n  </div>\n));\nexpect(wrapper.find('.foo').some('.qoo')).to.equal(true);\nexpect(wrapper.find('.foo').some('.foo')).to.equal(true);\nexpect(wrapper.find('.foo').some('.bar')).to.equal(false);\n```\n\n#### Related Methods\n\n- [`.someWhere(predicate) => Boolean`](someWhere.md)\n- [`.every(selector) => Boolean`](every.md)\n- [`.everyWhere(predicate) => Boolean`](everyWhere.md)\n"
  },
  {
    "path": "docs/api/ReactWrapper/someWhere.md",
    "content": "# `.someWhere(fn) => Boolean`\n\nReturns whether or not any of the nodes in the wrapper pass the provided predicate function.\n\n\n#### Arguments\n\n1. `predicate` (`ReactWrapper => Boolean`): A predicate function to match the nodes.\n\n\n\n#### Returns\n\n`Boolean`: True if at least one of the nodes in the current wrapper passed the predicate function.\n\n\n\n#### Example\n\n```jsx\nconst wrapper = mount((\n  <div>\n    <div className=\"foo qoo\" />\n    <div className=\"foo boo\" />\n    <div className=\"foo hoo\" />\n  </div>\n));\nexpect(wrapper.find('.foo').someWhere((n) => n.hasClass('qoo'))).to.equal(true);\nexpect(wrapper.find('.foo').someWhere((n) => n.hasClass('foo'))).to.equal(true);\nexpect(wrapper.find('.foo').someWhere((n) => n.hasClass('bar'))).to.equal(false);\n```\n\n\n#### Related Methods\n\n- [`.some(selector) => Boolean`](some.md)\n- [`.every(selector) => Boolean`](every.md)\n- [`.everyWhere(predicate) => Boolean`](everyWhere.md)\n"
  },
  {
    "path": "docs/api/ReactWrapper/state.md",
    "content": "# `.state([key]) => Any`\n\nReturns the state hash for the root node of the wrapper. Optionally pass in a prop name and it\nwill return just that value.\n\n\n#### Arguments\n\n1. `key` (`String` [optional]): If provided, the return value will be the `this.state[key]` of the\nroot component instance.\n\n\n\n#### Example\n\n\n```jsx\nconst wrapper = mount(<MyComponent />);\nexpect(wrapper.state().foo).to.equal(10);\nexpect(wrapper.state('foo')).to.equal(10);\n```\n\n\n#### Related Methods\n\n- [`.props() => Object`](props.md)\n- [`.prop(key) => Any`](prop.md)\n- [`.context([key]) => Any`](context.md)\n"
  },
  {
    "path": "docs/api/ReactWrapper/tap.md",
    "content": "# `.tap(intercepter) => Self`\n\nInvokes intercepter and returns itself. intercepter is called with itself.\nThis is helpful when debugging nodes in method chains.\n\n#### Arguments\n\n1. `intercepter` (`Self`): the current ReactWrapper instance.\n\n\n\n#### Returns\n\n`Self`: the current ReactWrapper instance.\n\n\n\n#### Example\n\n\n```jsx\nconst result = mount((\n  <ul>\n    <li>xxx</li>\n    <li>yyy</li>\n    <li>zzz</li>\n  </ul>\n)).find('li')\n  .tap((n) => console.log(n.debug()))\n  .map((n) => n.text());\n```\n"
  },
  {
    "path": "docs/api/ReactWrapper/text.md",
    "content": "# `.text() => String`\n\nReturns a string of the rendered text of the current render tree. This function should be\nlooked at with skepticism if being used to test what the actual HTML output of the component\nwill be. If that is what you would like to test, use enzyme's `render` function instead.\n\nNote: can only be called on a wrapper of a single node.\n\n\n#### Returns\n\n`String`: The resulting string\n\n\n#### Examples\n\n```jsx\nconst wrapper = mount(<div><b>important</b></div>);\nexpect(wrapper.text()).to.equal('important');\n```\n\n```jsx\nfunction Foo() {\n  return <div>This is</div>;\n}\n\nconst wrapper = mount(<div><Foo /> <b>really</b> important</div>);\nexpect(wrapper.text()).to.equal('This is really important');\n```\n\n\n#### Related Methods\n\n[`.html() => String`](html.md)\n"
  },
  {
    "path": "docs/api/ReactWrapper/type.md",
    "content": "# `.type() => String | Function | null`\n\nReturns the type of the only node of this wrapper.\nIf it's a React component, this will be the component constructor.\nIf it's a native DOM node, it will be a string with the tag name.\nIf it's `null`, it will be `null`. It must be a single-node wrapper.\n\n\n#### Returns\n\n`String | Function | null`: The type of the node\n\n\n#### Examples\n\n```jsx\nfunction Foo() {\n  return <div />;\n}\nconst wrapper = mount(<Foo />).childAt(0);\nexpect(wrapper.type()).to.equal('div');\n```\n\n```jsx\nfunction Foo() {\n  return (\n    <div>\n      <button type=\"button\" className=\"btn\">Button</button>\n    </div>\n  );\n}\nconst wrapper = mount(<Foo />);\nexpect(wrapper.find('.btn').type()).to.equal('button');\n```\n\n```jsx\nfunction Foo() {\n  return <Bar />;\n}\nconst wrapper = mount(<Foo />);\nexpect(wrapper.type()).to.equal(Foo);\nexpect(wrapper.childAt(0).type()).to.equal(Bar);\n```\n\n```jsx\nfunction Null() {\n  return null;\n}\nconst wrapper = mount(<Null />);\nexpect(wrapper.type()).to.equal(null);\n```\n"
  },
  {
    "path": "docs/api/ReactWrapper/unmount.md",
    "content": "# `.unmount() => Self`\n\nA method that unmounts the component. This can be used to simulate a component going through\nan unmount/mount lifecycle.\n\n#### Returns\n\n`ReactWrapper`: Returns itself.\n\n\n\n#### Example\n\n```jsx\nimport PropTypes from 'prop-types';\nimport sinon from 'sinon';\n\nconst willMount = sinon.spy();\nconst didMount = sinon.spy();\nconst willUnmount = sinon.spy();\n\nclass Foo extends React.Component {\n  constructor(props) {\n    super(props);\n    this.componentWillUnmount = willUnmount;\n    this.componentWillMount = willMount;\n    this.componentDidMount = didMount;\n  }\n\n  render() {\n    const { id } = this.props;\n    return (\n      <div className={id}>\n        {id}\n      </div>\n    );\n  }\n}\nFoo.propTypes = {\n  id: PropTypes.string.isRequired,\n};\nconst wrapper = mount(<Foo id=\"foo\" />);\nexpect(willMount).to.have.property('callCount', 1);\nexpect(didMount).to.have.property('callCount', 1);\nexpect(willUnmount).to.have.property('callCount', 0);\nwrapper.unmount();\nexpect(willMount).to.have.property('callCount', 1);\nexpect(didMount).to.have.property('callCount', 1);\nexpect(willUnmount).to.have.property('callCount', 1);\n```\n\n\n#### Related Methods\n\n- [`.mount() => Self`](mount.md)\n"
  },
  {
    "path": "docs/api/ReactWrapper/update.md",
    "content": "# `.update() => Self`\n\nSyncs the enzyme component tree snapshot with the react component tree. Useful to run before checking the render output if something external\nmay be updating the state of the component somewhere.\n\nNOTE: no matter what instance this is called on, it will always update the root.\n\nNOTE: only updates Enzyme's representation of rendered tree.\n\nNOTE: this does not force a re-render. Use `wrapper.setProps({})` to force a re-render.\n\n\n#### Returns\n\n`ReactWrapper`: Returns itself.\n\n\n\n#### Example\n\n```jsx\nclass UpdateEnzyme extends React.Component {\n  constructor(props) {\n    super(props);\n    this.state = {\n      count: 0,\n    };\n    this.increment = this.increment.bind(this);\n  }\n\n  increment() {\n    const { count } = this.state;\n    this.setState({ count: count + 1 });\n  }\n\n  render() {\n    const { count } = this.state;\n    return <button type=\"button\" className=\"increment\" onClick={this.increment}>{count}</button>;\n  }\n}\n```\n```jsx\nconst wrapper = mount(<UpdateEnzyme />);\nexpect(wrapper.find('button.increment').text()).to.equal('0');\nwrapper.instance().increment();\n\n// Update Enzyme's view of output\nwrapper.update();\n\nexpect(wrapper.find('button.increment').text()).to.equal('1');\n```\n"
  },
  {
    "path": "docs/api/ShallowWrapper/at.md",
    "content": "# `.at(index) => ShallowWrapper`\n\nReturns a wrapper around the node at a given index of the current wrapper.\n\n\n#### Arguments\n\n1. `index` (`Number`): A zero-based integer indicating which node to retrieve.\n\n\n\n#### Returns\n\n`ShallowWrapper`: A new wrapper that wraps the retrieved node.\n\n\n\n#### Examples\n\n```jsx\nconst wrapper = shallow(<MyComponent />);\nexpect(wrapper.find(Foo).at(0).props().foo).to.equal('bar');\n```\n\n\n\n#### Related Methods\n\n- [`.get(index) => ReactElement`](get.md) - same, but returns the React node itself, with no wrapper.\n- [`.first() => ShallowWrapper`](first.md) - same as at(0)\n- [`.last() => ShallowWrapper`](last.md)\n"
  },
  {
    "path": "docs/api/ShallowWrapper/childAt.md",
    "content": "# `.childAt(index) => ShallowWrapper`\n\nReturns a new wrapper with child at the specified index.\n\n#### Arguments\n\n1. `index` (`number`): A zero-based integer indicating which node to retrieve.\n\n\n#### Returns\n\n`ShallowWrapper`: A new wrapper that wraps the resulting node.\n\n\n\n#### Examples\n\n```jsx\nconst wrapper = shallow(<ToDoList items={items} />);\nexpect(wrapper.find('ul').childAt(0).type()).to.equal('li');\n```\n\n#### Related Methods\n\n- [`.parents([selector]) => ShallowWrapper`](parents.md)\n- [`.parent() => ShallowWrapper`](parent.md)\n- [`.closest(selector) => ShallowWrapper`](closest.md)\n- [`.children([selector]) => ShallowWrapper`](children.md)\n"
  },
  {
    "path": "docs/api/ShallowWrapper/children.md",
    "content": "# `.children([selector]) => ShallowWrapper`\n\nReturns a new wrapper with all of the children of the node(s) in the current wrapper. Optionally, a\nselector can be provided and it will filter the children by this selector\n\n\n#### Arguments\n\n1. `selector` ([`EnzymeSelector`](../selector.md) [optional]): A selector to filter the children by.\n\n\n#### Returns\n\n`ShallowWrapper`: A new wrapper that wraps the resulting nodes.\n\n\n\n#### Examples\n\n```jsx\nconst wrapper = shallow(<ToDoList items={items} />);\nexpect(wrapper.find('ul').children()).to.have.lengthOf(items.length);\n```\n\n#### Related Methods\n\n- [`.parents([selector]) => ShallowWrapper`](parents.md)\n- [`.parent() => ShallowWrapper`](parent.md)\n- [`.closest(selector) => ShallowWrapper`](closest.md)\n"
  },
  {
    "path": "docs/api/ShallowWrapper/closest.md",
    "content": "# `.closest(selector) => ShallowWrapper`\n\nReturns a wrapper of the first element that matches the selector by traversing up through the\nwrapped node's ancestors in the tree, starting with itself. It must be a single-node wrapper.\n\n#### Arguments\n\n1. `selector` ([`EnzymeSelector`](../selector.md)): The selector to match.\n\n#### Returns\n\n`ShallowWrapper`: A new wrapper that wraps the resulting node.\n\n\n\n#### Examples\n\n```jsx\nconst wrapper = shallow(<MyComponent />);\nexpect(wrapper.find(Foo).closest('.bar')).to.have.lengthOf(1);\n```\n\n#### Related Methods\n\n- [`.children([selector]) => ShallowWrapper`](children.md)\n- [`.parent() => ShallowWrapper`](parent.md)\n- [`.parents([selector]) => ShallowWrapper`](parents.md)\n"
  },
  {
    "path": "docs/api/ShallowWrapper/contains.md",
    "content": "# `.contains(nodeOrNodes) => Boolean`\n\nReturns whether or not all given react elements match elements in the render tree.\nIt will determine if an element in the wrapper matches the expected element by checking if the expected element has the same props as the wrapper's element and share the same values.\n\n\n#### Arguments\n\n1. `nodeOrNodes` (`ReactElement|Array<ReactElement>`): The node or array of nodes whose presence you are detecting in the current instance's\nrender tree.\n\n\n\n#### Returns\n\n`Boolean`: whether or not the current wrapper has nodes anywhere in its render tree that match\nthe ones passed in.\n\n\n\n#### Example\n\n\n```jsx\nconst wrapper = shallow((\n  <div>\n    <div data-foo=\"foo\" data-bar=\"bar\">Hello</div>\n  </div>\n));\n\nexpect(wrapper.contains(<div data-foo=\"foo\" data-bar=\"bar\">Hello</div>)).to.equal(true);\n\nexpect(wrapper.contains(<div data-foo=\"foo\">Hello</div>)).to.equal(false);\nexpect(wrapper.contains(<div data-foo=\"foo\" data-bar=\"bar\" data-baz=\"baz\">Hello</div>)).to.equal(false);\nexpect(wrapper.contains(<div data-foo=\"foo\" data-bar=\"Hello\">Hello</div>)).to.equal(false);\nexpect(wrapper.contains(<div data-foo=\"foo\" data-bar=\"bar\" />)).to.equal(false);\n```\n\n```jsx\nconst wrapper = shallow((\n  <div>\n    <span>Hello</span>\n    <div>Goodbye</div>\n    <span>Again</span>\n  </div>\n));\n\nexpect(wrapper.contains([\n  <span>Hello</span>,\n  <div>Goodbye</div>,\n])).to.equal(true);\n\nexpect(wrapper.contains([\n  <span>Hello</span>,\n  <div>World</div>,\n])).to.equal(false);\n```\n\n```jsx\nconst calculatedValue = 2 + 2;\n\nconst wrapper = shallow((\n  <div>\n    <div data-foo=\"foo\" data-bar=\"bar\">{calculatedValue}</div>\n  </div>\n));\n\nexpect(wrapper.contains(<div data-foo=\"foo\" data-bar=\"bar\">{4}</div>)).to.equal(true);\n```\n\n#### Common Gotchas\n\n- `.contains()` expects a ReactElement, not a selector (like many other methods). Make sure that\nwhen you are calling it you are calling it with a ReactElement or a JSX expression.\n- Keep in mind that this method determines equality based on the equality of the node's children as\nwell.\n"
  },
  {
    "path": "docs/api/ShallowWrapper/containsAllMatchingElements.md",
    "content": "# `.containsAllMatchingElements(patternNodes) => Boolean`\n\nReturns whether or not all of the given react elements in `patternNodes` match an element in the wrapper's render tree. Every single element of `patternNodes` must be matched one or more times. Matching follows the rules for `containsMatchingElement`.\n\n\n#### Arguments\n\n1. `patternNodes` (`Array<ReactElement>`): The array of nodes whose presence you are detecting in the current instance's\nrender tree.\n\n\n#### Returns\n\n`Boolean`: whether or not the current wrapper has nodes anywhere in its render tree that looks\nlike the nodes passed in.\n\n\n#### Example\n\n\n```jsx\nconst style = { fontSize: 13 };\nconst wrapper = shallow((\n  <div>\n    <span className=\"foo\">Hello</span>\n    <div style={style}>Goodbye</div>\n    <span>Again</span>\n  </div>\n));\n\nexpect(wrapper.containsAllMatchingElements([\n  <span>Hello</span>,\n  <div>Goodbye</div>,\n])).to.equal(true);\n```\n\n\n#### Common Gotchas\n\n- `.containsAllMatchingElements()` expects an array of ReactElement, not a selector (like many other methods). Make sure that\nwhen you are calling it you are calling it with an array of ReactElement or a JSX expression.\n- Keep in mind that this method determines matching based on the matching of the node's children as\nwell.\n\n\n#### Related Methods\n\n- [`.matchesElement() => ShallowWrapper`](matchesElement.md) - rules for matching each node\n- [`.containsMatchingElement() => ShallowWrapper`](containsMatchingElement.md) - rules for matching whole wrapper\n- [`.containsAnyMatchingElements() => ShallowWrapper`](containsAnyMatchingElements.md) - must match at least one in patternNodes\n"
  },
  {
    "path": "docs/api/ShallowWrapper/containsAnyMatchingElements.md",
    "content": "# `.containsAnyMatchingElements(patternNodes) => Boolean`\n\nReturns whether or not at least one of the given react elements in `patternNodes` matches an element in the wrapper's render tree. One or more elements of `patternNodes` must be matched one or more times. Matching follows the rules for `containsMatchingElement`.\n\n\n#### Arguments\n\n1. `patternNodes` (`Array<ReactElement>`): The array of nodes whose presence you are detecting in the current instance's\nrender tree.\n\n\n#### Returns\n\n`Boolean`: whether or not the current wrapper has a node anywhere in its render tree that looks\nlike one of the array passed in.\n\n\n#### Example\n\n\n```jsx\nconst style = { fontSize: 13 };\nconst wrapper = shallow((\n  <div>\n    <span className=\"foo\">Hello</span>\n    <div style={style}>Goodbye</div>\n    <span>Again</span>\n  </div>\n));\n\nexpect(wrapper.containsAnyMatchingElements([\n  <span>Bonjour</span>,\n  <div>Goodbye</div>,\n])).to.equal(true);\n```\n\n\n#### Common Gotchas\n\n- `.containsAnyMatchingElements()` expects an array of ReactElement, not a selector (like many other methods). Make sure that\nwhen you are calling it you are calling it with an array ReactElement or a JSX expression.\n- Keep in mind that this method determines equality based on the equality of the node's children as\nwell.\n\n\n#### Related Methods\n\n- [`.matchesElement() => ShallowWrapper`](matchesElement.md) - rules for matching each node\n- [`.containsMatchingElement() => ShallowWrapper`](containsMatchingElement.md) - rules for matching whole wrapper\n- [`.containsAllMatchingElements() => ShallowWrapper`](containsAllMatchingElements.md) - must match all nodes in patternNodes\n"
  },
  {
    "path": "docs/api/ShallowWrapper/containsMatchingElement.md",
    "content": "# `.containsMatchingElement(patternNode) => Boolean`\n\nReturns whether or not a `patternNode` react element matches any element in the render tree.\n* the matches can happen anywhere in the wrapper's contents\n* the wrapper can contain more than one node; all are searched\n\nOtherwise, the match follows the same rules as `matchesElement`.\n\n\n#### Arguments\n\n1. `patternNode` (`ReactElement`): The node whose presence you are detecting in the current instance's\nrender tree.\n\n\n#### Returns\n\n`Boolean`: whether or not the current wrapper has a node anywhere in its render tree that matches\nthe one passed in.\n\n\n\n#### Example\n\n\n```jsx\nconst wrapper = shallow((\n  <div>\n    <div data-foo=\"foo\" data-bar=\"bar\">Hello</div>\n  </div>\n));\n\nexpect(wrapper.containsMatchingElement(<div data-foo=\"foo\" data-bar=\"bar\">Hello</div>)).to.equal(true);\nexpect(wrapper.containsMatchingElement(<div data-foo=\"foo\">Hello</div>)).to.equal(true);\n\nexpect(wrapper.containsMatchingElement(<div data-foo=\"foo\" data-bar=\"bar\" data-baz=\"baz\">Hello</div>)).to.equal(false);\nexpect(wrapper.containsMatchingElement(<div data-foo=\"foo\" data-bar=\"Hello\">Hello</div>)).to.equal(false);\nexpect(wrapper.containsMatchingElement(<div data-foo=\"foo\" data-bar=\"bar\" />)).to.equal(false);\n```\n\n#### Common Gotchas\n\n- `.containsMatchingElement()` expects a ReactElement, not a selector (like many other methods). Make sure that\nwhen you are calling it you are calling it with a ReactElement or a JSX expression.\n- Keep in mind that this method determines equality based on the equality of the node's children as\nwell.\n\n\n#### Related Methods\n\n- [`.containsAllMatchingElements() => ShallowWrapper`](containsAllMatchingElements.md) - must match all nodes in patternNodes\n- [`.containsAnyMatchingElements() => ShallowWrapper`](containsAnyMatchingElements.md) - must match at least one in patternNodes\n"
  },
  {
    "path": "docs/api/ShallowWrapper/context.md",
    "content": "# `.context([key]) => Any`\n\nReturns the context hash for the root node of the wrapper. Optionally pass in a prop name and it\nwill return just that value.\n\n\n#### Arguments\n\n1. `key` (`String` [optional]): If provided, the return value will be the `this.context[key]` of the\nroot component instance.\n\n\n\n#### Example\n\n\n```jsx\nconst wrapper = shallow(\n  <MyComponent />,\n  { context: { foo: 10 } },\n);\nexpect(wrapper.context().foo).to.equal(10);\nexpect(wrapper.context('foo')).to.equal(10);\n```\n\n\n#### Related Methods\n\n- [`.props() => Object`](props.md)\n- [`.prop(key) => Any`](prop.md)\n- [`.state([key]) => Any`](state.md)\n"
  },
  {
    "path": "docs/api/ShallowWrapper/debug.md",
    "content": "# `.debug([options]) => String`\n\nReturns an HTML-like string of the wrapper for debugging purposes. Useful to print out to the\nconsole when tests are not passing when you expect them to.\n\n\n#### Arguments\n\n`options` (`Object` [optional]):\n- `options.ignoreProps`: (`Boolean` [optional]): Whether props should be omitted in the resulting string. Props are included by default.\n- `options.verbose`: (`Boolean` [optional]): Whether arrays and objects passed as props should be verbosely printed.\n\n#### Returns\n\n`String`: The resulting string.\n\n\n\n#### Examples\n```jsx\nfunction Book({ title, pages }) {\n  return (\n    <div>\n      <h1 className=\"title\">{title}</h1>\n      {pages && (\n        <NumberOfPages\n          pages={pages}\n          object={{ a: 1, b: 2 }}\n        />\n      )}\n    </div>\n  );\n}\nBook.propTypes = {\n  title: PropTypes.string.isRequired,\n  pages: PropTypes.number,\n};\nBook.defaultProps = {\n  pages: null,\n};\n```\n```jsx\nconst wrapper = shallow(<Book title=\"Huckleberry Finn\" />);\nconsole.log(wrapper.debug());\n```\nOutputs to console:\n```text\n<div>\n <h1 className=\"title\">Huckleberry Finn</h1>\n</div>\n```\n\n```jsx\nconst wrapper = shallow((\n  <Book\n    title=\"Huckleberry Finn\"\n    pages=\"633 pages\"\n  />\n));\nconsole.log(wrapper.debug());\n```\nOutputs to console:\n```text\n<div>\n  <h1 className=\"title\">Huckleberry Finn</h1>\n  <NumberOfPages pages=\"633 pages\" object={{...}}/>\n</div>\n```\n\n```jsx\nconst wrapper = shallow((\n  <Book\n    title=\"Huckleberry Finn\"\n    pages=\"633 pages\"\n  />\n));\nconsole.log(wrapper.debug({ ignoreProps: true }));\n```\nOutputs to console:\n```text\n<div>\n  <h1>Huckleberry Finn</h1>\n  <NumberOfPages />\n</div>\n```\n\n\n```jsx\nconst wrapper = shallow((\n  <Book\n    title=\"Huckleberry Finn\"\n    pages=\"633 pages\"\n  />\n));\nconsole.log(wrapper.debug({ verbose: true }));\n```\nOutputs to console:\n```text\n<div>\n  <h1 className=\"title\">Huckleberry Finn</h1>\n  <NumberOfPages pages=\"633 pages\" object={{ a: 1, b: 2 }}/>\n</div>\n```\n"
  },
  {
    "path": "docs/api/ShallowWrapper/dive.md",
    "content": "# `.dive([options]) => ShallowWrapper`\n\nShallow render the one non-DOM child of the current wrapper, and return a wrapper around the result. It must be a single-node wrapper, and the node must be a React component.\n\nThere is no corresponding `dive` method for ReactWrappers.\n\nNOTE: can only be called on a wrapper of a single non-DOM component element node, otherwise it will throw an error. If you have to shallow-wrap a wrapper with multiple child nodes, use [`.shallow()`](shallow.md).\n\n\n#### Arguments\n\n1. `options` (`Object` [optional]):\n- `options.context`: (`Object` [optional]): Context to be passed into the component\n\n\n#### Returns\n\n`ShallowWrapper`: A new wrapper that wraps the current node after it's been shallow rendered.\n\n\n#### Examples\n\n```jsx\nfunction Bar() {\n  return (\n    <div>\n      <div className=\"in-bar\" />\n    </div>\n  );\n}\n```\n\n```jsx\nfunction Foo() {\n  return (\n    <div>\n      <Bar />\n    </div>\n  );\n}\n```\n\n```jsx\nconst wrapper = shallow(<Foo />);\nexpect(wrapper.find('.in-bar')).to.have.lengthOf(0);\nexpect(wrapper.find(Bar)).to.have.lengthOf(1);\nexpect(wrapper.find(Bar).dive().find('.in-bar')).to.have.lengthOf(1);\n```\n"
  },
  {
    "path": "docs/api/ShallowWrapper/equals.md",
    "content": "# `.equals(node) => Boolean`\n\nReturns whether or not the current wrapper root node render tree looks like the one passed in.\n\n\n#### Arguments\n\n1. `node` (`ReactElement`): The node whose presence you are detecting in the current instance's\nrender tree.\n\n\n\n#### Returns\n\n`Boolean`: whether or not the current wrapper has a node anywhere in it's render tree that looks\nlike the one passed in.\n\n\n\n#### Example\n\n\n```jsx\nfunction MyComponent() {\n  return <div className=\"foo bar\" />;\n}\n\nconst wrapper = shallow(<MyComponent />);\nexpect(wrapper.equals(<div className=\"foo bar\" />)).to.equal(true);\n```\n\n\n#### Common Gotchas\n\n- `.equals()` expects a ReactElement, not a selector (like many other methods). Make sure that\nwhen you are calling it you are calling it with a ReactElement or a JSX expression.\n- Keep in mind that this method determines equality based on the equality of the node's children as\nwell.\n- Following React's behavior, `.equals()` ignores properties whose values are `undefined`.\n"
  },
  {
    "path": "docs/api/ShallowWrapper/every.md",
    "content": "# `.every(selector) => Boolean`\n\nReturns whether or not all of the nodes in the wrapper match the provided selector.\n\n\n#### Arguments\n\n1. `selector` ([`EnzymeSelector`](../selector.md)): The selector to match.\n\n\n\n#### Returns\n\n`Boolean`: True if every node in the current wrapper matched the provided selector.\n\n\n\n#### Examples\n\n```jsx\nconst wrapper = shallow((\n  <div>\n    <div className=\"foo qoo\" />\n    <div className=\"foo boo\" />\n    <div className=\"foo hoo\" />\n  </div>\n));\nexpect(wrapper.find('.foo').every('.foo')).to.equal(true);\nexpect(wrapper.find('.foo').every('.qoo')).to.equal(false);\nexpect(wrapper.find('.foo').every('.bar')).to.equal(false);\n```\n\n#### Related Methods\n\n- [`.someWhere(predicate) => Boolean`](someWhere.md)\n- [`.everyWhere(predicate) => Boolean`](everyWhere.md)\n"
  },
  {
    "path": "docs/api/ShallowWrapper/everyWhere.md",
    "content": "# `.everyWhere(fn) => Boolean`\n\nReturns whether or not all of the nodes in the wrapper pass the provided predicate function.\n\n\n#### Arguments\n\n1. `predicate` (`ShallowWrapper => Boolean`): A predicate function to match the nodes.\n\n\n\n#### Returns\n\n`Boolean`: True if every node in the current wrapper passed the predicate function.\n\n\n\n#### Example\n\n```jsx\nconst wrapper = shallow((\n  <div>\n    <div className=\"foo qoo\" />\n    <div className=\"foo boo\" />\n    <div className=\"foo hoo\" />\n  </div>\n));\nexpect(wrapper.find('.foo').everyWhere((n) => n.hasClass('foo'))).to.equal(true);\nexpect(wrapper.find('.foo').everyWhere((n) => n.hasClass('qoo'))).to.equal(false);\nexpect(wrapper.find('.foo').everyWhere((n) => n.hasClass('bar'))).to.equal(false);\n```\n\n\n#### Related Methods\n\n- [`.some(selector) => Boolean`](some.md)\n- [`.every(selector) => Boolean`](every.md)\n- [`.everyWhere(predicate) => Boolean`](everyWhere.md)\n"
  },
  {
    "path": "docs/api/ShallowWrapper/exists.md",
    "content": "# `.exists([selector]) => Boolean`\n\nReturns whether or not any nodes exist in the wrapper. Or, if a selector is passed in, whether that selector has any matches in the wrapper.\n\n\n\n#### Arguments\n\n1. `selector` ([`EnzymeSelector`](../selector.md) [optional]): The selector to check existence for.\n\n\n\n#### Returns\n\n`Boolean`: whether or not any nodes are on the list, or the selector had any matches.\n\n\n\n#### Example\n\n\n```jsx\nconst wrapper = shallow(<div className=\"some-class\" />);\nexpect(wrapper.exists('.some-class')).to.equal(true);\nexpect(wrapper.find('.other-class').exists()).to.equal(false);\n```\n"
  },
  {
    "path": "docs/api/ShallowWrapper/filter.md",
    "content": "# `.filter(selector) => ShallowWrapper`\n\nReturns a new wrapper with only the nodes of the current wrapper that match the provided selector.\n\n\n#### Arguments\n\n1. `selector` ([`EnzymeSelector`](../selector.md)): The selector to match.\n\n\n\n#### Returns\n\n`ShallowWrapper`: A new wrapper that wraps the filtered nodes.\n\n\n\n#### Examples\n\n```jsx\nconst wrapper = shallow(<MyComponent />);\nexpect(wrapper.find('.foo').filter('.bar')).to.have.lengthOf(1);\n```\n\n#### Related Methods\n\n- [`.filterWhere(predicate) => ShallowWrapper`](filterWhere.md)\n"
  },
  {
    "path": "docs/api/ShallowWrapper/filterWhere.md",
    "content": "# `.filterWhere(fn) => ShallowWrapper`\n\nReturns a new wrapper with only the nodes of the current wrapper that, when passed into the\nprovided predicate function, return true.\n\n\n#### Arguments\n\n1. `predicate` (`ShallowWrapper => Boolean`): A predicate function that is passed a wrapped node.\n\n\n\n#### Returns\n\n`ShallowWrapper`: A new wrapper that wraps the filtered nodes.\n\n\n\n#### Example\n\n```jsx\nconst wrapper = shallow(<MyComponent />);\nconst complexFoo = wrapper.find('.foo').filterWhere((n) => typeof n.type() !== 'string');\nexpect(complexFoo).to.have.lengthOf(4);\n```\n\n\n#### Related Methods\n\n- [`.filter(selector) => ShallowWrapper`](filter.md)\n"
  },
  {
    "path": "docs/api/ShallowWrapper/find.md",
    "content": "# `.find(selector) => ShallowWrapper`\n\nFinds every node in the render tree of the current wrapper that matches the provided selector.\n\n\n#### Arguments\n\n1. `selector` ([`EnzymeSelector`](../selector.md)): The selector to match.\n\n\n\n#### Returns\n\n`ShallowWrapper`: A new wrapper that wraps the found nodes.\n\n\n\n#### Examples\n\nCSS Selectors:\n```jsx\nconst wrapper = shallow(<MyComponent />);\nexpect(wrapper.find('.foo')).to.have.lengthOf(1);\nexpect(wrapper.find('.bar')).to.have.lengthOf(3);\n\n// compound selector\nexpect(wrapper.find('div.some-class')).to.have.lengthOf(3);\n\n// CSS id selector\nexpect(wrapper.find('#foo')).to.have.lengthOf(1);\n```\n\nComponent Constructors:\n```jsx\nimport Foo from '../components/Foo';\n\nconst wrapper = shallow(<MyComponent />);\nexpect(wrapper.find(Foo)).to.have.lengthOf(1);\n```\n\nComponent Display Name:\n```jsx\nconst wrapper = shallow(<MyComponent />);\nexpect(wrapper.find('Foo')).to.have.lengthOf(1);\n```\n\nObject Property Selector:\n```jsx\nconst wrapper = shallow(<MyComponent />);\nexpect(wrapper.find({ prop: 'value' })).to.have.lengthOf(1);\n```\n\n\n#### Related Methods\n\n- [`.findWhere(predicate) => ShallowWrapper`](findWhere.md)\n"
  },
  {
    "path": "docs/api/ShallowWrapper/findWhere.md",
    "content": "# `.findWhere(fn) => ShallowWrapper`\n\nFinds every node in the render tree that returns true for the provided predicate function.\n\n\n#### Arguments\n\n1. `predicate` (`ShallowWrapper => Boolean`): A predicate function called with the passed in wrapped\nnodes.\n\n\n\n#### Returns\n\n`ShallowWrapper`: A new wrapper that wraps the found nodes.\n\n\n\n#### Example\n\n```jsx\nconst wrapper = shallow(<MyComponent />);\nconst complexComponents = wrapper.findWhere((n) => n.type() !== 'string');\nexpect(complexComponents).to.have.lengthOf(8);\n```\n\n\n#### Related Methods\n\n- [`.find(selector) => ShallowWrapper`](find.md)\n"
  },
  {
    "path": "docs/api/ShallowWrapper/first.md",
    "content": "# `.first() => ShallowWrapper`\n\nReduce the set of matched nodes to the first in the set, just like `.at(0)`.\n\n\n#### Returns\n\n`ShallowWrapper`: A new wrapper that wraps the first node in the set.\n\n\n#### Examples\n\n```jsx\nconst wrapper = shallow(<MyComponent />);\nexpect(wrapper.find(Foo).first().props().foo).to.equal('bar');\n```\n\n\n#### Related Methods\n\n- [`.at(index) => ShallowWrapper`](at.md) - retrieve a wrapper node at given index\n- [`.last() => ShallowWrapper`](last.md)\n"
  },
  {
    "path": "docs/api/ShallowWrapper/forEach.md",
    "content": "# `.forEach(fn) => Self`\n\nIterates through each node of the current wrapper and executes the provided function with a\nwrapper around the corresponding node passed in as the first argument.\n\n\n#### Arguments\n\n1. `fn` (`Function ( ShallowWrapper node, Number index )`): A callback to be run for every node in the collection.\nShould expect a ShallowWrapper as the first argument, and will be run with a context of the original\ninstance.\n\n\n\n#### Returns\n\n`ShallowWrapper`: Returns itself.\n\n\n\n#### Example\n\n```jsx\nconst wrapper = shallow((\n  <div>\n    <div className=\"foo bax\" />\n    <div className=\"foo bar\" />\n    <div className=\"foo baz\" />\n  </div>\n));\n\nwrapper.find('.foo').forEach((node) => {\n  expect(node.hasClass('foo')).to.equal(true);\n});\n```\n\n\n#### Related Methods\n\n- [`.map(fn) => ShallowWrapper`](map.md)\n"
  },
  {
    "path": "docs/api/ShallowWrapper/get.md",
    "content": "# `.get(index) => ReactElement`\n\nReturns the node at a given index of the current wrapper.\n\n\n#### Arguments\n\n1. `index` (`Number`): A zero-based integer indicating which node to retrieve.\n\n\n#### Returns\n\n`ReactElement`: The retrieved node.\n\n\n#### Examples\n\n```jsx\nconst wrapper = shallow(<MyComponent />);\nexpect(wrapper.find(Foo).get(0).props.foo).to.equal('bar');\n```\n\n\n#### Related Methods\n\n- [`.at(index) => ShallowWrapper`](at.md) - same, but returns the React node in a single-node wrapper.\n"
  },
  {
    "path": "docs/api/ShallowWrapper/getElement.md",
    "content": "# `.getElement() => ReactElement`\n\nReturns the wrapped ReactElement.\n\nIf the current wrapper is wrapping the root component, returns the root component's latest render output.\n\n\n#### Returns\n\n`ReactElement`: The retrieved ReactElement.\n\n\n\n#### Examples\n\n```jsx\nconst element = (\n  <div>\n    <span />\n    <span />\n  </div>\n);\n\nfunction MyComponent() {\n  return element;\n}\n\nconst wrapper = shallow(<MyComponent />);\nexpect(wrapper.getElement()).to.equal(element);\n```\n\n\n\n#### Related Methods\n\n- [`.getElements() => Array<ReactElement>`](getElements.md)\n"
  },
  {
    "path": "docs/api/ShallowWrapper/getElements.md",
    "content": "# `.getElements() => Array<ReactElement>`\n\nReturns the wrapped ReactElements\n\nIf the current wrapper is wrapping the root component, returns the root component's latest render output wrapped in an array.\n\n\n#### Returns\n\n`Array<ReactElement>`: The retrieved ReactElements.\n\n\n\n#### Examples\n\n```jsx\nconst one = <span />;\nconst two = <span />;\n\nfunction Test() {\n  return (\n    <div>\n      {one}\n      {two}\n    </div>\n  );\n}\n\nconst wrapper = shallow(<Test />);\nexpect(wrapper.find('span').getElements()).to.deep.equal([one, two]);\n```\n\n\n\n#### Related Methods\n\n- [`.getElement() => ReactElement`](getElement.md)\n"
  },
  {
    "path": "docs/api/ShallowWrapper/getWrappingComponent.md",
    "content": "# `.getWrappingComponent() => ShallowWrapper`\n\nIf a `wrappingComponent` was passed in `options`, this methods returns a `ShallowWrapper` around the rendered `wrappingComponent`. This `ShallowWrapper` can be used to update the `wrappingComponent`'s props, state, etc.\n\n\n#### Returns\n\n`ShallowWrapper`: A `ShallowWrapper` around the rendered `wrappingComponent`\n\n\n\n#### Examples\n\n```jsx\nimport { Provider } from 'react-redux';\nimport { Router } from 'react-router';\nimport store from './my/app/store';\nimport mockStore from './my/app/mockStore';\n\nfunction MyProvider(props) {\n  const { children, customStore } = props;\n\n  return (\n    <Provider store={customStore || store}>\n      <Router>\n        {children}\n      </Router>\n    </Provider>\n  );\n}\nMyProvider.propTypes = {\n  children: PropTypes.node,\n  customStore: PropTypes.shape({}),\n};\nMyProvider.defaultProps = {\n  children: null,\n  customStore: null,\n};\n\nconst wrapper = shallow(<MyComponent />, {\n  wrappingComponent: MyProvider,\n});\nconst provider = wrapper.getWrappingComponent();\nprovider.setProps({ customStore: mockStore });\n```\n"
  },
  {
    "path": "docs/api/ShallowWrapper/hasClass.md",
    "content": "# `.hasClass(className) => Boolean`\n\nReturns whether or not the wrapped node has a `className` prop including the passed in class name. It must be a single-node wrapper.\n\n\n#### Arguments\n\n1. `className` (`String` | `RegExp`): A single class name or a regex expression.\n\n\n#### Returns\n\n`Boolean`: whether or not the wrapped node has the class.\n\n\n#### Example\n\n\n```jsx\nconst wrapper = shallow(<MyComponent />);\nexpect(wrapper.find('.my-button').hasClass('disabled')).to.equal(true);\n```\n\n```jsx\n// Searching using RegExp works fine when classes were injected by a jss decorator\nconst wrapper = shallow(<MyComponent />);\nexpect(wrapper.find('.my-button').hasClass(/(ComponentName)-(other)-(\\d+)/)).to.equal(true);\n```\n\n### Common Gotchas\n\n- `.hasClass()` expects a class name, NOT a CSS selector. `.hasClass('.foo')` should be\n`.hasClass('foo')`\n"
  },
  {
    "path": "docs/api/ShallowWrapper/hostNodes.md",
    "content": "# `.hostNodes() => ShallowWrapper`\n\nReturns a new wrapper with only host nodes.\nWhen using `react-dom`, host nodes are HTML elements rather than custom React components, e.g. `<div>` versus `<MyComponent>`.\n\n\n#### Returns\n\n`ShallowWrapper`: A new wrapper that wraps the filtered nodes.\n\n\n#### Examples\n\nThe following code takes a wrapper with two nodes, one a `<MyComponent>` React component, and the other a `<span>`, and filters out the React component.\n\n```jsx\nconst wrapper = shallow((\n  <div>\n    <MyComponent className=\"foo\" />\n    <span className=\"foo\" />\n  </div>\n));\nconst twoNodes = wrapper.find('.foo');\nexpect(twoNodes.hostNodes()).to.have.lengthOf(1);\n```\n"
  },
  {
    "path": "docs/api/ShallowWrapper/html.md",
    "content": "# `.html() => String`\n\nReturns a string of the rendered HTML markup of the entire current render tree (not just the shallow-rendered part). It uses [static rendering](../render.md) internally. To see only the shallow-rendered part use [`.debug()`](debug.md).\n\nNote: can only be called on a wrapper of a single node.\n\n\n#### Returns\n\n`String`: The resulting HTML string\n\n\n#### Examples\n\n```jsx\nfunction Foo() {\n  return (<div className=\"in-foo\" />);\n}\n```\n\n```jsx\nfunction Bar() {\n  return (\n    <div className=\"in-bar\">\n      <Foo />\n    </div>\n  );\n}\n```\n\n```jsx\nconst wrapper = shallow(<Bar />);\nexpect(wrapper.html()).to.equal('<div class=\"in-bar\"><div class=\"in-foo\"></div></div>');\nexpect(wrapper.find(Foo).html()).to.equal('<div class=\"in-foo\"></div>');\n```\n\n```jsx\nconst wrapper = shallow(<div><b>important</b></div>);\nexpect(wrapper.html()).to.equal('<div><b>important</b></div>');\n```\n\n\n#### Related Methods\n\n- [`.text() => String`](text.md)\n- [`.debug() => String`](debug.md)\n"
  },
  {
    "path": "docs/api/ShallowWrapper/instance.md",
    "content": "# `.instance() => ReactComponent`\n\nReturns the single-node wrapper's node's underlying class instance; `this` in its methods. It must be a single-node wrapper.\n\nNOTE: can only be called on a wrapper instance that is also the root instance. With React `16` and above, `instance()` returns `null` for functional components, regardless of [hooks](https://reactjs.org/docs/hooks-intro.html) usage.\n\n#### Returns\n\n`ReactComponent|DOMComponent`: The retrieved instance.\n\n#### Example\n\n<!-- eslint react/prop-types: 0, react/prefer-stateless-function: 0 -->\n\n```jsx\nfunction SFC() {\n  return <div>MyFunction</div>;\n}\n\nclass Stateful extends React.Component {\n  render() {\n    return <div>MyClass</div>;\n  }\n}\n```\n\n#### React 16.x\n\n```jsx\ntest('wrapper instance is null', () => {\n  const wrapper = shallow(<SFC />);\n  const instance = wrapper.instance();\n\n  expect(instance).to.equal(null);\n});\n\ntest('wrapper instance is not null', () => {\n  const wrapper = shallow(<Stateful />);\n  const instance = wrapper.instance();\n\n  expect(instance).to.be.instanceOf(MyCStatefullass);\n});\n```\n\n#### React 15.x\n\n```jsx\ntest('wrapper instance is not null', () => {\n  const wrapper = shallow(<SFC />);\n  const instance = wrapper.instance();\n\n  expect(instance).to.be.instanceOf(SFC);\n});\n\ntest('wrapper instance is not null', () => {\n  const wrapper = shallow(<Stateful />);\n  const instance = wrapper.instance();\n\n  expect(instance).to.be.instanceOf(Stateful);\n});\n```\n"
  },
  {
    "path": "docs/api/ShallowWrapper/invoke.md",
    "content": "# `.invoke(invokePropName)(...args) => Any`\n\nInvokes a function prop.\n\n#### Arguments\n\n1. `propName` (`String`): The function prop that is invoked\n2. `...args` (`Any` [optional]): Arguments that is passed to the prop function\n\nThis essentially calls wrapper.prop(propName)(...args).\n\n#### Returns\n\n`Any`: Returns the value from the prop function\n\n#### Example\n\n```jsx\nclass Foo extends React.Component {\n  loadData() {\n    return fetch();\n  }\n\n  render() {\n    return (\n      <div>\n        <button\n          type=\"button\"\n          onClick={() => this.loadData()}\n        >\n          Load more\n        </button>\n      </div>\n    );\n  }\n}\nconst wrapper = shallow(<Foo />);\nwrapper.find('button').invoke('onClick')().then(() => {\n  // expect()\n});\n```\n"
  },
  {
    "path": "docs/api/ShallowWrapper/is.md",
    "content": "# `.is(selector) => Boolean`\n\nReturns whether or not the single wrapped node matches the provided selector. It must be a single-node wrapper.\n\n\n#### Arguments\n\n1. `selector` ([`EnzymeSelector`](../selector.md)): The selector to match.\n\n\n#### Returns\n\n`Boolean`: whether or not the wrapped node matches the provided selector.\n\n\n#### Example\n\n\n```jsx\nconst wrapper = shallow(<div className=\"some-class other-class\" />);\nexpect(wrapper.is('.some-class')).to.equal(true);\n```\n"
  },
  {
    "path": "docs/api/ShallowWrapper/isEmpty.md",
    "content": "# `.isEmpty() => Boolean`\n**Deprecated**: Use [`.exists()`](exists.md) instead.\n\nReturns whether or not the wrapper is empty.\n\n\n#### Returns\n\n`Boolean`: whether or not the wrapper is empty.\n\n\n#### Example\n\n\n```jsx\nconst wrapper = shallow(<div className=\"some-class\" />);\nexpect(wrapper.find('.other-class').isEmpty()).to.equal(true);\n```\n"
  },
  {
    "path": "docs/api/ShallowWrapper/isEmptyRender.md",
    "content": "# `.isEmptyRender() => Boolean`\n\nReturns whether or not the wrapper would ultimately render only the allowed falsy values: `false` or `null`.\n\n#### Returns\n\n`Boolean`: whether the return is falsy\n\n#### Example\n\n```jsx\nfunction Foo() {\n  return null;\n}\n\nconst wrapper = shallow(<Foo />);\nexpect(wrapper.isEmptyRender()).to.equal(true);\n```\n"
  },
  {
    "path": "docs/api/ShallowWrapper/key.md",
    "content": "# `.key() => String`\n\nReturns the key value for the node of the current wrapper. It must be a single-node wrapper.\n\n#### Example\n\n\n```jsx\nconst wrapper = shallow((\n  <ul>\n    {['foo', 'bar'].map((s) => <li key={s}>{s}</li>)}\n  </ul>\n)).find('li');\nexpect(wrapper.at(0).key()).to.equal('foo');\nexpect(wrapper.at(1).key()).to.equal('bar');\n```\n"
  },
  {
    "path": "docs/api/ShallowWrapper/last.md",
    "content": "# `.last() => ShallowWrapper`\n\nReduce the set of matched nodes to the last in the set, just like `.at(length - 1)`.\n\n\n#### Returns\n\n`ShallowWrapper`: A new wrapper that wraps the last node in the set.\n\n\n#### Examples\n\n```jsx\nconst wrapper = shallow(<MyComponent />);\nexpect(wrapper.find(Foo).last().props().foo).to.equal('bar');\n```\n\n\n#### Related Methods\n\n- [`.at(index) => ShallowWrapper`](at.md) - retrieve a wrapper node by index\n- [`.first() => ShallowWrapper`](first.md)\n"
  },
  {
    "path": "docs/api/ShallowWrapper/length.md",
    "content": "# `.length => number`\n\nReturns the number of React nodes enclosed in this wrapper.\n\n\n\n#### Returns\n\n`Number`: count of nodes in the list in this wrapper.\n\n\n\n#### Example\n\n\n```jsx\nconst wrapper = shallow(<div />);\nexpect(wrapper.length).to.equal(1);\n```\n"
  },
  {
    "path": "docs/api/ShallowWrapper/map.md",
    "content": "# `.map(fn) => Array<Any>`\n\nMaps the current array of nodes to another array. Each node is passed in as a `ShallowWrapper`\nto the map function.\n\n\n#### Arguments\n\n1. `fn` (`Function ( ShallowWrapper node, Number index ) => Any`): A mapping function to be run for every node in\nthe collection, the results of which will be mapped to the returned array. Should expect a ShallowWrapper as the first argument, and will be run with a context of\nthe original instance.\n\n\n\n#### Returns\n\n`Array<Any>`: Returns an array of the returned values from the mapping function..\n\n\n\n#### Example\n\n```jsx\nconst wrapper = shallow((\n  <div>\n    <div className=\"foo\">bax</div>\n    <div className=\"foo\">bar</div>\n    <div className=\"foo\">baz</div>\n  </div>\n));\n\nconst texts = wrapper.find('.foo').map((node) => node.text());\nexpect(texts).to.eql(['bax', 'bar', 'baz']);\n```\n\n\n#### Related Methods\n\n- [`.forEach(fn) => ShallowWrapper`](forEach.md)\n- [`.reduce(fn[, initialValue]) => Any`](reduce.md)\n- [`.reduceRight(fn[, initialValue]) => Any`](reduceRight.md)\n"
  },
  {
    "path": "docs/api/ShallowWrapper/matchesElement.md",
    "content": "# `.matchesElement(patternNode) => Boolean`\n\nReturns whether or not a given react element `patternNode` matches the wrapper's render tree. It must be a single-node wrapper, and only the root node is checked.\n\nThe `patternNode` acts like a wildcard. For it to match a node in the wrapper:\n* tag names must match\n* contents must match:  In text nodes, leading and trailing spaces are ignored, but not space in the middle. Child elements must match according to these rules, recursively.\n* `patternNode` props (attributes) must appear in the wrapper's nodes, but not the other way around. Their values must match if they do appear.\n* `patternNode` style CSS properties must appear in the wrapper's node's style, but not the other way around. Their values must match if they do appear.\n\n\n#### Arguments\n\n1. `patternNode` (`ReactElement`): The node whose presence you are detecting in the wrapper's single node.\n\n\n#### Returns\n\n`Boolean`: whether or not the current wrapper match the one passed in.\n\n\n#### Example\n\n<!-- eslint-disable react/button-has-type -->\n```jsx\nclass MyComponent extends React.Component {\n  constructor(props) {\n    super(props);\n    this.handleClick = this.handleClick.bind(this);\n  }\n\n  handleClick() {\n    // ...\n  }\n\n  render() {\n    return (\n      <button type=\"button\" onClick={this.handleClick} className=\"foo bar\">Hello</button>\n    );\n  }\n}\n\nconst wrapper = shallow(<MyComponent />);\nexpect(wrapper.matchesElement(<button>Hello</button>)).to.equal(true);\nexpect(wrapper.matchesElement(<button className=\"foo bar\">Hello</button>)).to.equal(true);\n```\n\n\n#### Common Gotchas\n\n- `.matchesElement()` expects a ReactElement, not a selector (like many other methods). Make sure that\nwhen you are calling it you are calling it with a ReactElement or a JSX expression.\n- Keep in mind that this method determines matching based on the matching of the node's children as\nwell.\n\n\n#### Related Methods\n\n- [`.containsMatchingElement() => ShallowWrapper`](containsMatchingElement.md) - searches all nodes in the wrapper, and searches their entire depth\n"
  },
  {
    "path": "docs/api/ShallowWrapper/name.md",
    "content": "# `.name() => String|null`\n\nReturns the name of the current node of this wrapper. If it's a composite component, this will be\nthe name of the top-most rendered component. If it's a native DOM node, it will be a string of the\ntag name. If it's `null`, it will be `null`.\n\nThe order of precedence on returning the name is: `type.displayName` -> `type.name` -> `type`.\n\nNote: can only be called on a wrapper of a single node.\n\n\n#### Returns\n\n`String|null`: The name of the current node\n\n\n\n#### Examples\n\n```jsx\nconst wrapper = shallow(<div />);\nexpect(wrapper.name()).to.equal('div');\n```\n\n```jsx\nfunction SomeWrappingComponent() {\n  return <Foo />;\n}\nconst wrapper = shallow(<SomeWrappingComponent />);\nexpect(wrapper.name()).to.equal('Foo');\n```\n\n```jsx\nFoo.displayName = 'A cool custom name';\nfunction SomeWrappingComponent() {\n  return <Foo />;\n}\nconst wrapper = shallow(<SomeWrappingComponent />);\nexpect(wrapper.name()).to.equal('A cool custom name');\n```\n"
  },
  {
    "path": "docs/api/ShallowWrapper/not.md",
    "content": "# `.not(selector) => ShallowWrapper`\n\nReturns a new wrapper with only the nodes of the current wrapper that don't match the provided\nselector.\n\nThis method is effectively the negation or inverse of [`filter`](filter.md).\n\n\n#### Arguments\n\n1. `selector` ([`EnzymeSelector`](../selector.md)): The selector to match.\n\n\n\n#### Returns\n\n`ShallowWrapper`: A new wrapper that wraps the filtered nodes.\n\n\n\n#### Examples\n\n```jsx\nconst wrapper = shallow(<MyComponent />);\nexpect(wrapper.find('.foo').not('.bar')).to.have.lengthOf(1);\n```\n\n#### Related Methods\n\n- [`.filterWhere(predicate) => ShallowWrapper`](filterWhere.md)\n- [`.filter(selector) => ShallowWrapper`](filter.md)\n"
  },
  {
    "path": "docs/api/ShallowWrapper/parent.md",
    "content": "# `.parent() => ShallowWrapper`\n\nReturns a wrapper with the direct parent of the node in the current wrapper.\n\n\n#### Returns\n\n`ShallowWrapper`: A new wrapper that wraps the resulting nodes.\n\n\n#### Examples\n\n```jsx\nconst wrapper = shallow(<ToDoList />);\nexpect(wrapper.find('ul').parent().is('div')).to.equal(true);\n```\n\n#### Related Methods\n\n- [`.parents([selector]) => ShallowWrapper`](parents.md)\n- [`.children([selector]) => ShallowWrapper`](children.md)\n- [`.closest(selector) => ShallowWrapper`](closest.md)\n"
  },
  {
    "path": "docs/api/ShallowWrapper/parents.md",
    "content": "# `.parents([selector]) => ShallowWrapper`\n\nReturns a wrapper around all of the parents/ancestors of the single node in the wrapper. Does not include the node itself.\nOptionally, a selector can be provided and it will filter the parents by this selector. It must be a single-node wrapper.\n\n\n#### Arguments\n\n1. `selector` ([`EnzymeSelector`](../selector.md) [optional]): The selector to filter the parents by.\n\n\n#### Returns\n\n`ShallowWrapper`: A new wrapper that wraps the resulting nodes.\n\n\n#### Examples\n\n```jsx\nconst wrapper = shallow(<ToDoList />);\nexpect(wrapper.find('ul').parents()).to.have.lengthOf(2);\n```\n\n#### Related Methods\n\n- [`.children([selector]) => ShallowWrapper`](children.md)\n- [`.parent() => ShallowWrapper`](parent.md)\n- [`.closest(selector) => ShallowWrapper`](closest.md)\n"
  },
  {
    "path": "docs/api/ShallowWrapper/prop.md",
    "content": "# `.prop(key) => Any`\n\nReturns the prop value for the root node of the wrapper with the provided key. It must be a single-node wrapper.\n\nNOTE: When called on a shallow wrapper, `.prop(key)` will return values for\nprops on the root node that the component *renders*, not the component itself.\nTo return the props for the entire React component, use `wrapper.instance().props`.\nSee [`.instance() => ReactComponent`](instance.md)\n\n#### Arguments\n\n1. `key` (`String`): The prop name, that is, `this.props[key]` or `props[key]` for the root node of the wrapper.\n\n\n#### Example\n\n\n```jsx\nimport PropTypes from 'prop-types';\nimport ValidateNumberInputComponent from './ValidateNumberInputComponent';\n\nclass MyComponent extends React.Component {\n  constructor(...args) {\n    super(...args);\n\n    this.state = {\n      number: 0,\n    };\n    this.onValidNumberInput = this.onValidNumberInput.bind(this);\n  }\n\n  onValidNumberInput(e) {\n    const number = e.target.value;\n    if (!number || typeof number === 'number') {\n      this.setState({ number });\n    }\n  }\n\n  render() {\n    const { includedProp } = this.props;\n    const { number } = this.state;\n    return (\n      <div className=\"foo bar\" includedProp={includedProp}>\n        <ValidateNumberInputComponent onChangeHandler={onValidNumberInput} number={number} />\n      </div>\n    );\n  }\n}\nMyComponent.propTypes = {\n  includedProp: PropTypes.string.isRequired,\n};\n\nconst wrapper = shallow(<MyComponent includedProp=\"Success!\" excludedProp=\"I'm not included\" />);\nexpect(wrapper.prop('includedProp')).to.equal('Success!');\n\nconst validInput = 1;\nwrapper.find('ValidateNumberInputComponent').prop('onChangeHandler')(validInput);\nexpect(wrapper.state('number')).to.equal(validInput);\n\nconst invalidInput = 'invalid input';\nwrapper.find('ValidateNumberInputComponent').prop('onChangeHandler')(invalidInput);\nexpect(wrapper.state('number')).to.equal(0);\n\n// Warning: .prop(key) only returns values for props that exist in the root node.\n// See the note above about wrapper.instance().props to return all props in the React component.\n\nconsole.log(wrapper.prop('includedProp'));\n// \"Success!\"\n\nconsole.log(wrapper.prop('excludedProp'));\n// undefined\n\nconsole.log(wrapper.instance().props.excludedProp);\n// \"I'm not included\"\n```\n\n\n#### Related Methods\n\n- [`.props() => Object`](props.md)\n- [`.state([key]) => Any`](state.md)\n- [`.context([key]) => Any`](context.md)\n"
  },
  {
    "path": "docs/api/ShallowWrapper/props.md",
    "content": "# `.props() => Object`\n\nReturns the props object for the root node of the wrapper. It must be a single-node wrapper.\n\nNOTE: When called on a shallow wrapper, `.props()` will return values for props on the root node that the component *renders*, not the component itself.\n\nThis method is a reliable way of accessing the props of a node; `wrapper.instance().props` will work as well, but in React 16+, stateless functional components do not have an instance. See [`.instance() => ReactComponent`](instance.md)\n\n\n#### Example\n```jsx\nimport PropTypes from 'prop-types';\n\nfunction MyComponent(props) {\n  const { includedProp } = props;\n  return (\n    <div className=\"foo bar\" includedProp={includedProp}>Hello</div>\n  );\n}\nMyComponent.propTypes = {\n  includedProp: PropTypes.string.isRequired,\n};\n\nconst wrapper = shallow(<MyComponent includedProp=\"Success!\" excludedProp=\"I'm not included\" />);\nexpect(wrapper.props().includedProp).to.equal('Success!');\n\n// Warning: .props() only returns props that are passed to the root node,\n// which does not include excludedProp in this example.\n// See the note above about wrapper.instance().props.\n\nconsole.log(wrapper.props());\n// {children: \"Hello\", className: \"foo bar\", includedProp=\"Success!\"}\n\nconsole.log(wrapper.instance().props); // React 15.x - working as expected\n// {children: \"Hello\", className: \"foo bar\", includedProp:\"Success!\", excludedProp: \"I'm not included\"}\n\nconsole.log(wrapper.instance().props);\n// React 16.* - Uncaught TypeError: Cannot read property 'props' of null\n```\n\n\n#### Related Methods\n\n- [`.prop(key) => Any`](prop.md)\n- [`.state([key]) => Any`](state.md)\n- [`.context([key]) => Any`](context.md)\n"
  },
  {
    "path": "docs/api/ShallowWrapper/reduce.md",
    "content": "# `.reduce(fn[, initialValue]) => Any`\n\nApplies the provided reducing function to every node in the wrapper to reduce to a single value.\nEach node is passed in as a `ShallowWrapper`, and is processed from left to right.\n\n\n#### Arguments\n\n1. `fn` (`Function`): A reducing function to be run for every node in the collection, with the\nfollowing arguments:\n  - `value` (`T`): The value returned by the previous invocation of this function\n  - `node` (`ShallowWrapper`): A wrapper around the node being processed\n  - `index` (`Number`): The index of the node being processed\n\n2. `initialValue` (`T` [optional]): If provided, this will be passed in as the first argument to the first invocation of the reducing function. If omitted, the first `node` will be provided and the iteration will begin on the second node in the collection.\n\n\n#### Returns\n\n`T`: Returns an array of the returned values from the mapping function...\n\n\n#### Example\n\n```jsx\nfunction Foo() {\n  return (\n    <div>\n      <Bar amount={2} />\n      <Bar amount={4} />\n      <Bar amount={8} />\n    </div>\n  );\n}\n```\n\n```jsx\nconst wrapper = shallow(<Foo />);\nconst total = wrapper.find(Bar).reduce((amount, n) => amount + n.prop('amount'), 0);\nexpect(total).to.equal(14);\n```\n\n\n#### Related Methods\n\n- [`.reduceRight(fn[, initialValue]) => Any`](reduceRight.md)\n- [`.forEach(fn) => ShallowWrapper`](forEach.md)\n- [`.map(fn) => Array<Any>`](map.md)\n"
  },
  {
    "path": "docs/api/ShallowWrapper/reduceRight.md",
    "content": "# `.reduceRight(fn[, initialValue]) => Any`\n\nApplies the provided reducing function to every node in the wrapper to reduce to a single value.\nEach node is passed in as a `ShallowWrapper`, and is processed from right to left.\n\n\n#### Arguments\n\n1. `fn` (`Function`): A reducing function to be run for every node in the collection, with the\nfollowing arguments:\n  - `value` (`T`): The value returned by the previous invocation of this function\n  - `node` (`ShallowWrapper`): A single-node wrapper around the node being processed\n  - `index` (`Number`): The index of the node being processed\n\n2. `initialValue` (`T` [optional]): If provided, this will be passed in as the first argument to the first invocation of the reducing function. If omitted, the first `node` will be provided and the iteration will begin on the second node in the collection.\n\n\n#### Returns\n\n`T`: Returns an array of the returned values from the mapping function...\n\n\n#### Example\n\n```jsx\nfunction Foo() {\n  return (\n    <div>\n      <Bar amount={2} />\n      <Bar amount={4} />\n      <Bar amount={8} />\n    </div>\n  );\n}\n```\n\n```jsx\nconst wrapper = shallow(<Foo />);\nconst total = wrapper.find(Bar).reduceRight((amount, n) => amount + n.prop('amount'), 0);\nexpect(total).to.equal(14);\n```\n\n\n#### Related Methods\n\n- [`.reduce(fn[, initialValue]) => Any`](reduce.md)\n- [`.forEach(fn) => ShallowWrapper`](forEach.md)\n- [`.map(fn) => Array<Any>`](map.md)\n"
  },
  {
    "path": "docs/api/ShallowWrapper/render.md",
    "content": "# `.render() => CheerioWrapper`\n\nReturns a CheerioWrapper around the rendered HTML of the single node's subtree.\nIt must be a single-node wrapper.\n\n\n#### Returns\n\n`CheerioWrapper`: The resulting Cheerio object\n\n\n#### Examples\n\n```jsx\nfunction Foo() {\n  return (<div className=\"in-foo\" />);\n}\n```\n\n```jsx\nfunction Bar() {\n  return (\n    <div className=\"in-bar\">\n      <Foo />\n    </div>\n  );\n}\n```\n\n```jsx\nconst wrapper = shallow(<Bar />);\nexpect(wrapper.find('.in-foo')).to.have.lengthOf(0);\nexpect(wrapper.render().find('.in-foo')).to.have.lengthOf(1);\n```\n"
  },
  {
    "path": "docs/api/ShallowWrapper/renderProp.md",
    "content": "# `.renderProp(propName)(...args) => ShallowWrapper`\n\nReturns a function that, when called with arguments `args`, will return a new wrapper based on the render prop in the original wrapper's prop `propName`.\n\nNOTE: can only be called on wrapper of a single non-DOM component element node.\n\n#### Arguments\n\n1. `propName` (`String`):\n1. `...args` (`Array<Any>`):\n\nThis essentially calls `wrapper.prop(propName)(...args)`.\n\n#### Returns\n\n`ShallowWrapper`: A new wrapper that wraps the node returned from the render prop.\n\n#### Examples\n\n##### Test Setup\n\n```jsx\nclass Mouse extends React.Component {\n  constructor() {\n    super();\n    this.state = { x: 0, y: 0 };\n  }\n\n  render() {\n    const { render } = this.props;\n    return (\n      <div\n        style={{ height: '100%' }}\n        onMouseMove={(event) => {\n          this.setState({\n            x: event.clientX,\n            y: event.clientY,\n          });\n        }}\n      >\n        {render(this.state)}\n      </div>\n    );\n  }\n}\n\nMouse.propTypes = {\n  render: PropTypes.func.isRequired,\n};\n```\n\n```jsx\nfunction App() {\n  return (\n    <div style={{ height: '100%' }}>\n      <Mouse\n        render={(x = 0, y = 0) => (\n          <h1>\n            The mouse position is ({x}, {y})\n          </h1>\n        )}\n      />\n    </div>\n  );\n}\n```\n\n##### Testing with no arguments\n\n```jsx\nconst wrapper = shallow(<App />)\n  .find(Mouse)\n  .renderProp('render')();\n\nexpect(wrapper.equals(<h1>The mouse position is 0, 0</h1>)).to.equal(true);\n```\n\n##### Testing with multiple arguments\n\n```jsx\nconst wrapper = shallow(<App />)\n  .find(Mouse)\n  .renderProp('render')(10, 20);\n\nexpect(wrapper.equals(<h1>The mouse position is 10, 20</h1>)).to.equal(true);\n```\n"
  },
  {
    "path": "docs/api/ShallowWrapper/setContext.md",
    "content": "# `.setContext(context) => Self`\n\nA method that sets the context of the root component, and re-renders. Useful for when you are\nwanting to test how the component behaves over time with changing contexts.\n\nNOTE: can only be called on a wrapper instance that is also the root instance.\n\n\n#### Arguments\n\n1. `context` (`Object`): An object containing new props to merge in with the current state\n\n\n\n#### Returns\n\n`ShallowWrapper`: Returns itself.\n\n\n\n#### Example\n\n```jsx\nimport React from 'react';\nimport PropTypes from 'prop-types';\n\nfunction SimpleComponent(props, context) {\n  const { name } = context;\n  return <div>{name}</div>;\n}\nSimpleComponent.contextTypes = {\n  name: PropTypes.string,\n};\n```\n```jsx\nconst context = { name: 'foo' };\nconst wrapper = shallow(<SimpleComponent />, { context });\nexpect(wrapper.text()).to.equal('foo');\nwrapper.setContext({ name: 'bar' });\nexpect(wrapper.text()).to.equal('bar');\nwrapper.setContext({ name: 'baz' });\nexpect(wrapper.text()).to.equal('baz');\n```\n\n#### Common Gotchas\n\n- `.setContext()` can only be used on a wrapper that was initially created with a call to `shallow()`\nthat includes a `context` specified in the options argument.\n- The root component you are rendering must have a `contextTypes` static property.\n\n\n#### Related Methods\n\n- [`.setState(state[, callback]) => Self`](setState.md)\n- [`.setProps(props[, callback]) => Self`](setProps.md)\n\n\n"
  },
  {
    "path": "docs/api/ShallowWrapper/setProps.md",
    "content": "# `.setProps(nextProps[, callback]) => Self`\n\nA method that sets the props of the root component, and re-renders. Useful for when you are\nwanting to test how the component behaves over time with changing props. Calling this, for\ninstance, will call the `componentWillReceiveProps` lifecycle method.\n\nSimilar to `setState`, this method accepts a props object and will merge it in with the already\nexisting props.\n\nNOTE: can only be called on a wrapper instance that is also the root instance.\n\n\n#### Arguments\n\n1. `nextProps` (`Object`): An object containing new props to merge in with the current props\n2. `callback` (`Function` [optional]): If provided, the callback function will be executed once setProps has completed\n\n\n#### Returns\n\n`ShallowWrapper`: Returns itself.\n\n\n#### Example\n\n```jsx\nimport React from 'react';\nimport PropTypes from 'prop-types';\n\nfunction Foo({ name }) {\n  return (\n    <div className={name} />\n  );\n}\nFoo.propTypes = {\n  name: PropTypes.string.isRequired,\n};\n```\n```jsx\nconst wrapper = shallow(<Foo name=\"foo\" />);\nexpect(wrapper.find('.foo')).to.have.lengthOf(1);\nexpect(wrapper.find('.bar')).to.have.lengthOf(0);\nwrapper.setProps({ name: 'bar' });\nexpect(wrapper.find('.foo')).to.have.lengthOf(0);\nexpect(wrapper.find('.bar')).to.have.lengthOf(1);\n```\n\n```jsx\nimport sinon from 'sinon';\n\nconst spy = sinon.spy(MyComponent.prototype, 'componentWillReceiveProps');\n\nconst wrapper = shallow(<MyComponent foo=\"bar\" />);\nexpect(spy).to.have.property('callCount', 0);\nwrapper.setProps({ foo: 'foo' });\nexpect(spy).to.have.property('callCount', 1);\n```\n\n\n#### Related Methods\n\n- [`.setState(state) => Self`](setState.md)\n- [`.setContext(context) => Self`](setContext.md)\n"
  },
  {
    "path": "docs/api/ShallowWrapper/setState.md",
    "content": "# `.setState(nextState[, callback]) => Self`\n\nA method to invoke `setState()` on the root component instance, similar to how you might in the\nmethods of the component, and re-renders. This method is useful for testing your component\nin hard-to-achieve states, however should be used sparingly. If possible, you should utilize\nyour component's external API (which is often accessible via [`.instance()`](instance.md)) in order\nto get it into whatever state you want to test, in order to be as accurate of a test as possible.\nThis is not always practical, however.\n\nNOTE: can only be called on a wrapper instance that is also the root instance.\n\n\n#### Arguments\n\n1. `nextState` (`Object`): An object containing new state to merge in with the current state\n2. `callback` (`Function` [optional]): If provided, the callback function will be executed once setState has completed\n\n\n#### Returns\n\n`ShallowWrapper`: Returns itself.\n\n\n#### Example\n\n```jsx\nclass Foo extends React.Component {\n  constructor(props) {\n    super(props);\n    this.state = { name: 'foo' };\n  }\n\n  render() {\n    const { name } = this.state;\n    return (\n      <div className={name} />\n    );\n  }\n}\n```\n```jsx\nconst wrapper = shallow(<Foo />);\nexpect(wrapper.find('.foo')).to.have.lengthOf(1);\nexpect(wrapper.find('.bar')).to.have.lengthOf(0);\nwrapper.setState({ name: 'bar' });\nexpect(wrapper.find('.foo')).to.have.lengthOf(0);\nexpect(wrapper.find('.bar')).to.have.lengthOf(1);\n```\n\n\n#### Related Methods\n\n- [`.setProps(props[, callback]) => Self`](setProps.md)\n- [`.setContext(context) => Self`](setContext.md)\n"
  },
  {
    "path": "docs/api/ShallowWrapper/shallow.md",
    "content": "# `.shallow([options]) => ShallowWrapper`\n\nShallow renders the root node and returns a shallow wrapper around it.\nIt must be a single-node wrapper.\n\n\n#### Arguments\n\n1. `options` (`Object` [optional]):\n  - `options.context`: (`Object` [optional]): Context to be passed into the component\n  - `options.disableLifecycleMethods`: (`Boolean` [optional]): If set to true, `componentDidMount`\nis not called on the component, and `componentDidUpdate` is not called after\n[`setProps`](ShallowWrapper/setProps.md) and [`setContext`](ShallowWrapper/setContext.md). Default to `false`.\n\n\n#### Returns\n\n`ShallowWrapper`: A new wrapper that wraps the node after it's been shallow rendered.\n\n\n#### Examples\n\n```jsx\nfunction Bar() {\n  return (\n    <div>\n      <div className=\"in-bar\" />\n    </div>\n  );\n}\n```\n\n```jsx\nfunction Foo() {\n  return (\n    <div>\n      <Bar />\n    </div>\n  );\n}\n```\n\n```jsx\nconst wrapper = shallow(<Foo />);\nexpect(wrapper.find('.in-bar')).to.have.lengthOf(0);\nexpect(wrapper.find(Bar)).to.have.lengthOf(1);\nexpect(wrapper.find(Bar).shallow().find('.in-bar')).to.have.lengthOf(1);\n```\n"
  },
  {
    "path": "docs/api/ShallowWrapper/simulate.md",
    "content": "# `.simulate(event[, ...args]) => Self`\n\nSimulate events on the root node in the wrapper. It must be a single-node wrapper.\n\n\n#### Arguments\n\n1. `event` (`String`): The event name to be simulated\n2. `...args` (`Any` [optional]): A mock event object that will get passed through to the event handlers.\n\n\n#### Returns\n\n`ShallowWrapper`: Returns itself.\n\n\n#### Example `class component`\n\n```jsx\nclass Foo extends React.Component {\n  constructor(props) {\n    super(props);\n    this.state = { count: 0 };\n  }\n\n  render() {\n    const { count } = this.state;\n    return (\n      <div>\n        <div className={`clicks-${count}`}>\n          {count} clicks\n        </div>\n        <a href=\"url\" onClick={() => { this.setState({ count: count + 1 }); }}>\n          Increment\n        </a>\n      </div>\n    );\n  }\n}\n\nconst wrapper = shallow(<Foo />);\n\nexpect(wrapper.find('.clicks-0').length).to.equal(1);\nwrapper.find('a').simulate('click');\nexpect(wrapper.find('.clicks-1').length).to.equal(1);\n```\n\n#### Example `functional component`\n\n```jsx\nfunction Foo({ width, height, onChange }) {\n  return (\n    <div>\n      <input name=\"width\" value={width} onChange={onChange} />\n      <input name=\"height\" value={height} onChange={onChange} />\n    </div>\n  );\n}\nFoo.propTypes = {\n  width: PropTypes.number.isRequired,\n  height: PropTypes.number.isRequired,\n  onChange: PropTypes.func.isRequired,\n};\n\nconst testState = { width: 10, height: 20 };\nconst wrapper = shallow((\n  <Foo\n    width={testState.width}\n    height={testState.height}\n    onChange={(e) => {\n      testState[e.target.name] = e.target.value;\n    }}\n  />\n));\n\nexpect(wrapper.find('input').at(0).prop('value')).toEqual(10);\nexpect(wrapper.find('input').at(1).prop('value')).toEqual(20);\nwrapper.find('input').at(0).simulate('change', { target: { name: 'width', value: 50 } });\nwrapper.find('input').at(1).simulate('change', { target: { name: 'height', value: 70 } });\nexpect(testState.width).toEqual(50);\nexpect(testState.height).toEqual(70);\n```\n\n#### Common Gotchas\n\n- Currently, event simulation for the shallow renderer does not propagate as one would normally\nexpect in a real environment. As a result, one must call `.simulate()` on the actual node that has\nthe event handler set.\n- Even though the name would imply this simulates an actual event, `.simulate()` will in fact\ntarget the component's prop based on the event you give it. For example, `.simulate('click')` will\nactually get the `onClick` prop and call it.\n- As noted in the function signature above passing a mock event is optional. Keep in mind that if the code you are testing uses the event for something like, calling `event.preventDefault()` or accessing any of its properties you must provide a mock event object with the properties your code requires.\n"
  },
  {
    "path": "docs/api/ShallowWrapper/simulateError.md",
    "content": "# `.simulateError(error) => Self`\n\nSimulate a component throwing an error as part of its rendering lifecycle.\n\nThis is particularly useful in combination with React 16 error boundaries (ie, the `componentDidCatch` and `static getDerivedStateFromError` lifecycle methods).\n\n\n#### Arguments\n\n1. `error` (`Any`): The error to throw.\n\n\n\n#### Returns\n\n`ShallowWrapper`: Returns itself.\n\n\n\n#### Example\n\n```jsx\nfunction Something() {\n  // this is just a placeholder\n  return null;\n}\n\nclass ErrorBoundary extends React.Component {\n  static getDerivedStateFromError(error) {\n    return {\n      hasError: true,\n    };\n  }\n\n  constructor(props) {\n    super(props);\n    this.state = { hasError: false };\n  }\n\n  componentDidCatch(error, info) {\n    const { spy } = this.props;\n    spy(error, info);\n  }\n\n  render() {\n    const { children } = this.props;\n    const { hasError } = this.state;\n    return (\n      <React.Fragment>\n        {hasError ? 'Error' : children}\n      </React.Fragment>\n    );\n  }\n}\nErrorBoundary.propTypes = {\n  children: PropTypes.node.isRequired,\n  spy: PropTypes.func.isRequired,\n};\n\nconst spy = sinon.spy();\nconst wrapper = shallow(<ErrorBoundary spy={spy}><Something /></ErrorBoundary>);\nconst error = new Error('hi!');\nwrapper.find(Something).simulateError(error);\n\nexpect(wrapper.state()).to.have.property('hasError', true);\nexpect(spy).to.have.property('callCount', 1);\nexpect(spy.args).to.deep.equal([\n  error,\n  {\n    componentStack: `\n    in Something (created by ErrorBoundary)\n    in ErrorBoundary (created by WrapperComponent)\n    in WrapperComponent`,\n  },\n]);\n```"
  },
  {
    "path": "docs/api/ShallowWrapper/slice.md",
    "content": "# `.slice([begin[, end]]) => ShallowWrapper`\n\nReturns a new wrapper with a subset of the nodes of the original wrapper, according to the rules of `Array#slice`.\n\n\n#### Arguments\n\n1. `begin` (`Number` [optional]): Index from which to slice (defaults to `0`). If negative, this is treated as `length+begin`.\n1. `end` (`Number` [optional]): Index at which to end slicing (defaults to `length`). If negative, this is treated as `length+end`.\n\n\n\n#### Returns\n\n`ShallowWrapper`: A new wrapper with the subset of nodes specified.\n\n\n\n#### Examples\n\n```jsx\nconst wrapper = shallow((\n  <div>\n    <div className=\"foo bax\" />\n    <div className=\"foo bar\" />\n    <div className=\"foo baz\" />\n  </div>\n));\nexpect(wrapper.find('.foo').slice(1)).to.have.lengthOf(2);\nexpect(wrapper.find('.foo').slice(1).at(0).hasClass('bar')).to.equal(true);\nexpect(wrapper.find('.foo').slice(1).at(1).hasClass('baz')).to.equal(true);\n```\n\n```jsx\nconst wrapper = shallow((\n  <div>\n    <div className=\"foo bax\" />\n    <div className=\"foo bar\" />\n    <div className=\"foo baz\" />\n  </div>\n));\nexpect(wrapper.find('.foo').slice(1, 2)).to.have.lengthOf(1);\nexpect(wrapper.find('.foo').slice(1, 2).at(0).hasClass('bar')).to.equal(true);\n```\n"
  },
  {
    "path": "docs/api/ShallowWrapper/some.md",
    "content": "# `.some(selector) => Boolean`\n\nReturns whether or not any of the nodes in the wrapper match the provided selector.\n\n\n#### Arguments\n\n1. `selector` ([`EnzymeSelector`](../selector.md)): The selector to match.\n\n\n\n#### Returns\n\n`Boolean`: True if at least one of the nodes in the current wrapper matched the provided selector.\n\n\n\n#### Examples\n\n```jsx\nconst wrapper = shallow((\n  <div>\n    <div className=\"foo qoo\" />\n    <div className=\"foo boo\" />\n    <div className=\"foo hoo\" />\n  </div>\n));\nexpect(wrapper.find('.foo').some('.qoo')).to.equal(true);\nexpect(wrapper.find('.foo').some('.foo')).to.equal(true);\nexpect(wrapper.find('.foo').some('.bar')).to.equal(false);\n```\n\n#### Related Methods\n\n- [`.someWhere(predicate) => Boolean`](someWhere.md)\n- [`.every(selector) => Boolean`](every.md)\n- [`.everyWhere(predicate) => Boolean`](everyWhere.md)\n"
  },
  {
    "path": "docs/api/ShallowWrapper/someWhere.md",
    "content": "# `.someWhere(fn) => Boolean`\n\nReturns whether or not any of the nodes in the wrapper pass the provided predicate function.\n\n\n#### Arguments\n\n1. `predicate` (`ShallowWrapper => Boolean`): A predicate function to match the nodes.\n\n\n\n#### Returns\n\n`Boolean`: True if at least one of the nodes in the current wrapper passed the predicate function.\n\n\n\n#### Example\n\n```jsx\nconst wrapper = shallow((\n  <div>\n    <div className=\"foo qoo\" />\n    <div className=\"foo boo\" />\n    <div className=\"foo hoo\" />\n  </div>\n));\nexpect(wrapper.find('.foo').someWhere((n) => n.hasClass('qoo'))).to.equal(true);\nexpect(wrapper.find('.foo').someWhere((n) => n.hasClass('foo'))).to.equal(true);\nexpect(wrapper.find('.foo').someWhere((n) => n.hasClass('bar'))).to.equal(false);\n```\n\n\n#### Related Methods\n\n- [`.some(selector) => Boolean`](some.md)\n- [`.every(selector) => Boolean`](every.md)\n- [`.everyWhere(predicate) => Boolean`](everyWhere.md)\n"
  },
  {
    "path": "docs/api/ShallowWrapper/state.md",
    "content": "# `.state([key]) => Any`\n\nReturns the state hash for the root node of the wrapper. Optionally pass in a prop name and it\nwill return just that value.\n\n\n#### Arguments\n\n1. `key` (`String` [optional]): If provided, the return value will be the `this.state[key]` of the\nroot component instance.\n\n\n\n#### Example\n\n\n```jsx\nconst wrapper = shallow(<MyComponent />);\nexpect(wrapper.state().foo).to.equal(10);\nexpect(wrapper.state('foo')).to.equal(10);\n```\n\n\n#### Related Methods\n\n- [`.props() => Object`](props.md)\n- [`.prop(key) => Any`](prop.md)\n- [`.context([key]) => Any`](context.md)\n"
  },
  {
    "path": "docs/api/ShallowWrapper/tap.md",
    "content": "# `.tap(intercepter) => Self`\n\nInvokes intercepter and returns itself. intercepter is called with itself.\nThis is helpful when debugging nodes in method chains.\n\n#### Arguments\n\n1. `intercepter` (`Self`): the current ShallowWrapper instance.\n\n\n\n#### Returns\n\n`Self`: the current ShallowWrapper instance.\n\n\n\n#### Example\n\n\n```jsx\nconst result = shallow((\n  <ul>\n    <li>xxx</li>\n    <li>yyy</li>\n    <li>zzz</li>\n  </ul>\n)).find('li')\n  .tap((n) => console.log(n.debug()))\n  .map((n) => n.text());\n```\n"
  },
  {
    "path": "docs/api/ShallowWrapper/text.md",
    "content": "# `.text() => String`\n\nReturns a string of the rendered text of the current render tree. This function should be\nlooked at with skepticism if being used to test what the actual HTML output of the component\nwill be. If that is what you would like to test, use enzyme's `render` function instead.\n\nNote: can only be called on a wrapper of a single node.\n\n\n#### Returns\n\n`String`: The resulting string\n\n\n#### Examples\n\n```jsx\nconst wrapper = shallow(<div><b>important</b></div>);\nexpect(wrapper.text()).to.equal('important');\n```\n\n```jsx\nconst wrapper = shallow(<div><Foo /><b>important</b></div>);\nexpect(wrapper.text()).to.equal('<Foo />important');\n```\n\n\n#### Related Methods\n\n[`.html() => String`](html.md)\n"
  },
  {
    "path": "docs/api/ShallowWrapper/type.md",
    "content": "# `.type() => String | Function | null`\n\nReturns the type of the only node of this wrapper.\nIf it's a React component, this will be the component constructor.\nIf it's a native DOM node, it will be a string with the tag name.\nIf it's `null`, it will be `null`. It must be a single-node wrapper.\n\n\n#### Returns\n\n`String | Function | null`: The type of the node\n\n\n#### Examples\n\n```jsx\nfunction Foo() {\n  return <div />;\n}\nconst wrapper = shallow(<Foo />);\nexpect(wrapper.type()).to.equal('div');\n```\n\n```jsx\nfunction Foo() {\n  return (\n    <div>\n      <button type=\"button\" className=\"btn\">Button</button>\n    </div>\n  );\n}\nconst wrapper = shallow(<Foo />);\nexpect(wrapper.find('.btn').type()).to.equal('button');\n```\n\n```jsx\nfunction Foo() {\n  return <Bar />;\n}\nconst wrapper = shallow(<Foo />);\nexpect(wrapper.type()).to.equal(Bar);\n```\n\n```jsx\nfunction Null() {\n  return null;\n}\nconst wrapper = shallow(<Null />);\nexpect(wrapper.type()).to.equal(null);\n```\n"
  },
  {
    "path": "docs/api/ShallowWrapper/unmount.md",
    "content": "# `.unmount() => Self`\n\nA method that unmounts the component. This can be used to simulate a component going through\nan unmount/mount lifecycle.\n\n#### Returns\n\n`ShallowWrapper`: Returns itself.\n\n\n\n#### Example\n\n```jsx\nimport PropTypes from 'prop-types';\nimport sinon from 'sinon';\n\nconst spy = sinon.spy();\n\nclass Foo extends React.Component {\n  constructor(props) {\n    super(props);\n    this.componentWillUnmount = spy;\n  }\n\n  render() {\n    const { id } = this.props;\n    return (\n      <div className={id}>\n        {id}\n      </div>\n    );\n  }\n}\nFoo.propTypes = {\n  id: PropTypes.string.isRequired,\n};\nconst wrapper = shallow(<Foo id=\"foo\" />);\nexpect(spy).to.have.property('callCount', 0);\nwrapper.unmount();\nexpect(spy).to.have.property('callCount', 1);\n```\n"
  },
  {
    "path": "docs/api/ShallowWrapper/update.md",
    "content": "# `.update() => Self`\n\nSyncs the enzyme component tree snapshot with the react component tree. Useful to run before checking the render output if something external\nmay be updating the state of the component somewhere.\n\nNOTE: no matter what instance this is called on, it will always update the root.\n\nNOTE: only updates Enzyme's representation of rendered tree.\n\nNOTE: this does not force a re-render. Use `wrapper.setProps({})` to force a re-render.\n\n\n#### Returns\n\n`ReactWrapper`: Returns itself.\n\n\n\n#### Example\n\n```jsx\nclass UpdateEnzyme extends React.Component {\n  constructor(props) {\n    super(props);\n    this.state = {\n      count: 0,\n    };\n    this.increment = this.increment.bind(this);\n  }\n\n  increment() {\n    const { count } = this.state;\n    this.setState({ count: count + 1 });\n  }\n\n  render() {\n    const { count } = this.state;\n    return <button type=\"button\" className=\"increment\" onClick={this.increment}>{count}</button>;\n  }\n}\n```\n```jsx\nconst wrapper = shallow(<UpdateEnzyme />);\nexpect(wrapper.find('button.increment').text()).to.equal('0');\nwrapper.instance().increment();\n\n// Update Enzyme's view of output\nwrapper.update();\n\nexpect(wrapper.find('button.increment').text()).to.equal('1');\n```\n"
  },
  {
    "path": "docs/api/mount.md",
    "content": "# Full Rendering API (`mount(...)`)\n\nFull DOM rendering is ideal for use cases where you have components that may interact with DOM APIs or need to test components that are wrapped in higher order components.\n\nFull DOM rendering requires that a full DOM API be available at the global scope. This means that\nit must be run in an environment that at least “looks like” a browser environment. If you do not\nwant to run your tests inside of a browser, the recommended approach to using `mount` is to depend\non a library called [jsdom](https://github.com/jsdom/jsdom) which is essentially a headless browser\nimplemented completely in JS.\n\n**Note**: unlike shallow or static rendering, full rendering actually mounts the component in the DOM, which means that tests can affect each other if they are all using the same DOM. Keep that in mind while writing your tests and, if necessary, use [`.unmount()`](ReactWrapper/unmount.md) or something similar as cleanup.\n\n```jsx\nimport { mount } from 'enzyme';\nimport sinon from 'sinon';\nimport Foo from './Foo';\n\ndescribe('<Foo />', () => {\n  it('calls componentDidMount', () => {\n    sinon.spy(Foo.prototype, 'componentDidMount');\n    const wrapper = mount(<Foo />);\n    expect(Foo.prototype.componentDidMount).to.have.property('callCount', 1);\n  });\n\n  it('allows us to set props', () => {\n    const wrapper = mount(<Foo bar=\"baz\" />);\n    expect(wrapper.props().bar).to.equal('baz');\n    wrapper.setProps({ bar: 'foo' });\n    expect(wrapper.props().bar).to.equal('foo');\n  });\n\n  it('simulates click events', () => {\n    const onButtonClick = sinon.spy();\n    const wrapper = mount((\n      <Foo onButtonClick={onButtonClick} />\n    ));\n    wrapper.find('button').simulate('click');\n    expect(onButtonClick).to.have.property('callCount', 1);\n  });\n});\n```\n\n## `mount(node[, options]) => ReactWrapper`\n\n#### Arguments\n\n1. `node` (`ReactElement`): The node to render\n2. `options` (`Object` [optional]):\n- `options.context`: (`Object` [optional]): Context to be passed into the component\n- `options.attachTo`: (`DOMElement` [optional]): DOM Element to attach the component to.\n- `options.childContextTypes`: (`Object` [optional]): Merged contextTypes for all children of the wrapper.\n- `options.wrappingComponent`: (`ComponentType` [optional]): A component that will render as a parent of the `node`. It can be used to provide context to the `node`, among other things. See the [`getWrappingComponent()` docs](ReactWrapper/getWrappingComponent.md) for an example. **Note**: `wrappingComponent` _must_ render its children.\n- `options.wrappingComponentProps`: (`Object` [optional]): Initial props to pass to the `wrappingComponent` if it is specified.\n\n#### Returns\n\n`ReactWrapper`: The wrapper instance around the rendered output.\n\n\n## ReactWrapper API\n\n#### [`.find(selector) => ReactWrapper`](ReactWrapper/find.md)\nFind every node in the render tree that matches the provided selector.\n\n#### [`.findWhere(predicate) => ReactWrapper`](ReactWrapper/findWhere.md)\nFind every node in the render tree that returns true for the provided predicate function.\n\n#### [`.filter(selector) => ReactWrapper`](ReactWrapper/filter.md)\nRemove nodes in the current wrapper that do not match the provided selector.\n\n#### [`.filterWhere(predicate) => ReactWrapper`](ReactWrapper/filterWhere.md)\nRemove nodes in the current wrapper that do not return true for the provided predicate function.\n\n#### [`.hostNodes() => ReactWrapper`](ReactWrapper/hostNodes.md)\nRemoves nodes that are not host nodes; e.g., this will only return HTML nodes.\n\n#### [`.contains(nodeOrNodes) => Boolean`](ReactWrapper/contains.md)\nReturns whether or not a given node or array of nodes exists in the render tree.\n\n#### [`.containsMatchingElement(node) => Boolean`](ReactWrapper/containsMatchingElement.md)\nReturns whether or not a given react element exists in the render tree.\n\n#### [`.containsAllMatchingElements(nodes) => Boolean`](ReactWrapper/containsAllMatchingElements.md)\nReturns whether or not all the given react elements exist in the render tree.\n\n#### [`.containsAnyMatchingElements(nodes) => Boolean`](ReactWrapper/containsAnyMatchingElements.md)\nReturns whether or not one of the given react elements exist in the render tree.\n\n#### [`.equals(node) => Boolean`](ReactWrapper/equals.md)\nReturns whether or not the current wrapper root node render tree looks like the one passed in.\n\n#### [`.hasClass(className) => Boolean`](ReactWrapper/hasClass.md)\nReturns whether or not the current root node has the given class name or not.\n\n#### [`.is(selector) => Boolean`](ReactWrapper/is.md)\nReturns whether or not the current node matches a provided selector.\n\n#### [`.exists([selector]) => Boolean`](ReactWrapper/exists.md)\nReturns whether or not the current node exists, or, if given a selector, whether that selector has any matching results.\n\n#### [`.isEmpty() => Boolean`](ReactWrapper/isEmpty.md)\n*Deprecated*: Use [`.exists()`](ReactWrapper/exists.md) instead.\n\n#### [`.isEmptyRender() => Boolean`](ReactWrapper/isEmptyRender.md)\nReturns whether or not the current component returns a falsy value.\n\n#### [`.not(selector) => ReactWrapper`](ReactWrapper/not.md)\nRemove nodes in the current wrapper that match the provided selector. (inverse of `.filter()`)\n\n#### [`.children([selector]) => ReactWrapper`](ReactWrapper/children.md)\nGet a wrapper with all of the children nodes of the current wrapper.\n\n#### [`.childAt(index) => ReactWrapper`](ReactWrapper/childAt.md)\nReturns a new wrapper with child at the specified index.\n\n#### [`.parents([selector]) => ReactWrapper`](ReactWrapper/parents.md)\nGet a wrapper with all of the parents (ancestors) of the current node.\n\n#### [`.parent() => ReactWrapper`](ReactWrapper/parent.md)\nGet a wrapper with the direct parent of the current node.\n\n#### [`.closest(selector) => ReactWrapper`](ReactWrapper/closest.md)\nGet a wrapper with the first ancestor of the current node to match the provided selector.\n\n#### [`.render() => CheerioWrapper`](ReactWrapper/render.md)\nReturns a CheerioWrapper of the current node's subtree.\n\n#### [`.renderProp(key)() => ReactWrapper`](ReactWrapper/renderProp.md)\nReturns a wrapper of the node rendered by the provided render prop.\n\n#### [`.text() => String`](ReactWrapper/text.md)\nReturns a string representation of the text nodes in the current render tree.\n\n#### [`.html() => String`](ReactWrapper/html.md)\nReturns a static HTML rendering of the current node.\n\n#### [`.get(index) => ReactElement`](ReactWrapper/get.md)\nReturns the node at the provided index of the current wrapper.\n\n#### [`.getDOMNode() => DOMComponent`](ReactWrapper/getDOMNode.md)\nReturns the outer most DOMComponent of the current wrapper.\n\n#### [`.getElement() => ReactElement`](ReactWrapper/getElement.md)\nReturns the wrapped ReactElement.\n\n#### [`.getElements() => Array<ReactElement>`](ReactWrapper/getElements.md)\nReturns the wrapped ReactElements.\n\n#### [`.at(index) => ReactWrapper`](ReactWrapper/at.md)\nReturns a wrapper of the node at the provided index of the current wrapper.\n\n#### [`.first() => ReactWrapper`](ReactWrapper/first.md)\nReturns a wrapper of the first node of the current wrapper.\n\n#### [`.last() => ReactWrapper`](ReactWrapper/last.md)\nReturns a wrapper of the last node of the current wrapper.\n\n#### [`.state([key]) => Any`](ReactWrapper/state.md)\nReturns the state of the root component.\n\n#### [`.context([key]) => Any`](ReactWrapper/context.md)\nReturns the context of the root component.\n\n#### [`.props() => Object`](ReactWrapper/props.md)\nReturns the props of the root component.\n\n#### [`.prop(key) => Any`](ReactWrapper/prop.md)\nReturns the named prop of the root component.\n\n#### [`.invoke(propName)(...args) => Any`](ReactWrapper/invoke.md)\nInvokes a prop function on the current node and returns the function's return value.\n\n#### [`.key() => String`](ReactWrapper/key.md)\nReturns the key of the root component.\n\n#### [`.simulate(event[, mock]) => ReactWrapper`](ReactWrapper/simulate.md)\nSimulates an event on the current node.\n\n#### [`.setState(nextState) => ReactWrapper`](ReactWrapper/setState.md)\nManually sets state of the root component.\n\n#### [`.setProps(nextProps[, callback]) => ReactWrapper`](ReactWrapper/setProps.md)\nManually sets props of the root component.\n\n#### [`.setContext(context) => ReactWrapper`](ReactWrapper/setContext.md)\nManually sets context of the root component.\n\n#### [`.instance() => ReactComponent|DOMComponent`](ReactWrapper/instance.md)\nReturns the wrapper's underlying instance.\n\n#### [`.getWrappingComponent() => ReactWrapper`](ReactWrapper/getWrappingComponent.md)\nReturns a wrapper representing the `wrappingComponent`, if one was passed.\n\n#### [`.unmount() => ReactWrapper`](ReactWrapper/unmount.md)\nA method that un-mounts the component.\n\n#### [`.mount() => ReactWrapper`](ReactWrapper/mount.md)\nA method that re-mounts the component.\n\n#### [`.update() => ReactWrapper`](ReactWrapper/update.md)\nSyncs the enzyme component tree snapshot with the react component tree.\n\n#### [`.debug() => String`](ReactWrapper/debug.md)\nReturns a string representation of the current render tree for debugging purposes.\n\n#### [`.type() => String|Function`](ReactWrapper/type.md)\nReturns the type of the current node of the wrapper.\n\n#### [`.name() => String`](ReactWrapper/name.md)\nReturns the name of the current node of the wrapper.\n\n#### [`.forEach(fn) => ReactWrapper`](ReactWrapper/forEach.md)\nIterates through each node of the current wrapper and executes the provided function\n\n#### [`.map(fn) => Array`](ReactWrapper/map.md)\nMaps the current array of nodes to another array.\n\n#### [`.matchesElement(node) => Boolean`](ReactWrapper/matchesElement.md)\nReturns whether or not a given react element matches the current render tree.\n\n#### [`.reduce(fn[, initialValue]) => Any`](ReactWrapper/reduce.md)\nReduces the current array of nodes to a value\n\n#### [`.reduceRight(fn[, initialValue]) => Any`](ReactWrapper/reduceRight.md)\nReduces the current array of nodes to a value, from right to left.\n\n#### [`.slice([begin[, end]]) => ReactWrapper`](ReactWrapper/slice.md)\nReturns a new wrapper with a subset of the nodes of the original wrapper, according to the rules of `Array#slice`.\n\n#### [`.tap(intercepter) => Self`](ReactWrapper/tap.md)\nTaps into the wrapper method chain. Helpful for debugging.\n\n#### [`.some(selector) => Boolean`](ReactWrapper/some.md)\nReturns whether or not any of the nodes in the wrapper match the provided selector.\n\n#### [`.someWhere(predicate) => Boolean`](ReactWrapper/someWhere.md)\nReturns whether or not any of the nodes in the wrapper pass the provided predicate function.\n\n#### [`.every(selector) => Boolean`](ReactWrapper/every.md)\nReturns whether or not all of the nodes in the wrapper match the provided selector.\n\n#### [`.everyWhere(predicate) => Boolean`](ReactWrapper/everyWhere.md)\nReturns whether or not all of the nodes in the wrapper pass the provided predicate function.\n\n#### [`.ref(refName) => ReactComponent | HTMLElement`](ReactWrapper/ref.md)\nReturns the node that matches the provided reference name.\n\n#### [`.detach() => void`](ReactWrapper/detach.md)\nUnmount the component from the DOM node it's attached to.\n"
  },
  {
    "path": "docs/api/render.md",
    "content": "# Static Rendering API\n\nUse enzyme's `render` function to generate HTML from your React tree, and analyze the resulting HTML structure.\n\n`render` returns a wrapper very similar to the other renderers in enzyme, [`mount`](mount.md) and\n[`shallow`](shallow.md); however, `render` uses a third party HTML parsing and traversal library\n[Cheerio](https://cheerio.js.org). We believe that Cheerio handles parsing and\ntraversing HTML extremely well, and duplicating this functionality ourselves would be a\ndisservice.\n\nFor the purposes of this documentation, we will refer to Cheerio's constructor as\n`CheerioWrapper`, which is to say that it is analogous to our `ReactWrapper` and `ShallowWrapper`\nconstructors. You can reference the [Cheerio API docs](https://github.com/cheeriojs/cheerio#api) for methods available on a `CheerioWrapper` instance.\n\n### Example Usage\n\n```jsx\nimport React from 'react';\nimport { render } from 'enzyme';\nimport PropTypes from 'prop-types';\n\ndescribe('<Foo />', () => {\n  it('renders three `.foo-bar`s', () => {\n    const wrapper = render(<Foo />);\n    expect(wrapper.find('.foo-bar')).to.have.lengthOf(3);\n  });\n\n  it('rendered the title', () => {\n    const wrapper = render(<Foo title=\"unique\" />);\n    expect(wrapper.text()).to.contain('unique');\n  });\n\n  it('renders a div', () => {\n    const wrapper = render(<div className=\"myClass\" />);\n    expect(wrapper.html()).to.contain('div');\n  });\n\n  it('can pass in context', () => {\n    function SimpleComponent(props, context) {\n      const { name } = context;\n      return <div>{name}</div>;\n    }\n    SimpleComponent.contextTypes = {\n      name: PropTypes.string,\n    };\n\n    const context = { name: 'foo' };\n    const wrapper = render(<SimpleComponent />, { context });\n    expect(wrapper.text()).to.equal('foo');\n  });\n});\n```\n"
  },
  {
    "path": "docs/api/selector.md",
    "content": "# enzyme Selectors\n\nMany methods in enzyme’s API accept a *selector* as an argument.\nYou can select several different ways:\n\n### 1. A Valid CSS Selector\n\nenzyme supports a subset of valid CSS selectors to find nodes inside a render tree. Support is as\nfollows:\n\n- class syntax (`.foo`, `.foo-bar`, etc.)\n- element tag name syntax (`input`, `div`, `span`, etc.)\n- id syntax (`#foo`, `#foo-bar`, etc.)\n- attribute syntax (`[href=\"foo\"]`, `[type=\"text\"]`, and the other attribute selectors listed [here](https://developer.mozilla.org/en-US/docs/Learn/CSS/Introduction_to_CSS/Attribute_selectors).)\n- universal syntax (`*`)\n- React component name and props (`Button`, `Button[type=\"submit\"]`, etc) - however, please note that it is strongly encouraged to find by component constructor/function and not by display name.\n\nThe attribute syntax also works by value, rather than by string. Strings, numbers, and boolean property values are supported. Example:\n\n```js\nconst wrapper = mount((\n  <div>\n    <span anum={3} abool={false} />\n    <span anum=\"3\" abool=\"false\" />\n  </div>\n));\n```\n\nThe selector `[anum=3]` will select the first <span> but not the second, because there's no quotes surrounding the 3. The selector `[anum=\"3\"]` will select the second, because it's explicitly looking for a string because of the quotes surrounding 3. The same goes for the boolean; [abool=false] will select the first but not the second, etc.\n\nFurther, enzyme supports combining any of those supported syntaxes together, as with CSS:\n\n```css\ndiv.foo.bar\ninput#input-name\na[href=\"foo\"]\n.foo .bar\n.foo > .bar\n.foo + .bar\n.foo ~ .bar\n.foo input\n```\n\n**React Key and Ref Props**\n\nWhile in most cases, any React prop can be used, there are exceptions.\nThe `key` and `ref` props will never work; React uses these props internally.\n\n\n**Want more CSS support?**\n\nPRs implementing more support for CSS selectors will be accepted and is an area of development for\nenzyme that will likely be focused on in the future.\n\n\n### 2. A React Component Constructor\n\nenzyme allows you to find React components based on their constructor. You can pass in the reference to\nthe component’s constructor.\nOf course, this kind of selector only checks the component type; it ignores props and children.\n\n```jsx\nfunction MyComponent() {\n  return <div />;\n}\n\n// find instances of MyComponent\nconst myComponents = wrapper.find(MyComponent);\n```\n\n\n### 3. A React Component’s displayName\n\nenzyme allows you to find components based on a component’s `displayName`. If a component exists\nin a render tree where its `displayName` is set and has its first character as a capital letter,\nyou can use a string to find it:\n\n\n```jsx\nfunction MyComponent() {\n  return <div />;\n}\nMyComponent.displayName = 'My Component';\n\n// find instances of MyComponent\nconst myComponents = wrapper.find('My Component');\n```\n\nNOTE: This will *only* work if the selector (and thus the component’s `displayName`) is a string\nstarting with a capital letter. Strings starting with lower case letters will be assumed to be a CSS\nselector (therefore a tag name).\n\nSelecting a HOC-wrapped component, or a component with a custom `displayName`, even with lowercase letters (for example, `withHOC(MyComponent)`) will work as well.\n\n\n### 4. Object Property Selector\n\nenzyme allows you to find components and nodes based on a subset of their properties:\n\n\n```jsx\nconst wrapper = mount((\n  <div>\n    <span foo={3} bar={false} title=\"baz\" />\n  </div>\n));\n\nwrapper.find({ foo: 3 });\nwrapper.find({ bar: false });\nwrapper.find({ title: 'baz' });\n```\n\n**Undefined Properties**\n\nUndefined properties are not allowed in the object property selector and will cause an error:\n\n\n```jsx\nwrapper.find({ foo: 3, bar: undefined });\n// => TypeError: Enzyme::Props can't have 'undefined' values. Try using 'findWhere()' instead.\n```\n\nIf you have to search by `undefined` property value, use [`.findWhere()`](ShallowWrapper/findWhere.md).\n"
  },
  {
    "path": "docs/api/shallow.md",
    "content": "# Shallow Rendering API\n\nShallow rendering is useful to constrain yourself to testing a component as a unit, and to ensure\nthat your tests aren't indirectly asserting on behavior of child components.\n\nAs of Enzyme v3, the `shallow` API does call React lifecycle methods such as `componentDidMount` and `componentDidUpdate`. You can read more about this in the [version 3 migration guide](../guides/migration-from-2-to-3.md#lifecycle-methods).\n\n```jsx\nimport { shallow } from 'enzyme';\nimport sinon from 'sinon';\nimport Foo from './Foo';\n\ndescribe('<MyComponent />', () => {\n  it('renders three <Foo /> components', () => {\n    const wrapper = shallow(<MyComponent />);\n    expect(wrapper.find(Foo)).to.have.lengthOf(3);\n  });\n\n  it('renders an `.icon-star`', () => {\n    const wrapper = shallow(<MyComponent />);\n    expect(wrapper.find('.icon-star')).to.have.lengthOf(1);\n  });\n\n  it('renders children when passed in', () => {\n    const wrapper = shallow((\n      <MyComponent>\n        <div className=\"unique\" />\n      </MyComponent>\n    ));\n    expect(wrapper.contains(<div className=\"unique\" />)).to.equal(true);\n  });\n\n  it('simulates click events', () => {\n    const onButtonClick = sinon.spy();\n    const wrapper = shallow(<Foo onButtonClick={onButtonClick} />);\n    wrapper.find('button').simulate('click');\n    expect(onButtonClick).to.have.property('callCount', 1);\n  });\n});\n```\n\n## `shallow(node[, options]) => ShallowWrapper`\n\n#### Arguments\n\n1. `node` (`ReactElement`): The node to render\n2. `options` (`Object` [optional]):\n  - `options.context`: (`Object` [optional]): Context to be passed into the component\n  - `options.disableLifecycleMethods`: (`Boolean` [optional]): If set to true, `componentDidMount`\nis not called on the component, and `componentDidUpdate` is not called after\n[`setProps`](ShallowWrapper/setProps.md) and [`setContext`](ShallowWrapper/setContext.md). Default to `false`.\n  - `options.wrappingComponent`: (`ComponentType` [optional]): A component that will render as a parent of the `node`. It can be used to provide context to the `node`, among other things. See the [`getWrappingComponent()` docs](ShallowWrapper/getWrappingComponent.md) for an example. **Note**: `wrappingComponent` _must_ render its children.\n  - `options.wrappingComponentProps`: (`Object` [optional]): Initial props to pass to the `wrappingComponent` if it is specified.\n  - `options.suspenseFallback`: (`Boolean` [optional]): If set to true, when rendering `Suspense` enzyme will replace all the lazy components in children with `fallback` element prop. Otherwise it won't handle fallback of lazy component. Default to `true`. Note: not supported in React < 16.6.\n\n#### Returns\n\n`ShallowWrapper`: The wrapper instance around the rendered output.\n\n\n## ShallowWrapper API\n\n#### [`.find(selector) => ShallowWrapper`](ShallowWrapper/find.md)\nFind every node in the render tree that matches the provided selector.\n\n#### [`.findWhere(predicate) => ShallowWrapper`](ShallowWrapper/findWhere.md)\nFind every node in the render tree that returns true for the provided predicate function.\n\n#### [`.filter(selector) => ShallowWrapper`](ShallowWrapper/filter.md)\nRemove nodes in the current wrapper that do not match the provided selector.\n\n#### [`.filterWhere(predicate) => ShallowWrapper`](ShallowWrapper/filterWhere.md)\nRemove nodes in the current wrapper that do not return true for the provided predicate function.\n\n#### [`.hostNodes() => ShallowWrapper`](ShallowWrapper/hostNodes.md)\nRemoves nodes that are not host nodes; e.g., this will only return HTML nodes.\n\n#### [`.contains(nodeOrNodes) => Boolean`](ShallowWrapper/contains.md)\nReturns whether or not a given node or array of nodes is somewhere in the render tree.\n\n#### [`.containsMatchingElement(node) => Boolean`](ShallowWrapper/containsMatchingElement.md)\nReturns whether or not a given react element exists in the shallow render tree.\n\n#### [`.containsAllMatchingElements(nodes) => Boolean`](ShallowWrapper/containsAllMatchingElements.md)\nReturns whether or not all the given react elements exist in the shallow render tree.\n\n#### [`.containsAnyMatchingElements(nodes) => Boolean`](ShallowWrapper/containsAnyMatchingElements.md)\nReturns whether or not one of the given react elements exists in the shallow render tree.\n\n#### [`.equals(node) => Boolean`](ShallowWrapper/equals.md)\nReturns whether or not the current render tree is equal to the given node, based on the expected value.\n\n#### [`.matchesElement(node) => Boolean`](ShallowWrapper/matchesElement.md)\nReturns whether or not a given react element matches the shallow render tree.\n\n#### [`.hasClass(className) => Boolean`](ShallowWrapper/hasClass.md)\nReturns whether or not the current node has the given class name or not.\n\n#### [`.is(selector) => Boolean`](ShallowWrapper/is.md)\nReturns whether or not the current node matches a provided selector.\n\n#### [`.exists([selector]) => Boolean`](ShallowWrapper/exists.md)\nReturns whether or not the current node exists, or, if given a selector, whether that selector has any matching results.\n\n#### [`.isEmpty() => Boolean`](ShallowWrapper/isEmpty.md)\n*Deprecated*: Use [`.exists()`](ShallowWrapper/exists.md) instead.\n\n#### [`.isEmptyRender() => Boolean`](ShallowWrapper/isEmptyRender.md)\nReturns whether or not the current component returns a falsy value.\n\n#### [`.not(selector) => ShallowWrapper`](ShallowWrapper/not.md)\nRemove nodes in the current wrapper that match the provided selector. (inverse of `.filter()`)\n\n#### [`.children([selector]) => ShallowWrapper`](ShallowWrapper/children.md)\nGet a wrapper with all of the children nodes of the current wrapper.\n\n#### [`.childAt(index) => ShallowWrapper`](ShallowWrapper/childAt.md)\nReturns a new wrapper with child at the specified index.\n\n#### [`.parents([selector]) => ShallowWrapper`](ShallowWrapper/parents.md)\nGet a wrapper with all of the parents (ancestors) of the current node.\n\n#### [`.parent() => ShallowWrapper`](ShallowWrapper/parent.md)\nGet a wrapper with the direct parent of the current node.\n\n#### [`.closest(selector) => ShallowWrapper`](ShallowWrapper/closest.md)\nGet a wrapper with the first ancestor of the current node to match the provided selector.\n\n#### [`.shallow([options]) => ShallowWrapper`](ShallowWrapper/shallow.md)\nShallow renders the current node and returns a shallow wrapper around it.\n\n#### [`.render() => CheerioWrapper`](ShallowWrapper/render.md)\nReturns a CheerioWrapper of the current node's subtree.\n\n#### [`.renderProp(key)() => ShallowWrapper`](ShallowWrapper/renderProp.md)\nReturns a wrapper of the node rendered by the provided render prop.\n\n#### [`.unmount() => ShallowWrapper`](ShallowWrapper/unmount.md)\nA method that un-mounts the component.\n\n#### [`.text() => String`](ShallowWrapper/text.md)\nReturns a string representation of the text nodes in the current render tree.\n\n#### [`.html() => String`](ShallowWrapper/html.md)\nReturns a static HTML rendering of the current node.\n\n#### [`.get(index) => ReactElement`](ShallowWrapper/get.md)\nReturns the node at the provided index of the current wrapper.\n\n#### [`.getElement() => ReactElement`](ShallowWrapper/getElement.md)\nReturns the wrapped ReactElement.\n\n#### [`.getElements() => Array<ReactElement>`](ShallowWrapper/getElements.md)\nReturns the wrapped ReactElements.\n\n#### [`.at(index) => ShallowWrapper`](ShallowWrapper/at.md)\nReturns a wrapper of the node at the provided index of the current wrapper.\n\n#### [`.first() => ShallowWrapper`](ShallowWrapper/first.md)\nReturns a wrapper of the first node of the current wrapper.\n\n#### [`.last() => ShallowWrapper`](ShallowWrapper/last.md)\nReturns a wrapper of the last node of the current wrapper.\n\n#### [`.state([key]) => Any`](ShallowWrapper/state.md)\nReturns the state of the root component.\n\n#### [`.context([key]) => Any`](ShallowWrapper/context.md)\nReturns the context of the root component.\n\n#### [`.props() => Object`](ShallowWrapper/props.md)\nReturns the props of the current node.\n\n#### [`.prop(key) => Any`](ShallowWrapper/prop.md)\nReturns the named prop of the current node.\n\n#### [`.key() => String`](ShallowWrapper/key.md)\nReturns the key of the current node.\n\n#### [`.invoke(propName)(...args) => Any`](ShallowWrapper/invoke.md)\nInvokes a prop function on the current node and returns the function's return value.\n\n#### [`.simulate(event[, data]) => ShallowWrapper`](ShallowWrapper/simulate.md)\nSimulates an event on the current node.\n\n#### [`.setState(nextState) => ShallowWrapper`](ShallowWrapper/setState.md)\nManually sets state of the root component.\n\n#### [`.setProps(nextProps[, callback]) => ShallowWrapper`](ShallowWrapper/setProps.md)\nManually sets props of the root component.\n\n#### [`.setContext(context) => ShallowWrapper`](ShallowWrapper/setContext.md)\nManually sets context of the root component.\n\n#### [`.getWrappingComponent() => ShallowWrapper`](ShallowWrapper/getWrappingComponent.md)\nReturns a wrapper representing the `wrappingComponent`, if one was passed.\n\n#### [`.instance() => ReactComponent`](ShallowWrapper/instance.md)\nReturns the instance of the root component.\n\n#### [`.update() => ShallowWrapper`](ShallowWrapper/update.md)\nSyncs the enzyme component tree snapshot with the react component tree.\n\n#### [`.debug() => String`](ShallowWrapper/debug.md)\nReturns a string representation of the current shallow render tree for debugging purposes.\n\n#### [`.type() => String|Function|null`](ShallowWrapper/type.md)\nReturns the type of the current node of the wrapper.\n\n#### [`.name() => String`](ShallowWrapper/name.md)\nReturns the name of the current node of the wrapper.\n\n#### [`.forEach(fn) => ShallowWrapper`](ShallowWrapper/forEach.md)\nIterates through each node of the current wrapper and executes the provided function\n\n#### [`.map(fn) => Array`](ShallowWrapper/map.md)\nMaps the current array of nodes to another array.\n\n#### [`.reduce(fn[, initialValue]) => Any`](ShallowWrapper/reduce.md)\nReduces the current array of nodes to a value\n\n#### [`.reduceRight(fn[, initialValue]) => Any`](ShallowWrapper/reduceRight.md)\nReduces the current array of nodes to a value, from right to left.\n\n#### [`.slice([begin[, end]]) => ShallowWrapper`](ShallowWrapper/slice.md)\nReturns a new wrapper with a subset of the nodes of the original wrapper, according to the rules of `Array#slice`.\n\n#### [`.tap(intercepter) => Self`](ShallowWrapper/tap.md)\nTaps into the wrapper method chain. Helpful for debugging.\n\n#### [`.some(selector) => Boolean`](ShallowWrapper/some.md)\nReturns whether or not any of the nodes in the wrapper match the provided selector.\n\n#### [`.someWhere(predicate) => Boolean`](ShallowWrapper/someWhere.md)\nReturns whether or not any of the nodes in the wrapper pass the provided predicate function.\n\n#### [`.every(selector) => Boolean`](ShallowWrapper/every.md)\nReturns whether or not all of the nodes in the wrapper match the provided selector.\n\n#### [`.everyWhere(predicate) => Boolean`](ShallowWrapper/everyWhere.md)\nReturns whether or not all of the nodes in the wrapper pass the provided predicate function.\n\n#### [`.dive([options]) => ShallowWrapper`](ShallowWrapper/dive.md)\nShallow render the one non-DOM child of the current wrapper, and return a wrapper around the result.\n"
  },
  {
    "path": "docs/common-issues.md",
    "content": "# Common Issues\n\nThis list aims to be comprehensive. If you find an issue that has been frequently brought up in GitHub *Issues* that is not here, please open a PR to add it.\n\n### Query Selector fails\n\n###### Reason\n\nThis could be due to a regression, or the feature is not yet implemented. If you are wanting to use a\ncertain query syntax, make sure it is implemented first before raising an issue. Here is the list of\nselectors we currently support: https://github.com/enzymejs/enzyme/blob/master/docs/api/selector.md\n\n### Nested component may not be updated after wrapper updates\n\nAssume we have a simple component with an `<input />` and a `<button>`. Clicking the `<button>` updates the `<input>`'s value.\n\nHowever, this test fails:\n```jsx\nconst input = wrapper.find('input');\nconst button = wrapper.find('button');\nbutton.prop('onClick')();\nexpect(input.prop('value')).to.equal('test');\n```\nWhile this test:\n```jsx\nconst input = wrapper.find('input');\nconst button = wrapper.find('button');\nbutton.prop('onClick')();\nexpect(wrapper.find('input').prop('value')).to.equal('test');\n```\npasses.\n\nThis is because the wrapper returned by `.find()` (and every other method that produces a new wrapper) is immutable and won't update.\n\nMore details and motivation can be found at [migration from 2 to 3: Calling props() after a state change](https://github.com/enzymejs/enzyme/blob/master/docs/guides/migration-from-2-to-3.md#calling-props-after-a-state-change).\n\n###### Solutions\n\nInstead of storing `.find()` results into a local variable, re-find from the root after any change.\n\n```jsx\nwrapper.find('button').invoke('onClick')();\nexpect(wrapper.find('input').prop('value')).to.equal('test');\n```\n\nor we may wrap that into helper function(s) to call them each time\n\n```jsx\nfunction getButton(wrapper) {\n  return wrapper.find('button');\n}\n\n// …\n\ngetButton(wrapper).invoke('onClick')();\n```\n\n### Testing third party libraries\n\nSome third party libraries are difficult or impossible to test. enzyme's scope is severely limited to what\nReact exposes and provides for us. Things like \"portals\" are not currently testable with enzyme directly for that reason.\n\nAn example:\n\nIf you are testing a library that creates a Modal, and it manually appends it to a different part of the DOM, React has lost\ntrack of this component, and therefore enzyme has also lost track of it.\n\nEven more so, if this library appends dom elements into react components, react still does not know about it. A library like d3 which\nappends DOM elements would be an example here.\n\n###### Solutions\n\nYou can use the `render` API to attempt to access and assert on the appended DOM components. This will likely become natively supported\nwhen React natively supports Portals, which is expected to land with Fiber.\n\nIf the third party solution lets you attach a `ref`, that would be the ideal scenario. With a `ref` you can then get that element from enzyme.\n\nexample\n\n```jsx\nimport ThirdPartyPortalLibrary from 'someplace';\n\nclass Comp extends React.Component {\n  render() {\n    return <ThirdPartyPortalLibrary ref={(node) => { this.portal = node; }} />;\n  }\n}\n\nconst wrapper = mount(<Comp />);\nconst { portal } = wrapper.instance();\n// assert on `portal`\n```\n"
  },
  {
    "path": "docs/future.md",
    "content": "# Future Work\n\nDiscussion of additional features and support for enzyme should be initiated by opening a\n[GitHub issue](https://github.com/enzymejs/enzyme/issues).\n\nThere are several things we'd like to address with enzyme that often get asked. Here are a couple\nof projects that we plan on addressing in the near future:\n\n\n#### Improved event simulation and propagation support\n\nEvent simulation is limited for Shallow rendering. Event propagation is not supported, and one must\nsupply their own event objects. We would like to provide tools to more fully simulate real\ninteraction.\n\n\n### Improved Keyboard + Mouse Simulation\n\nMany react components involve simulating form input or complex mouse interaction. Simulating this\nusing the event simulation API that enzyme provides is cumbersome and impractical. We are looking for\nan expressive way to solve this problem, even if it is a library that lives outside of enzyme.\n"
  },
  {
    "path": "docs/guides/browserify.md",
    "content": "# Using enzyme with Browserify\n\nIf you are using a test runner that runs code in a browser-based environment, you may be using\n[browserify](https://browserify.org) in order to bundle your React code.\n\nPrior to enzyme 3.0 there were some issues with conditional requires that were used\nto maintain backwards compatibility with React versions. With enzyme 3.0+, this\nshould no longer be an issue. If it is, please file a GitHub issue or make a PR\nto this documentation with instructions on how to set it up.\n"
  },
  {
    "path": "docs/guides/jest.md",
    "content": "# Using enzyme with Jest\n\n## Configure with Jest\n\nTo run the setup file to configure Enzyme and the Adapter (as shown in the [Installation docs](https://enzymejs.github.io/enzyme/docs/installation/)) with Jest, set `setupFilesAfterEnv` (previously `setupTestFrameworkScriptFile`) in your config file (check [Jest's documentation](https://jestjs.io/docs/en/configuration) for the possible locations of that config file) to literally the string `<rootDir>` and the path to your setup file.\n\n```json\n{\n  \"jest\": {\n    \"setupFilesAfterEnv\": [\"<rootDir>src/setupTests.js\"]\n  }\n}\n```\n\n## Jest version 15 and up\n\nStarting with version 15, Jest [no longer mocks modules by default](https://facebook.github.io/jest/blog/2016/09/01/jest-15.html). Because of this, you no longer have to add _any_ special configuration for Jest to use it with enzyme.\n\nInstall Jest, and its Babel integrations, as recommended in the [Jest docs](https://facebook.github.io/jest/docs/en/getting-started.html). Install enzyme. Then, simply require/import React, enzyme functions, and your module at the top of a test file.\n\n```js\nimport React from 'react';\nimport { shallow, mount, render } from 'enzyme';\n\nimport Foo from '../Foo';\n```\n\nYou do **not** need to include Jest's own renderer, unless you want to use it _only_ for Jest snapshot testing.\n\n## Example Project for Jest version 15+\n\n- [Example test for Jest 15+](https://github.com/vjwilson/enzyme-example-jest)\n\n## Jest prior to version 15\n\nIf you are using Jest 0.9 – 14.0 with enzyme and using Jest's automocking feature, you will need to mark react and enzyme to be unmocked in your `package.json`:\n\n`package.json`:\n```json\n{\n  \"jest\": {\n    \"unmockedModulePathPatterns\": [\n      \"node_modules/react/\",\n      \"node_modules/enzyme/\"\n    ]\n  }\n}\n```\n\nIf you are using a previous version of Jest together with npm3, you may need to unmock [more modules](https://github.com/enzymejs/enzyme/blob/78febd90fe2fb184771b8b0356b0fcffbdad386e/docs/guides/jest.md).\n"
  },
  {
    "path": "docs/guides/jsdom.md",
    "content": "# Using enzyme with JSDOM\n\n[JSDOM](https://github.com/jsdom/jsdom) is a JavaScript based headless browser that can be used to create a realistic testing environment.\n\nSince enzyme's [`mount`](../api/mount.md) API requires a DOM, JSDOM is required in order to use\n`mount` if you are not already in a browser environment (ie, a Node environment).\n\nFor the best experience with enzyme, it is recommended that you load a document into the global\nscope *before* requiring React for the first time. It is very important that the below script\ngets run *before* React's code is run.\n\nAs a result, a standalone script like the one below is generally a good approach:\n\n`jsdom v10~`:\n\n```js\n/* setup.js */\n\nconst { JSDOM } = require('jsdom');\n\nconst jsdom = new JSDOM('<!doctype html><html><body></body></html>');\nconst { window } = jsdom;\n\nfunction copyProps(src, target) {\n  Object.defineProperties(target, {\n    ...Object.getOwnPropertyDescriptors(src),\n    ...Object.getOwnPropertyDescriptors(target),\n  });\n}\n\nglobal.window = window;\nglobal.document = window.document;\nglobal.navigator = {\n  userAgent: 'node.js',\n};\nglobal.requestAnimationFrame = function (callback) {\n  return setTimeout(callback, 0);\n};\nglobal.cancelAnimationFrame = function (id) {\n  clearTimeout(id);\n};\ncopyProps(window, global);\n```\n\nHere is the sample of [jsdom old API](https://github.com/jsdom/jsdom/blob/11.0.0/lib/old-api.md) as well.\n\n`jsdom ~<v10`:\n\n```js\n/* setup.js */\n\nconst { jsdom } = require('jsdom');\n\nglobal.document = jsdom('');\nglobal.window = document.defaultView;\nglobal.navigator = {\n  userAgent: 'node.js',\n};\n\nfunction copyProps(src, target) {\n  const props = Object.getOwnPropertyNames(src)\n    .filter((prop) => typeof target[prop] === 'undefined')\n    .reduce((result, prop) => ({\n      ...result,\n      [prop]: Object.getOwnPropertyDescriptor(src, prop),\n    }), {});\n  Object.defineProperties(target, props);\n}\ncopyProps(document.defaultView, global);\n```\n\n\n## `describeWithDOM` API and clearing the document after every test\n\nIn previous versions of enzyme, there was a public `describeWithDOM` API which loaded in a new\nJSDOM document into the global namespace before every test, ensuring that tests were deterministic\nand did not have side-effects.\n\nThis approach is no longer recommended. React's source code makes several assumptions about the\nenvironment it is running in, and one of them is that the `global.document` that is found at\n\"require time\" is going to be the one and only document it ever needs to worry about. As a result,\nthis type of \"reloading\" ends up causing more pain than it prevents.\n\nIt is important, however, to make sure that your tests using the global DOM APIs do not have leaky\nside-effects which could change the results of other tests. Until there is a better option, this is\nleft to you to ensure.\n\n\n## JSDOM + Mocha\n\nWhen testing with JSDOM, the `setup.js` file above needs to be run before the test suite runs. If\nyou are using mocha, this can be done from the command line using the `--require` option:\n\n```bash\nmocha --require setup.js --recursive path/to/test/dir\n```\n\n\n## Node.js Compatibility\n\nJsdom requires node 4 or above. As a result, if you want to use it with `mount`, you will need to\nmake sure node 4 or iojs is on your machine. If you are stuck using an older version of Node, you\nmay want to try using a browser-based test runner such as [Karma](../guides/karma.md).\n\n\n### Switching between node versions\n\nSome times you may need to switch between different versions of node, you can use a CLI tool called\n`nvm` to quickly switch between node versions.\n\nTo install `nvm`, use the curl script from https://nvm.sh, and then:\n\n```bash\nnvm install 4\n```\n\nNow your machine will be running Node 4. You can use the `nvm use` command to switch between the two\nenvironments:\n\n```bash\nnvm use 0.12\n```\n\n```bash\nnvm use 4\n```\n"
  },
  {
    "path": "docs/guides/karma.md",
    "content": "# Using enzyme with Karma\n\nKarma is a popular test runner that can run tests in multiple browser environments. Depending on your Karma setup, you may have a number of options for configuring Enzyme.\n\n## Basic Enzyme setup with Karma\n\n### Configure Enzyme\n\nCreate an Enzyme setup file. This file will configure Enzyme with the appropriate React adapter. It can also be used to initialize any that you'd like available for all tests. To avoid having to import this file and Enzyme, you can re-export all Enzyme exports from this file and just import it.\n\n```js\n/* test/enzyme.js */\nimport Enzyme from 'enzyme';\nimport Adapter from 'enzyme-adapter-react-16';\nimport jasmineEnzyme from 'jasmine-enzyme';\n\n// Configure Enzyme for the appropriate React adapter\nEnzyme.configure({ adapter: new Adapter() });\n\n// Initialize global helpers\nbeforeEach(() => {\n  jasmineEnzyme();\n});\n\n// Re-export all enzyme exports\nexport * from 'enzyme';\n```\n\n### Import Enzyme from the Enzyme setup file\n\nAnywhere you want to use Enzyme, import the Enzyme setup file just as you would Enzyme itself.\n\n```js\n/* some_test.js */\n// Import anything you would normally import `from 'enzyme'` from the Enzyme setup file\nimport { shallow } from './test/enzyme';\n\n// ...\n```\n\n\n## Alternative karma-webpack setup\n\nIf you're using Karma and Webpack using [karma-webpack's alternative setup](https://github.com/webpack-contrib/karma-webpack#alternative-usage), you can configure enzyme in your test entry file and import Enzyme directly in individual tests.\n\n```js\n/* test/index_test.js */\nimport './enzyme';\n\nconst testsContext = require.context('.', true, /_test$/);\n\ntestsContext.keys().forEach(testsContext);\n```\n\n```js\n/* some_test.js */\n// If Enzyme is configured in the test entry file, Enzyme can be imported directly\nimport { shallow } from 'enzyme';\n\n// ...\n```\n"
  },
  {
    "path": "docs/guides/lab.md",
    "content": "# Using enzyme with Lab and Code\n\n[Lab](https://github.com/hapijs/lab) is a simple test utility for node & part of the [Hapi.js](https://github.com/hapijs/hapi) framework universe. Lab's initial code borrowed heavily from [Mocha](https://github.com/mochajs/mocha). [Code](https://github.com/hapijs/code) is Lab's standard assertion library and was created as a direct rewrite of [Chai](https://github.com/chaijs).\n\n\n# Example Test: enzyme + Lab + Code\n\n```jsx\nimport { shallow, mount, render } from 'enzyme';\nimport React from 'react';\n\nconst Code = require('code');\nconst Lab = require('lab');\n\nconst lab = Lab.script();\nexport { lab };\n\nlab.suite('A suite', () => {\n  lab.test('calls componentDidMount', (done) => {\n    const wrapper = mount(<Foo />);\n    Code.expect(Foo.prototype.componentDidMount.callCount).to.equal(1);\n    done();\n  });\n});\n```\n\n\n## Example Projects\n\n- [enzyme-example-lab](https://github.com/gattermeier/enzyme-example-lab)\n"
  },
  {
    "path": "docs/guides/migration-from-2-to-3.md",
    "content": "# Migration Guide for enzyme v2.x to v3.x\n\nThe change from enzyme v2.x to v3.x is a more significant change than in previous major releases,\ndue to the fact that the internal implementation of enzyme has been almost completely rewritten.\n\nThe goal of this rewrite was to address a lot of the major issues that have plagued enzyme since\nits initial release. It was also to simultaneously remove a lot of the dependencies that enzyme has\non React internals, and to make enzyme more \"pluggable\", paving the way for enzyme to be used\nwith \"React-like\" libraries such as Preact and Inferno.\n\nWe have done our best to make enzyme v3 as API compatible with v2.x as possible, however there are\na handful of breaking changes that we decided we needed to make, intentionally, in order to\nsupport this new architecture and also improve the usability of the library long-term.\n\nAirbnb has one of the largest enzyme test suites, coming in at around 30,000 enzyme unit tests.\nAfter upgrading enzyme to v3.x in Airbnb's code base, 99.6% of these tests succeeded with no\nmodifications at all. Most of the tests that broke we found to be easy to fix, and some we found to\nactually depend on what could arguably be considered a bug in v2.x, and the breakage was\nactually desired.\n\nIn this guide, we will go over a couple of the most common breakages that we ran into, and how to\nfix them. Hopefully this will make your upgrade path that much easier. If during your upgrade you\nfind a breakage that doesn't seem to make sense to you, feel free to file an issue.\n\n\n## Configuring your Adapter\n\nenzyme now has an \"Adapter\" system. This means that you now need to install enzyme along with\nanother module that provides the Adapter that tells enzyme how to work with your version of React\n(or whatever other React-like library you are using).\n\nAt the time of writing this, enzyme publishes \"officially supported\" adapters for React 0.13.x,\n0.14.x, 15.x, and 16.x. These adapters are npm packages of the form `enzyme-adapter-react-{{version}}`.\n\nYou will want to configure enzyme with the adapter you'd like to use before using enzyme in your\ntests. The way to do this is with `enzyme.configure(...)`. For example, if your project depends\non React 16, you would want to configure enzyme this way:\n\n```js\nimport Enzyme from 'enzyme';\nimport Adapter from 'enzyme-adapter-react-16';\n\nEnzyme.configure({ adapter: new Adapter() });\n```\n\nThe list of adapter npm packages for React semver ranges are as follows:\n\n| enzyme Adapter Package | React semver compatibility |\n| --- | --- |\n| `enzyme-adapter-react-16` | `^16.4.0-0` |\n| `enzyme-adapter-react-16.3` | `~16.3.0-0` |\n| `enzyme-adapter-react-16.2` | `~16.2` |\n| `enzyme-adapter-react-16.1` | `~16.0.0-0 \\|\\| ~16.1` |\n| `enzyme-adapter-react-15` | `^15.5.0` |\n| `enzyme-adapter-react-15.4` | `15.0.0-0 - 15.4.x` |\n| `enzyme-adapter-react-14` | `^0.14.0` |\n| `enzyme-adapter-react-13` | `^0.13.0` |\n\n\n## Element referential identity is no longer preserved\n\nenzyme's new architecture means that the react \"render tree\" is transformed into an intermediate\nrepresentation that is common across all react versions so that enzyme can properly traverse it\nindependent of React's internal representations. A side effect of this is that enzyme no longer\nhas access to the actual object references that were returned from `render` in your React\ncomponents. This normally isn't much of a problem, but can manifest as a test failure in some\ncases.\n\nFor example, consider the following example:\n\n<!-- eslint react/prop-types: 0 -->\n```js\nimport React from 'react';\nimport Icon from './path/to/Icon';\n\nconst ICONS = {\n  success: <Icon name=\"check-mark\" />,\n  failure: <Icon name=\"exclamation-mark\" />,\n};\n\nfunction StatusLabel({ id, label }) {\n  return <div>{ICONS[id]}{label}{ICONS[id]}</div>;\n}\n```\n\n```js\nimport { shallow } from 'enzyme';\nimport StatusLabel from './path/to/StatusLabel';\nimport Icon from './path/to/Icon';\n\nconst wrapper = shallow(<StatusLabel id=\"success\" label=\"Success\" />);\n\nconst iconCount = wrapper.find(Icon).length;\n```\n\nIn v2.x, `iconCount` would be 1. In v3.x, it will be 2. This is because in v2.x it would find all\nof the elements matching the selector, and then remove any duplicates. Since `ICONS.success` is\nincluded twice in the render tree, but it's a constant that's reused, it would show up as a\nduplicate in the eyes of enzyme v2.x. In enzyme v3, the elements that are traversed are\ntransformations of the underlying react elements, and are thus different references, resulting in\ntwo elements being found.\n\nAlthough this is a breaking change, I believe the new behavior is closer to what people would\nactually expect and want. Having enzyme wrappers be immutable results in more deterministic tests\nthat are less prone to flakiness from external factors.\n\n### Calling `props()` after a state change\n\nIn `enzyme` v2, executing an event that would change a component state (and in turn update props) would return those updated props via the `.props` method.\n\nNow, in `enzyme` v3, you are required to re-find the component; for example:\n\n```jsx\nclass Toggler extends React.Component {\n  constructor(...args) {\n    super(...args);\n    this.state = { on: false };\n  }\n\n  toggle() {\n    this.setState(({ on }) => ({ on: !on }));\n  }\n\n  render() {\n    const { on } = this.state;\n    return (<div id=\"root\">{on ? 'on' : 'off'}</div>);\n  }\n}\n\nit('passes in enzyme v2, fails in v3', () => {\n  const wrapper = mount(<Toggler />);\n  const root = wrapper.find('#root');\n  expect(root.text()).to.equal('off');\n\n  wrapper.instance().toggle();\n\n  expect(root.text()).to.equal('on');\n});\n\nit('passes in v2 and v3', () => {\n  const wrapper = mount(<Toggler />);\n  expect(wrapper.find('#root').text()).to.equal('off');\n\n  wrapper.instance().toggle();\n\n  expect(wrapper.find('#root').text()).to.equal('on');\n});\n```\n\n## `children()` now has slightly different meaning\n\nenzyme has a `.children()` method which is intended to return the rendered children of a wrapper.\n\nWhen using `mount(...)`, it can sometimes be unclear exactly what this would mean. Consider for\nexample the following react components:\n\n<!-- eslint react/prop-types: 0, react/prefer-stateless-function: 0, max-classes-per-file: 0 -->\n```js\nclass Box extends React.Component {\n  render() {\n    const { children } = this.props;\n    return <div className=\"box\">{children}</div>;\n  }\n}\n\nclass Foo extends React.Component {\n  render() {\n    return (\n      <Box bam>\n        <div className=\"div\" />\n      </Box>\n    );\n  }\n}\n```\n\nNow lets say we have a test which does something like:\n\n```js\nconst wrapper = mount(<Foo />);\n```\n\nAt this point, there is an ambiguity about what `wrapper.find(Box).children()` should return.\nAlthough the `<Box ... />` element has a `children` prop of `<div className=\"div\" />`, the actual\nrendered children of the element that the box component renders is a `<div className=\"box\">...</div>`\nelement.\n\nPrior enzyme v3, we would observe the following behavior:\n\n```js\nwrapper.find(Box).children().debug();\n// => <div className=\"div\" />\n```\n\nIn enzyme v3, we now have `.children()` return the *rendered* children. In other words, it returns\nthe element that is returned from that component's `render` function.\n\n```js\nwrapper.find(Box).children().debug();\n// =>\n// <div className=\"box\">\n//   <div className=\"div\" />\n// </div>\n```\n\nThis may seem like a subtle difference, but making this change will be important for future APIs\nwe would like to introduce.\n\n## `find()` now returns host nodes and DOM nodes\n\nIn some cases find will return a host node and DOM node. Take the following for example:\n\n```\nconst Foo = () => <div/>;\nconst wrapper = mount(\n  <div>\n    <Foo className=\"bar\" />\n    <div className=\"bar\"/>\n   </div>\n);\nconsole.log(wrapper.find('.bar').length); // 2\n```\n\nSince `<Foo/>` has the className `bar` it is returned as the _hostNode_. As expected the `<div>` with the className `bar` is also returned\n\nTo avoid this you can explicitly query for the DOM node: `wrapper.find('div.bar')`. Alternatively if you would like to only find host nodes use [hostNodes()](https://enzymejs.github.io/enzyme/docs/api/ShallowWrapper/hostNodes.html)\n\n## For `mount`, updates are sometimes required when they weren't before\n\nReact applications are dynamic. When testing your react components, you often want to test them\nbefore *and after* certain state changes take place. When using `mount`, any react component\ninstance in the entire render tree could register code to initiate a state change at any time.\n\nFor instance, consider the following contrived example:\n\n```js\nimport React from 'react';\n\nclass CurrentTime extends React.Component {\n  constructor(props) {\n    super(props);\n    this.state = {\n      now: Date.now(),\n    };\n  }\n\n  componentDidMount() {\n    this.tick();\n  }\n\n  componentWillUnmount() {\n    clearTimeout(this.timer);\n  }\n\n  tick() {\n    this.setState({ now: Date.now() });\n    this.timer = setTimeout(tick, 0);\n  }\n\n  render() {\n    const { now } = this.state;\n    return <span>{now}</span>;\n  }\n}\n```\n\nIn this code, there is a timer that continuously changes the rendered output of this component. This\nmight be a reasonable thing to do in your application. The thing is, enzyme has no way of knowing\nthat these changes are taking place, and no way to automatically update the render tree. In enzyme\nv2, enzyme operated *directly* on the in-memory representation of the render tree that React itself\nhad. This means that even though enzyme couldn't know when the render tree was updated, updates\nwould be reflected anyway, since React *does* know.\n\nenzyme v3 architecturally created a layer where React would create an intermediate representation\nof the render tree at an instance in time and pass that to enzyme to traverse and inspect. This has\nmany advantages, but one of the side effects is that now the intermediate representation does not\nreceive automatic updates.\n\nenzyme does attempt to automatically \"update\" the root wrapper in most common scenarios, but these\nare only the state changes that it knows about. For all other state changes, you may need to call\n`wrapper.update()` yourself.\n\nThe most common manifestation of this problem can be shown with the following example:\n\n```js\nclass Counter extends React.Component {\n  constructor(props) {\n    super(props);\n    this.state = { count: 0 };\n    this.increment = this.increment.bind(this);\n    this.decrement = this.decrement.bind(this);\n  }\n\n  increment() {\n    this.setState(({ count }) => ({ count: count + 1 }));\n  }\n\n  decrement() {\n    this.setState(({ count }) => ({ count: count - 1 }));\n  }\n\n  render() {\n    const { count } = this.state;\n    return (\n      <div>\n        <div className=\"count\">Count: {count}</div>\n        <button type=\"button\" className=\"inc\" onClick={this.increment}>Increment</button>\n        <button type=\"button\" className=\"dec\" onClick={this.decrement}>Decrement</button>\n      </div>\n    );\n  }\n}\n```\n\nThis is a basic \"counter\" component in React. Here our resulting markup is a function of\n`this.state.count`, which can get updated by the `increment` and `decrement` functions. Let's take a\nlook at what some enzyme tests with this component might look like, and when we do or don't have to\ncall `update()`.\n\n```js\nconst wrapper = shallow(<Counter />);\nwrapper.find('.count').text(); // => \"Count: 0\"\n```\n\nAs we can see, we can easily assert on the text and the count of this component. But we haven't\ncaused any state changes yet. Let's see what it looks like when we simulate a `click` event on\nthe increment and decrement buttons:\n\n```js\nconst wrapper = shallow(<Counter />);\nwrapper.find('.count').text(); // => \"Count: 0\"\nwrapper.find('.inc').simulate('click');\nwrapper.find('.count').text(); // => \"Count: 1\"\nwrapper.find('.inc').simulate('click');\nwrapper.find('.count').text(); // => \"Count: 2\"\nwrapper.find('.dec').simulate('click');\nwrapper.find('.count').text(); // => \"Count: 1\"\n```\n\nIn this case enzyme will automatically check for updates after an event simulation takes place, as\nit knows that this is a very common place for state changes to occur. In this case there is no\ndifference between v2 and v3.\n\nLet's consider a different way this test could have been written.\n\n```js\nconst wrapper = shallow(<Counter />);\nwrapper.find('.count').text(); // => \"Count: 0\"\nwrapper.instance().increment();\nwrapper.find('.count').text(); // => \"Count: 0\" (would have been \"Count: 1\" in v2)\nwrapper.instance().increment();\nwrapper.find('.count').text(); // => \"Count: 0\" (would have been \"Count: 2\" in v2)\nwrapper.instance().decrement();\nwrapper.find('.count').text(); // => \"Count: 0\" (would have been \"Count: 1\" in v2)\n```\n\nThe problem here is that once we grab the instance using `wrapper.instance()`, enzyme has no way of\nknowing if you are going to execute something that will cause a state transition, and thus does not\nknow when to ask for an updated render tree from React. As a result, `.text()` never changes value.\n\nThe fix here is to use enzyme's `wrapper.update()` method after a state change has occurred:\n\n```js\nconst wrapper = shallow(<Counter />);\nwrapper.find('.count').text(); // => \"Count: 0\"\nwrapper.instance().increment();\nwrapper.update();\nwrapper.find('.count').text(); // => \"Count: 1\"\nwrapper.instance().increment();\nwrapper.update();\nwrapper.find('.count').text(); // => \"Count: 2\"\nwrapper.instance().decrement();\nwrapper.update();\nwrapper.find('.count').text(); // => \"Count: 1\"\n```\n\nIn practice we have found that this isn't actually needed that often, and when it is it is not\ndifficult to add. Additionally, having the enzyme wrapper automatically update alongside the real\nrender tree can result in flaky tests when writing asynchronous tests. This breaking change was\nworth the architectural benefits of the new adapter system in v3, and we believe is a better choice\nfor an assertion library to take.\n\n\n## `ref(refName)` now returns the actual ref instead of a wrapper\n\nIn enzyme v2, the wrapper returned from `mount(...)` had a prototype method on it `ref(refName)`\nthat returned a wrapper around the actual element of that ref. This has now been changed to\nreturn the actual ref, which we believe is a more intuitive API.\n\nConsider the following simple react component:\n\n<!-- eslint react/no-string-refs: 0 -->\n```js\nclass Box extends React.Component {\n  render() {\n    return <div ref=\"abc\" className=\"box\">Hello</div>;\n  }\n}\n```\n\nIn this case we can call `.ref('abc')` on a wrapper of `Box`. In this case it will return a wrapper\naround the rendered div. To demonstrate, we can see that both `wrapper` and the result of `ref(...)`\nshare the same constructor:\n\n```js\nconst wrapper = mount(<Box />);\n// this is what would happen with enzyme v2\nexpect(wrapper.ref('abc')).toBeInstanceOf(wrapper.constructor);\n```\n\nIn v3, the contract is slightly changed. The ref is exactly what React would assign as the ref. In\nthis case, it would be a DOM Element:\n\n```js\nconst wrapper = mount(<Box />);\n// this is what happens with enzyme v3\nexpect(wrapper.ref('abc')).toBeInstanceOf(Element);\n```\n\nSimilarly, if you have a ref on a composite component, the `ref(...)` method will return an instance\nof that element:\n\n<!-- eslint react/no-string-refs: 0 -->\n```js\nclass Bar extends React.Component {\n  render() {\n    return <Box ref=\"abc\" />;\n  }\n}\n```\n\n```js\nconst wrapper = mount(<Bar />);\nexpect(wrapper.ref('abc')).toBeInstanceOf(Box);\n```\n\nIn our experience, this is most often what people would actually want and expect out of the `.ref(...)`\nmethod.\n\nTo get the wrapper that was returned by enzyme 2:\n```js\nconst wrapper = mount(<Bar />);\nconst refWrapper = wrapper.findWhere((n) => n.instance() === wrapper.ref('abc'));\n```\n\n## With `mount`, `.instance()` can be called at any level of the tree\n\nenzyme now allows for you to grab the `instance()` of a wrapper at any level of the render tree,\nnot just at the root. This means that you can `.find(...)` a specific component, then grab its\ninstance and call `.setState(...)` or any other methods on the instance that you'd like.\n\n\n## With `mount`, `.getNode()` should not be used. `.instance()` does what it used to.\n\nFor `mount` wrappers, the `.getNode()` method used to return the actual component instance. This\nmethod no longer exists, but `.instance()` is functionally equivalent to what `.getNode()` used to\nbe.\n\n\n## With `shallow`, `.getNode()` should be replaced with `getElement()`\n\nFor shallow wrappers, if you were previously using `.getNode()`, you will want to replace those\ncalls with `.getElement()`, which is now functionally equivalent to what `.getNode()` used to do.\nOne caveat is that previously `.getNode()` would return the actual element instance that was\ncreated in the `render` function of the component you were testing, but now it will be a\nstructurally equal react element, but not referentially equal. Your tests will need to be updated to\naccount for this.\n\n## Private properties and methods have been removed\n\nThere are several properties that are on an enzyme \"wrapper\" that were considered to be private and\nwere undocumented as a result. Despite being undocumented, people may have been relying on them. In\nan effort to make making changes less likely to be accidentally breaking in the future, we have\ndecided to make these properties properly \"private\". The following properties will no longer be\naccessible on enzyme `shallow` or `mount` instances:\n\n- `.node`\n- `.nodes`\n- `.renderer`\n- `.unrendered`\n- `.root`\n- `.options`\n\n\n## Cheerio has been updated, thus `render(...)` has been updated as well\n\nenzyme's top level `render` API returns a [Cheerio](https://github.com/cheeriojs/cheerio) object.\nThe version of Cheerio that we use has been upgraded to 1.0.0. For debugging issues across enzyme\nv2.x and v3.x with the `render` API, we recommend checking out [Cheerio's Changelog](https://github.com/cheeriojs/cheerio/blob/48eae25c93702a29b8cd0d09c4a2dce2f912d1f4/History.md) and\nposting an issue on that repo instead of enzyme's unless you believe it is a bug in enzyme's use\nof the library.\n\n## CSS Selector\n\nenzyme v3 now uses a real CSS selector parser rather than its own incomplete parser implementation.\nThis is done with [rst-selector-parser](https://github.com/aweary/rst-selector-parser) a fork of [scalpel](https://github.com/gajus/scalpel/) which is a CSS parser implemented with [nearley](https://nearley.js.org/).\nWe don't think this should cause any breakages across enzyme v2.x to v3.x, but if you believe you\nhave found something that did indeed break, please file an issue with us. Thank you to\n[Brandon Dail](https://github.com/aweary) for making this happen!\n\n## CSS Selector results and `hostNodes()`\n\nenzyme v3 now returns **all** nodes in the result set and not just html nodes.\nConsider this example:\n\n<!-- eslint react/prop-types: 0, react/prefer-stateless-function: 0, react/jsx-props-no-spreading: 0 -->\n\n```js\nfunction HelpLink({ text, ...rest }) {\n  return <a {...rest}>{text}</a>;\n}\n\nfunction HelpLinkContainer({ text, ...rest }) {\n  return <HelpLink text={text} {...rest} />;\n}\n\nconst wrapper = mount(<HelpLinkContainer aria-expanded=\"true\" text=\"foo\" />);\n```\n\nIn enzyme v3, the expression `wrapper.find(\"[aria-expanded=true]\").length)` will\nreturn 3 and not 1 as in previous versions. A closer look using\n[`debug`](../api/ReactWrapper/debug.md) reveals:\n\n<!-- eslint react/prop-types: 0, react/prefer-stateless-function: 0 -->\n<!-- eslint-skip -->\n```jsx\n// console.log(wrapper.find('[aria-expanded=\"true\"]').debug());\n\n<HelpLinkContainer aria-expanded={true} text=\"foo\">\n  <HelpLink text=\"foo\" aria-expanded=\"true\">\n    <a aria-expanded=\"true\">\n      foo\n    </a>\n  </HelpLink>\n</HelpLinkContainer>\n\n<HelpLink text=\"foo\" aria-expanded=\"true\">\n  <a aria-expanded=\"true\">\n    foo\n  </a>\n</HelpLink>\n\n<a aria-expanded=\"true\">\n  foo\n</a>\n```\n\nTo return only the html nodes use the\n[`hostNodes()`](../api/ReactWrapper/hostNodes.md) function.\n\n`wrapper.find(\"[aria-expanded=true]\").hostNodes().debug()` will now return:\n\n<!-- eslint react/prop-types: 0, react/prefer-stateless-function: 0, no-unused-expressions: 0, jsx-a11y/anchor-is-valid: 0 -->\n\n```jsx\n<a aria-expanded=\"true\">foo</a>;\n```\n\n## Node Equality now ignores `undefined` values\n\nWe have updated enzyme to consider node \"equality\" in a semantically identical way to how react\ntreats nodes. More specifically, we've updated enzyme's algorithms to treat `undefined` props as\nequivalent to the absence of a prop. Consider the following example:\n\n<!-- eslint react/prop-types: 0, react/prefer-stateless-function: 0 -->\n```js\nclass Foo extends React.Component {\n  render() {\n    const { foo, bar } = this.props;\n    return <div className={foo} id={bar} />;\n  }\n}\n```\n\nWith this component, the behavior in enzyme v2.x the behavior would have been like:\n\n```js\nconst wrapper = shallow(<Foo />);\nwrapper.equals(<div />); // => false\nwrapper.equals(<div className={undefined} id={undefined} />); // => true\n```\n\nWith enzyme v3, the behavior is now as follows:\n```js\nconst wrapper = shallow(<Foo />);\nwrapper.equals(<div />); // => true\nwrapper.equals(<div className={undefined} id={undefined} />); // => true\n```\n\n## Lifecycle methods\n\nenzyme v2.x had an optional flag that could be passed in to all `shallow` calls which would make it\nso that more of the component's lifecycle methods were called (such as `componentDidMount` and\n`componentDidUpdate`).\n\nWith enzyme v3, we have now turned on this mode by default, instead of making it opt-in. It is now\npossible to *opt-out* instead. Additionally, you can now opt-out at a global level.\n\nIf you'd like to opt out globally, you can run the following:\n\n```js\nimport Enzyme from 'enzyme';\n\nEnzyme.configure({ disableLifecycleMethods: true });\n```\n\nThis will default enzyme back to the previous behavior globally. If instead you'd only like to opt\nenzyme to the previous behavior for a specific test, you can do the following:\n\n```js\nimport { shallow } from 'enzyme';\n\n// ...\n\nconst wrapper = shallow(<Component />, { disableLifecycleMethods: true });\n```\n"
  },
  {
    "path": "docs/guides/mocha.md",
    "content": "# Using enzyme with Mocha\n\nenzyme was originally designed to work with Mocha, so getting it up and running with Mocha should\nbe no problem at all. Simply install it and start using it:\n\n```bash\nnpm i --save-dev enzyme\n```\n\n```jsx\nimport React from 'react';\nimport { expect } from 'chai';\nimport { mount } from 'enzyme';\nimport { spy } from 'sinon';\nimport Foo from './src/Foo';\n\nspy(Foo.prototype, 'componentDidMount');\n\ndescribe('<Foo />', () => {\n  it('calls componentDidMount', () => {\n    const wrapper = mount(<Foo />);\n    expect(Foo.prototype.componentDidMount).to.have.property('callCount', 1);\n  });\n});\n```"
  },
  {
    "path": "docs/guides/react-native.md",
    "content": "# Using enzyme to Test Components in React Native\n\nAs of v0.18, React Native uses React as a dependency rather than a forked version of the library,\nwhich means it is now possible to use enzyme's `shallow` with React Native components.\n\nUnfortunately, React Native has many environmental dependencies that can be hard to simulate without\na host device.\n\nThis can be difficult when you want your test suite to run with typical Continuous Integration servers\nsuch as Travis.\n\nTo use enzyme to test React Native, you currently need to configure an adapter, and load an emulated DOM.\n\n## Configuring an Adapter\n\nWhile a React Native adapter is [in discussion](https://github.com/enzymejs/enzyme/issues/1436),\na standard adapter may be used, such as 'enzyme-adapter-react-16':\n\n```jsx\nimport Adapter from 'enzyme-adapter-react-16';\n\nEnzyme.configure({ adapter: new Adapter() });\n```\n\n## Loading an emulated DOM with JSDOM\n\nTo use enzyme's `mount` until a React Native adapter exists, an emulated DOM must be loaded.\n\nWhile some have had success with [react-native-mock-renderer](https://github.com/Root-App/react-native-mock-render),\nthe recommended approach is to use [JSDOM](https://github.com/jsdom/jsdom),\nas documented for enzyme at the [JSDOM](https://enzymejs.github.io/enzyme/docs/guides/jsdom.html) documentation page.\n\nJSDOM will allow all of the `enzyme` behavior you would expect. While Jest snapshot testing can be used with\nthis approach as well, it isn't encouraged and is only supported through `wrapper.debug()`.\n\n## Using enzyme's find when lacking className props\n\nIt is worth noting that React Native allows for a [testID](https://facebook.github.io/react-native/docs/view#testid)\nprop, that can be used a selector similar to `className` in standard React:\n\n<!-- eslint no-unused-expressions: 0, semi: 0 -->\n```jsx\n    <View key={key} style={styles.todo} testID=\"todo-item\">\n      <Text testID=\"todo-title\" style={styles.title}>{todo.title}</Text>\n    </View>\n```\n\n```jsx\nexpect(wrapper.findWhere((node) => node.prop('testID') === 'todo-item')).toExist();\n```\n\n## Default example configuration for Jest and JSDOM replacement\n\nTo perform the necessary configuration in your testing framework, it is recommended to use a setup script,\nsuch as with Jest's `setupFilesAfterEnv` setting.\n\nCreate or update a `jest.config.js` file at the root of your project to include the `setupFilesAfterEnv` setting:\n\n```jsx\n// jest.config.js\n\nmodule.exports = {\n  // Load setup-tests.js before test execution\n  setupFilesAfterEnv: '<rootDir>setup-tests.js',\n\n  // ...\n};\n```\n\nThen create or update the file specified in `setupFilesAfterEnv`, in this case `setup-tests.js` in the project root:\n\n```jsx\n// setup-tests.js\n\nimport 'react-native';\nimport 'jest-enzyme';\nimport Adapter from 'enzyme-adapter-react-16';\nimport Enzyme from 'enzyme';\n\n/**\n * Set up DOM in node.js environment for Enzyme to mount to\n */\nconst { JSDOM } = require('jsdom');\n\nconst jsdom = new JSDOM('<!doctype html><html><body></body></html>');\nconst { window } = jsdom;\n\nfunction copyProps(src, target) {\n  Object.defineProperties(target, {\n    ...Object.getOwnPropertyDescriptors(src),\n    ...Object.getOwnPropertyDescriptors(target),\n  });\n}\n\nglobal.window = window;\nglobal.document = window.document;\nglobal.navigator = {\n  userAgent: 'node.js',\n};\ncopyProps(window, global);\n\n/**\n * Set up Enzyme to mount to DOM, simulate events,\n * and inspect the DOM in tests.\n */\nEnzyme.configure({ adapter: new Adapter() });\n```\n\n## Configure enzyme with other test libraries and include JSDOM on the fly\n\nUpdate the file specified in `setupFilesAfterEnv`, in this case `setup-tests.js` in the project root:\n\n```jsx\nimport 'react-native';\nimport 'jest-enzyme';\nimport Adapter from 'enzyme-adapter-react-16';\nimport Enzyme from 'enzyme';\n\n/**\n * Set up Enzyme to mount to DOM, simulate events,\n * and inspect the DOM in tests.\n */\nEnzyme.configure({ adapter: new Adapter() });\n```\n\n### Create a separate test file\n\nCreate a file prefixed with enzyme.test.ts for example `component.enzyme.test.js`:\n\n```jsx\n/**\n * @jest-environment jsdom\n */\nimport React from 'react';\nimport { mount } from 'enzyme';\nimport { Text } from '../../../component/text';\n\ndescribe('Component tested with enzyme', () => {\n  test('App mount with enzyme', () => {\n    const wrapper = mount(<Text />);\n    // other tests operations\n  });\n});\n```\n\n**The most important part is to ensure that the test runs with the `jestEnvironment` set to `jsdom`** - one way is to include a `/* @jest-environment jsdom */` comment at the top of the file.\n\n\n\nThen you should then be able to start writing tests!\n\nNote that you may want to perform some additional mocking around native components,\nor if you want to perform snapshot testing against React Native components. Notice\nhow you may need to mock React Navigation's `KeyGenerator` in this case, to avoid\nrandom React keys that will cause snapshots to always fail.\n\n```jsx\nimport React from 'react';\nimport renderer from 'react-test-renderer';\nimport { mount, ReactWrapper } from 'enzyme';\nimport { Provider } from 'mobx-react';\nimport { Text } from 'native-base';\n\nimport { TodoItem } from './todo-item';\nimport { TodoList } from './todo-list';\nimport { todoStore } from '../../stores/todo-store';\n\n// https://github.com/react-navigation/react-navigation/issues/2269\n// React Navigation generates random React keys, which makes\n// snapshot testing fail. Mock the randomness to keep from failing.\njest.mock('react-navigation/src/routers/KeyGenerator', () => ({\n  generateKey: jest.fn(() => 123),\n}));\n\ndescribe('todo-list', () => {\n  describe('enzyme tests', () => {\n    it('can add a Todo with Enzyme', () => {\n      const wrapper = mount(\n        <Provider keyLength={0} todoStore={todoStore}>\n          <TodoList />\n        </Provider>,\n      );\n\n      const newTodoText = 'I need to do something...';\n      const newTodoTextInput = wrapper.find('Input').first();\n      const addTodoButton = wrapper\n        .find('Button')\n        .findWhere((w) => w.text() === 'Add Todo')\n        .first();\n\n      newTodoTextInput.props().onChangeText(newTodoText);\n\n      // Enzyme usually allows wrapper.simulate() alternatively, but this doesn't support 'press' events.\n      addTodoButton.props().onPress();\n\n      // Make sure to call update if external events (e.g. Mobx state changes)\n      // result in updating the component props.\n      wrapper.update();\n\n      // You can either check for a testID prop, similar to className in React:\n      expect(\n        wrapper.findWhere((node) => node.prop('testID') === 'todo-item'),\n      ).toExist();\n\n      // Or even just find a component itself, if you broke the JSX out into its own component:\n      expect(wrapper.find(TodoItem)).toExist();\n\n      // You can even do snapshot testing,\n      // if you pull in enzyme-to-json and configure\n      // it in snapshotSerializers in package.json\n      expect(wrapper.find(TodoList)).toMatchSnapshot();\n    });\n  });\n});\n```\n"
  },
  {
    "path": "docs/guides/systemjs.md",
    "content": "# Using enzyme with SystemJS\n\nIf you are using a test runner that runs code in a browser-based environment,\nyou may be using [SystemJS]() in order to bundle your React code.\n\nPrior to enzyme 3.0 there were some issues with conditional requires that were used\nto maintain backwards compatibility with React versions. With enzyme 3.0+, this\nshould no longer be an issue. If it is, please file a GitHub issue or make a PR\nto this documentation with instructions on how to set it up.\n"
  },
  {
    "path": "docs/guides/tape-ava.md",
    "content": "# Using enzyme with Tape and AVA\n\nenzyme works well with [Tape](https://github.com/substack/tape) and [AVA](https://github.com/avajs/ava).\nSimply install it and start using it:\n\n```bash\nnpm i --save-dev enzyme enzyme-adapter-react-16\n```\n\n## Tape\n\n```jsx\nimport test from 'tape';\nimport React from 'react';\nimport { shallow, mount, configure } from 'enzyme';\nimport Adapter from 'enzyme-adapter-react-16';\n\nimport Foo from '../path/to/foo';\n\nconfigure({ adapter: new Adapter() });\n\ntest('shallow', (t) => {\n  const wrapper = shallow(<Foo />);\n  t.equal(wrapper.contains(<span>Foo</span>), true);\n});\n\ntest('mount', (t) => {\n  const wrapper = mount(<Foo />);\n  const fooInner = wrapper.find('.foo-inner');\n  t.equal(fooInner.is('.foo-inner'), true);\n});\n```\n\n## AVA\n\n\n```jsx\nimport test from 'ava';\nimport React from 'react';\nimport { shallow, mount, configure } from 'enzyme';\nimport Adapter from 'enzyme-adapter-react-16';\n\nimport Foo from '../path/to/foo';\n\nconfigure({ adapter: new Adapter() });\n\ntest('shallow', (t) => {\n  const wrapper = shallow(<Foo />);\n  t.is(wrapper.contains(<span>Foo</span>), true);\n});\n\ntest('mount', (t) => {\n  const wrapper = mount(<Foo />);\n  const fooInner = wrapper.find('.foo-inner');\n  t.is(fooInner.is('.foo-inner'), true);\n});\n```\n\n## Example Projects\n\n- [enzyme-example-tape](https://github.com/TaeKimJR/enzyme-example-tape)\n- [enzyme-example-ava](https://github.com/mikenikles/enzyme-example-ava)\n"
  },
  {
    "path": "docs/guides/webpack.md",
    "content": "# Using enzyme with Webpack\n\nIf you are using a test runner that runs code in a browser-based environment, you may be using\n[webpack](https://webpack.js.org/) in order to bundle your React code.\n\nPrior to enzyme 3.0 there were some issues with conditional requires that were used\nto maintain backwards compatibility with React versions. With enzyme 3.0+, this\nshould no longer be an issue. If it is, please file a GitHub issue or make a PR\nto this documentation with instructions on how to set it up.\n"
  },
  {
    "path": "docs/guides.md",
    "content": "# enzyme Guides\n\n- [*Using enzyme with Browserify*](guides/browserify.md)\n- [*Using enzyme with Webpack*](guides/webpack.md)\n- [*Using enzyme with JSDOM*](guides/jsdom.md)\n- [*Using enzyme with Jest*](guides/jest.md)\n- [*Using enzyme with Karma*](guides/karma.md)\n- [*Using enzyme with Mocha*](guides/mocha.md)\n- [*Using enzyme with React Native*](guides/react-native.md)\n- [*Using enzyme with Lab*](guides/lab.md)\n- [*Using enzyme with Tape and AVA*](guides/tape-ava.md)\n"
  },
  {
    "path": "docs/installation/README.md",
    "content": "# Installation\n\nenzyme should be installed using npm:\n\n```bash\nnpm i --save-dev enzyme\n```\n\nenzyme can be used with your test runner of choice. All examples in the documentation will be\nprovided using [mocha](https://mochajs.org/) and [BDD style chai](http://chaijs.com/api/bdd/),\nalthough neither library is a dependency of enzyme.\n\n{% include \"./react-16.md\" %}\n\n{% include \"./react-15.md\" %}\n\n{% include \"./react-014.md\" %}\n\n{% include \"./react-013.md\" %}\n"
  },
  {
    "path": "docs/installation/react-013.md",
    "content": "# Working with React 0.13\n\nIf you are wanting to use enzyme with React 0.13, but don't already have React 0.13 installed, you\nshould do so:\n\n```bash\nnpm i react@0.13 --save\n```\n\nNext, to get started with enzyme, you can simply install it with npm:\n\n```bash\nnpm i --save-dev enzyme enzyme-adapter-react-13\n```\n\nAnd then you're ready to go!  In your test files you can simply `require` or `import` enzyme:\n\nES6:\n```js\n// setup file\nimport { configure } from 'enzyme';\nimport Adapter from 'enzyme-adapter-react-13';\n\nconfigure({ adapter: new Adapter() });\n```\n\n```js\n// test file\nimport { shallow, mount, render } from 'enzyme';\n\nconst wrapper = shallow(<Foo />);\n```\n\nES5:\n<!-- eslint no-var: 0 -->\n```js\n// setup file\nvar enzyme = require('enzyme');\nvar Adapter = require('enzyme-adapter-react-13');\n\nenzyme.configure({ adapter: new Adapter() });\n```\n\n<!-- eslint no-var: 0 -->\n```js\n// test file\nvar enzyme = require('enzyme');\n\nvar wrapper = enzyme.shallow(<Foo />);\n```\n"
  },
  {
    "path": "docs/installation/react-014.md",
    "content": "# Working with React 0.14\n\nIf you are wanting to use Enzyme with React 0.14, but don't already have React 0.14 and react-dom\ninstalled, you should do so:\n\n```bash\nnpm i --save react@0.14 react-dom@0.14\n```\n\nFurther, enzyme with React 0.14 requires the test utilities addon be installed:\n\n```bash\nnpm i --save-dev react-addons-test-utils@0.14\n```\n\nNext, to get started with enzyme, you can simply install it with npm:\n\n```bash\nnpm i --save-dev enzyme enzyme-adapter-react-14\n```\n\nAnd then you're ready to go!  In your test files you can simply `require` or `import` enzyme:\n\nES6:\n```js\n// setup file\nimport { configure } from 'enzyme';\nimport Adapter from 'enzyme-adapter-react-14';\n\nconfigure({ adapter: new Adapter() });\n```\n\n```js\n// test file\nimport { shallow, mount, render } from 'enzyme';\n\nconst wrapper = shallow(<Foo />);\n```\n\nES5:\n<!-- eslint no-var: 0 -->\n```js\n// setup file\nvar enzyme = require('enzyme');\nvar Adapter = require('enzyme-adapter-react-14');\n\nenzyme.configure({ adapter: new Adapter() });\n```\n\n<!-- eslint no-var: 0 -->\n```js\n// test file\nvar enzyme = require('enzyme');\n\nvar wrapper = enzyme.shallow(<Foo />);\n```\n"
  },
  {
    "path": "docs/installation/react-15.md",
    "content": "# Working with React 15\n\nIf you are wanting to use Enzyme with React 15, but don't already have React 15 and react-dom\ninstalled, you should do so:\n\n```bash\nnpm i --save react@15 react-dom@15\n```\n\nFurther, enzyme requires the test utilities addon be installed:\n\n```bash\nnpm i --save-dev react-test-renderer@15\n```\n\nNext, to get started with enzyme, you can simply install it with npm:\n\n```bash\nnpm i --save-dev enzyme enzyme-adapter-react-15\n```\n\nAnd then you're ready to go!  In your test files you can simply `require` or `import` enzyme:\n\nES6:\n```js\n// setup file\nimport { configure } from 'enzyme';\nimport Adapter from 'enzyme-adapter-react-15';\n\nconfigure({ adapter: new Adapter() });\n```\n\n```js\n// test file\nimport { shallow, mount, render } from 'enzyme';\n\nconst wrapper = shallow(<Foo />);\n```\n\nES5:\n<!-- eslint no-var: 0 -->\n```js\n// setup file\nvar enzyme = require('enzyme');\nvar Adapter = require('enzyme-adapter-react-15');\n\nenzyme.configure({ adapter: new Adapter() });\n```\n\n<!-- eslint no-var: 0 -->\n```js\n// test file\nvar enzyme = require('enzyme');\n\nvar wrapper = enzyme.shallow(<Foo />);\n```\n"
  },
  {
    "path": "docs/installation/react-16.md",
    "content": "# Working with React 16\n\nIf you are wanting to use enzyme with React 16, but don't already have React 16 and react-dom\ninstalled, you should do so:\n\n```bash\nnpm i --save react@16 react-dom@16\n```\n\nNext, to get started with enzyme, you can simply install it with npm:\n\n```bash\nnpm i --save-dev enzyme enzyme-adapter-react-16\n```\n\nAnd then you're ready to go!  In your test files you can simply `require` or `import` enzyme:\n\nES6:\n```js\n// setup file\nimport { configure } from 'enzyme';\nimport Adapter from 'enzyme-adapter-react-16';\n\nconfigure({ adapter: new Adapter() });\n```\n\n```js\n// test file\nimport { shallow, mount, render } from 'enzyme';\n\nconst wrapper = shallow(<Foo />);\n```\n\nES5:\n<!-- eslint no-var: 0 -->\n```js\n// setup file\nvar enzyme = require('enzyme');\nvar Adapter = require('enzyme-adapter-react-16');\n\nenzyme.configure({ adapter: new Adapter() });\n```\n\n<!-- eslint no-var: 0 -->\n```js\n// test file\nvar enzyme = require('enzyme');\n\nvar wrapper = enzyme.shallow(<Foo />);\n```\n"
  },
  {
    "path": "env.js",
    "content": "'use strict';\n\nconst path = require('path');\nconst fs = require('fs');\nconst spawn = require('child_process').spawn;\nconst rimraf = require('rimraf');\nconst semver = require('semver');\n\nconst promisify = (fn) => new Promise((res, rej) => {\n  const done = (err, val) => (err ? rej(err) : res(val));\n  fn(done);\n});\nconst getFile = (fpath) => promisify((cb) => fs.readFile(fpath, 'utf8', cb));\n// const getFiles = fpath => promisify(cb => fs.readdir(fpath, cb));\nconst getJSON = (fpath) => getFile(fpath).then((json) => JSON.parse(json));\nconst writeFile = (fpath, src) => promisify((cb) => {\n  console.log('writeFile', fpath, src);\n  if (process.env.DEBUG) {\n    cb();\n  } else {\n    fs.writeFile(fpath, src, cb);\n  }\n});\nconst writeJSON = (fpath, json, pretty = false) => writeFile(\n  fpath,\n  (pretty ? JSON.stringify(json, null, 2) : JSON.stringify(json)) + '\\n'\n);\nconst primraf = (fpath) => promisify((cb) => {\n  console.log('rimraf', fpath);\n  if (process.env.DEBUG) {\n    cb();\n  } else {\n    rimraf(fpath, cb);\n  }\n});\nconst run = (cmd, ...args) => promisify((cb) => {\n  console.log(cmd + ' ' + args.join(' '));\n  const child = spawn(\n    process.env.DEBUG ? 'echo' : cmd,\n    process.env.DEBUG ? [cmd].concat(args) : args,\n    { stdio: 'inherit' }\n  );\n  child.on('exit', cb);\n});\n\n// This script is executed with a single argument, indicating the version of\n// react and adapters etc. that we want to set ourselves up for testing.\n// should be \"14\" for \"enzyme-adapter-react-14\", \"15.4\" for \"enzyme-adapter-react-15.4\", etc.\nconst version = process.argv[2];\n\n// This script will do the following:\n//\n// 1. remove / uninstall all relevant modules\n// 2. find the adapter for the passed in version\n// 3. get the package.json for the adapter\n// 4. add the adapter to the dev-deps for enzyme-test-suite package\n// 5. call lerna bootstrap to link all the packages\n// 6. install all of the package's peer deps at the top level\n\nconst root = process.cwd();\n\nfunction getAdapter(reactVersion) {\n  if (semver.intersects(reactVersion, '0.13.x')) {\n    return '13';\n  }\n  if (semver.intersects(reactVersion, '0.14.x')) {\n    return '14';\n  }\n  if (semver.intersects(reactVersion, '^15.0.0-0')) {\n    if (semver.intersects(reactVersion, '>= 15.5')) {\n      return '15';\n    }\n    return '15.4';\n  }\n  if (semver.intersects(reactVersion, '^16.0.0-0')) {\n    if (semver.intersects(reactVersion, '>= 16.4')) {\n      return '16';\n    }\n    if (semver.intersects(reactVersion, '~16.3')) {\n      return '16.3';\n    }\n    if (semver.intersects(reactVersion, '~16.2')) {\n      return '16.2';\n    }\n    if (semver.intersects(reactVersion, '~16.0 || ~16.1')) {\n      return '16.1';\n    }\n  }\n  return null;\n}\nconst reactVersion = version < 15 ? '0.' + version : version;\nconst adapterVersion = process.env.ADAPTER || getAdapter(reactVersion) || version;\nconst adapterName = `enzyme-adapter-react-${adapterVersion}`;\nconst adapterPackageJsonPath = path.join(root, 'packages', adapterName, 'package.json');\nconst testPackageJsonPath = path.join(root, 'packages', 'enzyme-test-suite', 'package.json');\n\nif (!fs.statSync(adapterPackageJsonPath)) {\n  throw new Error('Adapter not found: \"' + adapterName + '\"');\n}\n\nconst packagesToRemove = [\n  'react',\n  'react-dom',\n  'react-addons-test-utils',\n  'react-test-renderer',\n  'create-react-class',\n].map((s) => `./node_modules/${s}`);\n\nconst additionalDirsToRemove = [\n];\n\nconst rmrfs = []\n  .concat(packagesToRemove)\n  .concat(additionalDirsToRemove);\n\nPromise.resolve()\n  .then(() => Promise.all(rmrfs.map((s) => primraf(s))))\n  .then(() => run('npm', 'i'))\n  .then(() => Promise.all([\n    getJSON(adapterPackageJsonPath),\n    getJSON(testPackageJsonPath),\n  ]))\n  .then(([adapterJson, testJson]) => {\n    const peerDeps = adapterJson.peerDependencies;\n    const installs = Object.keys(peerDeps)\n      .filter((key) => !key.startsWith('enzyme'))\n      .map((key) => `${key}@${key.startsWith('react') ? reactVersion : peerDeps[key]}`);\n\n    if (process.env.RENDERER) {\n      // eslint-disable-next-line no-param-reassign\n      adapterJson.dependencies['react-test-renderer'] = process.env.RENDERER;\n    }\n\n    // eslint-disable-next-line no-param-reassign\n    testJson.dependencies[adapterName] = adapterJson.version;\n\n    return writeJSON(adapterPackageJsonPath, adapterJson, true).then(() => Promise.all([\n      // npm install the peer deps at the root\n      run('npm', 'i', '--no-save', ...installs),\n\n      // add the adapter to the dependencies of the test suite\n      writeJSON(testPackageJsonPath, testJson, true),\n    ]));\n  })\n  .then(() => run('lerna', 'bootstrap', '--hoist=\\'react*\\''))\n  .then(() => getJSON(testPackageJsonPath))\n  .then((testJson) => {\n    // now that we've lerna bootstrapped, we can remove the adapter from the\n    // package.json so there is no diff\n    // eslint-disable-next-line no-param-reassign\n    delete testJson.dependencies[adapterName];\n    return writeJSON(testPackageJsonPath, testJson, true);\n  })\n  .catch((err) => console.error(err));\n"
  },
  {
    "path": "install-relevant-react.sh",
    "content": "#!/bin/sh\n\nREACT=\"${REACT:-${1:-16}}\"\n\necho \"installing React $REACT\"\n\nif [ \"$REACT\" = \"0.13\" ]; then\n  npm run env: -- 13\nelif [ \"$REACT\" = \"0.14\" ]; then\n  npm run env: -- 14\nelse\n  npm run env: -- \"${REACT}\"\nfi\n"
  },
  {
    "path": "karma.conf.js",
    "content": "/* eslint-disable no-var,prefer-arrow-callback,vars-on-top, import/no-extraneous-dependencies */\n\n'use strict';\n\nrequire('@babel/register');\n\nvar IgnorePlugin = require('webpack').IgnorePlugin;\nvar is = require('./packages/enzyme-test-suite/build/_helpers/version').is;\n\nfunction getPlugins() {\n  const adapter13 = new IgnorePlugin(/enzyme-adapter-react-13$/);\n  const adapter14 = new IgnorePlugin(/enzyme-adapter-react-14$/);\n  const adapter154 = new IgnorePlugin(/enzyme-adapter-react-15\\.4$/);\n  const adapter15 = new IgnorePlugin(/enzyme-adapter-react-15$/);\n  const adapter161 = new IgnorePlugin(/enzyme-adapter-react-16.1$/);\n  const adapter162 = new IgnorePlugin(/enzyme-adapter-react-16.2$/);\n  const adapter163 = new IgnorePlugin(/enzyme-adapter-react-16.3$/);\n  const adapter16 = new IgnorePlugin(/enzyme-adapter-react-16$/);\n\n  var plugins = [\n    adapter13,\n    adapter14,\n    adapter154,\n    adapter15,\n    adapter16,\n  ];\n\n  function not(x) {\n    return function notPredicate(y) {\n      return y !== x;\n    };\n  }\n\n  // we want to ignore all of the adapters *except* the one we are currently using\n  if (is('0.13.x')) {\n    plugins = plugins.filter(not(adapter13));\n  } else if (is('0.14.x')) {\n    plugins = plugins.filter(not(adapter14));\n  } else if (is('^15.5.0')) {\n    plugins = plugins.filter(not(adapter15));\n  } else if (is('^15.0.0-0')) {\n    plugins = plugins.filter(not(adapter154));\n  } else if (is('~16.0.0-0 || ~16.1')) {\n    plugins = plugins.filter(not(adapter161));\n  } else if (is('~16.2')) {\n    plugins = plugins.filter(not(adapter162));\n  } else if (is('~16.3.0-0')) {\n    plugins = plugins.filter(not(adapter163));\n  } else if (is('^16.4.0-0')) {\n    plugins = plugins.filter(not(adapter16));\n  }\n\n  return plugins;\n}\n\nmodule.exports = function karma(config) {\n  config.set({\n    basePath: '.',\n\n    plugins: [\n      'karma-chrome-launcher',\n      'karma-firefox-launcher',\n      'karma-mocha',\n      'karma-webpack',\n      'karma-sourcemap-loader',\n    ],\n\n    customLaunchers: {\n      Chrome_travis: {\n        base: 'Chrome',\n        flags: ['--no-sandbox'],\n      },\n    },\n\n    frameworks: ['mocha'],\n\n    reporters: ['dots'],\n\n    files: [\n      'packages/enzyme-test-suite/build/*.js',\n    ],\n\n    exclude: [\n      'packages/enzyme-test-suite/build/_helpers/index.js',\n    ],\n\n    browsers: [\n      process.env.TRAVIS ? 'Chrome_travis' : 'Chrome',\n      'Firefox',\n    ],\n\n    preprocessors: {\n      'packages/enzyme-test-suite/build/*.js': ['webpack', 'sourcemap'],\n    },\n\n    webpack: {\n      devtool: 'inline-source-map',\n      resolve: {\n        extensions: ['', '.js', '.jsx', '.json'],\n        alias: {\n          // dynamic require calls in sinon confuse webpack so we ignore it\n          sinon: 'sinon/pkg/sinon',\n        },\n      },\n      module: {\n        noParse: [\n          // dynamic require calls in sinon confuse webpack so we ignore it\n          /node_modules\\/sinon\\//,\n        ],\n        loaders: [\n          {\n            test: /\\.jsx?$/,\n            exclude: /node_modules/,\n            loader: 'babel-loader',\n          },\n          {\n            test: /\\.json$/,\n            loader: 'json-loader',\n          },\n        ],\n      },\n      plugins: getPlugins(),\n    },\n\n    webpackServer: {\n      noInfo: true,\n    },\n  });\n};\n"
  },
  {
    "path": "lerna.json",
    "content": "{\n  \"lerna\": \"2.0.0\",\n  \"packages\": [\n    \"packages/*\"\n  ],\n  \"version\": \"independent\",\n  \"independent\": true\n}\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"enzyme\",\n  \"private\": true,\n  \"version\": \"0.0.1\",\n  \"description\": \"JavaScript Testing utilities for React\",\n  \"homepage\": \"https://enzymejs.github.io/enzyme/\",\n  \"scripts\": {\n    \"clean-node-modules\": \"rm -rf node_modules/{*,.bin,.package-lock.json} && rm -rf packages/*/node_modules/{*,.bin,.package-lock.json}\",\n    \"postinstall\": \"[ -n \\\"${TRAVIS-}\\\" ] || (npm link npm && lerna bootstrap)\",\n    \"preversion\": \"npm run clean && npm run check\",\n    \"postversion\": \"git push && git push --tags && npm run clean && npm run docs:publish\",\n    \"version\": \"lerna run build\",\n    \"clean\": \"lerna run clean\",\n    \"prelint\": \"npm run lint:root\",\n    \"lint\": \"lerna exec --parallel 'npm run lint -- --quiet'\",\n    \"lint:root\": \"eslint . --ext=js,md,jsx --ignore-pattern=packages/\",\n    \"check\": \"lerna run lint && npm run test:all\",\n    \"prebuild\": \"npm run clean\",\n    \"build\": \"lerna run build\",\n    \"build:watch\": \"lerna run --parallel watch\",\n    \"pretest\": \"lerna run lint\",\n    \"test\": \"npm run test:only\",\n    \"pretest:only\": \"npm run build\",\n    \"test:only\": \"mocha --recursive packages/enzyme-test-suite/build\",\n    \"test:single\": \"mocha --watch\",\n    \"test:watch\": \"npm run test:only -- --watch\",\n    \"pretest:karma\": \"npm run build\",\n    \"test:karma\": \"karma start\",\n    \"test:all\": \"npm run react 13 && npm run test:only && npm run react 14 && npm run test:only && npm run react 15 && npm run test:only && npm run react 15.4 && npm run test:only && npm run react 15.5 && npm run test:only && npm run react 16 && npm run test:only && npm run react 16.1 && npm run test:only && npm run react 16.2 && npm run test:only && npm run react 16.3 && npm run test:only && npm run react 16.4 && npm run test:only && npm run react 16.5 && npm run test:only && npm run react 16.8 && npm run test:only\",\n    \"react\": \"sh install-relevant-react.sh\",\n    \"env:\": \"babel-node ./env.js\",\n    \"docs:clean\": \"rimraf _book\",\n    \"docs:prepare\": \"gitbook install\",\n    \"docs:build\": \"npm run docs:prepare && gitbook build\",\n    \"docs:watch\": \"npm run docs:prepare && gitbook serve\",\n    \"docs:publish\": \"npm run docs:clean && npm run docs:build && cd _book && git init && git commit --allow-empty -m 'update book' && git fetch git@github.com:enzymejs/enzyme.git gh-pages && git checkout -b gh-pages && git add . && git commit -am 'update book' && git push git@github.com:enzymejs/enzyme.git gh-pages --force\",\n    \"travis\": \"nyc mocha --recursive packages/enzyme-test-suite/build\",\n    \"since\": \"node since\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/enzymejs/enzyme.git\"\n  },\n  \"keywords\": [\n    \"javascript\",\n    \"shallow rendering\",\n    \"shallowRender\",\n    \"test\",\n    \"reactjs\",\n    \"react\",\n    \"flux\",\n    \"testing\",\n    \"test utils\",\n    \"assertion helpers\",\n    \"tdd\",\n    \"mocha\"\n  ],\n  \"author\": \"Jordan Harband <ljharb@gmail.com>\",\n  \"license\": \"MIT\",\n  \"devDependencies\": {\n    \"@babel/cli\": \"^7.28.3\",\n    \"@babel/core\": \"^7.28.4\",\n    \"@babel/eslint-parser\": \"^7.28.4\",\n    \"@babel/node\": \"~7.24.8\",\n    \"@babel/register\": \"^7.28.3\",\n    \"@babel/runtime\": \"^7.28.4\",\n    \"babel-loader\": \"^8.2.2\",\n    \"babel-plugin-add-module-exports\": \"^1.0.4\",\n    \"babel-plugin-transform-replace-object-assign\": \"^2.0.0\",\n    \"babel-preset-airbnb\": \"^4.5.0\",\n    \"chai\": \"^4.3.4\",\n    \"eslint\": \"^8.56.0\",\n    \"eslint-config-airbnb\": \"^19.0.4\",\n    \"eslint-plugin-import\": \"^2.32.0\",\n    \"eslint-plugin-jsx-a11y\": \"^6.10.2\",\n    \"eslint-plugin-markdown\": \"^3.0.1\",\n    \"eslint-plugin-react\": \"^7.37.5\",\n    \"eslint-plugin-react-hooks\": \"^4.6.0\",\n    \"gitbook-cli\": \"^1.0.1\",\n    \"gitbook-plugin-anchors\": \"^0.7.1\",\n    \"gitbook-plugin-codeblock-disable-glossary\": \"0.0.1\",\n    \"gitbook-plugin-collapsible-menu\": \"^1.0.3\",\n    \"gitbook-plugin-edit-link\": \"^2.0.2\",\n    \"gitbook-plugin-github\": \"^2.0.0\",\n    \"glob-gitignore\": \"^1.0.14\",\n    \"in-publish\": \"^2.0.1\",\n    \"json-loader\": \"^0.5.7\",\n    \"karma\": \"^1.3.0\",\n    \"karma-chrome-launcher\": \"^1.0.1\",\n    \"karma-firefox-launcher\": \"^1.3.0\",\n    \"karma-mocha\": \"^1.3.0\",\n    \"karma-sourcemap-loader\": \"^0.3.7\",\n    \"karma-webpack\": \"^1.8.1\",\n    \"lerna\": \"^2.11.0\",\n    \"mocha\": \"^3.5.3\",\n    \"mocha-lcov-reporter\": \"^1.3.0\",\n    \"npm\": \"gist:9cdb687f3806f8e6cb8a365d0b7840eb\",\n    \"nyc\": \"^10.3.2\",\n    \"prop-types\": \"^15.8.1\",\n    \"rimraf\": \"^2.7.1\",\n    \"safe-publish-latest\": \"^2.0.0\",\n    \"semver\": \"^6.3.1\",\n    \"webpack\": \"^2.7.0\"\n  },\n  \"greenkeeper\": {\n    \"ignore\": [\n      \"mocha\",\n      \"nyc\",\n      \"semver\",\n      \"webpack\"\n    ]\n  }\n}\n"
  },
  {
    "path": "packages/enzyme/.babelrc",
    "content": "{\n  \"presets\": [\n    [\"airbnb\", { \"transformRuntime\": false }],\n  ],\n  \"plugins\": [\n    [\"transform-replace-object-assign\", { \"moduleSpecifier\": \"object.assign\" }],\n    [\"add-module-exports\"],\n  ],\n  \"sourceMaps\": \"both\",\n}\n"
  },
  {
    "path": "packages/enzyme/.eslintrc",
    "content": "{\n  \"extends\": \"airbnb\",\n  \"parser\": \"@babel/eslint-parser\",\n  \"root\": true,\n  \"ignorePatterns\": [\"build/\"],\n  \"env\": {\n    \"node\": true,\n    \"mocha\": true\n  },\n  \"rules\": {\n    \"id-length\": 0,\n    \"max-classes-per-file\": 0,\n    \"new-cap\": [2, { \"capIsNewExceptions\": [\"AND\"] }],\n    \"react/jsx-pascal-case\": [2, { \"allowAllCaps\": true }],\n    \"react/no-find-dom-node\": 1,\n    \"import/first\": 0,\n    \"no-underscore-dangle\": [2, {\n      \"allowAfterThis\": true,\n      \"allow\": [\n        \"_context\",\n        \"_currentElement\",\n        \"_instance\",\n        \"_reactInternalComponent\",\n        \"_reactInternalInstance\",\n        \"_renderedChildren\",\n        \"_renderedComponent\",\n        \"_renderedNodeType\",\n        \"_state\",\n        \"_store\",\n        \"_stringText\",\n      ],\n    }],\n  }\n}\n"
  },
  {
    "path": "packages/enzyme/ReactWrapper.js",
    "content": "module.exports = require('./build/ReactWrapper');\n"
  },
  {
    "path": "packages/enzyme/ShallowWrapper.js",
    "content": "module.exports = require('./build/ShallowWrapper');\n"
  },
  {
    "path": "packages/enzyme/mount.js",
    "content": "module.exports = require('./build/mount');\n"
  },
  {
    "path": "packages/enzyme/package.json",
    "content": "{\n  \"name\": \"enzyme\",\n  \"version\": \"3.11.0\",\n  \"description\": \"JavaScript Testing utilities for React\",\n  \"homepage\": \"https://enzymejs.github.io/enzyme/\",\n  \"main\": \"build\",\n  \"scripts\": {\n    \"prepack\": \"npmignore --auto --commentLines=autogenerated --gitignore=../../.gitignore && cp ../../{LICENSE,README}.md ./ && npm run build\",\n    \"prepublishOnly\": \"safe-publish-latest\",\n    \"prepublish\": \"not-in-publish || npm run prepublishOnly\",\n    \"clean\": \"rimraf build\",\n    \"lint\": \"eslint --ext js,jsx .\",\n    \"pretest\": \"npm run lint\",\n    \"prebuild\": \"npm run clean\",\n    \"build\": \"babel --source-maps=both src --out-dir build\",\n    \"watch\": \"npm run build -- -w\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/enzymejs/enzyme.git\",\n    \"directory\": \"packages/enzyme\"\n  },\n  \"keywords\": [\n    \"javascript\",\n    \"shallow rendering\",\n    \"shallowRender\",\n    \"test\",\n    \"reactjs\",\n    \"react\",\n    \"flux\",\n    \"testing\",\n    \"test utils\",\n    \"assertion helpers\",\n    \"tdd\",\n    \"mocha\"\n  ],\n  \"author\": \"Jordan Harband <ljharb@gmail.com>\",\n  \"funding\": {\n    \"url\": \"https://github.com/sponsors/ljharb\"\n  },\n  \"license\": \"MIT\",\n  \"dependencies\": {\n    \"array.prototype.flat\": \"^1.3.3\",\n    \"cheerio\": \"=1.0.0-rc.3\",\n    \"enzyme-shallow-equal\": \"^1.0.7\",\n    \"function.prototype.name\": \"^1.1.8\",\n    \"hasown\": \"^2.0.2\",\n    \"html-element-map\": \"^1.3.1\",\n    \"is-boolean-object\": \"^1.2.2\",\n    \"is-callable\": \"^1.2.7\",\n    \"is-number-object\": \"^1.1.1\",\n    \"is-regex\": \"^1.2.1\",\n    \"is-string\": \"^1.1.1\",\n    \"is-subset\": \"^0.1.1\",\n    \"lodash.escape\": \"^4.0.1\",\n    \"lodash.isequal\": \"^4.5.0\",\n    \"object-inspect\": \"^1.13.4\",\n    \"object-is\": \"^1.1.6\",\n    \"object.assign\": \"^4.1.7\",\n    \"object.entries\": \"^1.1.9\",\n    \"object.fromentries\": \"^2.0.8\",\n    \"object.values\": \"^1.2.1\",\n    \"raf\": \"^3.4.1\",\n    \"rst-selector-parser\": \"^2.2.3\",\n    \"string.prototype.trim\": \"^1.2.10\"\n  },\n  \"devDependencies\": {\n    \"@babel/cli\": \"^7.28.3\",\n    \"@babel/core\": \"^7.28.4\",\n    \"@babel/eslint-parser\": \"^7.28.4\",\n    \"babel-plugin-add-module-exports\": \"^1.0.4\",\n    \"babel-plugin-transform-replace-object-assign\": \"^2.0.0\",\n    \"babel-preset-airbnb\": \"^4.5.0\",\n    \"eslint\": \"^8.56.0\",\n    \"eslint-config-airbnb\": \"^19.0.4\",\n    \"eslint-plugin-import\": \"^2.32.0\",\n    \"eslint-plugin-jsx-a11y\": \"^6.10.2\",\n    \"eslint-plugin-react\": \"^7.37.5\",\n    \"eslint-plugin-react-hooks\": \"^4.6.0\",\n    \"in-publish\": \"^2.0.1\",\n    \"jsdom\": \"^6.5.1\",\n    \"npmignore\": \"^0.3.1\",\n    \"rimraf\": \"^2.7.1\",\n    \"safe-publish-latest\": \"^2.0.0\"\n  },\n  \"publishConfig\": {\n    \"ignore\": [\n      \"!build\"\n    ]\n  }\n}\n"
  },
  {
    "path": "packages/enzyme/render.js",
    "content": "module.exports = require('./build/render');\n"
  },
  {
    "path": "packages/enzyme/shallow.js",
    "content": "module.exports = require('./build/shallow');\n"
  },
  {
    "path": "packages/enzyme/src/Debug.js",
    "content": "import escape from 'lodash.escape';\nimport functionName from 'function.prototype.name';\nimport isString from 'is-string';\nimport isNumber from 'is-number-object';\nimport isCallable from 'is-callable';\nimport isBoolean from 'is-boolean-object';\nimport inspect from 'object-inspect';\nimport hasOwn from 'hasown';\n\nimport {\n  propsOfNode,\n  childrenOfNode,\n} from './RSTTraversal';\nimport getAdapter from './getAdapter';\n\nconst booleanValue = Function.bind.call(Function.call, Boolean.prototype.valueOf);\n\nexport function typeName(node) {\n  const adapter = getAdapter();\n  if (adapter.displayNameOfNode) {\n    return getAdapter().displayNameOfNode(node) || 'Component';\n  }\n  return typeof node.type === 'function'\n    ? (node.type.displayName || functionName(node.type) || 'Component')\n    : node.type;\n}\n\nexport function spaces(n) {\n  return Array(n + 1).join(' ');\n}\n\nexport function indent(depth, string) {\n  return string.split('\\n').map((x) => `${spaces(depth)}${x}`).join('\\n');\n}\n\nfunction propString(prop, options) {\n  if (isString(prop)) {\n    return inspect(String(prop), { quoteStyle: 'double' });\n  }\n  if (isNumber(prop)) {\n    return `{${inspect(Number(prop))}}`;\n  }\n  if (isBoolean(prop)) {\n    return `{${inspect(booleanValue(prop))}}`;\n  }\n  if (isCallable(prop)) {\n    return `{${inspect(prop)}}`;\n  }\n  if (typeof prop === 'object') {\n    if (options.verbose) {\n      return `{${inspect(prop)}}`;\n    }\n\n    return '{{...}}';\n  }\n  return `{[${inspect(prop)}]}`;\n}\n\nfunction propsString(node, options) {\n  const props = propsOfNode(node);\n  const keys = Object.keys(props).filter((x) => x !== 'children');\n  return keys.map((key) => `${key}=${propString(props[key], options)}`).join(' ');\n}\n\nfunction indentChildren(childrenStrs, indentLength) {\n  return childrenStrs.length\n    ? `\\n${childrenStrs.map((x) => indent(indentLength, x)).join('\\n')}\\n`\n    : '';\n}\n\nfunction isRSTNodeLike(node) {\n  return hasOwn(node, 'nodeType')\n    && typeof node.nodeType === 'string'\n    && hasOwn(node, 'type')\n    && hasOwn(node, 'key')\n    && hasOwn(node, 'ref')\n    && hasOwn(node, 'instance')\n    && hasOwn(node, 'rendered');\n}\n\nexport function debugNode(node, indentLength = 2, options = {}) {\n  if (typeof node === 'string' || typeof node === 'number') return escape(node);\n  if (typeof node === 'function') {\n    const name = functionName(node);\n    return `[function${name ? ` ${name}` : ''}]`;\n  }\n  if (!node) return '';\n\n  const adapter = getAdapter();\n  if (!adapter.isValidElement(node) && !isRSTNodeLike(node)) {\n    return `{${inspect(node)}}`;\n  }\n\n  const childrenStrs = childrenOfNode(node)\n    .map((n) => debugNode(n, indentLength, options))\n    .filter(Boolean);\n  const type = typeName(node);\n\n  const props = options.ignoreProps ? '' : propsString(node, options);\n  const beforeProps = props ? ' ' : '';\n  const afterProps = childrenStrs.length\n    ? '>'\n    : ' ';\n  const childrenIndented = indentChildren(childrenStrs, indentLength);\n  const nodeClose = childrenStrs.length ? `</${type}>` : '/>';\n  return `<${type}${beforeProps}${props}${afterProps}${childrenIndented}${nodeClose}`;\n}\n\nexport function debugNodes(nodes, options = {}) {\n  return nodes.map((node) => debugNode(node, undefined, options)).join('\\n\\n\\n');\n}\n"
  },
  {
    "path": "packages/enzyme/src/EnzymeAdapter.js",
    "content": "function unimplementedError(methodName, classname) {\n  return new Error(`${methodName} is a required method of ${classname}, but was not implemented.`);\n}\n\nclass EnzymeAdapter {\n  constructor() {\n    this.options = {};\n  }\n\n  // Provided a bag of options, return an `EnzymeRenderer`. Some options can be implementation\n  // specific, like `attach` etc. for React, but not part of this interface explicitly.\n  // eslint-disable-next-line class-methods-use-this, no-unused-vars\n  createRenderer(options) {\n    throw unimplementedError('createRenderer', 'EnzymeAdapter');\n  }\n\n  // converts an RSTNode to the corresponding JSX Pragma Element. This will be needed\n  // in order to implement the `Wrapper.mount()` and `Wrapper.shallow()` methods, but should\n  // be pretty straightforward for people to implement.\n  // eslint-disable-next-line class-methods-use-this, no-unused-vars\n  nodeToElement(node) {\n    throw unimplementedError('nodeToElement', 'EnzymeAdapter');\n  }\n\n  // eslint-disable-next-line class-methods-use-this\n  matchesElementType(node, matchingType) {\n    if (!node) {\n      return node;\n    }\n    const { type } = node;\n    return type === matchingType;\n  }\n\n  // eslint-disable-next-line class-methods-use-this, no-unused-vars\n  isValidElement(element) {\n    throw unimplementedError('isValidElement', 'EnzymeAdapter');\n  }\n\n  // eslint-disable-next-line class-methods-use-this, no-unused-vars\n  createElement(type, props, ...children) {\n    throw unimplementedError('createElement', 'EnzymeAdapter');\n  }\n\n  // eslint-disable-next-line class-methods-use-this\n  invokeSetStateCallback(instance, callback) {\n    callback.call(instance);\n  }\n}\n\nEnzymeAdapter.MODES = {\n  STRING: 'string',\n  MOUNT: 'mount',\n  SHALLOW: 'shallow',\n};\n\nexport default EnzymeAdapter;\n"
  },
  {
    "path": "packages/enzyme/src/RSTTraversal.js",
    "content": "import flat from 'array.prototype.flat';\nimport entries from 'object.entries';\nimport fromEntries from 'object.fromentries';\nimport isSubset from 'is-subset';\nimport functionName from 'function.prototype.name';\nimport isRegex from 'is-regex';\nimport getAdapter from './getAdapter';\n\nexport function propsOfNode(node) {\n  return (node && node.props) || {};\n}\n\nexport function childrenOfNode(node) {\n  if (!node) return [];\n\n  const adapter = getAdapter();\n  const adapterHasIsFragment = adapter.isFragment && typeof adapter.isFragment === 'function';\n\n  const renderedArray = Array.isArray(node.rendered) ? flat(node.rendered, 1) : [node.rendered];\n\n  // React adapters before 16 will not have isFragment\n  if (!adapterHasIsFragment) {\n    return renderedArray;\n  }\n\n  return flat(renderedArray.map((currentChild) => {\n    // If the node is a Fragment, we want to return its children, not the fragment itself\n    if (adapter.isFragment(currentChild)) {\n      return childrenOfNode(currentChild);\n    }\n\n    return currentChild;\n  }), 1);\n}\n\nexport function hasClassName(node, className) {\n  let classes = propsOfNode(node).className || '';\n  classes = String(classes).replace(/\\s/g, ' ');\n  if (isRegex(className)) return className.test(classes);\n  return ` ${classes} `.indexOf(` ${className} `) > -1;\n}\n\nexport function treeForEach(tree, fn) {\n  if (tree) {\n    fn(tree);\n  }\n  childrenOfNode(tree).forEach((node) => treeForEach(node, fn));\n}\n\nexport function treeFilter(tree, fn) {\n  const results = [];\n  treeForEach(tree, (node) => {\n    if (fn(node)) {\n      results.push(node);\n    }\n  });\n  return results;\n}\n\n/**\n * To support sibling selectors we need to be able to find\n * the siblings of a node. The easiest way to do that is find\n * the parent of the node and access its children.\n *\n * This would be unneeded if the RST spec included sibling pointers\n * such as node.nextSibling and node.prevSibling\n * @param {*} root\n * @param {*} targetNode\n */\nexport function findParentNode(root, targetNode) {\n  const results = treeFilter(\n    root,\n    (node) => {\n      if (!node.rendered) {\n        return false;\n      }\n\n      return childrenOfNode(node).indexOf(targetNode) !== -1;\n    },\n  );\n  return results[0] || null;\n}\n\nfunction pathFilter(path, fn) {\n  return path.filter((tree) => treeFilter(tree, fn).length !== 0);\n}\n\nexport function pathToNode(node, root) {\n  const queue = [root];\n  const path = [];\n\n  const hasNode = (testNode) => node === testNode;\n\n  while (queue.length) {\n    const current = queue.pop();\n    const children = childrenOfNode(current);\n    if (current === node) return pathFilter(path, hasNode);\n\n    path.push(current);\n\n    if (children.length === 0) {\n      // leaf node. if it isn't the node we are looking for, we pop.\n      path.pop();\n    }\n    queue.push(...children);\n  }\n\n  return null;\n}\n\nexport function parentsOfNode(node, root) {\n  return (pathToNode(node, root) || []).reverse();\n}\n\nexport function nodeHasId(node, id) {\n  return propsOfNode(node).id === id;\n}\n\nconst CAN_NEVER_MATCH = {};\nfunction replaceUndefined(v) {\n  return typeof v !== 'undefined' ? v : CAN_NEVER_MATCH;\n}\nfunction replaceUndefinedValues(obj) {\n  const newEntries = entries(obj).map(([k, v]) => [k, replaceUndefined(v)]);\n  return fromEntries(newEntries);\n}\n\nexport function nodeMatchesObjectProps(node, props) {\n  return isSubset(propsOfNode(node), replaceUndefinedValues(props));\n}\n\nfunction getTextFromHostNode(hostNode) {\n  if (typeof hostNode === 'string') {\n    return String(hostNode || '');\n  }\n  if (!hostNode) {\n    return '';\n  }\n  return hostNode.textContent || '';\n}\n\nfunction getTextFromRSTNode(node, {\n  getCustom,\n  handleHostNodes,\n  recurse,\n  nullRenderReturnsNull = false,\n}) {\n  if (node == null) {\n    return '';\n  }\n\n  if (typeof node === 'string' || typeof node === 'number') {\n    return String(node);\n  }\n\n  if (getCustom && node.type && typeof node.type === 'function') {\n    return getCustom(node);\n  }\n\n  if (handleHostNodes && node.nodeType === 'host') {\n    return handleHostNodes(node);\n  }\n  if (node.rendered == null && nullRenderReturnsNull) {\n    return null;\n  }\n  return childrenOfNode(node).map(recurse).join('');\n}\n\nexport function getTextFromNode(node) {\n  return getTextFromRSTNode(node, {\n    recurse: getTextFromNode,\n    getCustom({ type }) {\n      return `<${type.displayName || functionName(type)} />`;\n    },\n  });\n}\n\nexport function getTextFromHostNodes(node, adapter) {\n  return getTextFromRSTNode(node, {\n    recurse(item) {\n      return getTextFromHostNodes(item, adapter);\n    },\n    handleHostNodes(item) {\n      const nodes = [].concat(adapter.nodeToHostNode(item, true));\n      return nodes.map(getTextFromHostNode).join('');\n    },\n  });\n}\n\nfunction getHTMLFromHostNode(hostNode) {\n  if (hostNode == null) {\n    return null;\n  }\n  return hostNode.outerHTML.replace(/\\sdata-(reactid|reactroot)+=\"([^\"]*)+\"/g, '');\n}\n\nexport function getHTMLFromHostNodes(node, adapter) {\n  return getTextFromRSTNode(node, {\n    recurse(item) {\n      return getHTMLFromHostNodes(item, adapter);\n    },\n    handleHostNodes(item) {\n      const nodes = [].concat(adapter.nodeToHostNode(item, true));\n      return nodes.map(getHTMLFromHostNode).join('');\n    },\n    nullRenderReturnsNull: true,\n  });\n}\n"
  },
  {
    "path": "packages/enzyme/src/ReactWrapper.js",
    "content": "import flat from 'array.prototype.flat';\nimport hasOwn from 'hasown';\nimport trim from 'string.prototype.trim';\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        privateSet(\n          this,\n          WRAPPING_COMPONENT,\n          // eslint-disable-next-line no-use-before-define\n          new WrappingComponentWrapper(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<ReactComponent>}\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<ReactElement>}\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(<MyComponent />);\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(<MyComponent />);\n   * expect(wrapper.contains(<div className=\"foo bar\" />)).to.equal(true);\n   * ```\n   *\n   * @param {ReactElement|Array<ReactElement>} 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 <div><div class=\"foo\">Hello</div></div>\n   * const wrapper = mount(<MyComponent />);\n   * expect(wrapper.containsMatchingElement(<div>Hello</div>)).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(<MyComponent />);\n   * expect(wrapper.containsAllMatchingElements([\n   *   <div>Hello</div>,\n   *   <div>Goodbye</div>,\n   * ])).to.equal(true);\n   * ```\n   *\n   * @param {Array<ReactElement>} 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(<MyComponent />);\n   * expect(wrapper.containsAnyMatchingElements([\n   *   <div>Hello</div>,\n   *   <div>Goodbye</div>,\n   * ])).to.equal(true);\n   * ```\n   *\n   * @param {Array<ReactElement>} 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(<MyComponent />);\n   * expect(wrapper.contains(<div className=\"foo bar\" />)).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 <div class=\"foo\">Hello</div>\n   * const wrapper = mount(<MyComponent />);\n   * expect(wrapper.matchesElement(<div>Hello</div>)).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.getNodesInternal();\n\n    return nodes.every((node) => renderedDive(node));\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 wrapped nodes that have a non-null instance');\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 (!hasOwn(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<ReactElement>} 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(trim(`\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"
  },
  {
    "path": "packages/enzyme/src/ShallowWrapper.js",
    "content": "import flat from 'array.prototype.flat';\nimport hasOwn from 'hasown';\nimport shallowEqual from 'enzyme-shallow-equal';\nimport trim from 'string.prototype.trim';\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\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 * @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<ReactComponent>}\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<ReactElement>}\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(<MyComponent />);\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(<MyComponent />);\n   * expect(wrapper.contains(<div className=\"foo bar\" />)).to.equal(true);\n   * ```\n   *\n   * @param {ReactElement|Array<ReactElement>} 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 <div><div class=\"foo\">Hello</div></div>\n   * const wrapper = shallow(<MyComponent />);\n   * expect(wrapper.containsMatchingElement(<div>Hello</div>)).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(<MyComponent />);\n   * expect(wrapper.containsAllMatchingElements([\n   *   <div>Hello</div>,\n   *   <div>Goodbye</div>,\n   * ])).to.equal(true);\n   * ```\n   *\n   * @param {Array<ReactElement>} 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(<MyComponent />);\n   * expect(wrapper.containsAnyMatchingElements([\n   *   <div>Hello</div>,\n   *   <div>Goodbye</div>,\n   * ])).to.equal(true);\n   * ```\n   *\n   * @param {Array<ReactElement>} 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(<MyComponent />);\n   * expect(wrapper.contains(<div className=\"foo bar\" />)).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 <div class=\"foo\">Hello</div>\n   * const wrapper = shallow(<MyComponent />);\n   * expect(wrapper.matchesElement(<div>Hello</div>)).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 (!hasOwn(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(trim(`\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"
  },
  {
    "path": "packages/enzyme/src/Utils.js",
    "content": "/* eslint no-use-before-define: 0 */\nimport isEqual from 'lodash.isequal';\nimport is from 'object-is';\nimport entries from 'object.entries';\nimport fromEntries from 'object.fromentries';\nimport functionName from 'function.prototype.name';\nimport hasOwn from 'hasown';\nimport flat from 'array.prototype.flat';\nimport trim from 'string.prototype.trim';\nimport cheerio from 'cheerio';\nimport { isHtml } from 'cheerio/lib/utils';\n\nimport { get } from './configuration';\nimport { childrenOfNode } from './RSTTraversal';\nimport realGetAdapter from './getAdapter';\nimport validateAdapter from './validateAdapter';\n\nexport const ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;\n\nexport function getAdapter(options = {}) {\n  console.warn('getAdapter from Utils is deprecated; please use ./getAdapter instead');\n  return realGetAdapter(options);\n}\n\nfunction validateMountOptions(attachTo, hydrateIn) {\n  if (attachTo && hydrateIn && attachTo !== hydrateIn) {\n    throw new TypeError('If both the `attachTo` and `hydrateIn` options are provided, they must be === (for backwards compatibility)');\n  }\n}\n\nexport function makeOptions(options) {\n  const { attachTo: configAttachTo, hydrateIn: configHydrateIn, ...config } = get();\n  validateMountOptions(configAttachTo, configHydrateIn);\n\n  const { attachTo, hydrateIn } = options;\n  validateMountOptions(attachTo, hydrateIn);\n\n  // neither present: both undefined\n  // only attachTo present: attachTo set, hydrateIn undefined\n  // only hydrateIn present: both set to hydrateIn\n  // both present (and ===, per above): both set to hydrateIn\n  const finalAttachTo = hydrateIn || configHydrateIn || configAttachTo || attachTo || undefined;\n  const finalHydrateIn = hydrateIn || configHydrateIn || undefined;\n  const mountTargets = {\n    ...(finalAttachTo && { attachTo: finalAttachTo }),\n    ...(finalHydrateIn && { hydrateIn: finalHydrateIn }),\n  };\n\n  return {\n    ...config,\n    ...options,\n    ...mountTargets,\n  };\n}\n\nexport function isCustomComponent(component, adapter) {\n  validateAdapter(adapter);\n  if (adapter.isCustomComponent) {\n    return !!adapter.isCustomComponent(component);\n  }\n  return typeof component === 'function';\n}\n\nexport function isCustomComponentElement(inst, adapter) {\n  if (adapter.isCustomComponentElement) {\n    return !!adapter.isCustomComponentElement(inst);\n  }\n  return !!inst && adapter.isValidElement(inst) && typeof inst.type === 'function';\n}\n\nexport function propsOfNode(node) {\n  const newEntries = entries((node && node.props) || {})\n    .filter(([, value]) => typeof value !== 'undefined');\n  return fromEntries(newEntries);\n}\n\nexport function typeOfNode(node) {\n  return node ? node.type : null;\n}\n\nexport function nodeHasType(node, type) {\n  if (!type || !node) return false;\n\n  const adapter = realGetAdapter();\n  if (adapter.displayNameOfNode) {\n    const displayName = adapter.displayNameOfNode(node);\n    return displayName === type;\n  }\n\n  if (!node.type) return false;\n  if (typeof node.type === 'string') return node.type === type;\n  return (\n    typeof node.type === 'function' ? functionName(node.type) === type : node.type.name === type\n  ) || node.type.displayName === type;\n}\n\nfunction internalChildrenCompare(a, b, lenComp, isLoose) {\n  const nodeCompare = isLoose ? nodeMatches : nodeEqual;\n\n  if (a === b) return true;\n  if (!Array.isArray(a) && !Array.isArray(b)) {\n    return nodeCompare(a, b, lenComp);\n  }\n  const flatA = flat(a, Infinity);\n  const flatB = flat(b, Infinity);\n  if (flatA.length !== flatB.length) return false;\n  if (flatA.length === 0 && flatB.length === 0) return true;\n  for (let i = 0; i < flatA.length; i += 1) {\n    if (!nodeCompare(flatA[i], flatB[i], lenComp)) return false;\n  }\n  return true;\n}\n\nfunction childrenMatch(a, b, lenComp) {\n  return internalChildrenCompare(a, b, lenComp, true);\n}\n\nfunction childrenEqual(a, b, lenComp) {\n  return internalChildrenCompare(a, b, lenComp, false);\n}\n\nfunction removeNullaryReducer(acc, [key, value]) {\n  const addition = value == null ? {} : { [key]: value };\n  return { ...acc, ...addition };\n}\n\nfunction internalNodeCompare(a, b, lenComp, isLoose) {\n  if (a === b) return true;\n  if (!a || !b) return false;\n  if (a.type !== b.type) return false;\n\n  let left = propsOfNode(a);\n  let right = propsOfNode(b);\n  if (isLoose) {\n    left = entries(left).reduce(removeNullaryReducer, {});\n    right = entries(right).reduce(removeNullaryReducer, {});\n  }\n\n  const leftKeys = Object.keys(left);\n  for (let i = 0; i < leftKeys.length; i += 1) {\n    const prop = leftKeys[i];\n    // we will check children later\n    if (prop === 'children') {\n      // continue;\n    } else if (!(prop in right)) {\n      return false;\n    } else if (right[prop] === left[prop]) {\n      // continue;\n    } else if (typeof right[prop] === typeof left[prop] && typeof left[prop] === 'object') {\n      if (!isEqual(left[prop], right[prop])) return false;\n    } else {\n      return false;\n    }\n  }\n\n  const leftHasChildren = 'children' in left;\n  const rightHasChildren = 'children' in right;\n  const childCompare = isLoose ? childrenMatch : childrenEqual;\n  if (leftHasChildren || rightHasChildren) {\n    if (!childCompare(\n      childrenToSimplifiedArray(left.children, isLoose),\n      childrenToSimplifiedArray(right.children, isLoose),\n      lenComp,\n    )) {\n      return false;\n    }\n  }\n\n  if (!isTextualNode(a)) {\n    const rightKeys = Object.keys(right);\n    return lenComp(leftKeys.length - leftHasChildren, rightKeys.length - rightHasChildren);\n  }\n\n  return false;\n}\n\nexport function nodeMatches(a, b, lenComp = is) {\n  return internalNodeCompare(a, b, lenComp, true);\n}\n\nexport function nodeEqual(a, b, lenComp = is) {\n  return internalNodeCompare(a, b, lenComp, false);\n}\n\nexport function containsChildrenSubArray(match, node, subArray) {\n  const children = childrenOfNode(node);\n  const checker = (_, i) => arraysEqual(match, children.slice(i, i + subArray.length), subArray);\n  return children.some(checker);\n}\n\nfunction arraysEqual(match, left, right) {\n  return left.length === right.length && left.every((el, i) => match(el, right[i]));\n}\n\nfunction childrenToArray(children) {\n  const result = [];\n\n  const push = (el) => {\n    if (el === null || el === false || typeof el === 'undefined') return;\n    result.push(el);\n  };\n\n  if (Array.isArray(children)) {\n    children.forEach(push);\n  } else {\n    push(children);\n  }\n  return result;\n}\n\nexport function childrenToSimplifiedArray(nodeChildren, isLoose = false) {\n  const childrenArray = childrenToArray(nodeChildren);\n  const simplifiedArray = [];\n\n  for (let i = 0; i < childrenArray.length; i += 1) {\n    const child = childrenArray[i];\n    const previousChild = simplifiedArray.pop();\n\n    if (typeof previousChild === 'undefined') {\n      simplifiedArray.push(child);\n    } else if (isTextualNode(child) && isTextualNode(previousChild)) {\n      simplifiedArray.push(previousChild + child);\n    } else {\n      simplifiedArray.push(previousChild);\n      simplifiedArray.push(child);\n    }\n  }\n\n  if (isLoose) {\n    return simplifiedArray.map((x) => (typeof x === 'string' ? trim(x) : x));\n  }\n\n  return simplifiedArray;\n}\n\nfunction isTextualNode(node) {\n  return typeof node === 'string' || typeof node === 'number';\n}\n\nexport function isReactElementAlike(arg, adapter) {\n  return adapter.isValidElement(arg) || isTextualNode(arg) || Array.isArray(arg);\n}\n\n// TODO(lmr): can we get rid of this outside of the adapter?\nexport function withSetStateAllowed(fn) {\n  // NOTE(lmr):\n  // this is currently here to circumvent a React bug where `setState()` is\n  // not allowed without global being defined.\n  let cleanup = false;\n  if (typeof global.document === 'undefined') {\n    cleanup = true;\n    global.document = {};\n  }\n  fn();\n  if (cleanup) {\n    // This works around a bug in node/jest in that developers aren't able to\n    // delete things from global when running in a node vm.\n    global.document = undefined;\n    delete global.document;\n  }\n}\n\n// TODO, semver-major: remove this\nexport function AND(fns) {\n  const fnsReversed = fns.slice().reverse();\n  return (x) => fnsReversed.every((fn) => fn(x));\n}\n\nexport function displayNameOfNode(node) {\n  if (!node) return null;\n\n  const { type } = node;\n\n  if (!type) return null;\n\n  return type.displayName || (typeof type === 'function' ? functionName(type) : type.name || type);\n}\n\nexport function sym(s) {\n  return typeof Symbol === 'function' ? Symbol.for(`enzyme.${s}`) : s;\n}\n\nexport function privateSet(obj, prop, value) {\n  Object.defineProperty(obj, prop, {\n    value,\n    enumerable: false,\n    writable: true,\n  });\n}\n\nexport function cloneElement(adapter, el, props) {\n  return adapter.createElement(\n    el.type,\n    { ...el.props, ...props },\n  );\n}\n\nexport function spyMethod(instance, methodName, getStub = () => {}) {\n  let lastReturnValue;\n  const originalMethod = instance[methodName];\n  const hasOwnProp = hasOwn(instance, methodName);\n  let descriptor;\n  if (hasOwnProp) {\n    descriptor = Object.getOwnPropertyDescriptor(instance, methodName);\n  }\n  Object.defineProperty(instance, methodName, {\n    configurable: true,\n    enumerable: !descriptor || !!descriptor.enumerable,\n    value: getStub(originalMethod) || function spied(...args) {\n      const result = originalMethod.apply(this, args);\n      lastReturnValue = result;\n      return result;\n    },\n  });\n  return {\n    restore() {\n      if (hasOwnProp) {\n        if (descriptor) {\n          Object.defineProperty(instance, methodName, descriptor);\n        } else {\n          /* eslint-disable no-param-reassign */\n          instance[methodName] = originalMethod;\n          /* eslint-enable no-param-reassign */\n        }\n      } else {\n        /* eslint-disable no-param-reassign */\n        delete instance[methodName];\n        /* eslint-enable no-param-reassign */\n      }\n    },\n    getLastReturnValue() {\n      return lastReturnValue;\n    },\n  };\n}\n\nexport function spyProperty(instance, propertyName, handlers = {}) {\n  const originalValue = instance[propertyName];\n  const hasOwnProp = hasOwn(instance, propertyName);\n  let descriptor;\n  if (hasOwnProp) {\n    descriptor = Object.getOwnPropertyDescriptor(instance, propertyName);\n  }\n  let wasAssigned = false;\n  let holder = originalValue;\n  const getV = handlers.get ? () => {\n    const value = descriptor && descriptor.get ? descriptor.get.call(instance) : holder;\n    return handlers.get.call(instance, value);\n  } : () => holder;\n  const set = handlers.set ? (newValue) => {\n    wasAssigned = true;\n    const handlerNewValue = handlers.set.call(instance, holder, newValue);\n    holder = handlerNewValue;\n    if (descriptor && descriptor.set) {\n      descriptor.set.call(instance, holder);\n    }\n  } : (v) => {\n    wasAssigned = true;\n    holder = v;\n  };\n  Object.defineProperty(instance, propertyName, {\n    configurable: true,\n    enumerable: !descriptor || !!descriptor.enumerable,\n    get: getV,\n    set,\n  });\n\n  return {\n    restore() {\n      if (hasOwnProp) {\n        if (descriptor) {\n          Object.defineProperty(instance, propertyName, descriptor);\n        } else {\n          /* eslint-disable no-param-reassign */\n          instance[propertyName] = holder;\n          /* eslint-enable no-param-reassign */\n        }\n      } else {\n        /* eslint-disable no-param-reassign */\n        delete instance[propertyName];\n        /* eslint-enable no-param-reassign */\n      }\n    },\n    wasAssigned() {\n      return wasAssigned;\n    },\n  };\n}\n\nexport { default as shallowEqual } from 'enzyme-shallow-equal';\n\nexport function isEmptyValue(renderedValue) {\n  return renderedValue === null || renderedValue === false;\n}\n\nexport function renderedDive(nodes) {\n  if (isEmptyValue(nodes)) {\n    return true;\n  }\n\n  return [].concat(nodes).every((n) => {\n    if (n) {\n      const { rendered } = n;\n      return isEmptyValue(rendered) || renderedDive(rendered);\n    }\n\n    return isEmptyValue(n);\n  });\n}\n\nexport function loadCheerioRoot(html) {\n  if (!html) {\n    return cheerio.root();\n  }\n\n  if (!isHtml(html)) {\n    // use isDocument=false to create fragment\n    return cheerio.load(html, null, false).root();\n  }\n\n  return cheerio.load('')(html);\n}\n"
  },
  {
    "path": "packages/enzyme/src/configuration.js",
    "content": "import validateAdapter from './validateAdapter';\n\nlet configuration = {};\n\nexport function get() {\n  return { ...configuration };\n}\n\nexport function merge(extra) {\n  if (extra.adapter) {\n    validateAdapter(extra.adapter);\n  }\n  Object.assign(configuration, extra);\n}\n\nexport function reset(replacementConfig = {}) {\n  configuration = {};\n  merge(replacementConfig);\n}\n"
  },
  {
    "path": "packages/enzyme/src/getAdapter.js",
    "content": "import validateAdapter from './validateAdapter';\nimport { get } from './configuration';\n\nexport default function getAdapter(options = {}) {\n  if (options.adapter) {\n    validateAdapter(options.adapter);\n    return options.adapter;\n  }\n  const { adapter } = get();\n  validateAdapter(adapter);\n  return adapter;\n}\n"
  },
  {
    "path": "packages/enzyme/src/index.js",
    "content": "export { default as ReactWrapper } from './ReactWrapper';\nexport { default as ShallowWrapper } from './ShallowWrapper';\nexport { default as EnzymeAdapter } from './EnzymeAdapter';\n\nexport { default as mount } from './mount';\nexport { default as shallow } from './shallow';\nexport { default as render } from './render';\nexport { merge as configure } from './configuration';\n"
  },
  {
    "path": "packages/enzyme/src/mount.js",
    "content": "import ReactWrapper from './ReactWrapper';\n\n/**\n * Mounts and renders a react component into the document and provides a testing wrapper around it.\n *\n * @param node\n * @returns {ReactWrapper}\n */\nexport default function mount(node, options) {\n  return new ReactWrapper(node, null, options);\n}\n"
  },
  {
    "path": "packages/enzyme/src/render.js",
    "content": "import getAdapter from './getAdapter';\nimport { loadCheerioRoot } from './Utils';\n\n/**\n * Renders a react component into static HTML and provides a cheerio wrapper around it. This is\n * somewhat asymmetric with `mount` and `shallow`, which don't use any external libraries, but\n * Cheerio's API is pretty close to what we actually want and has a significant amount of utility\n * that would be recreating the wheel if we didn't use it.\n *\n * I think there are a lot of good use cases to use `render` instead of `shallow` or `mount`, and\n * thus I'd like to keep this API in here even though it's not really \"ours\".\n *\n * @param node\n * @param options\n * @returns {Cheerio}\n */\n\nexport default function render(node, options = {}) {\n  const adapter = getAdapter(options);\n  const renderer = adapter.createRenderer({ mode: 'string', ...options });\n  const html = renderer.render(node, options.context);\n  return loadCheerioRoot(html);\n}\n"
  },
  {
    "path": "packages/enzyme/src/selectors.js",
    "content": "import { createParser } from 'rst-selector-parser';\nimport values from 'object.values';\nimport flat from 'array.prototype.flat';\nimport is from 'object-is';\nimport hasOwn from 'hasown';\nimport elementsByConstructor from 'html-element-map/byConstructor';\nimport {\n  treeFilter,\n  nodeHasId,\n  findParentNode,\n  nodeMatchesObjectProps,\n  childrenOfNode,\n  hasClassName,\n} from './RSTTraversal';\nimport { nodeHasType, propsOfNode } from './Utils';\nimport getAdapter from './getAdapter';\n// our CSS selector parser instance\nconst parser = createParser();\n\n// Combinators that allow you to chance selectors\nconst CHILD = 'childCombinator';\nconst ADJACENT_SIBLING = 'adjacentSiblingCombinator';\nconst GENERAL_SIBLING = 'generalSiblingCombinator';\nconst DESCENDANT = 'descendantCombinator';\n\n// Selectors for targeting elements\nconst SELECTOR = 'selector';\nconst TYPE_SELECTOR = 'typeSelector';\nconst CLASS_SELECTOR = 'classSelector';\nconst ID_SELECTOR = 'idSelector';\nconst UNIVERSAL_SELECTOR = 'universalSelector';\nconst ATTRIBUTE_PRESENCE = 'attributePresenceSelector';\nconst ATTRIBUTE_VALUE = 'attributeValueSelector';\n// @TODO we dont support these, throw if they are used\nconst PSEUDO_CLASS = 'pseudoClassSelector';\nconst PSEUDO_ELEMENT = 'pseudoElementSelector';\n\nconst EXACT_ATTRIBUTE_OPERATOR = '=';\nconst WHITELIST_ATTRIBUTE_OPERATOR = '~=';\nconst HYPHENATED_ATTRIBUTE_OPERATOR = '|=';\nconst PREFIX_ATTRIBUTE_OPERATOR = '^=';\nconst SUFFIX_ATTRIBUTE_OPERATOR = '$=';\nconst SUBSTRING_ATTRIBUTE_OPERATOR = '*=';\n\nfunction unique(arr) {\n  return [...new Set(arr)];\n}\n\n/**\n * Calls reduce on a array of nodes with the passed\n * function, returning only unique results.\n * @param {Function} fn\n * @param {Array<Node>} nodes\n */\nfunction uniqueReduce(fn, nodes) {\n  return unique(nodes.reduce(fn, []));\n}\n\n/**\n * Takes a CSS selector and returns a set of tokens parsed\n * by scalpel.\n * @param {String} selector\n */\nfunction safelyGenerateTokens(selector) {\n  try {\n    return parser.parse(selector);\n  } catch (err) {\n    throw new Error(`Failed to parse selector: ${selector}`);\n  }\n}\n\nfunction matchAttributeSelector(node, token) {\n  const { operator, value, name } = token;\n  const nodeProps = propsOfNode(node);\n  const descriptor = Object.getOwnPropertyDescriptor(nodeProps, name);\n  if (descriptor && descriptor.get) {\n    return false;\n  }\n  const nodePropValue = nodeProps[name];\n  if (typeof nodePropValue === 'undefined') {\n    return false;\n  }\n  if (token.type === ATTRIBUTE_PRESENCE) {\n    return hasOwn(nodeProps, token.name);\n  }\n  // Only the exact value operator (\"=\") can match non-strings\n  if (typeof nodePropValue !== 'string' || typeof value !== 'string') {\n    if (operator !== EXACT_ATTRIBUTE_OPERATOR) {\n      return false;\n    }\n  }\n  switch (operator) {\n    /**\n     * Represents an element with the att attribute whose value is exactly \"val\".\n     * @example\n     * [attr=\"val\"] matches attr=\"val\"\n     */\n    case EXACT_ATTRIBUTE_OPERATOR:\n      return is(nodePropValue, value);\n    /**\n     * Represents an element with the att attribute whose value is a whitespace-separated\n     * list of words, one of which is exactly\n     * @example\n     *  [rel~=\"copyright\"] matches rel=\"copyright other\"\n     */\n    case WHITELIST_ATTRIBUTE_OPERATOR:\n      return nodePropValue.split(' ').indexOf(value) !== -1;\n    /**\n     * Represents an element with the att attribute, its value either being exactly the\n     * value or beginning with the value immediately followed by \"-\"\n     * @example\n     * [hreflang|=\"en\"] matches hreflang=\"en-US\"\n     */\n    case HYPHENATED_ATTRIBUTE_OPERATOR:\n      return nodePropValue === value || nodePropValue.startsWith(`${value}-`);\n    /**\n     * Represents an element with the att attribute whose value begins with the prefix value.\n     * If the value is the empty string then the selector does not represent anything.\n     * @example\n     * [type^=\"image\"] matches type=\"imageobject\"\n     */\n    case PREFIX_ATTRIBUTE_OPERATOR:\n      return value === '' ? false : nodePropValue.slice(0, value.length) === value;\n    /**\n     * Represents an element with the att attribute whose value ends with the suffix value.\n     * If the value is the empty string then the selector does not represent anything.\n     * @example\n     * [type$=\"image\"] matches type=\"imageobject\"\n     */\n    case SUFFIX_ATTRIBUTE_OPERATOR:\n      return value === '' ? false : nodePropValue.slice(-value.length) === value;\n    /**\n     * Represents an element with the att attribute whose value contains at least one\n     * instance of the value. If value is the empty string then the\n     * selector does not represent anything.\n     * @example\n     * [title*=\"hello\"] matches title=\"well hello there\"\n     */\n    case SUBSTRING_ATTRIBUTE_OPERATOR:\n      return value === '' ? false : nodePropValue.indexOf(value) !== -1;\n    default:\n      throw new Error(`Enzyme::Selector: Unknown attribute selector operator \"${operator}\"`);\n  }\n}\n\nfunction matchPseudoSelector(node, token, root) {\n  const { name, parameters } = token;\n  if (name === 'not') {\n    // eslint-disable-next-line no-use-before-define\n    return parameters.every((selector) => reduceTreeBySelector(selector, node).length === 0);\n  }\n  if (name === 'empty') {\n    return treeFilter(node, (n) => n !== node).length === 0;\n  }\n  if (name === 'first-child') {\n    const { rendered } = findParentNode(root, node);\n    const [firstChild] = rendered;\n    return firstChild === node;\n  }\n  if (name === 'last-child') {\n    const { rendered } = findParentNode(root, node);\n    return rendered[rendered.length - 1] === node;\n  }\n  if (name === 'focus') {\n    if (typeof document === 'undefined') {\n      throw new Error('Enzyme::Selector does not support the \":focus\" pseudo-element without a global `document`.');\n    }\n    const adapter = getAdapter();\n    /* eslint-env browser */\n    return document.activeElement && adapter.nodeToHostNode(node) === document.activeElement;\n  }\n\n  throw new TypeError(`Enzyme::Selector does not support the \"${token.name}\" pseudo-element or pseudo-class selectors.`);\n}\n\n/**\n * Takes a node and a token and determines if the node\n * matches the predicate defined by the token.\n * @param {Node} node\n * @param {Token} token\n */\nfunction nodeMatchesToken(node, token, root) {\n  if (node === null || typeof node === 'string') {\n    return false;\n  }\n  switch (token.type) {\n    /**\n     * Match every node\n     * @example '*' matches every node\n     */\n    case UNIVERSAL_SELECTOR:\n      return true;\n    /**\n     * Match against the className prop\n     * @example '.active' matches <div className='active' />\n     */\n    case CLASS_SELECTOR:\n      return hasClassName(node, token.name);\n    /**\n     * Simple type matching\n     * @example 'div' matches <div />\n     */\n    case TYPE_SELECTOR:\n      return nodeHasType(node, token.name);\n    /**\n     * Match against the `id` prop\n     * @example '#nav' matches <ul id=\"nav\" />\n     */\n    case ID_SELECTOR:\n      return nodeHasId(node, token.name);\n    /**\n     * Matches if an attribute is present, regardless\n     * of its value\n     * @example '[disabled]' matches <a disabled />\n     */\n    case ATTRIBUTE_PRESENCE:\n      return matchAttributeSelector(node, token);\n    /**\n     * Matches if an attribute is present with the\n     * provided value\n     * @example '[data-foo=foo]' matches <div data-foo=\"foo\" />\n     */\n    case ATTRIBUTE_VALUE:\n      return matchAttributeSelector(node, token);\n    case PSEUDO_ELEMENT:\n    case PSEUDO_CLASS:\n      return matchPseudoSelector(node, token, root);\n    default:\n      throw new Error(`Unknown token type: ${token.type}`);\n  }\n}\n\n/**\n * Returns a predicate function that checks if a\n * node matches every token in the body of a selector\n * token.\n * @param {Token} token\n */\nfunction buildPredicateFromToken(token, root) {\n  return (node) => token.body.every((bodyToken) => nodeMatchesToken(node, bodyToken, root));\n}\n\n/**\n * Returns whether a parsed selector is a complex selector, which\n * is defined as a selector that contains combinators.\n * @param {Array<Token>} tokens\n */\nfunction isComplexSelector(tokens) {\n  return tokens.some((token) => token.type !== SELECTOR);\n}\n\n/**\n * Takes a component constructor, object, or string representing\n * a simple selector and returns a predicate function that can\n * be applied to a single node.\n * @param {EnzymeSelector} selector\n */\nexport function buildPredicate(selector) {\n  // If the selector is a string, parse it as a simple CSS selector\n  if (typeof selector === 'string') {\n    const tokens = safelyGenerateTokens(selector);\n    if (isComplexSelector(tokens)) {\n      throw new TypeError('This method does not support complex CSS selectors');\n    }\n    // Simple selectors only have a single selector token\n    return buildPredicateFromToken(tokens[0]);\n  }\n\n  // If the selector is an element type, check if the node's type matches\n  const adapter = getAdapter();\n  const isElementType = adapter.isValidElementType\n    ? adapter.isValidElementType(selector)\n    : typeof selector === 'function';\n  if (isElementType) {\n    return (node) => adapter.matchesElementType(node, selector);\n  }\n  // If the selector is an non-empty object, treat the keys/values as props\n  if (typeof selector === 'object') {\n    if (!Array.isArray(selector) && selector !== null && Object.keys(selector).length > 0) {\n      const hasUndefinedValues = values(selector).some((value) => typeof value === 'undefined');\n      if (hasUndefinedValues) {\n        throw new TypeError('Enzyme::Props can’t have `undefined` values. Try using ‘findWhere()’ instead.');\n      }\n      return (node) => nodeMatchesObjectProps(node, selector);\n    }\n    throw new TypeError('Enzyme::Selector does not support an array, null, or empty object as a selector');\n  }\n\n  throw new TypeError('Enzyme::Selector expects a string, object, or valid element type (Component Constructor)');\n}\n\n/**\n * Matches only nodes which are adjacent siblings (direct next sibling)\n * against a predicate, returning those that match.\n * @param {Array<Node>} nodes\n * @param {Function} predicate\n * @param {Node} root\n */\nfunction matchAdjacentSiblings(nodes, predicate, root) {\n  return nodes.reduce((matches, node) => {\n    const parent = findParentNode(root, node);\n    // If there's no parent, there's no siblings\n    if (!parent) {\n      return matches;\n    }\n    const parentChildren = childrenOfNode(parent);\n    const nodeIndex = parentChildren.indexOf(node);\n    const adjacentSibling = parentChildren[nodeIndex + 1];\n    // No sibling\n    if (!adjacentSibling) {\n      return matches;\n    }\n    if (predicate(adjacentSibling)) {\n      matches.push(adjacentSibling);\n    }\n    return matches;\n  }, []);\n}\n\n/**\n * Matches only nodes which are general siblings (any sibling *after*)\n * against a predicate, returning those that match.\n * @param {Array<Node>} nodes\n * @param {Function} predicate\n * @param {Node} root\n */\nfunction matchGeneralSibling(nodes, predicate, root) {\n  return uniqueReduce((matches, node) => {\n    const parent = findParentNode(root, node);\n    if (!parent) {\n      return matches;\n    }\n    const parentChildren = childrenOfNode(parent);\n    const nodeIndex = parentChildren.indexOf(node);\n    const youngerSiblings = parentChildren.slice(nodeIndex + 1);\n    return matches.concat(youngerSiblings.filter(predicate));\n  }, nodes);\n}\n\n/**\n * Matches only nodes which are direct children (not grandchildren, etc.)\n * against a predicate, returning those that match.\n * @param {Array<Node>} nodes\n * @param {Function} predicate\n */\nfunction matchDirectChild(nodes, predicate) {\n  return uniqueReduce(\n    (matches, node) => matches.concat(childrenOfNode(node).filter(predicate)),\n    nodes,\n  );\n}\n\n/**\n * Matches all descendant nodes against a predicate,\n * returning those that match.\n * @param {Array<Node>} nodes\n * @param {Function} predicate\n */\nfunction matchDescendant(nodes, predicate) {\n  return uniqueReduce(\n    (matches, node) => matches.concat(treeFilter(node, predicate)),\n    flat(nodes.map(childrenOfNode)),\n  );\n}\n\n/**\n * Takes an RST and reduces it to a set of nodes matching\n * the selector. The selector can be a simple selector, which\n * is handled by `buildPredicate`, or a complex CSS selector which\n * reduceTreeBySelector parses and reduces the tree based on the combinators.\n *\n * @param {EnzymeSelector} selector\n * @param {RSTNode} root\n */\nexport function reduceTreeBySelector(selector, root) {\n  if (typeof selector !== 'string') {\n    const elements = elementsByConstructor(selector);\n    if (elements.length > 0) {\n      return flat(elements.map((x) => reduceTreeBySelector(x.tag, root)));\n\n      // when https://github.com/aweary/rst-selector-parser/issues/15 is resolved\n      // const htmlTagNames = elements.map(x => x.tag).join(', ');\n      // return reduceTreeBySelector(htmlTagNames, root);\n    }\n  }\n\n  if (typeof selector === 'function' || typeof selector === 'object') {\n    return treeFilter(root, buildPredicate(selector));\n  }\n\n  let results = [];\n  if (typeof selector === 'string') {\n    const tokens = safelyGenerateTokens(selector);\n    let index = 0;\n    while (index < tokens.length) {\n      const token = tokens[index];\n      /**\n       * There are two types of tokens in a CSS selector:\n       *\n       * 1. Selector tokens. These target nodes directly, like\n       *    type or attribute selectors. These are easy to apply\n       *    because we can traverse the tree and return only\n       *    the nodes that match the predicate.\n       *\n       * 2. Combinator tokens. These tokens chain together\n       *    selector nodes. For example > for children, or +\n       *    for adjacent siblings. These are harder to match\n       *    as we have to track where in the tree we are\n       *    to determine if a selector node applies or not.\n       */\n      if (token.type === SELECTOR) {\n        const predicate = buildPredicateFromToken(token, root);\n        results = results.concat(treeFilter(root, predicate));\n      } else {\n        // We can assume there always all previously matched tokens since selectors\n        // cannot start with combinators.\n        const { type } = token;\n        // We assume the next token is a selector, so move the index\n        // forward and build the predicate.\n        index += 1;\n        const predicate = buildPredicateFromToken(tokens[index], root);\n        // We match against only the nodes which have already been matched,\n        // since a combinator is meant to refine a previous selector.\n        switch (type) {\n          // The + combinator\n          case ADJACENT_SIBLING:\n            results = matchAdjacentSiblings(results, predicate, root);\n            break;\n          // The ~ combinator\n          case GENERAL_SIBLING:\n            results = matchGeneralSibling(results, predicate, root);\n            break;\n          // The > combinator\n          case CHILD:\n            results = matchDirectChild(results, predicate);\n            break;\n          // The ' ' (whitespace) combinator\n          case DESCENDANT: {\n            results = matchDescendant(results, predicate);\n            break;\n          }\n          default:\n            throw new Error(`Unknown combinator selector: ${type}`);\n        }\n      }\n      index += 1;\n    }\n  } else {\n    throw new TypeError('Enzyme::Selector expects a string, object, or Component Constructor');\n  }\n  return results;\n}\n\nexport function reduceTreesBySelector(selector, roots) {\n  const results = roots.map((n) => reduceTreeBySelector(selector, n));\n  return unique(flat(results, 1));\n}\n"
  },
  {
    "path": "packages/enzyme/src/shallow.js",
    "content": "import ShallowWrapper from './ShallowWrapper';\n\n/**\n * Shallow renders a react component and provides a testing wrapper around it.\n *\n * @param node\n * @returns {ShallowWrapper}\n */\nexport default function shallow(node, options) {\n  return new ShallowWrapper(node, null, options);\n}\n"
  },
  {
    "path": "packages/enzyme/src/validateAdapter.js",
    "content": "import EnzymeAdapter from './EnzymeAdapter';\n\nexport default function validateAdapter(adapter) {\n  if (!adapter) {\n    throw new Error(`\n      Enzyme Internal Error: Enzyme expects an adapter to be configured, but found none.\n      To configure an adapter, you should call \\`Enzyme.configure({ adapter: new Adapter() })\\`\n      before using any of Enzyme's top level APIs, where \\`Adapter\\` is the adapter\n      corresponding to the library currently being tested. For example:\n\n      import Adapter from 'enzyme-adapter-react-15';\n\n      To find out more about this, see https://enzymejs.github.io/enzyme/docs/installation/index.html\n    `);\n  }\n  if (typeof adapter === 'function') {\n    if (Object.getPrototypeOf(adapter) === EnzymeAdapter) {\n      throw new Error(`\n        Enzyme Internal Error: Enzyme expects an adapter instance to be configured -\n        you provided an adapter *constructor*.\n        To configure an adapter, you should call \\`Enzyme.configure({ adapter: new Adapter() })\\`\n        before using any of Enzyme's top level APIs, where \\`Adapter\\` is the adapter\n        corresponding to the library currently being tested. For example:\n\n        import Adapter from 'enzyme-adapter-react-15';\n\n        To find out more about this, see https://enzymejs.github.io/enzyme/docs/installation/index.html\n      `);\n    }\n    throw new Error(`\n      Enzyme Internal Error: Enzyme expects an adapter to be configured -\n      an enzyme adapter must be an object instance; you provided a function.\n      To configure an adapter, you should call \\`Enzyme.configure({ adapter: new Adapter() })\\`\n      before using any of Enzyme's top level APIs, where \\`Adapter\\` is the adapter\n      corresponding to the library currently being tested. For example:\n\n      import Adapter from 'enzyme-adapter-react-15';\n\n      To find out more about this, see https://enzymejs.github.io/enzyme/docs/installation/index.html\n    `);\n  }\n  if (!(adapter instanceof EnzymeAdapter)) {\n    throw new Error('Enzyme Internal Error: configured enzyme adapter did not inherit from the EnzymeAdapter base class');\n  }\n}\n"
  },
  {
    "path": "packages/enzyme/withDom.js",
    "content": "require('raf/polyfill');\n\n/* eslint\n  no-console: 0,\n  prefer-template: 0,\n  prefer-destructuring: 0,\n*/\n\nif (!global.document) {\n  try {\n    // eslint-disable-next-line global-require, import/no-extraneous-dependencies\n    const jsdom = require('jsdom').jsdom; // could throw\n\n    global.document = jsdom('');\n    global.window = global.document.defaultView;\n    Object.keys(global.document.defaultView).forEach((property) => {\n      if (typeof global[property] === 'undefined') {\n        global[property] = global.document.defaultView[property];\n      }\n    });\n\n    global.navigator = {\n      userAgent: 'node.js',\n    };\n  } catch (e) {\n    // jsdom is not supported...\n    if (e.message === \"Cannot find module 'jsdom'\") {\n      console.error('[enzyme/withDom] Error: missing required module \"jsdom\"');\n      console.error('[enzyme/withDom] To fix this you must run:');\n      console.error('[enzyme/withDom]   npm install jsdom --save-dev');\n    } else {\n      console.error('[enzyme withDom] ' + (e.stack || e.message));\n    }\n  }\n}\n"
  },
  {
    "path": "packages/enzyme-adapter-react-13/.babelrc",
    "content": "{\n  \"presets\": [\n    [\"airbnb\", { \"transformRuntime\": false }],\n  ],\n  \"plugins\": [\n    [\"transform-replace-object-assign\", { \"moduleSpecifier\": \"object.assign\" }],\n    [\"add-module-exports\"],\n  ],\n  \"sourceMaps\": \"both\",\n}\n"
  },
  {
    "path": "packages/enzyme-adapter-react-13/.eslintrc",
    "content": "{\n  \"extends\": \"airbnb\",\n  \"parser\": \"@babel/eslint-parser\",\n  \"root\": true,\n  \"ignorePatterns\": [\"build/\"],\n  \"rules\": {\n    \"max-classes-per-file\": 0,\n    \"max-len\": 0,\n    \"react/no-find-dom-node\": 0,\n    \"react/no-multi-comp\": 0,\n    \"no-underscore-dangle\": 0,\n    \"class-methods-use-this\": 0,\n    \"react/no-render-return-value\": 0, // react 13's `render` returns a value we use\n  },\n  \"settings\": {\n    \"react\": {\n      \"version\": \"0.13.0\",\n    },\n  },\n}\n"
  },
  {
    "path": "packages/enzyme-adapter-react-13/package.json",
    "content": "{\n  \"name\": \"enzyme-adapter-react-13\",\n  \"version\": \"1.4.3\",\n  \"description\": \"JavaScript Testing utilities for React\",\n  \"homepage\": \"https://enzymejs.github.io/enzyme/\",\n  \"main\": \"build\",\n  \"scripts\": {\n    \"prepack\": \"npmignore --auto --commentLines=autogenerated --gitignore=../../.gitignore && cp ../../{LICENSE,README}.md ./ && npm run build\",\n    \"prepublishOnly\": \"safe-publish-latest\",\n    \"prepublish\": \"not-in-publish || npm run prepublishOnly\",\n    \"clean\": \"rimraf build\",\n    \"lint\": \"eslint --ext js,jsx .\",\n    \"pretest\": \"npm run lint\",\n    \"prebuild\": \"npm run clean\",\n    \"build\": \"babel --source-maps=both src --out-dir build\",\n    \"watch\": \"npm run build -- -w\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/enzymejs/enzyme.git\",\n    \"directory\": \"packages/enzyme-adapter-react-13\"\n  },\n  \"keywords\": [\n    \"javascript\",\n    \"shallow rendering\",\n    \"shallowRender\",\n    \"test\",\n    \"reactjs\",\n    \"react\",\n    \"flux\",\n    \"testing\",\n    \"test utils\",\n    \"assertion helpers\",\n    \"tdd\",\n    \"mocha\"\n  ],\n  \"author\": \"Jordan Harband <ljharb@gmail.com>\",\n  \"funding\": {\n    \"url\": \"https://github.com/sponsors/ljharb\"\n  },\n  \"license\": \"MIT\",\n  \"dependencies\": {\n    \"enzyme-adapter-utils\": \"^1.14.2\",\n    \"object.assign\": \"^4.1.7\",\n    \"object.values\": \"^1.2.1\",\n    \"prop-types\": \"^15.8.1\"\n  },\n  \"peerDependencies\": {\n    \"enzyme\": \"^3.0.0\",\n    \"react\": \"^0.13.0\"\n  },\n  \"devDependencies\": {\n    \"@babel/cli\": \"^7.28.3\",\n    \"@babel/core\": \"^7.28.4\",\n    \"@babel/eslint-parser\": \"^7.28.4\",\n    \"babel-plugin-add-module-exports\": \"^1.0.4\",\n    \"babel-plugin-transform-replace-object-assign\": \"^2.0.0\",\n    \"babel-preset-airbnb\": \"^4.5.0\",\n    \"enzyme\": \"^3.0.0\",\n    \"eslint\": \"^8.56.0\",\n    \"eslint-config-airbnb\": \"^19.0.4\",\n    \"eslint-plugin-import\": \"^2.32.0\",\n    \"eslint-plugin-jsx-a11y\": \"^6.10.2\",\n    \"eslint-plugin-react\": \"^7.37.5\",\n    \"eslint-plugin-react-hooks\": \"^4.6.0\",\n    \"in-publish\": \"^2.0.1\",\n    \"npmignore\": \"^0.3.1\",\n    \"rimraf\": \"^2.7.1\",\n    \"safe-publish-latest\": \"^2.0.0\"\n  },\n  \"publishConfig\": {\n    \"ignore\": [\n      \"!build\"\n    ]\n  }\n}\n"
  },
  {
    "path": "packages/enzyme-adapter-react-13/src/ReactThirteenAdapter.js",
    "content": "import React from 'react';\n// eslint-disable-next-line import/no-unresolved, import/extensions\nimport ReactAddons from 'react/addons';\n// eslint-disable-next-line import/no-unresolved, import/extensions\nimport ReactContext from 'react/lib/ReactContext';\nimport values from 'object.values';\nimport { EnzymeAdapter } from 'enzyme';\nimport {\n  displayNameOfNode,\n  propFromEvent,\n  withSetStateAllowed,\n  assertDomAvailable,\n  createRenderWrapper,\n  createMountWrapper,\n  propsWithKeysAndRef,\n  ensureKeyOrUndefined,\n  wrap,\n} from 'enzyme-adapter-utils';\nimport mapNativeEventNames from './ReactThirteenMapNativeEventNames';\nimport elementToTree from './ReactThirteenElementToTree';\n\n// this fixes some issues in React 0.13 with setState and jsdom...\n// see issue: https://github.com/enzymejs/enzyme/issues/27\n// eslint-disable-next-line import/no-unresolved\nrequire('react/lib/ExecutionEnvironment').canUseDOM = true;\n\nconst { TestUtils, batchedUpdates } = ReactAddons.addons;\n\nconst getEmptyElementType = (() => {\n  let EmptyElementType = null;\n  // eslint-disable-next-line react/prefer-stateless-function\n  class Foo extends React.Component {\n    render() {\n      return null;\n    }\n  }\n\n  return () => {\n    if (EmptyElementType === null) {\n      const instance = TestUtils.renderIntoDocument(React.createElement(Foo));\n      EmptyElementType = instance._reactInternalInstance._renderedComponent._currentElement.type;\n    }\n    return EmptyElementType;\n  };\n})();\n\nconst createShallowRenderer = function createRendererCompatible() {\n  const renderer = TestUtils.createRenderer();\n  renderer.render = ((originalRender) => function contextCompatibleRender(node, context = {}) {\n    ReactContext.current = context;\n    originalRender.call(this, React.createElement(node.type, node.props), context);\n    ReactContext.current = {};\n    return renderer.getRenderOutput();\n  })(renderer.render);\n  return renderer;\n};\n\nfunction instanceToTree(inst) {\n  if (typeof inst !== 'object') {\n    return inst;\n  }\n  const el = inst._currentElement;\n  if (!el) {\n    return null;\n  }\n  if (typeof el !== 'object') {\n    return el;\n  }\n  if (el.type === getEmptyElementType()) {\n    return null;\n  }\n  if (typeof el.type === 'string') {\n    const innerInst = inst._renderedComponent;\n    const children = innerInst._renderedChildren || { '.0': el._store.props.children };\n    return {\n      nodeType: 'host',\n      type: el.type,\n      props: el._store.props,\n      key: ensureKeyOrUndefined(el.key),\n      ref: el.ref,\n      instance: inst._instance.getDOMNode(),\n      rendered: values(children).map(instanceToTree),\n    };\n  }\n  if (inst._renderedComponent) {\n    return {\n      nodeType: 'class',\n      type: el.type,\n      props: el._store.props,\n      key: ensureKeyOrUndefined(el.key),\n      ref: el.ref,\n      instance: inst._instance || inst._hostNode || null,\n      rendered: instanceToTree(inst._renderedComponent),\n    };\n  }\n  throw new Error('Enzyme Internal Error: unknown instance encountered');\n}\n\nclass ReactThirteenAdapter extends EnzymeAdapter {\n  constructor() {\n    super();\n\n    const { lifecycles } = this.options;\n    this.options = {\n      ...this.options,\n      supportPrevContextArgumentOfComponentDidUpdate: true, // TODO: remove, semver-major\n      legacyContextMode: 'owner',\n      lifecycles: {\n        ...lifecycles,\n        componentDidUpdate: {\n          prevContext: true,\n        },\n      },\n    };\n  }\n\n  createMountRenderer(options) {\n    assertDomAvailable('mount');\n    const domNode = options.attachTo || global.document.createElement('div');\n    let instance = null;\n    const adapter = this;\n    return {\n      render(el, context, callback) {\n        if (instance === null) {\n          const { ref, type, props } = el;\n          const wrapperProps = {\n            Component: type,\n            props,\n            context,\n            ...(ref && { ref }),\n          };\n          const ReactWrapperComponent = createMountWrapper(el, { ...options, adapter });\n          const wrappedEl = React.createElement(ReactWrapperComponent, wrapperProps);\n          instance = React.render(wrappedEl, domNode);\n          if (typeof callback === 'function') {\n            callback();\n          }\n        } else {\n          instance.setChildProps(el.props, context, callback);\n        }\n      },\n      unmount() {\n        React.unmountComponentAtNode(domNode);\n        instance = null;\n      },\n      getNode() {\n        return instance ? instanceToTree(instance._reactInternalInstance).rendered : null;\n      },\n      simulateEvent(node, event, mock) {\n        const mappedEvent = mapNativeEventNames(event);\n        const eventFn = TestUtils.Simulate[mappedEvent];\n        if (!eventFn) {\n          throw new TypeError(`ReactWrapper::simulate() event '${event}' does not exist`);\n        }\n        // eslint-disable-next-line react/no-find-dom-node\n        eventFn(React.findDOMNode(node.instance), mock);\n      },\n      batchedUpdates(fn) {\n        return batchedUpdates(fn);\n      },\n    };\n  }\n\n  createShallowRenderer(/* options */) {\n    const renderer = createShallowRenderer();\n    let isDOM = false;\n    let cachedNode = null;\n    return {\n      render(el, context) {\n        cachedNode = el;\n        /* eslint consistent-return: 0 */\n        if (typeof el.type === 'string') {\n          isDOM = true;\n        } else {\n          isDOM = false;\n          // return withSetStateAllowed(() => renderer.render(el, context));\n          return renderer.render(el, context);\n        }\n      },\n      unmount() {\n        renderer.unmount();\n      },\n      getNode() {\n        if (isDOM) {\n          return elementToTree(cachedNode);\n        }\n        const output = renderer.getRenderOutput();\n        return {\n          nodeType: 'class',\n          type: cachedNode.type,\n          props: cachedNode.props,\n          key: ensureKeyOrUndefined(cachedNode.key),\n          ref: cachedNode.ref,\n          instance: renderer._instance._instance,\n          rendered: elementToTree(output),\n        };\n      },\n      simulateEvent(node, event, ...args) {\n        const handler = node.props[propFromEvent(event)];\n        if (handler) {\n          withSetStateAllowed(() => {\n            // TODO(lmr): create/use synthetic events\n            // TODO(lmr): emulate React's event propagation\n            batchedUpdates(() => {\n              handler(...args);\n            });\n          });\n        }\n      },\n      batchedUpdates(fn) {\n        return withSetStateAllowed(() => batchedUpdates(fn));\n      },\n    };\n  }\n\n  createStringRenderer(options) {\n    return {\n      render(el, context) {\n        if (options.context && (el.type.contextTypes || options.childContextTypes)) {\n          const childContextTypes = {\n            ...(el.type.contextTypes || {}),\n            ...options.childContextTypes,\n          };\n          const ContextWrapper = createRenderWrapper(el, context, childContextTypes);\n          return React.renderToStaticMarkup(React.createElement(ContextWrapper));\n        }\n        return React.renderToStaticMarkup(el);\n      },\n    };\n  }\n\n  // Provided a bag of options, return an `EnzymeRenderer`. Some options can be implementation\n  // specific, like `attach` etc. for React, but not part of this interface explicitly.\n  // eslint-disable-next-line class-methods-use-this, no-unused-vars\n  createRenderer(options) {\n    switch (options.mode) {\n      case EnzymeAdapter.MODES.MOUNT: return this.createMountRenderer(options);\n      case EnzymeAdapter.MODES.SHALLOW: return this.createShallowRenderer(options);\n      case EnzymeAdapter.MODES.STRING: return this.createStringRenderer(options);\n      default:\n        throw new Error(`Enzyme Internal Error: Unrecognized mode: ${options.mode}`);\n    }\n  }\n\n  wrap(element) {\n    return wrap(element);\n  }\n\n  // converts an RSTNode to the corresponding JSX Pragma Element. This will be needed\n  // in order to implement the `Wrapper.mount()` and `Wrapper.shallow()` methods, but should\n  // be pretty straightforward for people to implement.\n  // eslint-disable-next-line class-methods-use-this, no-unused-vars\n  nodeToElement(node) {\n    if (!node || typeof node !== 'object') return null;\n    return React.createElement(node.type, propsWithKeysAndRef(node));\n  }\n\n  displayNameOfNode(node) {\n    return displayNameOfNode(node);\n  }\n\n  elementToNode(element) {\n    return elementToTree(element);\n  }\n\n  nodeToHostNode(node) {\n    return React.findDOMNode(node.instance);\n  }\n\n  isValidElement(element) {\n    return React.isValidElement(element);\n  }\n\n  isValidElementType(object) {\n    return typeof object === 'string' || typeof object === 'function';\n  }\n\n  isCustomComponent(component) {\n    return typeof component === 'function';\n  }\n\n  createElement(...args) {\n    return React.createElement(...args);\n  }\n}\n\nexport default ReactThirteenAdapter;\n"
  },
  {
    "path": "packages/enzyme-adapter-react-13/src/ReactThirteenElementToTree.js",
    "content": "import { flatten, isArrayLike, ensureKeyOrUndefined } from 'enzyme-adapter-utils';\n\nexport function nodeTypeFromType(type) {\n  if (typeof type === 'string') {\n    return 'host';\n  }\n  if (type && type.prototype && typeof type.prototype.render === 'function') {\n    return 'class';\n  }\n  return 'function';\n}\n\nexport default function elementToTree(el) {\n  if (el === null || typeof el !== 'object' || !('type' in el)) {\n    return el;\n  }\n  const {\n    type,\n    props,\n    key,\n    ref,\n  } = el;\n  const { children } = props;\n  let rendered = null;\n  if (isArrayLike(children)) {\n    rendered = flatten([...children]).map(elementToTree);\n  } else if (typeof children !== 'undefined') {\n    rendered = elementToTree(children);\n  }\n\n  const nodeType = nodeTypeFromType(type);\n\n  if (nodeType === 'host' && props.dangerouslySetInnerHTML) {\n    if (props.children != null) {\n      const error = new Error('Can only set one of `children` or `props.dangerouslySetInnerHTML`.');\n      error.name = 'Invariant Violation';\n      throw error;\n    }\n  }\n\n  return {\n    nodeType,\n    type,\n    props,\n    key: ensureKeyOrUndefined(key),\n    ref,\n    instance: null,\n    rendered,\n  };\n}\n"
  },
  {
    "path": "packages/enzyme-adapter-react-13/src/ReactThirteenMapNativeEventNames.js",
    "content": "export default function mapNativeEventNames(event) {\n  const nativeToReactEventMap = {\n    compositionend: 'compositionEnd',\n    compositionstart: 'compositionStart',\n    compositionupdate: 'compositionUpdate',\n    keydown: 'keyDown',\n    keyup: 'keyUp',\n    keypress: 'keyPress',\n    contextmenu: 'contextMenu',\n    dblclick: 'doubleClick',\n    doubleclick: 'doubleClick', // kept for legacy. TODO: remove with next major.\n    dragend: 'dragEnd',\n    dragenter: 'dragEnter',\n    dragexist: 'dragExit',\n    dragleave: 'dragLeave',\n    dragover: 'dragOver',\n    dragstart: 'dragStart',\n    mousedown: 'mouseDown',\n    mousemove: 'mouseMove',\n    mouseout: 'mouseOut',\n    mouseover: 'mouseOver',\n    mouseup: 'mouseUp',\n    touchcancel: 'touchCancel',\n    touchend: 'touchEnd',\n    touchmove: 'touchMove',\n    touchstart: 'touchStart',\n    canplay: 'canPlay',\n    canplaythrough: 'canPlayThrough',\n    durationchange: 'durationChange',\n    loadeddata: 'loadedData',\n    loadedmetadata: 'loadedMetadata',\n    loadstart: 'loadStart',\n    ratechange: 'rateChange',\n    timeupdate: 'timeUpdate',\n    volumechange: 'volumeChange',\n    beforeinput: 'beforeInput',\n  };\n  return nativeToReactEventMap[event] || event;\n}\n"
  },
  {
    "path": "packages/enzyme-adapter-react-13/src/index.js",
    "content": "/* eslint global-require: 0 */\nmodule.exports = require('./ReactThirteenAdapter');\n"
  },
  {
    "path": "packages/enzyme-adapter-react-14/.babelrc",
    "content": "{\n  \"presets\": [\n    [\"airbnb\", { \"transformRuntime\": false }],\n  ],\n  \"plugins\": [\n    [\"transform-replace-object-assign\", { \"moduleSpecifier\": \"object.assign\" }],\n    [\"add-module-exports\"],\n  ],\n  \"sourceMaps\": \"both\",\n}\n"
  },
  {
    "path": "packages/enzyme-adapter-react-14/.eslintrc",
    "content": "{\n  \"extends\": \"airbnb\",\n  \"parser\": \"@babel/eslint-parser\",\n  \"root\": true,\n  \"ignorePatterns\": [\"build/\"],\n  \"rules\": {\n    \"max-len\": 0,\n    \"react/no-find-dom-node\": 0,\n    \"react/no-multi-comp\": 0,\n    \"no-underscore-dangle\": 0,\n    \"class-methods-use-this\": 0,\n    \"react/no-render-return-value\": 0, // react 14's `render` returns a value we use\n  },\n  \"settings\": {\n    \"react\": {\n      \"version\": \"0.14.0\",\n    },\n  },\n}\n"
  },
  {
    "path": "packages/enzyme-adapter-react-14/package.json",
    "content": "{\n  \"name\": \"enzyme-adapter-react-14\",\n  \"version\": \"1.4.4\",\n  \"description\": \"JavaScript Testing utilities for React\",\n  \"homepage\": \"https://enzymejs.github.io/enzyme/\",\n  \"main\": \"build\",\n  \"scripts\": {\n    \"prepack\": \"npmignore --auto --commentLines=autogenerated --gitignore=../../.gitignore && cp ../../{LICENSE,README}.md ./ && npm run build\",\n    \"prepublishOnly\": \"safe-publish-latest\",\n    \"prepublish\": \"not-in-publish || npm run prepublishOnly\",\n    \"clean\": \"rimraf build\",\n    \"lint\": \"eslint --ext js,jsx .\",\n    \"pretest\": \"npm run lint\",\n    \"prebuild\": \"npm run clean\",\n    \"build\": \"babel --source-maps=both src --out-dir build\",\n    \"watch\": \"npm run build -- -w\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/enzymejs/enzyme.git\",\n    \"directory\": \"packages/enzyme-adapter-react-14\"\n  },\n  \"keywords\": [\n    \"javascript\",\n    \"shallow rendering\",\n    \"shallowRender\",\n    \"test\",\n    \"reactjs\",\n    \"react\",\n    \"flux\",\n    \"testing\",\n    \"test utils\",\n    \"assertion helpers\",\n    \"tdd\",\n    \"mocha\"\n  ],\n  \"author\": \"Jordan Harband <ljharb@gmail.com>\",\n  \"funding\": {\n    \"url\": \"https://github.com/sponsors/ljharb\"\n  },\n  \"license\": \"MIT\",\n  \"dependencies\": {\n    \"enzyme-adapter-utils\": \"^1.14.2\",\n    \"enzyme-shallow-equal\": \"^1.0.7\",\n    \"object.assign\": \"^4.1.7\",\n    \"object.values\": \"^1.2.1\",\n    \"prop-types\": \"^15.8.1\",\n    \"react-is\": \"^17.0.2\"\n  },\n  \"peerDependencies\": {\n    \"enzyme\": \"^3.0.0\",\n    \"react\": \"^0.14.0\",\n    \"react-addons-test-utils\": \"^0.14.0\",\n    \"react-dom\": \"^0.14.0\"\n  },\n  \"devDependencies\": {\n    \"@babel/cli\": \"^7.28.3\",\n    \"@babel/core\": \"^7.28.4\",\n    \"@babel/eslint-parser\": \"^7.28.4\",\n    \"babel-plugin-add-module-exports\": \"^1.0.4\",\n    \"babel-plugin-transform-replace-object-assign\": \"^2.0.0\",\n    \"babel-preset-airbnb\": \"^4.5.0\",\n    \"enzyme\": \"^3.0.0\",\n    \"eslint\": \"^8.56.0\",\n    \"eslint-config-airbnb\": \"^19.0.4\",\n    \"eslint-plugin-import\": \"^2.32.0\",\n    \"eslint-plugin-jsx-a11y\": \"^6.10.2\",\n    \"eslint-plugin-react\": \"^7.37.5\",\n    \"eslint-plugin-react-hooks\": \"^4.6.0\",\n    \"in-publish\": \"^2.0.1\",\n    \"npmignore\": \"^0.3.1\",\n    \"rimraf\": \"^2.7.1\",\n    \"safe-publish-latest\": \"^2.0.0\"\n  },\n  \"publishConfig\": {\n    \"ignore\": [\n      \"!build\"\n    ]\n  }\n}\n"
  },
  {
    "path": "packages/enzyme-adapter-react-14/src/ReactFourteenAdapter.js",
    "content": "import React from 'react';\nimport ReactDOM from 'react-dom';\n// eslint-disable-next-line import/no-unresolved, import/extensions\nimport ReactDOMServer from 'react-dom/server';\n// eslint-disable-next-line import/no-unresolved, import/extensions\nimport TestUtils from 'react-addons-test-utils';\nimport values from 'object.values';\nimport { isElement, isValidElementType } from 'react-is';\nimport { EnzymeAdapter } from 'enzyme';\nimport {\n  displayNameOfNode,\n  elementToTree,\n  mapNativeEventNames,\n  propFromEvent,\n  withSetStateAllowed,\n  assertDomAvailable,\n  createRenderWrapper,\n  createMountWrapper,\n  propsWithKeysAndRef,\n  ensureKeyOrUndefined,\n  wrap,\n  RootFinder,\n  getNodeFromRootFinder,\n  wrapWithWrappingComponent,\n  getWrappingComponentMountRenderer,\n  spyMethod,\n} from 'enzyme-adapter-utils';\nimport shallowEqual from 'enzyme-shallow-equal';\n\nfunction typeToNodeType(type) {\n  if (typeof type === 'function') {\n    if (type.prototype && typeof type.prototype.render === 'function') {\n      return 'class';\n    }\n    return 'function';\n  }\n  return 'host';\n}\n\nfunction instanceToTree(inst) {\n  if (!inst || typeof inst !== 'object') {\n    return inst;\n  }\n  const el = inst._currentElement;\n  if (!el) {\n    return null;\n  }\n  if (typeof el !== 'object') {\n    return el;\n  }\n  if (inst._tag) {\n    if (typeof el !== 'object') {\n      return el;\n    }\n    const children = inst._renderedChildren || { '.0': el.props.children };\n    return {\n      nodeType: 'host',\n      type: el.type,\n      props: el.props,\n      key: ensureKeyOrUndefined(el.key),\n      ref: el.ref,\n      instance: ReactDOM.findDOMNode(inst.getPublicInstance()) || null,\n      rendered: values(children).map(instanceToTree),\n    };\n  }\n  if (inst._renderedComponent) {\n    return {\n      nodeType: typeToNodeType(el.type),\n      type: el.type,\n      props: el.props,\n      key: ensureKeyOrUndefined(el.key),\n      ref: el.ref,\n      instance: inst._instance || null,\n      rendered: instanceToTree(inst._renderedComponent),\n    };\n  }\n  throw new Error('Enzyme Internal Error: unknown instance encountered');\n}\n\nclass ReactFourteenAdapter extends EnzymeAdapter {\n  constructor() {\n    super();\n\n    const { lifecycles } = this.options;\n    this.options = {\n      ...this.options,\n      supportPrevContextArgumentOfComponentDidUpdate: true, // TODO: remove, semver-major\n      legacyContextMode: 'parent',\n      lifecycles: {\n        ...lifecycles,\n        componentDidUpdate: {\n          prevContext: true,\n        },\n        getChildContext: {\n          calledByRenderer: true,\n        },\n      },\n    };\n  }\n\n  createMountRenderer(options) {\n    assertDomAvailable('mount');\n    const domNode = options.attachTo || global.document.createElement('div');\n    let instance = null;\n    const adapter = this;\n    return {\n      render(el, context, callback) {\n        if (instance === null) {\n          const { type, props, ref } = el;\n          const wrapperProps = {\n            Component: type,\n            wrappingComponentProps: options.wrappingComponentProps,\n            props,\n            context,\n            ...(ref && { refProp: ref }),\n          };\n          const ReactWrapperComponent = createMountWrapper(el, { ...options, adapter });\n          const wrappedEl = React.createElement(ReactWrapperComponent, wrapperProps);\n          instance = ReactDOM.render(wrappedEl, domNode);\n          if (typeof callback === 'function') {\n            callback();\n          }\n        } else {\n          instance.setChildProps(el.props, context, callback);\n        }\n      },\n      unmount() {\n        ReactDOM.unmountComponentAtNode(domNode);\n        instance = null;\n      },\n      getNode() {\n        if (!instance) {\n          return null;\n        }\n        return getNodeFromRootFinder(\n          adapter.isCustomComponent,\n          instanceToTree(instance._reactInternalInstance),\n          options,\n        );\n      },\n      simulateEvent(node, event, mock) {\n        const mappedEvent = mapNativeEventNames(event);\n        const eventFn = TestUtils.Simulate[mappedEvent];\n        if (!eventFn) {\n          throw new TypeError(`ReactWrapper::simulate() event '${event}' does not exist`);\n        }\n        // eslint-disable-next-line react/no-find-dom-node\n        eventFn(ReactDOM.findDOMNode(node.instance), mock);\n      },\n      batchedUpdates(fn) {\n        return ReactDOM.unstable_batchedUpdates(fn);\n      },\n      getWrappingComponentRenderer() {\n        return {\n          ...this,\n          ...getWrappingComponentMountRenderer({\n            toTree: (inst) => instanceToTree(inst._reactInternalInstance),\n            getMountWrapperInstance: () => instance,\n          }),\n        };\n      },\n    };\n  }\n\n  createShallowRenderer(/* options */) {\n    const renderer = TestUtils.createRenderer();\n    let isDOM = false;\n    let cachedNode = null;\n    return {\n      render(el, context) {\n        cachedNode = el;\n        /* eslint consistent-return: 0 */\n        if (typeof el.type === 'string') {\n          isDOM = true;\n        } else {\n          isDOM = false;\n\n          const inst = renderer._instance;\n          if (inst) {\n            const { restore: restoreUpdateComponent } = spyMethod(\n              inst,\n              'updateComponent',\n              (originalUpadateComponentMethod) => function updateComponent(\n                transaction,\n                prevParentElement,\n                nextParentElement,\n                prevUnmaskedContext,\n                nextUnmaskedContext,\n              ) {\n                if (prevParentElement === nextParentElement) {\n                  const { restore: restoreProcessPendingState } = spyMethod(\n                    inst,\n                    '_processPendingState',\n                    (originalProcessPendingStateMethod) => function _processPendingState(nextProps, nextContext) {\n                      if (!shallowEqual(prevUnmaskedContext, nextUnmaskedContext)) {\n                        if (inst._instance.componentWillReceiveProps) {\n                          inst._instance.componentWillReceiveProps(nextProps, nextContext);\n                        }\n                      }\n\n                      const result = originalProcessPendingStateMethod.call(inst, nextProps, nextContext);\n                      restoreProcessPendingState();\n                      return result;\n                    },\n                  );\n                }\n\n                const result = originalUpadateComponentMethod.call(\n                  inst,\n                  transaction,\n                  prevParentElement,\n                  nextParentElement,\n                  prevUnmaskedContext,\n                  nextUnmaskedContext,\n                );\n                restoreUpdateComponent();\n                return result;\n              },\n            );\n          }\n\n          return withSetStateAllowed(() => renderer.render(el, context));\n        }\n      },\n      unmount() {\n        renderer.unmount();\n      },\n      getNode() {\n        if (isDOM) {\n          return elementToTree(cachedNode);\n        }\n        const output = renderer.getRenderOutput();\n        return {\n          nodeType: typeToNodeType(cachedNode.type),\n          type: cachedNode.type,\n          props: cachedNode.props,\n          key: ensureKeyOrUndefined(cachedNode.key),\n          ref: cachedNode.ref,\n          instance: renderer._instance._instance,\n          rendered: elementToTree(output),\n        };\n      },\n      simulateEvent(node, event, ...args) {\n        const handler = node.props[propFromEvent(event)];\n        if (handler) {\n          withSetStateAllowed(() => {\n            // TODO(lmr): create/use synthetic events\n            // TODO(lmr): emulate React's event propagation\n            ReactDOM.unstable_batchedUpdates(() => {\n              handler(...args);\n            });\n          });\n        }\n      },\n      batchedUpdates(fn) {\n        return withSetStateAllowed(() => ReactDOM.unstable_batchedUpdates(fn));\n      },\n    };\n  }\n\n  createStringRenderer(options) {\n    return {\n      render(el, context) {\n        if (options.context && (el.type.contextTypes || options.childContextTypes)) {\n          const childContextTypes = {\n            ...(el.type.contextTypes || {}),\n            ...options.childContextTypes,\n          };\n          const ContextWrapper = createRenderWrapper(el, context, childContextTypes);\n          return ReactDOMServer.renderToStaticMarkup(React.createElement(ContextWrapper));\n        }\n        return ReactDOMServer.renderToStaticMarkup(el);\n      },\n    };\n  }\n\n  // Provided a bag of options, return an `EnzymeRenderer`. Some options can be implementation\n  // specific, like `attach` etc. for React, but not part of this interface explicitly.\n  // eslint-disable-next-line class-methods-use-this, no-unused-vars\n  createRenderer(options) {\n    switch (options.mode) {\n      case EnzymeAdapter.MODES.MOUNT: return this.createMountRenderer(options);\n      case EnzymeAdapter.MODES.SHALLOW: return this.createShallowRenderer(options);\n      case EnzymeAdapter.MODES.STRING: return this.createStringRenderer(options);\n      default:\n        throw new Error(`Enzyme Internal Error: Unrecognized mode: ${options.mode}`);\n    }\n  }\n\n  wrap(element) {\n    return wrap(element);\n  }\n\n  // converts an RSTNode to the corresponding JSX Pragma Element. This will be needed\n  // in order to implement the `Wrapper.mount()` and `Wrapper.shallow()` methods, but should\n  // be pretty straightforward for people to implement.\n  // eslint-disable-next-line class-methods-use-this, no-unused-vars\n  nodeToElement(node) {\n    if (!node || typeof node !== 'object') return null;\n    return React.createElement(node.type, propsWithKeysAndRef(node));\n  }\n\n  elementToNode(element) {\n    return elementToTree(element);\n  }\n\n  nodeToHostNode(node) {\n    return ReactDOM.findDOMNode(node.instance);\n  }\n\n  displayNameOfNode(node) {\n    return displayNameOfNode(node);\n  }\n\n  isValidElement(element) {\n    return isElement(element);\n  }\n\n  isValidElementType(object) {\n    return isValidElementType(object);\n  }\n\n  isCustomComponent(component) {\n    return typeof component === 'function';\n  }\n\n  createElement(...args) {\n    return React.createElement(...args);\n  }\n\n  wrapWithWrappingComponent(node, options) {\n    return {\n      RootFinder,\n      node: wrapWithWrappingComponent(React.createElement, node, options),\n    };\n  }\n}\n\nexport default ReactFourteenAdapter;\n"
  },
  {
    "path": "packages/enzyme-adapter-react-14/src/index.js",
    "content": "/* eslint global-require: 0 */\nmodule.exports = require('./ReactFourteenAdapter');\n"
  },
  {
    "path": "packages/enzyme-adapter-react-15/.babelrc",
    "content": "{\n  \"presets\": [\n    [\"airbnb\", { \"transformRuntime\": false }],\n  ],\n  \"plugins\": [\n    [\"transform-replace-object-assign\", { \"moduleSpecifier\": \"object.assign\" }],\n    [\"add-module-exports\"],\n  ],\n  \"sourceMaps\": \"both\",\n}\n"
  },
  {
    "path": "packages/enzyme-adapter-react-15/.eslintrc",
    "content": "{\n  \"extends\": \"airbnb\",\n  \"parser\": \"@babel/eslint-parser\",\n  \"root\": true,\n  \"ignorePatterns\": [\"build/\"],\n  \"rules\": {\n    \"max-len\": 0,\n    \"react/no-find-dom-node\": 0,\n    \"react/no-multi-comp\": 0,\n    \"no-underscore-dangle\": 0,\n    \"class-methods-use-this\": 0,\n    \"react/no-render-return-value\": 0, // react 15's `render` returns a value we use\n  },\n  \"settings\": {\n    \"react\": {\n      \"version\": \"15.5.0\",\n    },\n  },\n}\n"
  },
  {
    "path": "packages/enzyme-adapter-react-15/package.json",
    "content": "{\n  \"name\": \"enzyme-adapter-react-15\",\n  \"version\": \"1.4.4\",\n  \"description\": \"JavaScript Testing utilities for React\",\n  \"homepage\": \"https://enzymejs.github.io/enzyme/\",\n  \"main\": \"build\",\n  \"scripts\": {\n    \"prepack\": \"npmignore --auto --commentLines=autogenerated --gitignore=../../.gitignore && cp ../../{LICENSE,README}.md ./ && npm run build\",\n    \"prepublishOnly\": \"safe-publish-latest\",\n    \"prepublish\": \"not-in-publish || npm run prepublishOnly\",\n    \"clean\": \"rimraf build\",\n    \"lint\": \"eslint --ext js,jsx .\",\n    \"pretest\": \"npm run lint\",\n    \"prebuild\": \"npm run clean\",\n    \"build\": \"babel --source-maps=both src --out-dir build\",\n    \"watch\": \"npm run build -- -w\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/enzymejs/enzyme.git\",\n    \"directory\": \"packages/enzyme-adapter-react-15\"\n  },\n  \"keywords\": [\n    \"javascript\",\n    \"shallow rendering\",\n    \"shallowRender\",\n    \"test\",\n    \"reactjs\",\n    \"react\",\n    \"flux\",\n    \"testing\",\n    \"test utils\",\n    \"assertion helpers\",\n    \"tdd\",\n    \"mocha\"\n  ],\n  \"author\": \"Jordan Harband <ljharb@gmail.com>\",\n  \"funding\": {\n    \"url\": \"https://github.com/sponsors/ljharb\"\n  },\n  \"license\": \"MIT\",\n  \"dependencies\": {\n    \"enzyme-adapter-utils\": \"^1.14.2\",\n    \"object.assign\": \"^4.1.7\",\n    \"object.values\": \"^1.2.1\",\n    \"prop-types\": \"^15.8.1\",\n    \"react-is\": \"^17.0.2\"\n  },\n  \"peerDependencies\": {\n    \"enzyme\": \"^3.0.0\",\n    \"react\": \"^15.5.0\",\n    \"react-dom\": \"^15.5.0\",\n    \"react-test-renderer\": \"^15.5.0\"\n  },\n  \"devDependencies\": {\n    \"@babel/cli\": \"^7.28.3\",\n    \"@babel/core\": \"^7.28.4\",\n    \"@babel/eslint-parser\": \"^7.28.4\",\n    \"babel-plugin-add-module-exports\": \"^1.0.4\",\n    \"babel-plugin-transform-replace-object-assign\": \"^2.0.0\",\n    \"babel-preset-airbnb\": \"^4.5.0\",\n    \"enzyme\": \"^3.0.0\",\n    \"eslint\": \"^8.56.0\",\n    \"eslint-config-airbnb\": \"^19.0.4\",\n    \"eslint-plugin-import\": \"^2.32.0\",\n    \"eslint-plugin-jsx-a11y\": \"^6.10.2\",\n    \"eslint-plugin-react\": \"^7.37.5\",\n    \"eslint-plugin-react-hooks\": \"^4.6.0\",\n    \"in-publish\": \"^2.0.1\",\n    \"npmignore\": \"^0.3.1\",\n    \"rimraf\": \"^2.7.1\",\n    \"safe-publish-latest\": \"^2.0.0\"\n  },\n  \"publishConfig\": {\n    \"ignore\": [\n      \"!build\"\n    ]\n  }\n}\n"
  },
  {
    "path": "packages/enzyme-adapter-react-15/src/ReactFifteenAdapter.js",
    "content": "import React from 'react';\nimport ReactDOM from 'react-dom';\n// eslint-disable-next-line import/no-unresolved, import/extensions\nimport ReactDOMServer from 'react-dom/server';\n// eslint-disable-next-line import/no-unresolved, import/extensions\nimport TestUtils from 'react-dom/test-utils';\n// eslint-disable-next-line import/no-unresolved, import/extensions\nimport ShallowRenderer from 'react-test-renderer/shallow';\nimport values from 'object.values';\nimport { isElement, isValidElementType } from 'react-is';\nimport { EnzymeAdapter } from 'enzyme';\nimport {\n  displayNameOfNode,\n  elementToTree,\n  mapNativeEventNames,\n  propFromEvent,\n  withSetStateAllowed,\n  assertDomAvailable,\n  createRenderWrapper,\n  createMountWrapper,\n  propsWithKeysAndRef,\n  ensureKeyOrUndefined,\n  wrap,\n  RootFinder,\n  getNodeFromRootFinder,\n  wrapWithWrappingComponent,\n  getWrappingComponentMountRenderer,\n} from 'enzyme-adapter-utils';\n\nfunction compositeTypeToNodeType(type) {\n  switch (type) {\n    case 0:\n    case 1: return 'class';\n    case 2: return 'function';\n    default:\n      throw new Error(`Enzyme Internal Error: unknown composite type ${type}`);\n  }\n}\nfunction childrenFromInst(inst, el) {\n  if (inst._renderedChildren) {\n    return values(inst._renderedChildren);\n  }\n  if (el.props) {\n    return values({ '.0': el.props.children });\n  }\n  return [];\n}\n\nfunction nodeType(inst) {\n  if (inst._compositeType != null) {\n    return compositeTypeToNodeType(inst._compositeType);\n  }\n  return 'host';\n}\n\nfunction instanceToTree(inst) {\n  if (!inst || typeof inst !== 'object') {\n    return inst;\n  }\n  const el = inst._currentElement;\n  if (el == null || el === false) {\n    return null;\n  }\n  if (typeof el !== 'object') {\n    return el;\n  }\n  if (inst._renderedChildren) {\n    return {\n      nodeType: nodeType(inst),\n      type: el.type,\n      props: el.props,\n      key: ensureKeyOrUndefined(el.key),\n      ref: el.ref,\n      instance: inst._instance || inst._hostNode || null,\n      rendered: values(inst._renderedChildren).map(instanceToTree),\n    };\n  }\n  if (inst._hostNode) {\n    return {\n      nodeType: 'host',\n      type: el.type,\n      props: el.props,\n      key: ensureKeyOrUndefined(el.key),\n      ref: el.ref,\n      instance: inst._instance || inst._hostNode || null,\n      rendered: childrenFromInst(inst, el).map(instanceToTree),\n    };\n  }\n  if (inst._renderedComponent) {\n    return {\n      nodeType: nodeType(inst),\n      type: el.type,\n      props: el.props,\n      key: ensureKeyOrUndefined(el.key),\n      ref: el.ref,\n      instance: inst._instance || inst._hostNode || null,\n      rendered: instanceToTree(inst._renderedComponent),\n    };\n  }\n  return {\n    nodeType: nodeType(inst),\n    type: el.type,\n    props: el.props,\n    key: ensureKeyOrUndefined(el.key),\n    ref: el.ref,\n    instance: inst._instance || null,\n    rendered: childrenFromInst(inst, el).map(instanceToTree),\n  };\n}\n\nconst eventOptions = { animation: true };\n\nclass ReactFifteenAdapter extends EnzymeAdapter {\n  constructor() {\n    super();\n\n    const { lifecycles } = this.options;\n    this.options = {\n      ...this.options,\n      supportPrevContextArgumentOfComponentDidUpdate: true, // TODO: remove, semver-major\n      legacyContextMode: 'parent',\n      lifecycles: {\n        ...lifecycles,\n        componentDidUpdate: {\n          prevContext: true,\n        },\n        getChildContext: {\n          calledByRenderer: true,\n        },\n      },\n    };\n  }\n\n  createMountRenderer(options) {\n    assertDomAvailable('mount');\n    const domNode = options.attachTo || global.document.createElement('div');\n    let instance = null;\n    const adapter = this;\n    return {\n      render(el, context, callback) {\n        if (instance === null) {\n          const { type, props, ref } = el;\n          const wrapperProps = {\n            Component: type,\n            wrappingComponentProps: options.wrappingComponentProps,\n            props,\n            context,\n            ...(ref && { refProp: ref }),\n          };\n          const ReactWrapperComponent = createMountWrapper(el, { ...options, adapter });\n          const wrappedEl = React.createElement(ReactWrapperComponent, wrapperProps);\n          instance = ReactDOM.render(wrappedEl, domNode);\n          if (typeof callback === 'function') {\n            callback();\n          }\n        } else {\n          instance.setChildProps(el.props, context, callback);\n        }\n      },\n      unmount() {\n        ReactDOM.unmountComponentAtNode(domNode);\n        instance = null;\n      },\n      getNode() {\n        if (!instance) {\n          return null;\n        }\n        return getNodeFromRootFinder(\n          adapter.isCustomComponent,\n          instanceToTree(instance._reactInternalInstance),\n          options,\n        );\n      },\n      simulateEvent(node, event, mock) {\n        const mappedEvent = mapNativeEventNames(event, eventOptions);\n        const eventFn = TestUtils.Simulate[mappedEvent];\n        if (!eventFn) {\n          throw new TypeError(`ReactWrapper::simulate() event '${event}' does not exist`);\n        }\n        // eslint-disable-next-line react/no-find-dom-node\n        eventFn(ReactDOM.findDOMNode(node.instance), mock);\n      },\n      batchedUpdates(fn) {\n        return ReactDOM.unstable_batchedUpdates(fn);\n      },\n      getWrappingComponentRenderer() {\n        return {\n          ...this,\n          ...getWrappingComponentMountRenderer({\n            toTree: (inst) => instanceToTree(inst._reactInternalInstance),\n            getMountWrapperInstance: () => instance,\n          }),\n        };\n      },\n    };\n  }\n\n  createShallowRenderer(/* options */) {\n    const renderer = new ShallowRenderer();\n    let isDOM = false;\n    let cachedNode = null;\n    return {\n      render(el, context) {\n        cachedNode = el;\n        /* eslint consistent-return: 0 */\n        if (typeof el.type === 'string') {\n          isDOM = true;\n        } else {\n          isDOM = false;\n          return withSetStateAllowed(() => renderer.render(el, context));\n        }\n      },\n      unmount() {\n        renderer.unmount();\n      },\n      getNode() {\n        if (isDOM) {\n          return elementToTree(cachedNode);\n        }\n        const output = renderer.getRenderOutput();\n\n        const internalInstance = renderer._instance;\n        return {\n          nodeType: compositeTypeToNodeType(internalInstance._compositeType),\n          type: cachedNode.type,\n          props: cachedNode.props,\n          key: ensureKeyOrUndefined(cachedNode.key),\n          ref: cachedNode.ref,\n          instance: internalInstance._instance,\n          rendered: elementToTree(output),\n        };\n      },\n      simulateEvent(node, event, ...args) {\n        const handler = node.props[propFromEvent(event, eventOptions)];\n        if (handler) {\n          withSetStateAllowed(() => {\n            // TODO(lmr): create/use synthetic events\n            // TODO(lmr): emulate React's event propagation\n            renderer.unstable_batchedUpdates(() => {\n              handler(...args);\n            });\n          });\n        }\n      },\n      batchedUpdates(fn) {\n        return withSetStateAllowed(() => renderer.unstable_batchedUpdates(fn));\n      },\n    };\n  }\n\n  createStringRenderer(options) {\n    return {\n      render(el, context) {\n        if (options.context && (el.type.contextTypes || options.childContextTypes)) {\n          const childContextTypes = {\n            ...(el.type.contextTypes || {}),\n            ...options.childContextTypes,\n          };\n          const ContextWrapper = createRenderWrapper(el, context, childContextTypes);\n          return ReactDOMServer.renderToStaticMarkup(React.createElement(ContextWrapper));\n        }\n        return ReactDOMServer.renderToStaticMarkup(el);\n      },\n    };\n  }\n\n  // Provided a bag of options, return an `EnzymeRenderer`. Some options can be implementation\n  // specific, like `attach` etc. for React, but not part of this interface explicitly.\n  // eslint-disable-next-line class-methods-use-this, no-unused-vars\n  createRenderer(options) {\n    switch (options.mode) {\n      case EnzymeAdapter.MODES.MOUNT: return this.createMountRenderer(options);\n      case EnzymeAdapter.MODES.SHALLOW: return this.createShallowRenderer(options);\n      case EnzymeAdapter.MODES.STRING: return this.createStringRenderer(options);\n      default:\n        throw new Error(`Enzyme Internal Error: Unrecognized mode: ${options.mode}`);\n    }\n  }\n\n  wrap(element) {\n    return wrap(element);\n  }\n\n  // converts an RSTNode to the corresponding JSX Pragma Element. This will be needed\n  // in order to implement the `Wrapper.mount()` and `Wrapper.shallow()` methods, but should\n  // be pretty straightforward for people to implement.\n  // eslint-disable-next-line class-methods-use-this, no-unused-vars\n  nodeToElement(node) {\n    if (!node || typeof node !== 'object') return null;\n    return React.createElement(node.type, propsWithKeysAndRef(node));\n  }\n\n  elementToNode(element) {\n    return elementToTree(element);\n  }\n\n  nodeToHostNode(node) {\n    return ReactDOM.findDOMNode(node.instance);\n  }\n\n  displayNameOfNode(node) {\n    return displayNameOfNode(node);\n  }\n\n  isValidElement(element) {\n    return isElement(element);\n  }\n\n  isValidElementType(object) {\n    return isValidElementType(object);\n  }\n\n  isCustomComponent(component) {\n    return typeof component === 'function';\n  }\n\n  createElement(...args) {\n    return React.createElement(...args);\n  }\n\n  invokeSetStateCallback(instance, callback) {\n    // React in >= 15.4, and < 16 pass undefined to a setState callback\n    callback.call(instance, undefined);\n  }\n\n  wrapWithWrappingComponent(node, options) {\n    return {\n      RootFinder,\n      node: wrapWithWrappingComponent(React.createElement, node, options),\n    };\n  }\n}\n\nexport default ReactFifteenAdapter;\n"
  },
  {
    "path": "packages/enzyme-adapter-react-15/src/index.js",
    "content": "/* eslint global-require: 0 */\nmodule.exports = require('./ReactFifteenAdapter');\n"
  },
  {
    "path": "packages/enzyme-adapter-react-15.4/.babelrc",
    "content": "{\n  \"presets\": [\n    [\"airbnb\", { \"transformRuntime\": false }],\n  ],\n  \"plugins\": [\n    [\"transform-replace-object-assign\", { \"moduleSpecifier\": \"object.assign\" }],\n    [\"add-module-exports\"],\n  ],\n  \"sourceMaps\": \"both\",\n}\n"
  },
  {
    "path": "packages/enzyme-adapter-react-15.4/.eslintrc",
    "content": "{\n  \"extends\": \"airbnb\",\n  \"parser\": \"@babel/eslint-parser\",\n  \"ignorePatterns\": [\"build/\"],\n  \"root\": true,\n  \"rules\": {\n    \"max-len\": 0,\n    \"react/no-find-dom-node\": 0,\n    \"react/no-multi-comp\": 0,\n    \"no-underscore-dangle\": 0,\n    \"class-methods-use-this\": 0,\n    \"react/no-render-return-value\": 0, // react 15's `render` returns a value we use\n  },\n  \"settings\": {\n    \"react\": {\n      \"version\": \"15.4.0\",\n    },\n  },\n}\n"
  },
  {
    "path": "packages/enzyme-adapter-react-15.4/package.json",
    "content": "{\n  \"name\": \"enzyme-adapter-react-15.4\",\n  \"version\": \"1.4.5\",\n  \"description\": \"JavaScript Testing utilities for React\",\n  \"homepage\": \"https://enzymejs.github.io/enzyme/\",\n  \"main\": \"build\",\n  \"scripts\": {\n    \"prepack\": \"npmignore --auto --commentLines=autogenerated --gitignore=../../.gitignore && cp ../../{LICENSE,README}.md ./ && npm run build\",\n    \"prepublishOnly\": \"safe-publish-latest\",\n    \"prepublish\": \"not-in-publish || npm run prepublishOnly\",\n    \"clean\": \"rimraf build\",\n    \"lint\": \"eslint --ext js,jsx .\",\n    \"pretest\": \"npm run lint\",\n    \"prebuild\": \"npm run clean\",\n    \"build\": \"babel --source-maps=both src --out-dir build\",\n    \"watch\": \"npm run build -- -w\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/enzymejs/enzyme.git\",\n    \"directory\": \"packages/enzyme-adapter-react-15.4\"\n  },\n  \"keywords\": [\n    \"javascript\",\n    \"shallow rendering\",\n    \"shallowRender\",\n    \"test\",\n    \"reactjs\",\n    \"react\",\n    \"flux\",\n    \"testing\",\n    \"test utils\",\n    \"assertion helpers\",\n    \"tdd\",\n    \"mocha\"\n  ],\n  \"author\": \"Jordan Harband <ljharb@gmail.com>\",\n  \"funding\": {\n    \"url\": \"https://github.com/sponsors/ljharb\"\n  },\n  \"license\": \"MIT\",\n  \"dependencies\": {\n    \"enzyme-adapter-react-helper\": \"^1.3.10\",\n    \"enzyme-adapter-utils\": \"^1.14.2\",\n    \"object.assign\": \"^4.1.7\",\n    \"object.values\": \"^1.2.1\",\n    \"prop-types\": \"^15.8.1\",\n    \"react-is\": \"^17.0.2\"\n  },\n  \"peerDependencies\": {\n    \"enzyme\": \"^3.0.0\",\n    \"react\": \"15.0.0-0 - 15.4.x\",\n    \"react-addons-test-utils\": \"15.0.0-0 - 15.4.x\",\n    \"react-dom\": \"15.0.0-0 - 15.4.x\"\n  },\n  \"devDependencies\": {\n    \"@babel/cli\": \"^7.28.3\",\n    \"@babel/core\": \"^7.28.4\",\n    \"@babel/eslint-parser\": \"^7.28.4\",\n    \"babel-plugin-add-module-exports\": \"^1.0.4\",\n    \"babel-plugin-transform-replace-object-assign\": \"^2.0.0\",\n    \"babel-preset-airbnb\": \"^4.5.0\",\n    \"enzyme\": \"^3.0.0\",\n    \"eslint\": \"^8.56.0\",\n    \"eslint-config-airbnb\": \"^19.0.4\",\n    \"eslint-plugin-import\": \"^2.32.0\",\n    \"eslint-plugin-jsx-a11y\": \"^6.10.2\",\n    \"eslint-plugin-react\": \"^7.37.5\",\n    \"eslint-plugin-react-hooks\": \"^4.6.0\",\n    \"in-publish\": \"^2.0.1\",\n    \"npmignore\": \"^0.3.1\",\n    \"rimraf\": \"^2.7.1\",\n    \"safe-publish-latest\": \"^2.0.0\"\n  },\n  \"publishConfig\": {\n    \"ignore\": [\n      \"!build\"\n    ]\n  }\n}\n"
  },
  {
    "path": "packages/enzyme-adapter-react-15.4/src/ReactFifteenFourAdapter.js",
    "content": "import React from 'react';\nimport ReactDOM from 'react-dom';\n// eslint-disable-next-line import/no-unresolved, import/extensions\nimport ReactDOMServer from 'react-dom/server';\n// eslint-disable-next-line import/no-unresolved, import/extensions\nimport TestUtils from 'react-addons-test-utils';\nimport values from 'object.values';\nimport { isElement, isValidElementType } from 'react-is';\nimport { EnzymeAdapter } from 'enzyme';\nimport {\n  displayNameOfNode,\n  elementToTree,\n  mapNativeEventNames,\n  propFromEvent,\n  withSetStateAllowed,\n  assertDomAvailable,\n  createRenderWrapper,\n  createMountWrapper,\n  propsWithKeysAndRef,\n  ensureKeyOrUndefined,\n  wrap,\n  RootFinder,\n  getNodeFromRootFinder,\n  wrapWithWrappingComponent,\n  getWrappingComponentMountRenderer,\n} from 'enzyme-adapter-utils';\nimport ifReact from 'enzyme-adapter-react-helper/build/ifReact';\n\nfunction compositeTypeToNodeType(type) {\n  switch (type) {\n    case 0:\n    case 1: return 'class';\n    case 2: return 'function';\n    default:\n      throw new Error(`Enzyme Internal Error: unknown composite type ${type}`);\n  }\n}\n\nfunction childrenFromInst(inst, el) {\n  if (inst._renderedChildren) {\n    return values(inst._renderedChildren);\n  }\n  if (el.props) {\n    return values({ '.0': el.props.children });\n  }\n  return [];\n}\n\nfunction nodeType(inst) {\n  if (inst._compositeType != null) {\n    return compositeTypeToNodeType(inst._compositeType);\n  }\n\n  const type = inst._instance && inst._instance.constructor;\n  if (type && type.prototype && type.prototype.isReactComponent) {\n    return 'class';\n  }\n  if (typeof type === 'function') {\n    return 'function';\n  }\n  return 'host';\n}\n\nfunction instanceToTree(inst) {\n  if (!inst || typeof inst !== 'object') {\n    return inst;\n  }\n  const el = inst._currentElement;\n  if (el == null || el === false) {\n    return null;\n  }\n  if (typeof el !== 'object') {\n    return el;\n  }\n  if (inst._renderedChildren) {\n    return {\n      nodeType: nodeType(inst),\n      type: el.type,\n      props: el.props,\n      key: ensureKeyOrUndefined(el.key),\n      ref: el.ref,\n      instance: inst._instance || inst._hostNode || null,\n      rendered: childrenFromInst(inst, el).map(instanceToTree),\n    };\n  }\n  if (inst._hostNode) {\n    return {\n      nodeType: nodeType(inst),\n      type: el.type,\n      props: el.props,\n      key: ensureKeyOrUndefined(el.key),\n      ref: el.ref,\n      instance: inst._instance || inst._hostNode || null,\n      rendered: childrenFromInst(inst, el).map(instanceToTree),\n    };\n  }\n  if (inst._renderedComponent) {\n    return {\n      nodeType: nodeType(inst),\n      type: el.type,\n      props: el.props,\n      key: ensureKeyOrUndefined(el.key),\n      ref: el.ref,\n      instance: inst._instance || inst._hostNode || null,\n      rendered: instanceToTree(inst._renderedComponent),\n    };\n  }\n  return {\n    nodeType: nodeType(inst),\n    type: el.type,\n    props: el.props,\n    key: ensureKeyOrUndefined(el.key),\n    ref: el.ref,\n    instance: inst._instance || null,\n    rendered: childrenFromInst(inst, el).map(instanceToTree),\n  };\n}\n\nfunction nodeToDOMNode(node) {\n  // TODO: investigate other primitive types\n  if (typeof node === 'string' || typeof node === 'number') {\n    return global.document.createTextNode(node);\n  }\n\n  if (node && node.nodeType === 'host') {\n    const domNode = global.document.createElement(node.type);\n\n    Object.keys(node.props).filter((x) => x !== 'children').forEach((propKey) => {\n      if (propKey === 'className') {\n        domNode.setAttribute('class', node.props[propKey]);\n      } else {\n        domNode.setAttribute(propKey, node.props[propKey]);\n      }\n    });\n\n    node.rendered.map(nodeToDOMNode).filter(Boolean).forEach((child) => {\n      domNode.appendChild(child);\n    });\n\n    return domNode;\n  }\n}\n\nconst eventOptions = { animation: true };\n\nclass ReactFifteenFourAdapter extends EnzymeAdapter {\n  constructor() {\n    super();\n\n    const { lifecycles } = this.options;\n    this.options = {\n      ...this.options,\n      supportPrevContextArgumentOfComponentDidUpdate: true, // TODO: remove, semver-major\n      legacyContextMode: 'parent',\n      lifecycles: {\n        ...lifecycles,\n        componentDidUpdate: {\n          prevContext: true,\n        },\n        getChildContext: {\n          calledByRenderer: true,\n        },\n      },\n    };\n  }\n\n  createMountRenderer(options) {\n    assertDomAvailable('mount');\n    const domNode = options.attachTo || global.document.createElement('div');\n    let instance = null;\n    const adapter = this;\n    return {\n      render(el, context, callback) {\n        if (instance === null) {\n          const { type, props, ref } = el;\n          const wrapperProps = {\n            Component: type,\n            wrappingComponentProps: options.wrappingComponentProps,\n            props,\n            context,\n            ...(ref && { refProp: ref }),\n          };\n          const ReactWrapperComponent = createMountWrapper(el, { ...options, adapter });\n          const wrappedEl = React.createElement(ReactWrapperComponent, wrapperProps);\n          instance = ReactDOM.render(wrappedEl, domNode);\n          if (typeof callback === 'function') {\n            callback();\n          }\n        } else {\n          instance.setChildProps(el.props, context, callback);\n        }\n      },\n      unmount() {\n        ReactDOM.unmountComponentAtNode(domNode);\n        instance = null;\n      },\n      getNode() {\n        if (!instance) {\n          return null;\n        }\n        return getNodeFromRootFinder(\n          adapter.isCustomComponent,\n          instanceToTree(instance._reactInternalInstance),\n          options,\n        );\n      },\n      simulateEvent(node, event, mock) {\n        const mappedEvent = mapNativeEventNames(event, eventOptions);\n        const eventFn = TestUtils.Simulate[mappedEvent];\n        if (!eventFn) {\n          throw new TypeError(`ReactWrapper::simulate() event '${event}' does not exist`);\n        }\n        // eslint-disable-next-line react/no-find-dom-node\n        eventFn(ReactDOM.findDOMNode(node.instance), mock);\n      },\n      batchedUpdates(fn) {\n        return ReactDOM.unstable_batchedUpdates(fn);\n      },\n      getWrappingComponentRenderer() {\n        return {\n          ...this,\n          ...getWrappingComponentMountRenderer({\n            toTree: (inst) => instanceToTree(inst._reactInternalInstance),\n            getMountWrapperInstance: () => instance,\n          }),\n        };\n      },\n    };\n  }\n\n  createShallowRenderer(/* options */) {\n    const renderer = TestUtils.createRenderer();\n    let isDOM = false;\n    let cachedNode = null;\n    return {\n      render(el, context) {\n        cachedNode = el;\n        /* eslint consistent-return: 0 */\n        if (typeof el.type === 'string') {\n          isDOM = true;\n        } else {\n          isDOM = false;\n          return withSetStateAllowed(() => renderer.render(el, context));\n        }\n      },\n      unmount() {\n        renderer.unmount();\n      },\n      getNode() {\n        if (isDOM) {\n          return elementToTree(cachedNode);\n        }\n        const output = renderer.getRenderOutput();\n\n        const internalInstance = renderer._instance;\n        return {\n          nodeType: nodeType(internalInstance),\n          type: cachedNode.type,\n          props: cachedNode.props,\n          key: ensureKeyOrUndefined(cachedNode.key),\n          ref: cachedNode.ref,\n          instance: internalInstance._instance,\n          rendered: elementToTree(output),\n        };\n      },\n      simulateEvent(node, event, ...args) {\n        const handler = node.props[propFromEvent(event, eventOptions)];\n        if (handler) {\n          withSetStateAllowed(() => {\n            // TODO(lmr): create/use synthetic events\n            // TODO(lmr): emulate React's event propagation\n            ReactDOM.unstable_batchedUpdates(() => {\n              handler(...args);\n            });\n          });\n        }\n      },\n      batchedUpdates(fn) {\n        return withSetStateAllowed(() => ReactDOM.unstable_batchedUpdates(fn));\n      },\n    };\n  }\n\n  createStringRenderer(options) {\n    return {\n      render(el, context) {\n        if (options.context && (el.type.contextTypes || options.childContextTypes)) {\n          const childContextTypes = {\n            ...(el.type.contextTypes || {}),\n            ...options.childContextTypes,\n          };\n          const ContextWrapper = createRenderWrapper(el, context, childContextTypes);\n          return ReactDOMServer.renderToStaticMarkup(React.createElement(ContextWrapper));\n        }\n        return ReactDOMServer.renderToStaticMarkup(el);\n      },\n    };\n  }\n\n  // Provided a bag of options, return an `EnzymeRenderer`. Some options can be implementation\n  // specific, like `attach` etc. for React, but not part of this interface explicitly.\n  // eslint-disable-next-line class-methods-use-this, no-unused-vars\n  createRenderer(options) {\n    switch (options.mode) {\n      case EnzymeAdapter.MODES.MOUNT: return this.createMountRenderer(options);\n      case EnzymeAdapter.MODES.SHALLOW: return this.createShallowRenderer(options);\n      case EnzymeAdapter.MODES.STRING: return this.createStringRenderer(options);\n      default:\n        throw new Error(`Enzyme Internal Error: Unrecognized mode: ${options.mode}`);\n    }\n  }\n\n  wrap(element) {\n    return wrap(element);\n  }\n\n  // converts an RSTNode to the corresponding JSX Pragma Element. This will be needed\n  // in order to implement the `Wrapper.mount()` and `Wrapper.shallow()` methods, but should\n  // be pretty straightforward for people to implement.\n  // eslint-disable-next-line class-methods-use-this, no-unused-vars\n  nodeToElement(node) {\n    if (!node || typeof node !== 'object') return null;\n    return React.createElement(node.type, propsWithKeysAndRef(node));\n  }\n\n  elementToNode(element) {\n    return elementToTree(element);\n  }\n\n  nodeToHostNode(node) {\n    if (!node.instance) {\n      return nodeToDOMNode(node);\n    }\n    return ReactDOM.findDOMNode(node.instance);\n  }\n\n  displayNameOfNode(node) {\n    return displayNameOfNode(node);\n  }\n\n  isValidElement(element) {\n    return isElement(element);\n  }\n\n  isValidElementType(object) {\n    return isValidElementType(object);\n  }\n\n  isCustomComponent(component) {\n    return typeof component === 'function';\n  }\n\n  createElement(...args) {\n    return React.createElement(...args);\n  }\n\n  invokeSetStateCallback(instance, callback) {\n    // React in >= 15.4, and < 16 pass undefined to a setState callback\n    const invoke = ifReact(\n      '^15.4',\n      () => { callback.call(instance, undefined); },\n      () => { super.invokeSetStateCallback(instance, callback); },\n    );\n    invoke();\n  }\n\n  wrapWithWrappingComponent(node, options) {\n    return {\n      RootFinder,\n      node: wrapWithWrappingComponent(React.createElement, node, options),\n    };\n  }\n}\n\nexport default ReactFifteenFourAdapter;\n"
  },
  {
    "path": "packages/enzyme-adapter-react-15.4/src/index.js",
    "content": "/* eslint global-require: 0 */\nmodule.exports = require('./ReactFifteenFourAdapter');\n"
  },
  {
    "path": "packages/enzyme-adapter-react-16/.babelrc",
    "content": "{\n  \"presets\": [\n    [\"airbnb\", { \"transformRuntime\": false }],\n  ],\n  \"plugins\": [\n    [\"transform-replace-object-assign\", { \"moduleSpecifier\": \"object.assign\" }],\n    [\"add-module-exports\"],\n  ],\n  \"sourceMaps\": \"both\",\n}\n"
  },
  {
    "path": "packages/enzyme-adapter-react-16/.eslintrc",
    "content": "{\n  \"extends\": \"airbnb\",\n  \"parser\": \"@babel/eslint-parser\",\n  \"root\": true,\n  \"ignorePatterns\": [\"build/\"],\n  \"rules\": {\n    \"max-classes-per-file\": 0,\n    \"max-len\": 0,\n    \"import/no-extraneous-dependencies\": 2,\n    \"import/no-unresolved\": 2,\n    \"import/extensions\": 2,\n    \"react/no-deprecated\": 0,\n    \"react/no-find-dom-node\": 0,\n    \"react/no-multi-comp\": 0,\n    \"no-underscore-dangle\": 0,\n    \"class-methods-use-this\": 0\n  },\n  \"settings\": {\n    \"react\": {\n      \"version\": \"16\",\n    },\n  },\n}\n"
  },
  {
    "path": "packages/enzyme-adapter-react-16/package.json",
    "content": "{\n  \"name\": \"enzyme-adapter-react-16\",\n  \"version\": \"1.15.8\",\n  \"description\": \"JavaScript Testing utilities for React\",\n  \"homepage\": \"https://enzymejs.github.io/enzyme/\",\n  \"main\": \"build\",\n  \"scripts\": {\n    \"prepack\": \"npmignore --auto --commentLines=autogenerated --gitignore=../../.gitignore && cp ../../{LICENSE,README}.md ./ && npm run build\",\n    \"prepublishOnly\": \"safe-publish-latest\",\n    \"prepublish\": \"not-in-publish || npm run prepublishOnly\",\n    \"clean\": \"rimraf build\",\n    \"lint\": \"eslint --ext js,jsx .\",\n    \"pretest\": \"npm run lint\",\n    \"prebuild\": \"npm run clean\",\n    \"build\": \"babel --source-maps=both src --out-dir build\",\n    \"watch\": \"npm run build -- -w\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/enzymejs/enzyme.git\",\n    \"directory\": \"packages/enzyme-adapter-react-16\"\n  },\n  \"keywords\": [\n    \"javascript\",\n    \"shallow rendering\",\n    \"shallowRender\",\n    \"test\",\n    \"reactjs\",\n    \"react\",\n    \"flux\",\n    \"testing\",\n    \"test utils\",\n    \"assertion helpers\",\n    \"tdd\",\n    \"mocha\"\n  ],\n  \"author\": \"Jordan Harband <ljharb@gmail.com>\",\n  \"funding\": {\n    \"url\": \"https://github.com/sponsors/ljharb\"\n  },\n  \"license\": \"MIT\",\n  \"dependencies\": {\n    \"enzyme-adapter-utils\": \"^1.14.2\",\n    \"enzyme-shallow-equal\": \"^1.0.7\",\n    \"hasown\": \"^2.0.2\",\n    \"object.assign\": \"^4.1.7\",\n    \"object.values\": \"^1.2.1\",\n    \"prop-types\": \"^15.8.1\",\n    \"react-is\": \"^16.13.1\",\n    \"react-test-renderer\": \"^16.0.0-0\",\n    \"semver\": \"^5.7.2\"\n  },\n  \"peerDependencies\": {\n    \"enzyme\": \"^3.0.0\",\n    \"react\": \"^16.0.0-0\",\n    \"react-dom\": \"^16.0.0-0\"\n  },\n  \"devDependencies\": {\n    \"@babel/cli\": \"^7.28.3\",\n    \"@babel/core\": \"^7.28.4\",\n    \"@babel/eslint-parser\": \"^7.28.4\",\n    \"babel-plugin-add-module-exports\": \"^1.0.4\",\n    \"babel-plugin-transform-replace-object-assign\": \"^2.0.0\",\n    \"babel-preset-airbnb\": \"^4.5.0\",\n    \"enzyme\": \"^3.0.0\",\n    \"eslint\": \"^8.56.0\",\n    \"eslint-config-airbnb\": \"^19.0.4\",\n    \"eslint-plugin-import\": \"^2.32.0\",\n    \"eslint-plugin-jsx-a11y\": \"^6.10.2\",\n    \"eslint-plugin-react\": \"^7.37.5\",\n    \"eslint-plugin-react-hooks\": \"^4.6.0\",\n    \"in-publish\": \"^2.0.1\",\n    \"npmignore\": \"^0.3.1\",\n    \"rimraf\": \"^2.7.1\",\n    \"safe-publish-latest\": \"^2.0.0\"\n  },\n  \"publishConfig\": {\n    \"ignore\": [\n      \"!build\"\n    ]\n  }\n}\n"
  },
  {
    "path": "packages/enzyme-adapter-react-16/src/ReactSixteenAdapter.js",
    "content": "/* eslint no-use-before-define: 0 */\nimport React from 'react';\nimport ReactDOM from 'react-dom';\n// eslint-disable-next-line import/no-unresolved\nimport ReactDOMServer from 'react-dom/server';\n// eslint-disable-next-line import/no-unresolved\nimport ShallowRenderer from 'react-test-renderer/shallow';\nimport { version as testRendererVersion } from 'react-test-renderer/package.json';\n// eslint-disable-next-line import/no-unresolved\nimport TestUtils from 'react-dom/test-utils';\nimport semver from 'semver';\nimport checkPropTypes from 'prop-types/checkPropTypes';\nimport hasOwn from 'hasown';\nimport {\n  AsyncMode,\n  ConcurrentMode,\n  ContextConsumer,\n  ContextProvider,\n  Element,\n  ForwardRef,\n  Fragment,\n  isContextConsumer,\n  isContextProvider,\n  isElement,\n  isForwardRef,\n  isPortal,\n  isSuspense,\n  isValidElementType,\n  Lazy,\n  Memo,\n  Portal,\n  Profiler,\n  StrictMode,\n  Suspense,\n} from 'react-is';\nimport { EnzymeAdapter } from 'enzyme';\nimport { typeOfNode } from 'enzyme/build/Utils';\nimport shallowEqual from 'enzyme-shallow-equal';\nimport {\n  displayNameOfNode,\n  elementToTree as utilElementToTree,\n  nodeTypeFromType as utilNodeTypeFromType,\n  mapNativeEventNames,\n  propFromEvent,\n  assertDomAvailable,\n  withSetStateAllowed,\n  createRenderWrapper,\n  createMountWrapper,\n  propsWithKeysAndRef,\n  ensureKeyOrUndefined,\n  simulateError,\n  wrap,\n  getMaskedContext,\n  getComponentStack,\n  RootFinder,\n  getNodeFromRootFinder,\n  wrapWithWrappingComponent,\n  getWrappingComponentMountRenderer,\n  compareNodeTypeOf,\n  spyMethod,\n} from 'enzyme-adapter-utils';\nimport findCurrentFiberUsingSlowPath from './findCurrentFiberUsingSlowPath';\nimport detectFiberTags from './detectFiberTags';\n\nconst is164 = !!TestUtils.Simulate.touchStart; // 16.4+\nconst is165 = !!TestUtils.Simulate.auxClick; // 16.5+\nconst is166 = is165 && !React.unstable_AsyncMode; // 16.6+\nconst is168 = is166 && typeof TestUtils.act === 'function';\n\nconst hasShouldComponentUpdateBug = semver.satisfies(testRendererVersion, '< 16.8');\n\n// Lazily populated if DOM is available.\nlet FiberTags = null;\n\nfunction nodeAndSiblingsArray(nodeWithSibling) {\n  const array = [];\n  let node = nodeWithSibling;\n  while (node != null) {\n    array.push(node);\n    node = node.sibling;\n  }\n  return array;\n}\n\nfunction flatten(arr) {\n  const result = [];\n  const stack = [{ i: 0, array: arr }];\n  while (stack.length) {\n    const n = stack.pop();\n    while (n.i < n.array.length) {\n      const el = n.array[n.i];\n      n.i += 1;\n      if (Array.isArray(el)) {\n        stack.push(n);\n        stack.push({ i: 0, array: el });\n        break;\n      }\n      result.push(el);\n    }\n  }\n  return result;\n}\n\nfunction nodeTypeFromType(type) {\n  if (type === Portal) {\n    return 'portal';\n  }\n\n  return utilNodeTypeFromType(type);\n}\n\nfunction isMemo(type) {\n  return compareNodeTypeOf(type, Memo);\n}\n\nfunction isLazy(type) {\n  return compareNodeTypeOf(type, Lazy);\n}\n\nfunction unmemoType(type) {\n  return isMemo(type) ? type.type : type;\n}\n\nfunction transformSuspense(renderedEl, prerenderEl, { suspenseFallback }) {\n  if (!isSuspense(renderedEl)) {\n    return renderedEl;\n  }\n\n  let { children } = renderedEl.props;\n\n  if (suspenseFallback) {\n    const { fallback } = renderedEl.props;\n    children = replaceLazyWithFallback(children, fallback);\n  }\n\n  const {\n    propTypes,\n    defaultProps,\n    contextTypes,\n    contextType,\n    childContextTypes,\n  } = renderedEl.type;\n\n  const FakeSuspense = Object.assign(\n    isStateful(prerenderEl.type)\n      ? class FakeSuspense extends prerenderEl.type {\n        render() {\n          const { type, props } = prerenderEl;\n          return React.createElement(\n            type,\n            { ...props, ...this.props },\n            children,\n          );\n        }\n      }\n      : function FakeSuspense(props) { // eslint-disable-line prefer-arrow-callback\n        return React.createElement(\n          renderedEl.type,\n          { ...renderedEl.props, ...props },\n          children,\n        );\n      },\n    {\n      propTypes,\n      defaultProps,\n      contextTypes,\n      contextType,\n      childContextTypes,\n    },\n  );\n  return React.createElement(FakeSuspense, null, children);\n}\n\nfunction elementToTree(el) {\n  if (!isPortal(el)) {\n    return utilElementToTree(el, elementToTree);\n  }\n\n  const { children, containerInfo } = el;\n  const props = { children, containerInfo };\n\n  return {\n    nodeType: 'portal',\n    type: Portal,\n    props,\n    key: ensureKeyOrUndefined(el.key),\n    ref: el.ref || null,\n    instance: null,\n    rendered: elementToTree(el.children),\n  };\n}\n\nfunction toTree(vnode) {\n  if (vnode == null) {\n    return null;\n  }\n  // TODO(lmr): I'm not really sure I understand whether or not this is what\n  // i should be doing, or if this is a hack for something i'm doing wrong\n  // somewhere else. Should talk to sebastian about this perhaps\n  const node = findCurrentFiberUsingSlowPath(vnode);\n  switch (node.tag) {\n    case FiberTags.HostRoot:\n      return childrenToTree(node.child);\n    case FiberTags.HostPortal: {\n      const {\n        stateNode: { containerInfo },\n        memoizedProps: children,\n      } = node;\n      const props = { containerInfo, children };\n      return {\n        nodeType: 'portal',\n        type: Portal,\n        props,\n        key: ensureKeyOrUndefined(node.key),\n        ref: node.ref,\n        instance: null,\n        rendered: childrenToTree(node.child),\n      };\n    }\n    case FiberTags.ClassComponent:\n      return {\n        nodeType: 'class',\n        type: node.type,\n        props: { ...node.memoizedProps },\n        key: ensureKeyOrUndefined(node.key),\n        ref: node.ref,\n        instance: node.stateNode,\n        rendered: childrenToTree(node.child),\n      };\n    case FiberTags.FunctionalComponent:\n      return {\n        nodeType: 'function',\n        type: node.type,\n        props: { ...node.memoizedProps },\n        key: ensureKeyOrUndefined(node.key),\n        ref: node.ref,\n        instance: null,\n        rendered: childrenToTree(node.child),\n      };\n    case FiberTags.MemoClass:\n      return {\n        nodeType: 'class',\n        type: node.elementType.type,\n        props: { ...node.memoizedProps },\n        key: ensureKeyOrUndefined(node.key),\n        ref: node.ref,\n        instance: node.stateNode,\n        rendered: childrenToTree(node.child.child),\n      };\n    case FiberTags.MemoSFC: {\n      let renderedNodes = flatten(nodeAndSiblingsArray(node.child).map(toTree));\n      if (renderedNodes.length === 0) {\n        renderedNodes = childrenToTree(node.memoizedProps.children);\n      }\n      return {\n        nodeType: 'function',\n        type: node.elementType,\n        props: { ...node.memoizedProps },\n        key: ensureKeyOrUndefined(node.key),\n        ref: node.ref,\n        instance: null,\n        rendered: renderedNodes,\n      };\n    }\n    case FiberTags.HostComponent: {\n      let renderedNodes = flatten(nodeAndSiblingsArray(node.child).map(toTree));\n      if (renderedNodes.length === 0) {\n        renderedNodes = [node.memoizedProps.children];\n      }\n      return {\n        nodeType: 'host',\n        type: node.type,\n        props: { ...node.memoizedProps },\n        key: ensureKeyOrUndefined(node.key),\n        ref: node.ref,\n        instance: node.stateNode,\n        rendered: renderedNodes,\n      };\n    }\n    case FiberTags.HostText:\n      return node.memoizedProps;\n    case FiberTags.Fragment:\n    case FiberTags.Mode:\n    case FiberTags.ContextProvider:\n    case FiberTags.ContextConsumer:\n      return childrenToTree(node.child);\n    case FiberTags.Profiler:\n    case FiberTags.ForwardRef: {\n      return {\n        nodeType: 'function',\n        type: node.type,\n        props: { ...node.pendingProps },\n        key: ensureKeyOrUndefined(node.key),\n        ref: node.ref,\n        instance: null,\n        rendered: childrenToTree(node.child),\n      };\n    }\n    case FiberTags.Suspense: {\n      return {\n        nodeType: 'function',\n        type: Suspense,\n        props: { ...node.memoizedProps },\n        key: ensureKeyOrUndefined(node.key),\n        ref: node.ref,\n        instance: null,\n        rendered: childrenToTree(node.child),\n      };\n    }\n    case FiberTags.Lazy:\n      return childrenToTree(node.child);\n    default:\n      throw new Error(`Enzyme Internal Error: unknown node with tag ${node.tag}`);\n  }\n}\n\nfunction childrenToTree(node) {\n  if (!node) {\n    return null;\n  }\n  const children = nodeAndSiblingsArray(node);\n  if (children.length === 0) {\n    return null;\n  }\n  if (children.length === 1) {\n    return toTree(children[0]);\n  }\n  return flatten(children.map(toTree));\n}\n\nfunction nodeToHostNode(_node) {\n  // NOTE(lmr): node could be a function component\n  // which wont have an instance prop, but we can get the\n  // host node associated with its return value at that point.\n  // Although this breaks down if the return value is an array,\n  // as is possible with React 16.\n  let node = _node;\n  while (node && !Array.isArray(node) && node.instance === null) {\n    node = node.rendered;\n  }\n  // if the SFC returned null effectively, there is no host node.\n  if (!node) {\n    return null;\n  }\n\n  const mapper = (item) => {\n    if (item && item.instance) return ReactDOM.findDOMNode(item.instance);\n    return null;\n  };\n  if (Array.isArray(node)) {\n    return node.map(mapper);\n  }\n  if (Array.isArray(node.rendered) && node.nodeType === 'class') {\n    return node.rendered.map(mapper);\n  }\n  return mapper(node);\n}\n\nfunction replaceLazyWithFallback(node, fallback) {\n  if (!node) {\n    return null;\n  }\n  if (Array.isArray(node)) {\n    return node.map((el) => replaceLazyWithFallback(el, fallback));\n  }\n  if (isLazy(node.type)) {\n    return fallback;\n  }\n  return {\n    ...node,\n    props: {\n      ...node.props,\n      children: replaceLazyWithFallback(node.props.children, fallback),\n    },\n  };\n}\n\nconst eventOptions = {\n  animation: true,\n  pointerEvents: is164,\n  auxClick: is165,\n};\n\nfunction getEmptyStateValue() {\n  // this handles a bug in React 16.0 - 16.2\n  // see https://github.com/facebook/react/commit/39be83565c65f9c522150e52375167568a2a1459\n  // also see https://github.com/facebook/react/pull/11965\n\n  // eslint-disable-next-line react/prefer-stateless-function\n  class EmptyState extends React.Component {\n    render() {\n      return null;\n    }\n  }\n  const testRenderer = new ShallowRenderer();\n  testRenderer.render(React.createElement(EmptyState));\n  return testRenderer._instance.state;\n}\n\nfunction wrapAct(fn) {\n  if (!is168) {\n    return fn();\n  }\n  let returnVal;\n  TestUtils.act(() => { returnVal = fn(); });\n  return returnVal;\n}\n\nfunction getProviderDefaultValue(Provider) {\n  // React stores references to the Provider's defaultValue differently across versions.\n  if ('_defaultValue' in Provider._context) {\n    return Provider._context._defaultValue;\n  }\n  if ('_currentValue' in Provider._context) {\n    return Provider._context._currentValue;\n  }\n  throw new Error('Enzyme Internal Error: can’t figure out how to get Provider’s default value');\n}\n\nfunction makeFakeElement(type) {\n  return { $$typeof: Element, type };\n}\n\nfunction isStateful(Component) {\n  return Component.prototype && (\n    Component.prototype.isReactComponent\n    || Array.isArray(Component.__reactAutoBindPairs) // fallback for createClass components\n  );\n}\n\nclass ReactSixteenAdapter extends EnzymeAdapter {\n  constructor() {\n    super();\n    const { lifecycles } = this.options;\n    this.options = {\n      ...this.options,\n      enableComponentDidUpdateOnSetState: true, // TODO: remove, semver-major\n      legacyContextMode: 'parent',\n      lifecycles: {\n        ...lifecycles,\n        componentDidUpdate: {\n          onSetState: true,\n        },\n        getDerivedStateFromProps: {\n          hasShouldComponentUpdateBug,\n        },\n        getSnapshotBeforeUpdate: true,\n        setState: {\n          skipsComponentDidUpdateOnNullish: true,\n        },\n        getChildContext: {\n          calledByRenderer: false,\n        },\n        getDerivedStateFromError: is166,\n      },\n    };\n  }\n\n  createMountRenderer(options) {\n    assertDomAvailable('mount');\n    if (hasOwn(options, 'suspenseFallback')) {\n      throw new TypeError('`suspenseFallback` is not supported by the `mount` renderer');\n    }\n    if (FiberTags === null) {\n      // Requires DOM.\n      FiberTags = detectFiberTags();\n    }\n    const { attachTo, hydrateIn, wrappingComponentProps } = options;\n    const domNode = hydrateIn || attachTo || global.document.createElement('div');\n    let instance = null;\n    const adapter = this;\n    return {\n      render(el, context, callback) {\n        return wrapAct(() => {\n          if (instance === null) {\n            const { type, props, ref } = el;\n            const wrapperProps = {\n              Component: type,\n              props,\n              wrappingComponentProps,\n              context,\n              ...(ref && { refProp: ref }),\n            };\n            const ReactWrapperComponent = createMountWrapper(el, { ...options, adapter });\n            const wrappedEl = React.createElement(ReactWrapperComponent, wrapperProps);\n            instance = hydrateIn\n              ? ReactDOM.hydrate(wrappedEl, domNode)\n              : ReactDOM.render(wrappedEl, domNode);\n            if (typeof callback === 'function') {\n              callback();\n            }\n          } else {\n            instance.setChildProps(el.props, context, callback);\n          }\n        });\n      },\n      unmount() {\n        ReactDOM.unmountComponentAtNode(domNode);\n        instance = null;\n      },\n      getNode() {\n        if (!instance) {\n          return null;\n        }\n        return getNodeFromRootFinder(\n          adapter.isCustomComponent,\n          toTree(instance._reactInternalFiber),\n          options,\n        );\n      },\n      simulateError(nodeHierarchy, rootNode, error) {\n        const isErrorBoundary = ({ instance: elInstance, type }) => {\n          if (is166 && type && type.getDerivedStateFromError) {\n            return true;\n          }\n          return elInstance && elInstance.componentDidCatch;\n        };\n\n        const {\n          instance: catchingInstance,\n          type: catchingType,\n        } = nodeHierarchy.find(isErrorBoundary) || {};\n\n        simulateError(\n          error,\n          catchingInstance,\n          rootNode,\n          nodeHierarchy,\n          nodeTypeFromType,\n          adapter.displayNameOfNode.bind(adapter),\n          is166 ? catchingType : undefined,\n        );\n      },\n      simulateEvent(node, event, mock) {\n        const mappedEvent = mapNativeEventNames(event, eventOptions);\n        const eventFn = TestUtils.Simulate[mappedEvent];\n        if (!eventFn) {\n          throw new TypeError(`ReactWrapper::simulate() event '${event}' does not exist`);\n        }\n        wrapAct(() => {\n          eventFn(adapter.nodeToHostNode(node), mock);\n        });\n      },\n      batchedUpdates(fn) {\n        return fn();\n        // return ReactDOM.unstable_batchedUpdates(fn);\n      },\n      getWrappingComponentRenderer() {\n        return {\n          ...this,\n          ...getWrappingComponentMountRenderer({\n            toTree: (inst) => toTree(inst._reactInternalFiber),\n            getMountWrapperInstance: () => instance,\n          }),\n        };\n      },\n      ...(is168 && { wrapInvoke: wrapAct }),\n    };\n  }\n\n  createShallowRenderer(options = {}) {\n    const adapter = this;\n    const renderer = new ShallowRenderer();\n    const { suspenseFallback } = options;\n    if (typeof suspenseFallback !== 'undefined' && typeof suspenseFallback !== 'boolean') {\n      throw TypeError('`options.suspenseFallback` should be boolean or undefined');\n    }\n    let isDOM = false;\n    let cachedNode = null;\n\n    let lastComponent = null;\n    let wrappedComponent = null;\n    const sentinel = {};\n\n    // wrap memo components with a PureComponent, or a class component with sCU\n    const wrapPureComponent = (Component, compare) => {\n      if (!is166) {\n        throw new RangeError('this function should not be called in React < 16.6. Please report this!');\n      }\n      if (lastComponent !== Component) {\n        if (isStateful(Component)) {\n          wrappedComponent = class extends Component {}; // eslint-disable-line react/prefer-stateless-function\n          if (compare) {\n            wrappedComponent.prototype.shouldComponentUpdate = (nextProps) => !compare(this.props, nextProps);\n          } else {\n            wrappedComponent.prototype.isPureReactComponent = true;\n          }\n        } else {\n          let memoized = sentinel;\n          let prevProps;\n          wrappedComponent = function (props, ...args) {\n            const shouldUpdate = memoized === sentinel || (compare\n              ? !compare(prevProps, props)\n              : !shallowEqual(prevProps, props)\n            );\n            if (shouldUpdate) {\n              memoized = Component({ ...Component.defaultProps, ...props }, ...args);\n              prevProps = props;\n            }\n            return memoized;\n          };\n        }\n        Object.assign(\n          wrappedComponent,\n          Component,\n          { displayName: adapter.displayNameOfNode({ type: Component }) },\n        );\n        lastComponent = Component;\n      }\n      return wrappedComponent;\n    };\n\n    // Wrap functional components on versions prior to 16.5,\n    // to avoid inadvertently pass a `this` instance to it.\n    const wrapFunctionalComponent = (Component) => {\n      if (is166 && hasOwn(Component, 'defaultProps')) {\n        if (lastComponent !== Component) {\n          wrappedComponent = Object.assign(\n            // eslint-disable-next-line new-cap\n            (props, ...args) => Component({ ...Component.defaultProps, ...props }, ...args),\n            Component,\n            { displayName: adapter.displayNameOfNode({ type: Component }) },\n          );\n          lastComponent = Component;\n        }\n        return wrappedComponent;\n      }\n      if (is165) {\n        return Component;\n      }\n\n      if (lastComponent !== Component) {\n        wrappedComponent = Object.assign(\n          (...args) => Component(...args), // eslint-disable-line new-cap\n          Component,\n        );\n        lastComponent = Component;\n      }\n      return wrappedComponent;\n    };\n\n    const renderElement = (elConfig, ...rest) => {\n      const renderedEl = renderer.render(elConfig, ...rest);\n\n      const typeIsExisted = !!(renderedEl && renderedEl.type);\n      if (is166 && typeIsExisted) {\n        const clonedEl = transformSuspense(renderedEl, elConfig, { suspenseFallback });\n\n        const elementIsChanged = clonedEl.type !== renderedEl.type;\n        if (elementIsChanged) {\n          return renderer.render({ ...elConfig, type: clonedEl.type }, ...rest);\n        }\n      }\n\n      return renderedEl;\n    };\n\n    return {\n      render(el, unmaskedContext, {\n        providerValues = new Map(),\n      } = {}) {\n        cachedNode = el;\n        /* eslint consistent-return: 0 */\n        if (typeof el.type === 'string') {\n          isDOM = true;\n        } else if (isContextProvider(el)) {\n          providerValues.set(el.type, el.props.value);\n          const MockProvider = Object.assign(\n            (props) => props.children,\n            el.type,\n          );\n          return withSetStateAllowed(() => renderElement({ ...el, type: MockProvider }));\n        } else if (isContextConsumer(el)) {\n          const Provider = adapter.getProviderFromConsumer(el.type);\n          const value = providerValues.has(Provider)\n            ? providerValues.get(Provider)\n            : getProviderDefaultValue(Provider);\n          const MockConsumer = Object.assign(\n            (props) => props.children(value),\n            el.type,\n          );\n          return withSetStateAllowed(() => renderElement({ ...el, type: MockConsumer }));\n        } else {\n          isDOM = false;\n          let renderedEl = el;\n          if (isLazy(renderedEl)) {\n            throw TypeError('`React.lazy` is not supported by shallow rendering.');\n          }\n\n          renderedEl = transformSuspense(renderedEl, renderedEl, { suspenseFallback });\n          const { type: Component } = renderedEl;\n\n          const context = getMaskedContext(Component.contextTypes, unmaskedContext);\n\n          if (isMemo(el.type)) {\n            const { type: InnerComp, compare } = el.type;\n\n            return withSetStateAllowed(() => renderElement(\n              { ...el, type: wrapPureComponent(InnerComp, compare) },\n              context,\n            ));\n          }\n\n          const isComponentStateful = isStateful(Component);\n\n          if (!isComponentStateful && typeof Component === 'function') {\n            return withSetStateAllowed(() => renderElement(\n              { ...renderedEl, type: wrapFunctionalComponent(Component) },\n              context,\n            ));\n          }\n\n          if (isComponentStateful) {\n            if (\n              renderer._instance\n              && el.props === renderer._instance.props\n              && !shallowEqual(context, renderer._instance.context)\n            ) {\n              const { restore } = spyMethod(\n                renderer,\n                '_updateClassComponent',\n                (originalMethod) => function _updateClassComponent(...args) {\n                  const { props } = renderer._instance;\n                  const clonedProps = { ...props };\n                  renderer._instance.props = clonedProps;\n\n                  const result = originalMethod.apply(renderer, args);\n\n                  renderer._instance.props = props;\n                  restore();\n\n                  return result;\n                },\n              );\n            }\n\n            // fix react bug; see implementation of `getEmptyStateValue`\n            const emptyStateValue = getEmptyStateValue();\n            if (emptyStateValue) {\n              Object.defineProperty(Component.prototype, 'state', {\n                configurable: true,\n                enumerable: true,\n                get() {\n                  return null;\n                },\n                set(value) {\n                  if (value !== emptyStateValue) {\n                    Object.defineProperty(this, 'state', {\n                      configurable: true,\n                      enumerable: true,\n                      value,\n                      writable: true,\n                    });\n                  }\n                },\n              });\n            }\n          }\n          return withSetStateAllowed(() => renderElement(renderedEl, context));\n        }\n      },\n      unmount() {\n        renderer.unmount();\n      },\n      getNode() {\n        if (isDOM) {\n          return elementToTree(cachedNode);\n        }\n        const output = renderer.getRenderOutput();\n        return {\n          nodeType: nodeTypeFromType(cachedNode.type),\n          type: cachedNode.type,\n          props: cachedNode.props,\n          key: ensureKeyOrUndefined(cachedNode.key),\n          ref: cachedNode.ref,\n          instance: renderer._instance,\n          rendered: Array.isArray(output)\n            ? flatten(output).map((el) => elementToTree(el))\n            : elementToTree(output),\n        };\n      },\n      simulateError(nodeHierarchy, rootNode, error) {\n        simulateError(\n          error,\n          renderer._instance,\n          cachedNode,\n          nodeHierarchy.concat(cachedNode),\n          nodeTypeFromType,\n          adapter.displayNameOfNode.bind(adapter),\n          is166 ? cachedNode.type : undefined,\n        );\n      },\n      simulateEvent(node, event, ...args) {\n        const handler = node.props[propFromEvent(event, eventOptions)];\n        if (handler) {\n          withSetStateAllowed(() => {\n            // TODO(lmr): create/use synthetic events\n            // TODO(lmr): emulate React's event propagation\n            // ReactDOM.unstable_batchedUpdates(() => {\n            handler(...args);\n            // });\n          });\n        }\n      },\n      batchedUpdates(fn) {\n        return fn();\n        // return ReactDOM.unstable_batchedUpdates(fn);\n      },\n      checkPropTypes(typeSpecs, values, location, hierarchy) {\n        return checkPropTypes(\n          typeSpecs,\n          values,\n          location,\n          displayNameOfNode(cachedNode),\n          () => getComponentStack(hierarchy.concat([cachedNode])),\n        );\n      },\n    };\n  }\n\n  createStringRenderer(options) {\n    if (hasOwn(options, 'suspenseFallback')) {\n      throw new TypeError('`suspenseFallback` should not be specified in options of string renderer');\n    }\n    return {\n      render(el, context) {\n        if (options.context && (el.type.contextTypes || options.childContextTypes)) {\n          const childContextTypes = {\n            ...(el.type.contextTypes || {}),\n            ...options.childContextTypes,\n          };\n          const ContextWrapper = createRenderWrapper(el, context, childContextTypes);\n          return ReactDOMServer.renderToStaticMarkup(React.createElement(ContextWrapper));\n        }\n        return ReactDOMServer.renderToStaticMarkup(el);\n      },\n    };\n  }\n\n  // Provided a bag of options, return an `EnzymeRenderer`. Some options can be implementation\n  // specific, like `attach` etc. for React, but not part of this interface explicitly.\n  // eslint-disable-next-line class-methods-use-this\n  createRenderer(options) {\n    switch (options.mode) {\n      case EnzymeAdapter.MODES.MOUNT: return this.createMountRenderer(options);\n      case EnzymeAdapter.MODES.SHALLOW: return this.createShallowRenderer(options);\n      case EnzymeAdapter.MODES.STRING: return this.createStringRenderer(options);\n      default:\n        throw new Error(`Enzyme Internal Error: Unrecognized mode: ${options.mode}`);\n    }\n  }\n\n  wrap(element) {\n    return wrap(element);\n  }\n\n  // converts an RSTNode to the corresponding JSX Pragma Element. This will be needed\n  // in order to implement the `Wrapper.mount()` and `Wrapper.shallow()` methods, but should\n  // be pretty straightforward for people to implement.\n  // eslint-disable-next-line class-methods-use-this\n  nodeToElement(node) {\n    if (!node || typeof node !== 'object') return null;\n    const { type } = node;\n    return React.createElement(unmemoType(type), propsWithKeysAndRef(node));\n  }\n\n  // eslint-disable-next-line class-methods-use-this\n  matchesElementType(node, matchingType) {\n    if (!node) {\n      return node;\n    }\n    const { type } = node;\n    return unmemoType(type) === unmemoType(matchingType);\n  }\n\n  elementToNode(element) {\n    return elementToTree(element);\n  }\n\n  nodeToHostNode(node, supportsArray = false) {\n    const nodes = nodeToHostNode(node);\n    if (Array.isArray(nodes) && !supportsArray) {\n      return nodes[0];\n    }\n    return nodes;\n  }\n\n  displayNameOfNode(node) {\n    if (!node) return null;\n    const { type, $$typeof } = node;\n    const adapter = this;\n\n    const nodeType = type || $$typeof;\n\n    // newer node types may be undefined, so only test if the nodeType exists\n    if (nodeType) {\n      switch (nodeType) {\n        case (is166 ? ConcurrentMode : AsyncMode) || NaN: return is166 ? 'ConcurrentMode' : 'AsyncMode';\n        case Fragment || NaN: return 'Fragment';\n        case StrictMode || NaN: return 'StrictMode';\n        case Profiler || NaN: return 'Profiler';\n        case Portal || NaN: return 'Portal';\n        case Suspense || NaN: return 'Suspense';\n        default:\n      }\n    }\n\n    const $$typeofType = type && type.$$typeof;\n\n    switch ($$typeofType) {\n      case ContextConsumer || NaN: return 'ContextConsumer';\n      case ContextProvider || NaN: return 'ContextProvider';\n      case Memo || NaN: {\n        const nodeName = displayNameOfNode(node);\n        return typeof nodeName === 'string' ? nodeName : `Memo(${adapter.displayNameOfNode(type)})`;\n      }\n      case ForwardRef || NaN: {\n        if (type.displayName) {\n          return type.displayName;\n        }\n        const name = adapter.displayNameOfNode({ type: type.render });\n        return name ? `ForwardRef(${name})` : 'ForwardRef';\n      }\n      case Lazy || NaN: {\n        return 'lazy';\n      }\n      default: return displayNameOfNode(node);\n    }\n  }\n\n  isValidElement(element) {\n    return isElement(element);\n  }\n\n  isValidElementType(object) {\n    return !!object && isValidElementType(object);\n  }\n\n  isFragment(fragment) {\n    return typeOfNode(fragment) === Fragment;\n  }\n\n  isCustomComponent(type) {\n    const fakeElement = makeFakeElement(type);\n    return !!type && (\n      typeof type === 'function'\n      || isForwardRef(fakeElement)\n      || isContextProvider(fakeElement)\n      || isContextConsumer(fakeElement)\n      || isSuspense(fakeElement)\n    );\n  }\n\n  isContextConsumer(type) {\n    return !!type && isContextConsumer(makeFakeElement(type));\n  }\n\n  isCustomComponentElement(inst) {\n    if (!inst || !this.isValidElement(inst)) {\n      return false;\n    }\n    return this.isCustomComponent(inst.type);\n  }\n\n  getProviderFromConsumer(Consumer) {\n    // React stores references to the Provider on a Consumer differently across versions.\n    if (Consumer) {\n      let Provider;\n      if (Consumer._context) { // check this first, to avoid a deprecation warning\n        ({ Provider } = Consumer._context);\n      } else if (Consumer.Provider) {\n        ({ Provider } = Consumer);\n      }\n      if (Provider) {\n        return Provider;\n      }\n    }\n    throw new Error('Enzyme Internal Error: can’t figure out how to get Provider from Consumer');\n  }\n\n  createElement(...args) {\n    return React.createElement(...args);\n  }\n\n  wrapWithWrappingComponent(node, options) {\n    return {\n      RootFinder,\n      node: wrapWithWrappingComponent(React.createElement, node, options),\n    };\n  }\n}\n\nexport default ReactSixteenAdapter;\n"
  },
  {
    "path": "packages/enzyme-adapter-react-16/src/detectFiberTags.js",
    "content": "import React from 'react';\nimport ReactDOM from 'react-dom';\nimport { fakeDynamicImport } from 'enzyme-adapter-utils';\n\nfunction getFiber(element) {\n  const container = global.document.createElement('div');\n  let inst = null;\n  class Tester extends React.Component {\n    render() {\n      inst = this;\n      return element;\n    }\n  }\n  ReactDOM.render(React.createElement(Tester), container);\n  return inst._reactInternalFiber.child;\n}\n\nfunction getLazyFiber(LazyComponent) {\n  const container = global.document.createElement('div');\n  let inst = null;\n  // eslint-disable-next-line react/prefer-stateless-function\n  class Tester extends React.Component {\n    render() {\n      inst = this;\n      return React.createElement(LazyComponent);\n    }\n  }\n  // eslint-disable-next-line react/prefer-stateless-function\n  class SuspenseWrapper extends React.Component {\n    render() {\n      return React.createElement(\n        React.Suspense,\n        { fallback: false },\n        React.createElement(Tester),\n      );\n    }\n  }\n  ReactDOM.render(React.createElement(SuspenseWrapper), container);\n  return inst._reactInternalFiber.child;\n}\n\nexport default function detectFiberTags() {\n  const supportsMode = typeof React.StrictMode !== 'undefined';\n  const supportsContext = typeof React.createContext !== 'undefined';\n  const supportsForwardRef = typeof React.forwardRef !== 'undefined';\n  const supportsMemo = typeof React.memo !== 'undefined';\n  const supportsProfiler = typeof React.unstable_Profiler !== 'undefined' || typeof React.Profiler !== 'undefined';\n  const supportsSuspense = typeof React.Suspense !== 'undefined';\n  const supportsLazy = typeof React.lazy !== 'undefined';\n\n  function Fn() {\n    return null;\n  }\n  // eslint-disable-next-line react/prefer-stateless-function\n  class Cls extends React.Component {\n    render() {\n      return null;\n    }\n  }\n  let Ctx = null;\n  let FwdRef = null;\n  let LazyComponent = null;\n  if (supportsContext) {\n    Ctx = React.createContext();\n  }\n  if (supportsForwardRef) {\n    // React will warn if we don't have both arguments.\n    // eslint-disable-next-line no-unused-vars\n    FwdRef = React.forwardRef((props, ref) => null);\n  }\n  if (supportsLazy) {\n    LazyComponent = React.lazy(() => fakeDynamicImport(() => null));\n  }\n\n  return {\n    HostRoot: getFiber('test').return.return.tag, // Go two levels above to find the root\n    ClassComponent: getFiber(React.createElement(Cls)).tag,\n    Fragment: getFiber([['nested']]).tag,\n    FunctionalComponent: getFiber(React.createElement(Fn)).tag,\n    MemoSFC: supportsMemo\n      ? getFiber(React.createElement(React.memo(Fn))).tag\n      : -1,\n    MemoClass: supportsMemo\n      ? getFiber(React.createElement(React.memo(Cls))).tag\n      : -1,\n    HostPortal: getFiber(ReactDOM.createPortal(null, global.document.createElement('div'))).tag,\n    HostComponent: getFiber(React.createElement('span')).tag,\n    HostText: getFiber('text').tag,\n    Mode: supportsMode\n      ? getFiber(React.createElement(React.StrictMode)).tag\n      : -1,\n    ContextConsumer: supportsContext\n      ? getFiber(React.createElement(Ctx.Consumer, null, () => null)).tag\n      : -1,\n    ContextProvider: supportsContext\n      ? getFiber(React.createElement(Ctx.Provider, { value: null }, null)).tag\n      : -1,\n    ForwardRef: supportsForwardRef\n      ? getFiber(React.createElement(FwdRef)).tag\n      : -1,\n    Profiler: supportsProfiler\n      ? getFiber(React.createElement((React.Profiler || React.unstable_Profiler), { id: 'mock', onRender() {} })).tag\n      : -1,\n    Suspense: supportsSuspense\n      ? getFiber(React.createElement(React.Suspense, { fallback: false })).tag\n      : -1,\n    Lazy: supportsLazy\n      ? getLazyFiber(LazyComponent).tag\n      : -1,\n  };\n}\n"
  },
  {
    "path": "packages/enzyme-adapter-react-16/src/findCurrentFiberUsingSlowPath.js",
    "content": "// Extracted from https://github.com/facebook/react/blob/7bdf93b17a35a5d8fcf0ceae0bf48ed5e6b16688/src/renderers/shared/fiber/ReactFiberTreeReflection.js#L104-L228\nfunction findCurrentFiberUsingSlowPath(fiber) {\n  const { alternate } = fiber;\n  if (!alternate) {\n    return fiber;\n  }\n  // If we have two possible branches, we'll walk backwards up to the root\n  // to see what path the root points to. On the way we may hit one of the\n  // special cases and we'll deal with them.\n  let a = fiber;\n  let b = alternate;\n  while (true) { // eslint-disable-line\n    const parentA = a.return;\n    const parentB = parentA ? parentA.alternate : null;\n    if (!parentA || !parentB) {\n      // We're at the root.\n      break;\n    }\n\n    // If both copies of the parent fiber point to the same child, we can\n    // assume that the child is current. This happens when we bailout on low\n    // priority: the bailed out fiber's child reuses the current child.\n    if (parentA.child === parentB.child) {\n      let { child } = parentA;\n      while (child) {\n        if (child === a) {\n          // We've determined that A is the current branch.\n          return fiber;\n        }\n        if (child === b) {\n          // We've determined that B is the current branch.\n          return alternate;\n        }\n        child = child.sibling;\n      }\n      // We should never have an alternate for any mounting node. So the only\n      // way this could possibly happen is if this was unmounted, if at all.\n      throw new Error('Unable to find node on an unmounted component.');\n    }\n\n    if (a.return !== b.return) {\n      // The return pointer of A and the return pointer of B point to different\n      // fibers. We assume that return pointers never criss-cross, so A must\n      // belong to the child set of A.return, and B must belong to the child\n      // set of B.return.\n      a = parentA;\n      b = parentB;\n    } else {\n      // The return pointers point to the same fiber. We'll have to use the\n      // default, slow path: scan the child sets of each parent alternate to see\n      // which child belongs to which set.\n      //\n      // Search parent A's child set\n      let didFindChild = false;\n      let { child } = parentA;\n      while (child) {\n        if (child === a) {\n          didFindChild = true;\n          a = parentA;\n          b = parentB;\n          break;\n        }\n        if (child === b) {\n          didFindChild = true;\n          b = parentA;\n          a = parentB;\n          break;\n        }\n        child = child.sibling;\n      }\n      if (!didFindChild) {\n        // Search parent B's child set\n        ({ child } = parentB);\n        while (child) {\n          if (child === a) {\n            didFindChild = true;\n            a = parentB;\n            b = parentA;\n            break;\n          }\n          if (child === b) {\n            didFindChild = true;\n            b = parentB;\n            a = parentA;\n            break;\n          }\n          child = child.sibling;\n        }\n        if (!didFindChild) {\n          throw new Error('Child was not found in either parent set. This indicates a bug '\n            + 'in React related to the return pointer. Please file an issue.');\n        }\n      }\n    }\n  }\n  if (a.stateNode?.current === a) {\n    // We've determined that A is the current branch.\n    return fiber;\n  }\n  // Otherwise B has to be current branch.\n  return alternate;\n}\n\nmodule.exports = findCurrentFiberUsingSlowPath;\n"
  },
  {
    "path": "packages/enzyme-adapter-react-16/src/index.js",
    "content": "/* eslint global-require: 0 */\nmodule.exports = require('./ReactSixteenAdapter');\n"
  },
  {
    "path": "packages/enzyme-adapter-react-16.1/.babelrc",
    "content": "{\n  \"presets\": [\n    [\"airbnb\", { \"transformRuntime\": false }],\n  ],\n  \"plugins\": [\n    [\"transform-replace-object-assign\", { \"moduleSpecifier\": \"object.assign\" }],\n    [\"add-module-exports\"],\n  ],\n  \"sourceMaps\": \"both\",\n}\n"
  },
  {
    "path": "packages/enzyme-adapter-react-16.1/.eslintignore",
    "content": "_book/\nbuild/\nnode_modules/\n**/node_modules/\n"
  },
  {
    "path": "packages/enzyme-adapter-react-16.1/.eslintrc",
    "content": "{\n  \"extends\": \"airbnb\",\n  \"parser\": \"@babel/eslint-parser\",\n  \"root\": true,\n  \"ignorePatterns\": [\"build/\"],\n  \"rules\": {\n    \"max-classes-per-file\": 0,\n    \"max-len\": 0,\n    \"react/no-deprecated\": 0,\n    \"react/no-find-dom-node\": 0,\n    \"react/no-multi-comp\": 0,\n    \"no-underscore-dangle\": 0,\n    \"class-methods-use-this\": 0\n  },\n  \"settings\": {\n    \"react\": {\n      \"version\": \"16.1.0\",\n    },\n  },\n}\n"
  },
  {
    "path": "packages/enzyme-adapter-react-16.1/.npmrc",
    "content": "package-lock=false\n"
  },
  {
    "path": "packages/enzyme-adapter-react-16.1/package.json",
    "content": "{\n  \"name\": \"enzyme-adapter-react-16.1\",\n  \"version\": \"1.6.5\",\n  \"description\": \"JavaScript Testing utilities for React\",\n  \"homepage\": \"https://enzymejs.github.io/enzyme/\",\n  \"main\": \"build\",\n  \"scripts\": {\n    \"prepack\": \"npmignore --auto --commentLines=autogenerated --gitignore=../../.gitignore && cp ../../{LICENSE,README}.md ./ && npm run build\",\n    \"prepublishOnly\": \"safe-publish-latest\",\n    \"prepublish\": \"not-in-publish || npm run prepublishOnly\",\n    \"clean\": \"rimraf build\",\n    \"lint\": \"eslint --ext js,jsx .\",\n    \"pretest\": \"npm run lint\",\n    \"prebuild\": \"npm run clean\",\n    \"build\": \"babel --source-maps=both src --out-dir build\",\n    \"watch\": \"npm run build -- -w\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/enzymejs/enzyme.git\",\n    \"directory\": \"packages/enzyme-adapter-react-16.1\"\n  },\n  \"keywords\": [\n    \"javascript\",\n    \"shallow rendering\",\n    \"shallowRender\",\n    \"test\",\n    \"reactjs\",\n    \"react\",\n    \"flux\",\n    \"testing\",\n    \"test utils\",\n    \"assertion helpers\",\n    \"tdd\",\n    \"mocha\"\n  ],\n  \"author\": \"Jordan Harband <ljharb@gmail.com>\",\n  \"funding\": {\n    \"url\": \"https://github.com/sponsors/ljharb\"\n  },\n  \"license\": \"MIT\",\n  \"dependencies\": {\n    \"enzyme-adapter-utils\": \"^1.14.2\",\n    \"enzyme-shallow-equal\": \"^1.0.7\",\n    \"object.assign\": \"^4.1.7\",\n    \"prop-types\": \"^15.8.1\",\n    \"react-is\": \"^17.0.2\",\n    \"react-reconciler\": \"^0.7.0\",\n    \"react-test-renderer\": \"~16.0.0-0 || ~16.1\"\n  },\n  \"peerDependencies\": {\n    \"enzyme\": \"^3.0.0\",\n    \"react\": \"~16.0.0-0 || ~16.1\",\n    \"react-dom\": \"~16.0.0-0 || ~16.1\"\n  },\n  \"devDependencies\": {\n    \"@babel/cli\": \"^7.28.3\",\n    \"@babel/core\": \"^7.28.4\",\n    \"@babel/eslint-parser\": \"^7.28.4\",\n    \"babel-plugin-add-module-exports\": \"^1.0.4\",\n    \"babel-plugin-transform-replace-object-assign\": \"^2.0.0\",\n    \"babel-preset-airbnb\": \"^4.5.0\",\n    \"enzyme\": \"^3.0.0\",\n    \"eslint\": \"^8.56.0\",\n    \"eslint-config-airbnb\": \"^19.0.4\",\n    \"eslint-plugin-import\": \"^2.32.0\",\n    \"eslint-plugin-jsx-a11y\": \"^6.10.2\",\n    \"eslint-plugin-react\": \"^7.37.5\",\n    \"eslint-plugin-react-hooks\": \"^4.6.0\",\n    \"in-publish\": \"^2.0.1\",\n    \"npmignore\": \"^0.3.1\",\n    \"rimraf\": \"^2.7.1\",\n    \"safe-publish-latest\": \"^2.0.0\"\n  },\n  \"publishConfig\": {\n    \"ignore\": [\n      \"!build\"\n    ]\n  }\n}\n"
  },
  {
    "path": "packages/enzyme-adapter-react-16.1/src/ReactSixteenOneAdapter.js",
    "content": "/* eslint no-use-before-define: 0 */\nimport React from 'react';\nimport ReactDOM from 'react-dom';\n// eslint-disable-next-line import/no-unresolved\nimport ReactDOMServer from 'react-dom/server';\n// eslint-disable-next-line import/no-unresolved\nimport ShallowRenderer from 'react-test-renderer/shallow';\n// eslint-disable-next-line import/no-unresolved\nimport TestUtils from 'react-dom/test-utils';\nimport checkPropTypes from 'prop-types/checkPropTypes';\nimport {\n  isElement,\n  isPortal,\n  isValidElementType,\n  Fragment,\n  Portal,\n} from 'react-is';\nimport { EnzymeAdapter } from 'enzyme';\nimport shallowEqual from 'enzyme-shallow-equal';\nimport {\n  displayNameOfNode,\n  elementToTree as utilElementToTree,\n  nodeTypeFromType as utilNodeTypeFromType,\n  mapNativeEventNames,\n  propFromEvent,\n  assertDomAvailable,\n  withSetStateAllowed,\n  createRenderWrapper,\n  createMountWrapper,\n  propsWithKeysAndRef,\n  ensureKeyOrUndefined,\n  simulateError,\n  wrap,\n  getMaskedContext,\n  getComponentStack,\n  RootFinder,\n  getNodeFromRootFinder,\n  wrapWithWrappingComponent,\n  getWrappingComponentMountRenderer,\n  spyMethod,\n} from 'enzyme-adapter-utils';\nimport { findCurrentFiberUsingSlowPath } from 'react-reconciler/reflection';\n\nconst HostRoot = 3;\nconst ClassComponent = 2;\nconst FunctionalComponent = 1;\nconst HostPortal = 4;\nconst HostComponent = 5;\nconst HostText = 6;\nconst FragmentType = 10;\nconst Mode = 11;\n\nfunction nodeAndSiblingsArray(nodeWithSibling) {\n  const array = [];\n  let node = nodeWithSibling;\n  while (node != null) {\n    array.push(node);\n    node = node.sibling;\n  }\n  return array;\n}\n\nconst displayNamesByType = {\n  [Fragment]: 'Fragment',\n  [Portal]: 'Portal',\n};\n\nfunction flatten(arr) {\n  const result = [];\n  const stack = [{ i: 0, array: arr }];\n  while (stack.length) {\n    const n = stack.pop();\n    while (n.i < n.array.length) {\n      const el = n.array[n.i];\n      n.i += 1;\n      if (Array.isArray(el)) {\n        stack.push(n);\n        stack.push({ i: 0, array: el });\n        break;\n      }\n      result.push(el);\n    }\n  }\n  return result;\n}\n\nfunction nodeTypeFromType(type) {\n  if (type === Portal) {\n    return 'portal';\n  }\n\n  return utilNodeTypeFromType(type);\n}\n\nfunction elementToTree(el) {\n  if (!isPortal(el)) {\n    return utilElementToTree(el, elementToTree);\n  }\n\n  const { children, containerInfo } = el;\n  const props = { children, containerInfo };\n\n  return {\n    nodeType: 'portal',\n    type: Portal,\n    props,\n    key: ensureKeyOrUndefined(el.key),\n    ref: el.ref || null,\n    instance: null,\n    rendered: elementToTree(el.children),\n  };\n}\n\nfunction toTree(vnode) {\n  if (vnode == null) {\n    return null;\n  }\n  // TODO(lmr): I'm not really sure I understand whether or not this is what\n  // i should be doing, or if this is a hack for something i'm doing wrong\n  // somewhere else. Should talk to sebastian about this perhaps\n  const node = findCurrentFiberUsingSlowPath(vnode);\n  switch (node.tag) {\n    case HostRoot: // 3\n      return childrenToTree(node.child);\n    case HostPortal: { // 4\n      const {\n        stateNode: { containerInfo },\n        memoizedProps: children,\n      } = node;\n      const props = { containerInfo, children };\n      return {\n        nodeType: 'portal',\n        type: Portal,\n        props,\n        key: ensureKeyOrUndefined(node.key),\n        ref: node.ref,\n        instance: null,\n        rendered: childrenToTree(node.child),\n      };\n    }\n    case ClassComponent:\n      return {\n        nodeType: 'class',\n        type: node.type,\n        props: { ...node.memoizedProps },\n        key: ensureKeyOrUndefined(node.key),\n        ref: node.ref,\n        instance: node.stateNode,\n        rendered: childrenToTree(node.child),\n      };\n    case FunctionalComponent: // 1\n      return {\n        nodeType: 'function',\n        type: node.type,\n        props: { ...node.memoizedProps },\n        key: ensureKeyOrUndefined(node.key),\n        ref: node.ref,\n        instance: null,\n        rendered: childrenToTree(node.child),\n      };\n    case HostComponent: { // 5\n      let renderedNodes = flatten(nodeAndSiblingsArray(node.child).map(toTree));\n      if (renderedNodes.length === 0) {\n        renderedNodes = [node.memoizedProps.children];\n      }\n      return {\n        nodeType: 'host',\n        type: node.type,\n        props: { ...node.memoizedProps },\n        key: ensureKeyOrUndefined(node.key),\n        ref: node.ref,\n        instance: node.stateNode,\n        rendered: renderedNodes,\n      };\n    }\n    case HostText: // 6\n      return node.memoizedProps;\n    case FragmentType: // 10\n    case Mode: // 11\n      return childrenToTree(node.child);\n    default:\n      throw new Error(`Enzyme Internal Error: unknown node with tag ${node.tag}`);\n  }\n}\n\nfunction childrenToTree(node) {\n  if (!node) {\n    return null;\n  }\n  const children = nodeAndSiblingsArray(node);\n  if (children.length === 0) {\n    return null;\n  }\n  if (children.length === 1) {\n    return toTree(children[0]);\n  }\n  return flatten(children.map(toTree));\n}\n\nfunction nodeToHostNode(_node) {\n  // NOTE(lmr): node could be a function component\n  // which wont have an instance prop, but we can get the\n  // host node associated with its return value at that point.\n  // Although this breaks down if the return value is an array,\n  // as is possible with React 16.\n  let node = _node;\n  while (node && !Array.isArray(node) && node.instance === null) {\n    node = node.rendered;\n  }\n  // if the SFC returned null effectively, there is no host node.\n  if (!node) {\n    return null;\n  }\n\n  const mapper = (item) => {\n    if (item && item.instance) return ReactDOM.findDOMNode(item.instance);\n    return null;\n  };\n  if (Array.isArray(node)) {\n    return node.map(mapper);\n  }\n  if (Array.isArray(node.rendered) && node.nodeType === 'class') {\n    return node.rendered.map(mapper);\n  }\n  return mapper(node);\n}\n\nconst eventOptions = { animation: true };\n\nfunction getEmptyStateValue() {\n  // this handles a bug in React 16.0 - 16.2\n  // see https://github.com/facebook/react/commit/39be83565c65f9c522150e52375167568a2a1459\n  // also see https://github.com/facebook/react/pull/11965\n\n  // eslint-disable-next-line react/prefer-stateless-function\n  class EmptyState extends React.Component {\n    render() {\n      return null;\n    }\n  }\n  const testRenderer = new ShallowRenderer();\n  testRenderer.render(React.createElement(EmptyState));\n  return testRenderer._instance.state;\n}\n\nclass ReactSixteenOneAdapter extends EnzymeAdapter {\n  constructor() {\n    super();\n    const { lifecycles } = this.options;\n    this.options = {\n      ...this.options,\n      legacyContextMode: 'parent',\n      lifecycles: {\n        ...lifecycles,\n        componentDidUpdate: {\n          onSetState: true,\n        },\n        setState: {\n          skipsComponentDidUpdateOnNullish: true,\n        },\n        getChildContext: {\n          calledByRenderer: false,\n        },\n      },\n    };\n  }\n\n  createMountRenderer(options) {\n    assertDomAvailable('mount');\n    const { attachTo, hydrateIn, wrappingComponentProps } = options;\n    const domNode = hydrateIn || attachTo || global.document.createElement('div');\n    let instance = null;\n    const adapter = this;\n    return {\n      render(el, context, callback) {\n        if (instance === null) {\n          const { type, props, ref } = el;\n          const wrapperProps = {\n            Component: type,\n            props,\n            wrappingComponentProps,\n            context,\n            ...(ref && { refProp: ref }),\n          };\n          const ReactWrapperComponent = createMountWrapper(el, { ...options, adapter });\n          const wrappedEl = React.createElement(ReactWrapperComponent, wrapperProps);\n          instance = hydrateIn\n            ? ReactDOM.hydrate(wrappedEl, domNode)\n            : ReactDOM.render(wrappedEl, domNode);\n          if (typeof callback === 'function') {\n            callback();\n          }\n        } else {\n          instance.setChildProps(el.props, context, callback);\n        }\n      },\n      unmount() {\n        ReactDOM.unmountComponentAtNode(domNode);\n        instance = null;\n      },\n      getNode() {\n        if (!instance) {\n          return null;\n        }\n        return getNodeFromRootFinder(\n          adapter.isCustomComponent,\n          toTree(instance._reactInternalFiber),\n          options,\n        );\n      },\n      simulateError(nodeHierarchy, rootNode, error) {\n        const { instance: catchingInstance } = nodeHierarchy\n          .find((x) => x.instance && x.instance.componentDidCatch) || {};\n\n        simulateError(\n          error,\n          catchingInstance,\n          rootNode,\n          nodeHierarchy,\n          nodeTypeFromType,\n          adapter.displayNameOfNode,\n        );\n      },\n      simulateEvent(node, event, mock) {\n        const mappedEvent = mapNativeEventNames(event, eventOptions);\n        const eventFn = TestUtils.Simulate[mappedEvent];\n        if (!eventFn) {\n          throw new TypeError(`ReactWrapper::simulate() event '${event}' does not exist`);\n        }\n        // eslint-disable-next-line react/no-find-dom-node\n        eventFn(adapter.nodeToHostNode(node), mock);\n      },\n      batchedUpdates(fn) {\n        return fn();\n        // return ReactDOM.unstable_batchedUpdates(fn);\n      },\n      getWrappingComponentRenderer() {\n        return {\n          ...this,\n          ...getWrappingComponentMountRenderer({\n            toTree: (inst) => toTree(inst._reactInternalFiber),\n            getMountWrapperInstance: () => instance,\n          }),\n        };\n      },\n    };\n  }\n\n  createShallowRenderer(/* options */) {\n    const adapter = this;\n    const renderer = new ShallowRenderer();\n    let isDOM = false;\n    let cachedNode = null;\n    return {\n      render(el, unmaskedContext) {\n        cachedNode = el;\n        /* eslint consistent-return: 0 */\n        if (typeof el.type === 'string') {\n          isDOM = true;\n        } else {\n          isDOM = false;\n          const { type: Component } = el;\n\n          const isStateful = Component.prototype && (\n            Component.prototype.isReactComponent\n            || Array.isArray(Component.__reactAutoBindPairs) // fallback for createClass components\n          );\n          const context = getMaskedContext(Component.contextTypes, unmaskedContext);\n\n          if (!isStateful && typeof Component === 'function') {\n            const wrappedEl = Object.assign(\n              (...args) => Component(...args), // eslint-disable-line new-cap\n              Component,\n            );\n            return withSetStateAllowed(() => renderer.render({ ...el, type: wrappedEl }, context));\n          }\n          if (isStateful) {\n            if (\n              renderer._instance\n              && el.props === renderer._instance.props\n              && !shallowEqual(context, renderer._instance.context)\n            ) {\n              const { restore } = spyMethod(\n                renderer,\n                '_updateClassComponent',\n                (originalMethod) => function _updateClassComponent(...args) {\n                  const { props } = renderer._instance;\n                  const clonedProps = { ...props };\n                  renderer._instance.props = clonedProps;\n\n                  const result = originalMethod.apply(renderer, args);\n\n                  renderer._instance.props = props;\n                  restore();\n\n                  return result;\n                },\n              );\n            }\n\n            // fix react bug; see implementation of `getEmptyStateValue`\n            const emptyStateValue = getEmptyStateValue();\n            if (emptyStateValue) {\n              Object.defineProperty(Component.prototype, 'state', {\n                configurable: true,\n                enumerable: true,\n                get() {\n                  return null;\n                },\n                set(value) {\n                  if (value !== emptyStateValue) {\n                    Object.defineProperty(this, 'state', {\n                      configurable: true,\n                      enumerable: true,\n                      value,\n                      writable: true,\n                    });\n                  }\n                },\n              });\n            }\n          }\n          return withSetStateAllowed(() => renderer.render(el, context));\n        }\n      },\n      unmount() {\n        renderer.unmount();\n      },\n      getNode() {\n        if (isDOM) {\n          return elementToTree(cachedNode);\n        }\n        const output = renderer.getRenderOutput();\n        return {\n          nodeType: nodeTypeFromType(cachedNode.type),\n          type: cachedNode.type,\n          props: cachedNode.props,\n          key: ensureKeyOrUndefined(cachedNode.key),\n          ref: cachedNode.ref,\n          instance: renderer._instance,\n          rendered: Array.isArray(output)\n            ? flatten(output).map((el) => elementToTree(el))\n            : elementToTree(output),\n        };\n      },\n      simulateError(nodeHierarchy, rootNode, error) {\n        simulateError(\n          error,\n          renderer._instance,\n          cachedNode,\n          nodeHierarchy.concat(cachedNode),\n          nodeTypeFromType,\n          adapter.displayNameOfNode,\n        );\n      },\n      simulateEvent(node, event, ...args) {\n        const handler = node.props[propFromEvent(event, eventOptions)];\n        if (handler) {\n          withSetStateAllowed(() => {\n            // TODO(lmr): create/use synthetic events\n            // TODO(lmr): emulate React's event propagation\n            // ReactDOM.unstable_batchedUpdates(() => {\n            handler(...args);\n            // });\n          });\n        }\n      },\n      batchedUpdates(fn) {\n        return fn();\n        // return ReactDOM.unstable_batchedUpdates(fn);\n      },\n      checkPropTypes(typeSpecs, values, location, hierarchy) {\n        return checkPropTypes(\n          typeSpecs,\n          values,\n          location,\n          displayNameOfNode(cachedNode),\n          () => getComponentStack(hierarchy.concat([cachedNode])),\n        );\n      },\n    };\n  }\n\n  createStringRenderer(options) {\n    return {\n      render(el, context) {\n        if (options.context && (el.type.contextTypes || options.childContextTypes)) {\n          const childContextTypes = {\n            ...(el.type.contextTypes || {}),\n            ...options.childContextTypes,\n          };\n          const ContextWrapper = createRenderWrapper(el, context, childContextTypes);\n          return ReactDOMServer.renderToStaticMarkup(React.createElement(ContextWrapper));\n        }\n        return ReactDOMServer.renderToStaticMarkup(el);\n      },\n    };\n  }\n\n  // Provided a bag of options, return an `EnzymeRenderer`. Some options can be implementation\n  // specific, like `attach` etc. for React, but not part of this interface explicitly.\n  // eslint-disable-next-line class-methods-use-this, no-unused-vars\n  createRenderer(options) {\n    switch (options.mode) {\n      case EnzymeAdapter.MODES.MOUNT: return this.createMountRenderer(options);\n      case EnzymeAdapter.MODES.SHALLOW: return this.createShallowRenderer(options);\n      case EnzymeAdapter.MODES.STRING: return this.createStringRenderer(options);\n      default:\n        throw new Error(`Enzyme Internal Error: Unrecognized mode: ${options.mode}`);\n    }\n  }\n\n  wrap(element) {\n    return wrap(element);\n  }\n\n  // converts an RSTNode to the corresponding JSX Pragma Element. This will be needed\n  // in order to implement the `Wrapper.mount()` and `Wrapper.shallow()` methods, but should\n  // be pretty straightforward for people to implement.\n  // eslint-disable-next-line class-methods-use-this, no-unused-vars\n  nodeToElement(node) {\n    if (!node || typeof node !== 'object') return null;\n    return React.createElement(node.type, propsWithKeysAndRef(node));\n  }\n\n  elementToNode(element) {\n    return elementToTree(element);\n  }\n\n  nodeToHostNode(node, supportsArray = false) {\n    const nodes = nodeToHostNode(node);\n    if (Array.isArray(nodes) && !supportsArray) {\n      return nodes[0];\n    }\n    return nodes;\n  }\n\n  displayNameOfNode(node) {\n    if (!node) return null;\n\n    const { type, $$typeof } = node;\n    return displayNamesByType[type || $$typeof] || displayNameOfNode(node);\n  }\n\n  isValidElement(element) {\n    return isElement(element);\n  }\n\n  isValidElementType(object) {\n    return isValidElementType(object);\n  }\n\n  isCustomComponent(component) {\n    return typeof component === 'function';\n  }\n\n  createElement(...args) {\n    return React.createElement(...args);\n  }\n\n  wrapWithWrappingComponent(node, options) {\n    return {\n      RootFinder,\n      node: wrapWithWrappingComponent(React.createElement, node, options),\n    };\n  }\n}\n\nexport default ReactSixteenOneAdapter;\n"
  },
  {
    "path": "packages/enzyme-adapter-react-16.1/src/index.js",
    "content": "module.exports = require('./ReactSixteenOneAdapter');\n"
  },
  {
    "path": "packages/enzyme-adapter-react-16.2/.babelrc",
    "content": "{\n  \"presets\": [\n    [\"airbnb\", { \"transformRuntime\": false }],\n  ],\n  \"plugins\": [\n    [\"transform-replace-object-assign\", { \"moduleSpecifier\": \"object.assign\" }],\n    [\"add-module-exports\"],\n  ],\n  \"sourceMaps\": \"both\",\n}\n"
  },
  {
    "path": "packages/enzyme-adapter-react-16.2/.eslintignore",
    "content": "_book/\nbuild/\nnode_modules/\n**/node_modules/\n"
  },
  {
    "path": "packages/enzyme-adapter-react-16.2/.eslintrc",
    "content": "{\n  \"extends\": \"airbnb\",\n  \"parser\": \"@babel/eslint-parser\",\n  \"root\": true,\n  \"ignorePatterns\": [\"build/\"],\n  \"rules\": {\n    \"max-classes-per-file\": 0,\n    \"max-len\": 0,\n    \"react/no-deprecated\": 0,\n    \"react/no-find-dom-node\": 0,\n    \"react/no-multi-comp\": 0,\n    \"no-underscore-dangle\": 0,\n    \"class-methods-use-this\": 0\n  },\n  \"settings\": {\n    \"react\": {\n      \"version\": \"16.2.0\",\n    },\n  },\n}\n"
  },
  {
    "path": "packages/enzyme-adapter-react-16.2/.npmrc",
    "content": "package-lock=false\n"
  },
  {
    "path": "packages/enzyme-adapter-react-16.2/package.json",
    "content": "{\n  \"name\": \"enzyme-adapter-react-16.2\",\n  \"version\": \"1.6.5\",\n  \"description\": \"JavaScript Testing utilities for React\",\n  \"homepage\": \"https://enzymejs.github.io/enzyme/\",\n  \"main\": \"build\",\n  \"scripts\": {\n    \"prepack\": \"npmignore --auto --commentLines=autogenerated --gitignore=../../.gitignore && cp ../../{LICENSE,README}.md ./ && npm run build\",\n    \"prepublishOnly\": \"safe-publish-latest\",\n    \"prepublish\": \"not-in-publish || npm run prepublishOnly\",\n    \"clean\": \"rimraf build\",\n    \"lint\": \"eslint --ext js,jsx .\",\n    \"pretest\": \"npm run lint\",\n    \"prebuild\": \"npm run clean\",\n    \"build\": \"babel --source-maps=both src --out-dir build\",\n    \"watch\": \"npm run build -- -w\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/enzymejs/enzyme.git\",\n    \"directory\": \"packages/enzyme-adapter-react-16.2\"\n  },\n  \"keywords\": [\n    \"javascript\",\n    \"shallow rendering\",\n    \"shallowRender\",\n    \"test\",\n    \"reactjs\",\n    \"react\",\n    \"flux\",\n    \"testing\",\n    \"test utils\",\n    \"assertion helpers\",\n    \"tdd\",\n    \"mocha\"\n  ],\n  \"author\": \"Jordan Harband <ljharb@gmail.com>\",\n  \"funding\": {\n    \"url\": \"https://github.com/sponsors/ljharb\"\n  },\n  \"license\": \"MIT\",\n  \"dependencies\": {\n    \"enzyme-adapter-utils\": \"^1.14.2\",\n    \"enzyme-shallow-equal\": \"^1.0.7\",\n    \"object.assign\": \"^4.1.7\",\n    \"object.values\": \"^1.2.1\",\n    \"prop-types\": \"^15.8.1\",\n    \"react-is\": \"^17.0.2\",\n    \"react-reconciler\": \"^0.7.0\",\n    \"react-test-renderer\": \"~16.2.0\"\n  },\n  \"peerDependencies\": {\n    \"enzyme\": \"^3.0.0\",\n    \"react\": \"~16.2\",\n    \"react-dom\": \"~16.2\"\n  },\n  \"devDependencies\": {\n    \"@babel/cli\": \"^7.28.3\",\n    \"@babel/core\": \"^7.28.4\",\n    \"@babel/eslint-parser\": \"^7.28.4\",\n    \"babel-plugin-add-module-exports\": \"^1.0.4\",\n    \"babel-plugin-transform-replace-object-assign\": \"^2.0.0\",\n    \"babel-preset-airbnb\": \"^4.5.0\",\n    \"enzyme\": \"^3.0.0\",\n    \"eslint\": \"^8.56.0\",\n    \"eslint-config-airbnb\": \"^19.0.4\",\n    \"eslint-plugin-import\": \"^2.32.0\",\n    \"eslint-plugin-jsx-a11y\": \"^6.10.2\",\n    \"eslint-plugin-react\": \"^7.37.5\",\n    \"eslint-plugin-react-hooks\": \"^4.6.0\",\n    \"in-publish\": \"^2.0.1\",\n    \"npmignore\": \"^0.3.1\",\n    \"rimraf\": \"^2.7.1\",\n    \"safe-publish-latest\": \"^2.0.0\"\n  },\n  \"publishConfig\": {\n    \"ignore\": [\n      \"!build\"\n    ]\n  }\n}\n"
  },
  {
    "path": "packages/enzyme-adapter-react-16.2/src/ReactSixteenTwoAdapter.js",
    "content": "/* eslint no-use-before-define: 0 */\nimport React from 'react';\nimport ReactDOM from 'react-dom';\n// eslint-disable-next-line import/no-unresolved\nimport ReactDOMServer from 'react-dom/server';\n// eslint-disable-next-line import/no-unresolved\nimport ShallowRenderer from 'react-test-renderer/shallow';\n// eslint-disable-next-line import/no-unresolved\nimport TestUtils from 'react-dom/test-utils';\nimport checkPropTypes from 'prop-types/checkPropTypes';\nimport {\n  isElement,\n  isPortal,\n  isValidElementType,\n  Fragment,\n  Portal,\n} from 'react-is';\nimport { EnzymeAdapter } from 'enzyme';\nimport { typeOfNode } from 'enzyme/build/Utils';\nimport shallowEqual from 'enzyme-shallow-equal';\nimport {\n  displayNameOfNode,\n  elementToTree as utilElementToTree,\n  nodeTypeFromType as utilNodeTypeFromType,\n  mapNativeEventNames,\n  propFromEvent,\n  assertDomAvailable,\n  withSetStateAllowed,\n  createRenderWrapper,\n  createMountWrapper,\n  propsWithKeysAndRef,\n  ensureKeyOrUndefined,\n  simulateError,\n  wrap,\n  getMaskedContext,\n  getComponentStack,\n  RootFinder,\n  getNodeFromRootFinder,\n  wrapWithWrappingComponent,\n  getWrappingComponentMountRenderer,\n  spyMethod,\n} from 'enzyme-adapter-utils';\nimport { findCurrentFiberUsingSlowPath } from 'react-reconciler/reflection';\n\nconst HostRoot = 3;\nconst ClassComponent = 2;\nconst FragmentType = 10;\nconst FunctionalComponent = 1;\nconst HostPortal = 4;\nconst HostComponent = 5;\nconst HostText = 6;\nconst Mode = 11;\n\nfunction nodeAndSiblingsArray(nodeWithSibling) {\n  const array = [];\n  let node = nodeWithSibling;\n  while (node != null) {\n    array.push(node);\n    node = node.sibling;\n  }\n  return array;\n}\n\nconst displayNamesByType = {\n  [Fragment]: 'Fragment',\n  [Portal]: 'Portal',\n};\n\nfunction flatten(arr) {\n  const result = [];\n  const stack = [{ i: 0, array: arr }];\n  while (stack.length) {\n    const n = stack.pop();\n    while (n.i < n.array.length) {\n      const el = n.array[n.i];\n      n.i += 1;\n      if (Array.isArray(el)) {\n        stack.push(n);\n        stack.push({ i: 0, array: el });\n        break;\n      }\n      result.push(el);\n    }\n  }\n  return result;\n}\n\nfunction nodeTypeFromType(type) {\n  if (type === Portal) {\n    return 'portal';\n  }\n\n  return utilNodeTypeFromType(type);\n}\n\nfunction elementToTree(el) {\n  if (!isPortal(el)) {\n    return utilElementToTree(el, elementToTree);\n  }\n\n  const { children, containerInfo } = el;\n  const props = { children, containerInfo };\n\n  return {\n    nodeType: 'portal',\n    type: Portal,\n    props,\n    key: ensureKeyOrUndefined(el.key),\n    ref: el.ref || null,\n    instance: null,\n    rendered: elementToTree(el.children),\n  };\n}\n\nfunction toTree(vnode) {\n  if (vnode == null) {\n    return null;\n  }\n  // TODO(lmr): I'm not really sure I understand whether or not this is what\n  // i should be doing, or if this is a hack for something i'm doing wrong\n  // somewhere else. Should talk to sebastian about this perhaps\n  const node = findCurrentFiberUsingSlowPath(vnode);\n  switch (node.tag) {\n    case HostRoot: // 3\n      return childrenToTree(node.child);\n    case HostPortal: { // 4\n      const {\n        stateNode: { containerInfo },\n        memoizedProps: children,\n      } = node;\n      const props = { containerInfo, children };\n      return {\n        nodeType: 'portal',\n        type: Portal,\n        props,\n        key: ensureKeyOrUndefined(node.key),\n        ref: node.ref,\n        instance: null,\n        rendered: childrenToTree(node.child),\n      };\n    }\n    case ClassComponent:\n      return {\n        nodeType: 'class',\n        type: node.type,\n        props: { ...node.memoizedProps },\n        key: ensureKeyOrUndefined(node.key),\n        ref: node.ref,\n        instance: node.stateNode,\n        rendered: childrenToTree(node.child),\n      };\n    case FunctionalComponent: // 1\n      return {\n        nodeType: 'function',\n        type: node.type,\n        props: { ...node.memoizedProps },\n        key: ensureKeyOrUndefined(node.key),\n        ref: node.ref,\n        instance: null,\n        rendered: childrenToTree(node.child),\n      };\n    case HostComponent: { // 5\n      let renderedNodes = flatten(nodeAndSiblingsArray(node.child).map(toTree));\n      if (renderedNodes.length === 0) {\n        renderedNodes = [node.memoizedProps.children];\n      }\n      return {\n        nodeType: 'host',\n        type: node.type,\n        props: { ...node.memoizedProps },\n        key: ensureKeyOrUndefined(node.key),\n        ref: node.ref,\n        instance: node.stateNode,\n        rendered: renderedNodes,\n      };\n    }\n    case HostText: // 6\n      return node.memoizedProps;\n    case FragmentType: // 10\n    case Mode: // 11\n      return childrenToTree(node.child);\n    default:\n      throw new Error(`Enzyme Internal Error: unknown node with tag ${node.tag}`);\n  }\n}\n\nfunction childrenToTree(node) {\n  if (!node) {\n    return null;\n  }\n  const children = nodeAndSiblingsArray(node);\n  if (children.length === 0) {\n    return null;\n  }\n  if (children.length === 1) {\n    return toTree(children[0]);\n  }\n  return flatten(children.map(toTree));\n}\n\nfunction nodeToHostNode(_node) {\n  // NOTE(lmr): node could be a function component\n  // which wont have an instance prop, but we can get the\n  // host node associated with its return value at that point.\n  // Although this breaks down if the return value is an array,\n  // as is possible with React 16.\n  let node = _node;\n  while (node && !Array.isArray(node) && node.instance === null) {\n    node = node.rendered;\n  }\n  // if the SFC returned null effectively, there is no host node.\n  if (!node) {\n    return null;\n  }\n\n  const mapper = (item) => {\n    if (item && item.instance) return ReactDOM.findDOMNode(item.instance);\n    return null;\n  };\n  if (Array.isArray(node)) {\n    return node.map(mapper);\n  }\n  if (Array.isArray(node.rendered) && node.nodeType === 'class') {\n    return node.rendered.map(mapper);\n  }\n  return mapper(node);\n}\n\nconst eventOptions = { animation: true };\n\nfunction getEmptyStateValue() {\n  // this handles a bug in React 16.0 - 16.2\n  // see https://github.com/facebook/react/commit/39be83565c65f9c522150e52375167568a2a1459\n  // also see https://github.com/facebook/react/pull/11965\n\n  // eslint-disable-next-line react/prefer-stateless-function\n  class EmptyState extends React.Component {\n    render() {\n      return null;\n    }\n  }\n  const testRenderer = new ShallowRenderer();\n  testRenderer.render(React.createElement(EmptyState));\n  return testRenderer._instance.state;\n}\n\nclass ReactSixteenTwoAdapter extends EnzymeAdapter {\n  constructor() {\n    super();\n    const { lifecycles } = this.options;\n    this.options = {\n      ...this.options,\n      enableComponentDidUpdateOnSetState: true, // TODO: remove, semver-major\n      legacyContextMode: 'parent',\n      lifecycles: {\n        ...lifecycles,\n        componentDidUpdate: {\n          onSetState: true,\n        },\n        setState: {\n          skipsComponentDidUpdateOnNullish: true,\n        },\n        getChildContext: {\n          calledByRenderer: false,\n        },\n      },\n    };\n  }\n\n  createMountRenderer(options) {\n    assertDomAvailable('mount');\n    const { attachTo, hydrateIn, wrappingComponentProps } = options;\n    const domNode = hydrateIn || attachTo || global.document.createElement('div');\n    let instance = null;\n    const adapter = this;\n    return {\n      render(el, context, callback) {\n        if (instance === null) {\n          const { type, props, ref } = el;\n          const wrapperProps = {\n            Component: type,\n            props,\n            wrappingComponentProps,\n            context,\n            ...(ref && { refProp: ref }),\n          };\n          const ReactWrapperComponent = createMountWrapper(el, { ...options, adapter });\n          const wrappedEl = React.createElement(ReactWrapperComponent, wrapperProps);\n          instance = hydrateIn\n            ? ReactDOM.hydrate(wrappedEl, domNode)\n            : ReactDOM.render(wrappedEl, domNode);\n          if (typeof callback === 'function') {\n            callback();\n          }\n        } else {\n          instance.setChildProps(el.props, context, callback);\n        }\n      },\n      unmount() {\n        ReactDOM.unmountComponentAtNode(domNode);\n        instance = null;\n      },\n      getNode() {\n        if (!instance) {\n          return null;\n        }\n        return getNodeFromRootFinder(\n          adapter.isCustomComponent,\n          toTree(instance._reactInternalFiber),\n          options,\n        );\n      },\n      simulateError(nodeHierarchy, rootNode, error) {\n        const { instance: catchingInstance } = nodeHierarchy\n          .find((x) => x.instance && x.instance.componentDidCatch) || {};\n\n        simulateError(\n          error,\n          catchingInstance,\n          rootNode,\n          nodeHierarchy,\n          nodeTypeFromType,\n          adapter.displayNameOfNode,\n        );\n      },\n      simulateEvent(node, event, mock) {\n        const mappedEvent = mapNativeEventNames(event, eventOptions);\n        const eventFn = TestUtils.Simulate[mappedEvent];\n        if (!eventFn) {\n          throw new TypeError(`ReactWrapper::simulate() event '${event}' does not exist`);\n        }\n        // eslint-disable-next-line react/no-find-dom-node\n        eventFn(adapter.nodeToHostNode(node), mock);\n      },\n      batchedUpdates(fn) {\n        return fn();\n        // return ReactDOM.unstable_batchedUpdates(fn);\n      },\n      getWrappingComponentRenderer() {\n        return {\n          ...this,\n          ...getWrappingComponentMountRenderer({\n            toTree: (inst) => toTree(inst._reactInternalFiber),\n            getMountWrapperInstance: () => instance,\n          }),\n        };\n      },\n    };\n  }\n\n  createShallowRenderer(/* options */) {\n    const adapter = this;\n    const renderer = new ShallowRenderer();\n    let isDOM = false;\n    let cachedNode = null;\n    return {\n      render(el, unmaskedContext) {\n        cachedNode = el;\n        /* eslint consistent-return: 0 */\n        if (typeof el.type === 'string') {\n          isDOM = true;\n        } else {\n          isDOM = false;\n          const { type: Component } = el;\n\n          const isStateful = Component.prototype && (\n            Component.prototype.isReactComponent\n            || Array.isArray(Component.__reactAutoBindPairs) // fallback for createClass components\n          );\n          const context = getMaskedContext(Component.contextTypes, unmaskedContext);\n\n          if (!isStateful && typeof Component === 'function') {\n            const wrappedEl = Object.assign(\n              (...args) => Component(...args), // eslint-disable-line new-cap\n              Component,\n            );\n            return withSetStateAllowed(() => renderer.render({ ...el, type: wrappedEl }, context));\n          }\n          if (isStateful) {\n            if (\n              renderer._instance\n              && el.props === renderer._instance.props\n              && !shallowEqual(context, renderer._instance.context)\n            ) {\n              const { restore } = spyMethod(\n                renderer,\n                '_updateClassComponent',\n                (originalMethod) => function _updateClassComponent(...args) {\n                  const { props } = renderer._instance;\n                  const clonedProps = { ...props };\n                  renderer._instance.props = clonedProps;\n\n                  const result = originalMethod.apply(renderer, args);\n\n                  renderer._instance.props = props;\n                  restore();\n\n                  return result;\n                },\n              );\n            }\n\n            // fix react bug; see implementation of `getEmptyStateValue`\n            const emptyStateValue = getEmptyStateValue();\n            if (emptyStateValue) {\n              Object.defineProperty(Component.prototype, 'state', {\n                configurable: true,\n                enumerable: true,\n                get() {\n                  return null;\n                },\n                set(value) {\n                  if (value !== emptyStateValue) {\n                    Object.defineProperty(this, 'state', {\n                      configurable: true,\n                      enumerable: true,\n                      value,\n                      writable: true,\n                    });\n                  }\n                },\n              });\n            }\n          }\n          return withSetStateAllowed(() => renderer.render(el, context));\n        }\n      },\n      unmount() {\n        renderer.unmount();\n      },\n      getNode() {\n        if (isDOM) {\n          return elementToTree(cachedNode);\n        }\n        const output = renderer.getRenderOutput();\n        return {\n          nodeType: nodeTypeFromType(cachedNode.type),\n          type: cachedNode.type,\n          props: cachedNode.props,\n          key: ensureKeyOrUndefined(cachedNode.key),\n          ref: cachedNode.ref,\n          instance: renderer._instance,\n          rendered: Array.isArray(output)\n            ? flatten(output).map((el) => elementToTree(el))\n            : elementToTree(output),\n        };\n      },\n      simulateError(nodeHierarchy, rootNode, error) {\n        simulateError(\n          error,\n          renderer._instance,\n          cachedNode,\n          nodeHierarchy.concat(cachedNode),\n          nodeTypeFromType,\n          adapter.displayNameOfNode,\n        );\n      },\n      simulateEvent(node, event, ...args) {\n        const handler = node.props[propFromEvent(event, eventOptions)];\n        if (handler) {\n          withSetStateAllowed(() => {\n            // TODO(lmr): create/use synthetic events\n            // TODO(lmr): emulate React's event propagation\n            // ReactDOM.unstable_batchedUpdates(() => {\n            handler(...args);\n            // });\n          });\n        }\n      },\n      batchedUpdates(fn) {\n        return fn();\n        // return ReactDOM.unstable_batchedUpdates(fn);\n      },\n      checkPropTypes(typeSpecs, values, location, hierarchy) {\n        return checkPropTypes(\n          typeSpecs,\n          values,\n          location,\n          displayNameOfNode(cachedNode),\n          () => getComponentStack(hierarchy.concat([cachedNode])),\n        );\n      },\n    };\n  }\n\n  createStringRenderer(options) {\n    return {\n      render(el, context) {\n        if (options.context && (el.type.contextTypes || options.childContextTypes)) {\n          const childContextTypes = {\n            ...(el.type.contextTypes || {}),\n            ...options.childContextTypes,\n          };\n          const ContextWrapper = createRenderWrapper(el, context, childContextTypes);\n          return ReactDOMServer.renderToStaticMarkup(React.createElement(ContextWrapper));\n        }\n        return ReactDOMServer.renderToStaticMarkup(el);\n      },\n    };\n  }\n\n  // Provided a bag of options, return an `EnzymeRenderer`. Some options can be implementation\n  // specific, like `attach` etc. for React, but not part of this interface explicitly.\n  // eslint-disable-next-line class-methods-use-this, no-unused-vars\n  createRenderer(options) {\n    switch (options.mode) {\n      case EnzymeAdapter.MODES.MOUNT: return this.createMountRenderer(options);\n      case EnzymeAdapter.MODES.SHALLOW: return this.createShallowRenderer(options);\n      case EnzymeAdapter.MODES.STRING: return this.createStringRenderer(options);\n      default:\n        throw new Error(`Enzyme Internal Error: Unrecognized mode: ${options.mode}`);\n    }\n  }\n\n  wrap(element) {\n    return wrap(element);\n  }\n\n  // converts an RSTNode to the corresponding JSX Pragma Element. This will be needed\n  // in order to implement the `Wrapper.mount()` and `Wrapper.shallow()` methods, but should\n  // be pretty straightforward for people to implement.\n  // eslint-disable-next-line class-methods-use-this, no-unused-vars\n  nodeToElement(node) {\n    if (!node || typeof node !== 'object') return null;\n    return React.createElement(node.type, propsWithKeysAndRef(node));\n  }\n\n  elementToNode(element) {\n    return elementToTree(element);\n  }\n\n  nodeToHostNode(node, supportsArray = false) {\n    const nodes = nodeToHostNode(node);\n    if (Array.isArray(nodes) && !supportsArray) {\n      return nodes[0];\n    }\n    return nodes;\n  }\n\n  displayNameOfNode(node) {\n    if (!node) return null;\n\n    const { type, $$typeof } = node;\n    return displayNamesByType[type || $$typeof] || displayNameOfNode(node);\n  }\n\n  isValidElement(element) {\n    return isElement(element);\n  }\n\n  isValidElementType(object) {\n    return isValidElementType(object);\n  }\n\n  isCustomComponent(component) {\n    return typeof component === 'function';\n  }\n\n  isFragment(fragment) {\n    return typeOfNode(fragment) === Fragment;\n  }\n\n  createElement(...args) {\n    return React.createElement(...args);\n  }\n\n  wrapWithWrappingComponent(node, options) {\n    return {\n      RootFinder,\n      node: wrapWithWrappingComponent(React.createElement, node, options),\n    };\n  }\n}\n\nexport default ReactSixteenTwoAdapter;\n"
  },
  {
    "path": "packages/enzyme-adapter-react-16.2/src/index.js",
    "content": "module.exports = require('./ReactSixteenTwoAdapter');\n"
  },
  {
    "path": "packages/enzyme-adapter-react-16.3/.babelrc",
    "content": "{\n  \"presets\": [\n    [\"airbnb\", { \"transformRuntime\": false }],\n  ],\n  \"plugins\": [\n    [\"transform-replace-object-assign\", { \"moduleSpecifier\": \"object.assign\" }],\n    [\"add-module-exports\"],\n  ],\n  \"sourceMaps\": \"both\",\n}\n"
  },
  {
    "path": "packages/enzyme-adapter-react-16.3/.eslintignore",
    "content": "_book/\nbuild/\nnode_modules/\n**/node_modules/\n"
  },
  {
    "path": "packages/enzyme-adapter-react-16.3/.eslintrc",
    "content": "{\n  \"extends\": \"airbnb\",\n  \"parser\": \"@babel/eslint-parser\",\n  \"root\": true,\n  \"ignorePatterns\": [\"build/\"],\n  \"rules\": {\n    \"max-len\": 0,\n    \"react/no-deprecated\": 0,\n    \"react/no-find-dom-node\": 0,\n    \"react/no-multi-comp\": 0,\n    \"no-underscore-dangle\": 0,\n    \"class-methods-use-this\": 0\n  },\n  \"settings\": {\n    \"react\": {\n      \"version\": \"16.3.0\",\n    },\n  },\n}\n"
  },
  {
    "path": "packages/enzyme-adapter-react-16.3/.npmrc",
    "content": "package-lock=false\n"
  },
  {
    "path": "packages/enzyme-adapter-react-16.3/package.json",
    "content": "{\n  \"name\": \"enzyme-adapter-react-16.3\",\n  \"version\": \"1.7.5\",\n  \"description\": \"JavaScript Testing utilities for React\",\n  \"homepage\": \"https://enzymejs.github.io/enzyme/\",\n  \"main\": \"build\",\n  \"scripts\": {\n    \"prepack\": \"npmignore --auto --commentLines=autogenerated --gitignore=../../.gitignore && cp ../../{LICENSE,README}.md ./ && npm run build\",\n    \"prepublishOnly\": \"safe-publish-latest\",\n    \"prepublish\": \"not-in-publish || npm run prepublishOnly\",\n    \"clean\": \"rimraf build\",\n    \"lint\": \"eslint --ext js,jsx .\",\n    \"pretest\": \"npm run lint\",\n    \"prebuild\": \"npm run clean\",\n    \"build\": \"babel --source-maps=both src --out-dir build\",\n    \"watch\": \"npm run build -- -w\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/enzymejs/enzyme.git\",\n    \"directory\": \"packages/enzyme-adapter-react-16.3\"\n  },\n  \"keywords\": [\n    \"javascript\",\n    \"shallow rendering\",\n    \"shallowRender\",\n    \"test\",\n    \"reactjs\",\n    \"react\",\n    \"flux\",\n    \"testing\",\n    \"test utils\",\n    \"assertion helpers\",\n    \"tdd\",\n    \"mocha\"\n  ],\n  \"author\": \"Jordan Harband <ljharb@gmail.com>\",\n  \"funding\": {\n    \"url\": \"https://github.com/sponsors/ljharb\"\n  },\n  \"license\": \"MIT\",\n  \"dependencies\": {\n    \"enzyme-adapter-utils\": \"^1.14.2\",\n    \"enzyme-shallow-equal\": \"^1.0.7\",\n    \"object.assign\": \"^4.1.7\",\n    \"object.values\": \"^1.2.1\",\n    \"prop-types\": \"^15.8.1\",\n    \"react-is\": \"^16.13.1\",\n    \"react-reconciler\": \"^0.7.0\",\n    \"react-test-renderer\": \"~16.3.0-0\"\n  },\n  \"peerDependencies\": {\n    \"enzyme\": \"^3.0.0\",\n    \"react\": \"~16.3.0-0\",\n    \"react-dom\": \"~16.3.0-0\"\n  },\n  \"devDependencies\": {\n    \"@babel/cli\": \"^7.28.3\",\n    \"@babel/core\": \"^7.28.4\",\n    \"@babel/eslint-parser\": \"^7.28.4\",\n    \"babel-plugin-add-module-exports\": \"^1.0.4\",\n    \"babel-plugin-transform-replace-object-assign\": \"^2.0.0\",\n    \"babel-preset-airbnb\": \"^4.5.0\",\n    \"enzyme\": \"^3.0.0\",\n    \"eslint\": \"^8.56.0\",\n    \"eslint-config-airbnb\": \"^19.0.4\",\n    \"eslint-plugin-import\": \"^2.32.0\",\n    \"eslint-plugin-jsx-a11y\": \"^6.10.2\",\n    \"eslint-plugin-react\": \"^7.37.5\",\n    \"eslint-plugin-react-hooks\": \"^4.6.0\",\n    \"in-publish\": \"^2.0.1\",\n    \"npmignore\": \"^0.3.1\",\n    \"rimraf\": \"^2.7.1\",\n    \"safe-publish-latest\": \"^2.0.0\"\n  },\n  \"publishConfig\": {\n    \"ignore\": [\n      \"!build\"\n    ]\n  }\n}\n"
  },
  {
    "path": "packages/enzyme-adapter-react-16.3/src/ReactSixteenThreeAdapter.js",
    "content": "/* eslint no-use-before-define: 0 */\nimport React from 'react';\nimport ReactDOM from 'react-dom';\n// eslint-disable-next-line import/no-unresolved\nimport ReactDOMServer from 'react-dom/server';\n// eslint-disable-next-line import/no-unresolved\nimport ShallowRenderer from 'react-test-renderer/shallow';\n// eslint-disable-next-line import/no-unresolved\nimport TestUtils from 'react-dom/test-utils';\nimport checkPropTypes from 'prop-types/checkPropTypes';\nimport {\n  AsyncMode,\n  ContextConsumer,\n  ContextProvider,\n  Element,\n  ForwardRef,\n  Fragment,\n  isContextConsumer,\n  isContextProvider,\n  isElement,\n  isForwardRef,\n  isPortal,\n  isValidElementType,\n  Portal,\n  StrictMode,\n} from 'react-is';\nimport { EnzymeAdapter } from 'enzyme';\nimport { typeOfNode } from 'enzyme/build/Utils';\nimport shallowEqual from 'enzyme-shallow-equal';\nimport {\n  displayNameOfNode,\n  elementToTree as utilElementToTree,\n  nodeTypeFromType as utilNodeTypeFromType,\n  mapNativeEventNames,\n  propFromEvent,\n  assertDomAvailable,\n  withSetStateAllowed,\n  createRenderWrapper,\n  createMountWrapper,\n  propsWithKeysAndRef,\n  ensureKeyOrUndefined,\n  simulateError,\n  wrap,\n  getComponentStack,\n  RootFinder,\n  getNodeFromRootFinder,\n  wrapWithWrappingComponent,\n  getWrappingComponentMountRenderer,\n  spyMethod,\n} from 'enzyme-adapter-utils';\nimport { findCurrentFiberUsingSlowPath } from 'react-reconciler/reflection';\n\nconst HostRoot = 3;\nconst ClassComponent = 2;\nconst FragmentType = 10;\nconst FunctionalComponent = 1;\nconst HostPortal = 4;\nconst HostComponent = 5;\nconst HostText = 6;\nconst Mode = 11;\nconst ContextConsumerType = 12;\nconst ContextProviderType = 13;\nconst ForwardRefType = 14;\n\nfunction nodeAndSiblingsArray(nodeWithSibling) {\n  const array = [];\n  let node = nodeWithSibling;\n  while (node != null) {\n    array.push(node);\n    node = node.sibling;\n  }\n  return array;\n}\n\nfunction flatten(arr) {\n  const result = [];\n  const stack = [{ i: 0, array: arr }];\n  while (stack.length) {\n    const n = stack.pop();\n    while (n.i < n.array.length) {\n      const el = n.array[n.i];\n      n.i += 1;\n      if (Array.isArray(el)) {\n        stack.push(n);\n        stack.push({ i: 0, array: el });\n        break;\n      }\n      result.push(el);\n    }\n  }\n  return result;\n}\n\nfunction nodeTypeFromType(type) {\n  if (type === Portal) {\n    return 'portal';\n  }\n\n  return utilNodeTypeFromType(type);\n}\n\nfunction elementToTree(el) {\n  if (!isPortal(el)) {\n    return utilElementToTree(el, elementToTree);\n  }\n\n  const { children, containerInfo } = el;\n  const props = { children, containerInfo };\n\n  return {\n    nodeType: 'portal',\n    type: Portal,\n    props,\n    key: ensureKeyOrUndefined(el.key),\n    ref: el.ref || null,\n    instance: null,\n    rendered: elementToTree(el.children),\n  };\n}\n\nfunction toTree(vnode) {\n  if (vnode == null) {\n    return null;\n  }\n  // TODO(lmr): I'm not really sure I understand whether or not this is what\n  // i should be doing, or if this is a hack for something i'm doing wrong\n  // somewhere else. Should talk to sebastian about this perhaps\n  const node = findCurrentFiberUsingSlowPath(vnode);\n  switch (node.tag) {\n    case HostRoot: // 3\n      return childrenToTree(node.child);\n    case HostPortal: { // 4\n      const {\n        stateNode: { containerInfo },\n        memoizedProps: children,\n      } = node;\n      const props = { containerInfo, children };\n      return {\n        nodeType: 'portal',\n        type: Portal,\n        props,\n        key: ensureKeyOrUndefined(node.key),\n        ref: node.ref,\n        instance: null,\n        rendered: childrenToTree(node.child),\n      };\n    }\n    case ClassComponent:\n      return {\n        nodeType: 'class',\n        type: node.type,\n        props: { ...node.memoizedProps },\n        key: ensureKeyOrUndefined(node.key),\n        ref: node.ref,\n        instance: node.stateNode,\n        rendered: childrenToTree(node.child),\n      };\n    case FunctionalComponent: // 1\n      return {\n        nodeType: 'function',\n        type: node.type,\n        props: { ...node.memoizedProps },\n        key: ensureKeyOrUndefined(node.key),\n        ref: node.ref,\n        instance: null,\n        rendered: childrenToTree(node.child),\n      };\n    case HostComponent: { // 5\n      let renderedNodes = flatten(nodeAndSiblingsArray(node.child).map(toTree));\n      if (renderedNodes.length === 0) {\n        renderedNodes = [node.memoizedProps.children];\n      }\n      return {\n        nodeType: 'host',\n        type: node.type,\n        props: { ...node.memoizedProps },\n        key: ensureKeyOrUndefined(node.key),\n        ref: node.ref,\n        instance: node.stateNode,\n        rendered: renderedNodes,\n      };\n    }\n    case HostText: // 6\n      return node.memoizedProps;\n    case FragmentType: // 10\n    case Mode: // 11\n    case ContextProviderType: // 13\n    case ContextConsumerType: // 12\n      return childrenToTree(node.child);\n    case ForwardRefType: {\n      return {\n        nodeType: 'function',\n        type: node.type,\n        props: { ...node.pendingProps },\n        key: ensureKeyOrUndefined(node.key),\n        ref: node.ref,\n        instance: null,\n        rendered: childrenToTree(node.child),\n      };\n    }\n    default:\n      throw new Error(`Enzyme Internal Error: unknown node with tag ${node.tag}`);\n  }\n}\n\nfunction childrenToTree(node) {\n  if (!node) {\n    return null;\n  }\n  const children = nodeAndSiblingsArray(node);\n  if (children.length === 0) {\n    return null;\n  }\n  if (children.length === 1) {\n    return toTree(children[0]);\n  }\n  return flatten(children.map(toTree));\n}\n\nfunction nodeToHostNode(_node) {\n  // NOTE(lmr): node could be a function component\n  // which wont have an instance prop, but we can get the\n  // host node associated with its return value at that point.\n  // Although this breaks down if the return value is an array,\n  // as is possible with React 16.\n  let node = _node;\n  while (node && !Array.isArray(node) && node.instance === null) {\n    node = node.rendered;\n  }\n  // if the SFC returned null effectively, there is no host node.\n  if (!node) {\n    return null;\n  }\n\n  const mapper = (item) => {\n    if (item && item.instance) return ReactDOM.findDOMNode(item.instance);\n    return null;\n  };\n  if (Array.isArray(node)) {\n    return node.map(mapper);\n  }\n  if (Array.isArray(node.rendered) && node.nodeType === 'class') {\n    return node.rendered.map(mapper);\n  }\n  return mapper(node);\n}\n\nfunction getProviderDefaultValue(Provider) {\n  // React stores references to the Provider's defaultValue differently across versions.\n  if ('_defaultValue' in Provider._context) {\n    return Provider._context._defaultValue;\n  }\n  throw new Error('Enzyme Internal Error: can’t figure out how to get Provider’s default value');\n}\n\nfunction makeFakeElement(type) {\n  return { $$typeof: Element, type };\n}\n\nconst eventOptions = { animation: true };\n\nclass ReactSixteenThreeAdapter extends EnzymeAdapter {\n  constructor() {\n    super();\n    const { lifecycles } = this.options;\n    this.options = {\n      ...this.options,\n      enableComponentDidUpdateOnSetState: true, // TODO: remove, semver-major\n      legacyContextMode: 'parent',\n      lifecycles: {\n        ...lifecycles,\n        componentDidUpdate: {\n          onSetState: true,\n        },\n        getDerivedStateFromProps: {\n          hasShouldComponentUpdateBug: true,\n        },\n        getSnapshotBeforeUpdate: true,\n        setState: {\n          skipsComponentDidUpdateOnNullish: true,\n        },\n        getChildContext: {\n          calledByRenderer: false,\n        },\n      },\n    };\n  }\n\n  createMountRenderer(options) {\n    assertDomAvailable('mount');\n    const { attachTo, hydrateIn, wrappingComponentProps } = options;\n    const domNode = hydrateIn || attachTo || global.document.createElement('div');\n    let instance = null;\n    const adapter = this;\n    return {\n      render(el, context, callback) {\n        if (instance === null) {\n          const { type, props, ref } = el;\n          const wrapperProps = {\n            Component: type,\n            props,\n            wrappingComponentProps,\n            context,\n            ...(ref && { refProp: ref }),\n          };\n          const ReactWrapperComponent = createMountWrapper(el, { ...options, adapter });\n          const wrappedEl = React.createElement(ReactWrapperComponent, wrapperProps);\n          instance = hydrateIn\n            ? ReactDOM.hydrate(wrappedEl, domNode)\n            : ReactDOM.render(wrappedEl, domNode);\n          if (typeof callback === 'function') {\n            callback();\n          }\n        } else {\n          instance.setChildProps(el.props, context, callback);\n        }\n      },\n      unmount() {\n        ReactDOM.unmountComponentAtNode(domNode);\n        instance = null;\n      },\n      getNode() {\n        if (!instance) {\n          return null;\n        }\n        return getNodeFromRootFinder(\n          adapter.isCustomComponent,\n          toTree(instance._reactInternalFiber),\n          options,\n        );\n      },\n      simulateError(nodeHierarchy, rootNode, error) {\n        const { instance: catchingInstance } = nodeHierarchy\n          .find((x) => x.instance && x.instance.componentDidCatch) || {};\n\n        simulateError(\n          error,\n          catchingInstance,\n          rootNode,\n          nodeHierarchy,\n          nodeTypeFromType,\n          adapter.displayNameOfNode,\n        );\n      },\n      simulateEvent(node, event, mock) {\n        const mappedEvent = mapNativeEventNames(event, eventOptions);\n        const eventFn = TestUtils.Simulate[mappedEvent];\n        if (!eventFn) {\n          throw new TypeError(`ReactWrapper::simulate() event '${event}' does not exist`);\n        }\n        // eslint-disable-next-line react/no-find-dom-node\n        eventFn(adapter.nodeToHostNode(node), mock);\n      },\n      batchedUpdates(fn) {\n        return fn();\n        // return ReactDOM.unstable_batchedUpdates(fn);\n      },\n      getWrappingComponentRenderer() {\n        return {\n          ...this,\n          ...getWrappingComponentMountRenderer({\n            toTree: (inst) => toTree(inst._reactInternalFiber),\n            getMountWrapperInstance: () => instance,\n          }),\n        };\n      },\n    };\n  }\n\n  createShallowRenderer(/* options */) {\n    const adapter = this;\n    const renderer = new ShallowRenderer();\n    let isDOM = false;\n    let cachedNode = null;\n    return {\n      render(el, context, {\n        providerValues = new Map(),\n      } = {}) {\n        cachedNode = el;\n        /* eslint consistent-return: 0 */\n        if (typeof el.type === 'string') {\n          isDOM = true;\n        } else if (isContextProvider(el)) {\n          providerValues.set(el.type, el.props.value);\n          const MockProvider = Object.assign(\n            (props) => props.children,\n            el.type,\n          );\n          return withSetStateAllowed(() => renderer.render({ ...el, type: MockProvider }));\n        } else if (isContextConsumer(el)) {\n          const Provider = adapter.getProviderFromConsumer(el.type);\n          const value = providerValues.has(Provider)\n            ? providerValues.get(Provider)\n            : getProviderDefaultValue(Provider);\n          const MockConsumer = Object.assign(\n            (props) => props.children(value),\n            el.type,\n          );\n          return withSetStateAllowed(() => renderer.render({ ...el, type: MockConsumer }));\n        } else {\n          isDOM = false;\n          const { type: Component } = el;\n\n          const isStateful = Component.prototype && (\n            Component.prototype.isReactComponent\n            || Array.isArray(Component.__reactAutoBindPairs) // fallback for createClass components\n          );\n\n          if (!isStateful && typeof Component === 'function') {\n            const wrappedEl = Object.assign(\n              (...args) => Component(...args), // eslint-disable-line new-cap\n              Component,\n            );\n            return withSetStateAllowed(() => renderer.render({ ...el, type: wrappedEl }, context));\n          }\n\n          if (isStateful) {\n            if (\n              renderer._instance\n              && el.props === renderer._instance.props\n              && !shallowEqual(context, renderer._instance.context)\n            ) {\n              const { restore } = spyMethod(\n                renderer,\n                '_updateClassComponent',\n                (originalMethod) => function _updateClassComponent(...args) {\n                  const { props } = renderer._instance;\n                  const clonedProps = { ...props };\n                  renderer._instance.props = clonedProps;\n\n                  const result = originalMethod.apply(renderer, args);\n\n                  renderer._instance.props = props;\n                  restore();\n\n                  return result;\n                },\n              );\n            }\n          }\n\n          return withSetStateAllowed(() => renderer.render(el, context));\n        }\n      },\n      unmount() {\n        renderer.unmount();\n      },\n      getNode() {\n        if (isDOM) {\n          return elementToTree(cachedNode);\n        }\n        const output = renderer.getRenderOutput();\n        return {\n          nodeType: nodeTypeFromType(cachedNode.type),\n          type: cachedNode.type,\n          props: cachedNode.props,\n          key: ensureKeyOrUndefined(cachedNode.key),\n          ref: cachedNode.ref,\n          instance: renderer._instance,\n          rendered: Array.isArray(output)\n            ? flatten(output).map((el) => elementToTree(el))\n            : elementToTree(output),\n        };\n      },\n      simulateError(nodeHierarchy, rootNode, error) {\n        simulateError(\n          error,\n          renderer._instance,\n          cachedNode,\n          nodeHierarchy.concat(cachedNode),\n          nodeTypeFromType,\n          adapter.displayNameOfNode,\n        );\n      },\n      simulateEvent(node, event, ...args) {\n        const handler = node.props[propFromEvent(event, eventOptions)];\n        if (handler) {\n          withSetStateAllowed(() => {\n            // TODO(lmr): create/use synthetic events\n            // TODO(lmr): emulate React's event propagation\n            // ReactDOM.unstable_batchedUpdates(() => {\n            handler(...args);\n            // });\n          });\n        }\n      },\n      batchedUpdates(fn) {\n        return fn();\n        // return ReactDOM.unstable_batchedUpdates(fn);\n      },\n      checkPropTypes(typeSpecs, values, location, hierarchy) {\n        return checkPropTypes(\n          typeSpecs,\n          values,\n          location,\n          displayNameOfNode(cachedNode),\n          () => getComponentStack(hierarchy.concat([cachedNode])),\n        );\n      },\n    };\n  }\n\n  createStringRenderer(options) {\n    return {\n      render(el, context) {\n        if (options.context && (el.type.contextTypes || options.childContextTypes)) {\n          const childContextTypes = {\n            ...(el.type.contextTypes || {}),\n            ...options.childContextTypes,\n          };\n          const ContextWrapper = createRenderWrapper(el, context, childContextTypes);\n          return ReactDOMServer.renderToStaticMarkup(React.createElement(ContextWrapper));\n        }\n        return ReactDOMServer.renderToStaticMarkup(el);\n      },\n    };\n  }\n\n  // Provided a bag of options, return an `EnzymeRenderer`. Some options can be implementation\n  // specific, like `attach` etc. for React, but not part of this interface explicitly.\n  // eslint-disable-next-line class-methods-use-this, no-unused-vars\n  createRenderer(options) {\n    switch (options.mode) {\n      case EnzymeAdapter.MODES.MOUNT: return this.createMountRenderer(options);\n      case EnzymeAdapter.MODES.SHALLOW: return this.createShallowRenderer(options);\n      case EnzymeAdapter.MODES.STRING: return this.createStringRenderer(options);\n      default:\n        throw new Error(`Enzyme Internal Error: Unrecognized mode: ${options.mode}`);\n    }\n  }\n\n  wrap(element) {\n    return wrap(element);\n  }\n\n  // converts an RSTNode to the corresponding JSX Pragma Element. This will be needed\n  // in order to implement the `Wrapper.mount()` and `Wrapper.shallow()` methods, but should\n  // be pretty straightforward for people to implement.\n  // eslint-disable-next-line class-methods-use-this, no-unused-vars\n  nodeToElement(node) {\n    if (!node || typeof node !== 'object') return null;\n    return React.createElement(node.type, propsWithKeysAndRef(node));\n  }\n\n  elementToNode(element) {\n    return elementToTree(element);\n  }\n\n  nodeToHostNode(node, supportsArray = false) {\n    const nodes = nodeToHostNode(node);\n    if (Array.isArray(nodes) && !supportsArray) {\n      return nodes[0];\n    }\n    return nodes;\n  }\n\n  displayNameOfNode(node) {\n    if (!node) return null;\n    const { type, $$typeof } = node;\n\n    const nodeType = type || $$typeof;\n\n    // newer node types may be undefined, so only test if the nodeType exists\n    if (nodeType) {\n      switch (nodeType) {\n        case AsyncMode || NaN: return 'AsyncMode';\n        case Fragment || NaN: return 'Fragment';\n        case StrictMode || NaN: return 'StrictMode';\n        case Portal || NaN: return 'Portal';\n        default:\n      }\n    }\n\n    const $$typeofType = type && type.$$typeof;\n\n    switch ($$typeofType) {\n      case ContextConsumer || NaN: return 'ContextConsumer';\n      case ContextProvider || NaN: return 'ContextProvider';\n      case ForwardRef || NaN: {\n        if (type.displayName) {\n          return type.displayName;\n        }\n        const name = displayNameOfNode({ type: type.render });\n        return name ? `ForwardRef(${name})` : 'ForwardRef';\n      }\n      default: return displayNameOfNode(node);\n    }\n  }\n\n  isValidElement(element) {\n    return isElement(element);\n  }\n\n  isValidElementType(object) {\n    return !!object && isValidElementType(object);\n  }\n\n  isFragment(fragment) {\n    return typeOfNode(fragment) === Fragment;\n  }\n\n  isCustomComponent(type) {\n    const fakeElement = makeFakeElement(type);\n    return !!type && (\n      typeof type === 'function'\n      || isForwardRef(fakeElement)\n      || isContextProvider(fakeElement)\n      || isContextConsumer(fakeElement)\n    );\n  }\n\n  isContextConsumer(type) {\n    return !!type && isContextConsumer(makeFakeElement(type));\n  }\n\n  isCustomComponentElement(inst) {\n    if (!inst || !this.isValidElement(inst)) {\n      return false;\n    }\n    return this.isCustomComponent(inst.type);\n  }\n\n  getProviderFromConsumer(Consumer) {\n    const { Provider } = Consumer || {};\n    if (Provider) {\n      return Provider;\n    }\n    throw new Error('Enzyme Internal Error: can’t figure out how to get Provider from Consumer');\n  }\n\n  createElement(...args) {\n    return React.createElement(...args);\n  }\n\n  wrapWithWrappingComponent(node, options) {\n    return {\n      RootFinder,\n      node: wrapWithWrappingComponent(React.createElement, node, options),\n    };\n  }\n}\n\nexport default ReactSixteenThreeAdapter;\n"
  },
  {
    "path": "packages/enzyme-adapter-react-16.3/src/index.js",
    "content": "module.exports = require('./ReactSixteenThreeAdapter');\n"
  },
  {
    "path": "packages/enzyme-adapter-react-helper/.babelrc",
    "content": "{\n  \"presets\": [\n    [\"airbnb\", { \"transformRuntime\": false }],\n  ],\n  \"plugins\": [\n    [\"transform-replace-object-assign\", { \"moduleSpecifier\": \"object.assign\" }],\n    [\"add-module-exports\"],\n  ],\n  \"sourceMaps\": \"both\",\n}\n"
  },
  {
    "path": "packages/enzyme-adapter-react-helper/.eslintrc",
    "content": "{\n  \"extends\": \"airbnb\",\n  \"parser\": \"@babel/eslint-parser\",\n  \"root\": true,\n  \"ignorePatterns\": [\"build/\"],\n  \"rules\": {\n    \"max-len\": 0,\n  },\n  \"settings\": {\n    \"react\": {\n      \"version\": \"detect\",\n    },\n  },\n}\n"
  },
  {
    "path": "packages/enzyme-adapter-react-helper/package.json",
    "content": "{\n  \"name\": \"enzyme-adapter-react-helper\",\n  \"version\": \"1.3.10\",\n  \"description\": \"JavaScript Testing utilities for React\",\n  \"homepage\": \"https://enzymejs.github.io/enzyme/\",\n  \"main\": \"build\",\n  \"scripts\": {\n    \"prepack\": \"npmignore --auto --commentLines=autogenerated --gitignore=../../.gitignore && cp ../../{LICENSE,README}.md ./ && npm run build\",\n    \"prepublishOnly\": \"safe-publish-latest\",\n    \"prepublish\": \"not-in-publish || npm run prepublishOnly\",\n    \"clean\": \"rimraf build\",\n    \"lint\": \"eslint --ext js,jsx .\",\n    \"pretest\": \"npm run lint\",\n    \"prebuild\": \"npm run clean\",\n    \"build\": \"babel --source-maps=both src --out-dir build\",\n    \"watch\": \"npm run build -- -w\"\n  },\n  \"bin\": {\n    \"enzyme-adapter-react-install\": \"./build/enzyme-adapter-react-install.js\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/enzymejs/enzyme.git\",\n    \"directory\": \"packages/enzyme-adapter-react-helper\"\n  },\n  \"keywords\": [\n    \"javascript\",\n    \"shallow rendering\",\n    \"shallowRender\",\n    \"test\",\n    \"reactjs\",\n    \"react\",\n    \"flux\",\n    \"testing\",\n    \"test utils\",\n    \"assertion helpers\",\n    \"tdd\",\n    \"mocha\"\n  ],\n  \"author\": \"Bruce Paul <brucewpaul@gmail.com>\",\n  \"funding\": {\n    \"url\": \"https://github.com/sponsors/ljharb\"\n  },\n  \"license\": \"MIT\",\n  \"devDependencies\": {\n    \"@babel/cli\": \"^7.28.3\",\n    \"@babel/core\": \"^7.28.4\",\n    \"@babel/eslint-parser\": \"^7.28.4\",\n    \"babel-plugin-add-module-exports\": \"^1.0.4\",\n    \"babel-plugin-transform-replace-object-assign\": \"^2.0.0\",\n    \"babel-preset-airbnb\": \"^4.5.0\",\n    \"enzyme\": \"^3.0.0\",\n    \"eslint\": \"^8.56.0\",\n    \"eslint-config-airbnb\": \"^19.0.4\",\n    \"eslint-plugin-import\": \"^2.32.0\",\n    \"eslint-plugin-jsx-a11y\": \"^6.10.2\",\n    \"eslint-plugin-react\": \"^7.37.5\",\n    \"eslint-plugin-react-hooks\": \"^4.6.0\",\n    \"in-publish\": \"^2.0.1\",\n    \"npmignore\": \"^0.3.1\",\n    \"react\": \"0.13.x || 0.14.x || ^15.0.0-0 || ^16.0.0-0 || ^16.3.0-0 || ^16.4.0-0\",\n    \"safe-publish-latest\": \"^2.0.0\"\n  },\n  \"peerDependencies\": {\n    \"enzyme\": \"^3.0.0\",\n    \"react\": \"0.13.x || 0.14.x || ^15.0.0-0 || ^16.0.0-0 || ^16.3.0-0 || ^16.4.0-0\"\n  },\n  \"dependencies\": {\n    \"airbnb-js-shims\": \"^2.2.1\",\n    \"install-peerdeps\": \"~1.8.0\",\n    \"npm-run\": \"^4.1.2\",\n    \"object.assign\": \"^4.1.7\",\n    \"object.getownpropertydescriptors\": \"^2.1.8\",\n    \"rimraf\": \"^2.7.1\",\n    \"semver\": \"^5.7.2\"\n  },\n  \"publishConfig\": {\n    \"ignore\": [\n      \"!build\"\n    ]\n  }\n}\n"
  },
  {
    "path": "packages/enzyme-adapter-react-helper/src/enzyme-adapter-react-install.js",
    "content": "#! /usr/bin/env node\n/* eslint no-console: 0 */\n\nimport 'airbnb-js-shims';\n\nimport semver from 'semver';\nimport npmRun from 'npm-run';\nimport getAdapterForReactVersion from './getAdapterForReactVersion';\n\nconst reactEnv = process.env.REACT;\nconst reactArg = process.argv[2];\n\nif (reactEnv && !semver.validRange(reactEnv)) {\n  throw new Error('REACT environment variable is not a valid semver range');\n}\n\nif (reactArg && !semver.validRange(reactArg)) {\n  throw new Error('Argument supplied to enzyme-adapter-react-install is not a valid semver range');\n}\n\nconst reactVersion = reactEnv || reactArg;\n\nif (!semver.intersects(reactVersion, '>=0.13')) {\n  throw new Error('semver range is not valid. Please provide a valid semver range as an argument or environment variable.');\n}\n\nconsole.log('Cleaning up React and related packages...');\nconst commands = [\n  'npm uninstall --no-save react-dom react-test-renderer react-addons-test-utils enzyme-adapter-react-14 enzyme-adapter-react-15.4 enzyme-adapter-react-15 enzyme-adapter-react-16',\n  'rimraf node_modules/react-test-renderer node_modules/react',\n  'npm prune',\n];\n\ntry {\n  commands.forEach((cmd) => {\n    npmRun.execSync(cmd, { stdio: 'inherit' });\n  });\n} catch (e) {\n  console.error('An uninstallation failed');\n  console.error(e, e.stack);\n  process.exit(1);\n}\n\nconsole.log(`Installing React@${reactVersion} and related packages...`);\nconst adapterName = getAdapterForReactVersion(reactVersion);\n\ntry {\n  npmRun.execSync(`install-peerdeps -S ${adapterName}`, { stdio: 'inherit' });\n} catch (e) {\n  console.error('An installation failed');\n  console.error(e, e.stack);\n  process.exit(666);\n}\n"
  },
  {
    "path": "packages/enzyme-adapter-react-helper/src/getAdapterForReactVersion.js",
    "content": "import semver from 'semver';\n\nfunction getValidRange(version) {\n  return semver.prerelease(version)\n    // Remove pre-release versions by incrementing them. This works because a pre-release is less\n    // than the corresponding non-pre-prelease version.\n    ? semver.inc(version, 'patch')\n    // Convert partial versions, such as 16 or 16.8, to their corresponding range notation, so that\n    // they work with the rest of the semver functions.\n    : semver.validRange(version);\n}\n\nexport default function getAdapterForReactVersion(reactVersion) {\n  const versionRange = getValidRange(reactVersion);\n\n  if (semver.intersects(versionRange, '^16.4.0')) {\n    return 'enzyme-adapter-react-16';\n  }\n  if (semver.intersects(versionRange, '~16.3.0')) {\n    return 'enzyme-adapter-react-16.3';\n  }\n  if (semver.intersects(versionRange, '~16.2')) {\n    return 'enzyme-adapter-react-16.2';\n  }\n  if (semver.intersects(versionRange, '~16.0.0 || ~16.1')) {\n    return 'enzyme-adapter-react-16.1';\n  }\n  if (semver.intersects(versionRange, '^15.5.0')) {\n    return 'enzyme-adapter-react-15';\n  }\n  if (semver.intersects(versionRange, '15.0.0 - 15.4.x')) {\n    return 'enzyme-adapter-react-15.4';\n  }\n  if (semver.intersects(versionRange, '^0.14.0')) {\n    return 'enzyme-adapter-react-14';\n  }\n  if (semver.intersects(versionRange, '^0.13.0')) {\n    return 'enzyme-adapter-react-13';\n  }\n\n  throw new RangeError(`No Enzyme adapter could be found for React version “${reactVersion}”`);\n}\n"
  },
  {
    "path": "packages/enzyme-adapter-react-helper/src/ifReact.js",
    "content": "import React from 'react';\nimport { intersects } from 'semver';\n\nexport default function ifReact(range, yes, no) {\n  if (typeof yes !== 'function') { throw new TypeError('\"yes\" must be a function'); }\n  if (typeof no !== 'function') { throw new TypeError('\"no\" must be a function'); }\n  return intersects(range, React.version) ? yes : no;\n}\n"
  },
  {
    "path": "packages/enzyme-adapter-react-helper/src/index.js",
    "content": "import { configure } from 'enzyme';\n\nexport default function setupEnzymeAdapter(enzymeOptions = {}, adapterOptions = {}) {\n  let Adapter;\n\n  try {\n    // eslint-disable-next-line import/no-extraneous-dependencies, global-require, import/no-unresolved\n    Adapter = require('enzyme-adapter-react-16');\n  } catch (R) {\n    try {\n      // eslint-disable-next-line import/no-extraneous-dependencies, global-require, import/no-unresolved\n      Adapter = require('enzyme-adapter-react-16.3');\n    } catch (E) {\n      try {\n        // eslint-disable-next-line import/no-extraneous-dependencies, global-require, import/no-unresolved\n        Adapter = require('enzyme-adapter-react-16.2');\n      } catch (A) {\n        try {\n          // eslint-disable-next-line import/no-extraneous-dependencies, global-require, import/no-unresolved\n          Adapter = require('enzyme-adapter-react-16.1');\n        } catch (r) {\n          try {\n            // eslint-disable-next-line import/no-extraneous-dependencies, global-require, import/no-unresolved\n            Adapter = require('enzyme-adapter-react-15');\n          } catch (e) {\n            try {\n              // eslint-disable-next-line import/no-extraneous-dependencies, global-require, import/no-unresolved\n              Adapter = require('enzyme-adapter-react-15.4');\n            } catch (a) {\n              try {\n                // eslint-disable-next-line import/no-extraneous-dependencies, global-require, import/no-unresolved\n                Adapter = require('enzyme-adapter-react-14');\n              } catch (c) {\n                try {\n                  // eslint-disable-next-line import/no-extraneous-dependencies, global-require, import/no-unresolved\n                  Adapter = require('enzyme-adapter-react-13');\n                } catch (t) {\n                  throw new Error('It seems as though you don’t have any `enzyme-adapter-react-*` installed. Please install the relevant version and try again.');\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n\n  configure({\n    adapter: new Adapter(adapterOptions),\n    ...enzymeOptions,\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-adapter-react-helper/src/safeSFC.jsx",
    "content": "import React from 'react';\nimport gOPDs from 'object.getownpropertydescriptors';\n\nimport ifReact from './ifReact';\n\nfunction assertFunction(fn) {\n  if (typeof fn !== 'function') {\n    throw new TypeError('Component must be a function');\n  }\n  return fn;\n}\n\nfunction copyStatics(source, target) {\n  assertFunction(source);\n\n  // eslint-disable-next-line no-param-reassign\n  target.displayName = source.displayName || source.name;\n  const {\n    prototype: oldProto,\n    ...descriptors\n  } = gOPDs(source);\n  Object.defineProperties(target, descriptors);\n\n  return target;\n}\n\nfunction nullToNoScript(fn) {\n  // eslint-disable-next-line prefer-arrow-callback\n  return copyStatics(fn, function NullHandler(...args) {\n    const element = fn(...args);\n    return element === null ? <noscript /> : element;\n  });\n}\n\nconst maybeNullWrapper = ifReact('^0.14', nullToNoScript, assertFunction);\n\nfunction safeSFC(fn) {\n  return copyStatics(fn, class SafeSFC extends React.Component {\n    render() {\n      return maybeNullWrapper(fn(this.props, this.context));\n    }\n  });\n}\n\nexport default ifReact('>= 0.14', maybeNullWrapper, safeSFC);\n"
  },
  {
    "path": "packages/enzyme-adapter-utils/.babelrc",
    "content": "{\n  \"presets\": [\n    [\"airbnb\", { \"transformRuntime\": false }],\n  ],\n  \"plugins\": [\n    [\"transform-replace-object-assign\", { \"moduleSpecifier\": \"object.assign\" }],\n    [\"add-module-exports\"],\n  ],\n  \"sourceMaps\": \"both\",\n}\n"
  },
  {
    "path": "packages/enzyme-adapter-utils/.eslintrc",
    "content": "{\n  \"extends\": \"airbnb\",\n  \"parser\": \"@babel/eslint-parser\",\n  \"root\": true,\n  \"ignorePatterns\": [\"build/\"],\n  \"overrides\": [\n    {\n      \"files\": [\"src/createMountWrapper.*\"],\n      \"rules\": {\n        \"no-underscore-dangle\": 0,\n      },\n    },\n  ],\n  \"rules\": {\n    \"max-len\": 0,\n  },\n  \"settings\": {\n    \"react\": {\n      \"version\": \"detect\",\n    },\n  },\n}\n"
  },
  {
    "path": "packages/enzyme-adapter-utils/package.json",
    "content": "{\n  \"name\": \"enzyme-adapter-utils\",\n  \"version\": \"1.14.2\",\n  \"description\": \"JavaScript Testing utilities for React\",\n  \"homepage\": \"https://enzymejs.github.io/enzyme/\",\n  \"main\": \"build\",\n  \"scripts\": {\n    \"prepack\": \"npmignore --auto --commentLines=autogenerated --gitignore=../../.gitignore && cp ../../{LICENSE,README}.md ./ && npm run build\",\n    \"prepublishOnly\": \"safe-publish-latest\",\n    \"prepublish\": \"not-in-publish || npm run prepublishOnly\",\n    \"clean\": \"rimraf build\",\n    \"lint\": \"eslint --ext js,jsx .\",\n    \"pretest\": \"npm run lint\",\n    \"prebuild\": \"npm run clean\",\n    \"build\": \"babel --source-maps=both src --out-dir build\",\n    \"watch\": \"npm run build -- -w\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/enzymejs/enzyme.git\",\n    \"directory\": \"packages/enzyme-adapter-utils\"\n  },\n  \"keywords\": [\n    \"javascript\",\n    \"shallow rendering\",\n    \"shallowRender\",\n    \"test\",\n    \"reactjs\",\n    \"react\",\n    \"flux\",\n    \"testing\",\n    \"test utils\",\n    \"assertion helpers\",\n    \"tdd\",\n    \"mocha\"\n  ],\n  \"author\": \"Jordan Harband <ljharb@gmail.com>\",\n  \"funding\": {\n    \"url\": \"https://github.com/sponsors/ljharb\"\n  },\n  \"license\": \"MIT\",\n  \"dependencies\": {\n    \"airbnb-prop-types\": \"^2.16.0\",\n    \"function.prototype.name\": \"^1.1.8\",\n    \"hasown\": \"^2.0.2\",\n    \"object.assign\": \"^4.1.7\",\n    \"object.fromentries\": \"^2.0.8\",\n    \"prop-types\": \"^15.8.1\",\n    \"semver\": \"^6.3.1\"\n  },\n  \"peerDependencies\": {\n    \"react\": \"0.13.x || 0.14.x || ^15.0.0-0 || ^16.0.0-0\"\n  },\n  \"devDependencies\": {\n    \"@babel/cli\": \"^7.28.3\",\n    \"@babel/core\": \"^7.28.4\",\n    \"@babel/eslint-parser\": \"^7.28.4\",\n    \"babel-plugin-add-module-exports\": \"^1.0.4\",\n    \"babel-plugin-transform-replace-object-assign\": \"^2.0.0\",\n    \"babel-preset-airbnb\": \"^4.5.0\",\n    \"eslint\": \"^8.56.0\",\n    \"eslint-config-airbnb\": \"^19.0.4\",\n    \"eslint-plugin-import\": \"^2.32.0\",\n    \"eslint-plugin-jsx-a11y\": \"^6.10.2\",\n    \"eslint-plugin-react\": \"^7.37.5\",\n    \"eslint-plugin-react-hooks\": \"^4.6.0\",\n    \"in-publish\": \"^2.0.1\",\n    \"npmignore\": \"^0.3.0\",\n    \"rimraf\": \"^2.7.1\",\n    \"safe-publish-latest\": \"^2.0.0\"\n  },\n  \"publishConfig\": {\n    \"ignore\": [\n      \"!build\"\n    ]\n  }\n}\n"
  },
  {
    "path": "packages/enzyme-adapter-utils/src/RootFinder.jsx",
    "content": "import React from 'react';\nimport PropTypes from 'prop-types';\n\nexport default class RootFinder extends React.Component {\n  render() {\n    const { children } = this.props;\n    return children;\n  }\n}\nRootFinder.propTypes = {\n  children: PropTypes.node,\n};\nRootFinder.defaultProps = {\n  children: null,\n};\n"
  },
  {
    "path": "packages/enzyme-adapter-utils/src/Utils.js",
    "content": "import functionName from 'function.prototype.name';\nimport fromEntries from 'object.fromentries';\nimport hasOwn from 'hasown';\nimport createMountWrapper from './createMountWrapper';\nimport createRenderWrapper from './createRenderWrapper';\nimport wrap from './wrapWithSimpleWrapper';\nimport RootFinder from './RootFinder';\n\nexport {\n  createMountWrapper,\n  createRenderWrapper,\n  wrap,\n  RootFinder,\n};\n\nexport function mapNativeEventNames(event, {\n  animation = false, // should be true for React 15+\n  pointerEvents = false, // should be true for React 16.4+\n  auxClick = false, // should be true for React 16.5+\n} = {}) {\n  const nativeToReactEventMap = {\n    compositionend: 'compositionEnd',\n    compositionstart: 'compositionStart',\n    compositionupdate: 'compositionUpdate',\n    keydown: 'keyDown',\n    keyup: 'keyUp',\n    keypress: 'keyPress',\n    contextmenu: 'contextMenu',\n    dblclick: 'doubleClick',\n    doubleclick: 'doubleClick', // kept for legacy. TODO: remove with next major.\n    dragend: 'dragEnd',\n    dragenter: 'dragEnter',\n    dragexist: 'dragExit',\n    dragleave: 'dragLeave',\n    dragover: 'dragOver',\n    dragstart: 'dragStart',\n    mousedown: 'mouseDown',\n    mousemove: 'mouseMove',\n    mouseout: 'mouseOut',\n    mouseover: 'mouseOver',\n    mouseup: 'mouseUp',\n    touchcancel: 'touchCancel',\n    touchend: 'touchEnd',\n    touchmove: 'touchMove',\n    touchstart: 'touchStart',\n    canplay: 'canPlay',\n    canplaythrough: 'canPlayThrough',\n    durationchange: 'durationChange',\n    loadeddata: 'loadedData',\n    loadedmetadata: 'loadedMetadata',\n    loadstart: 'loadStart',\n    ratechange: 'rateChange',\n    timeupdate: 'timeUpdate',\n    volumechange: 'volumeChange',\n    beforeinput: 'beforeInput',\n    mouseenter: 'mouseEnter',\n    mouseleave: 'mouseLeave',\n    transitionend: 'transitionEnd',\n    ...(animation && {\n      animationstart: 'animationStart',\n      animationiteration: 'animationIteration',\n      animationend: 'animationEnd',\n    }),\n    ...(pointerEvents && {\n      pointerdown: 'pointerDown',\n      pointermove: 'pointerMove',\n      pointerup: 'pointerUp',\n      pointercancel: 'pointerCancel',\n      gotpointercapture: 'gotPointerCapture',\n      lostpointercapture: 'lostPointerCapture',\n      pointerenter: 'pointerEnter',\n      pointerleave: 'pointerLeave',\n      pointerover: 'pointerOver',\n      pointerout: 'pointerOut',\n    }),\n    ...(auxClick && {\n      auxclick: 'auxClick',\n    }),\n  };\n\n  return nativeToReactEventMap[event] || event;\n}\n\n// 'click' => 'onClick'\n// 'mouseEnter' => 'onMouseEnter'\nexport function propFromEvent(event, eventOptions = {}) {\n  const nativeEvent = mapNativeEventNames(event, eventOptions);\n  return `on${nativeEvent[0].toUpperCase()}${nativeEvent.slice(1)}`;\n}\n\nexport function withSetStateAllowed(fn) {\n  // NOTE(lmr):\n  // this is currently here to circumvent a React bug where `setState()` is\n  // not allowed without global being defined.\n  let cleanup = false;\n  if (typeof global.document === 'undefined') {\n    cleanup = true;\n    global.document = {};\n  }\n  const result = fn();\n  if (cleanup) {\n    // This works around a bug in node/jest in that developers aren't able to\n    // delete things from global when running in a node vm.\n    global.document = undefined;\n    delete global.document;\n  }\n  return result;\n}\n\nexport function assertDomAvailable(feature) {\n  if (!global || !global.document || !global.document.createElement) {\n    throw new Error(`Enzyme's ${feature} expects a DOM environment to be loaded, but found none`);\n  }\n}\n\nexport function displayNameOfNode(node) {\n  if (!node) return null;\n\n  const { type } = node;\n\n  if (!type) return null;\n\n  return type.displayName || (typeof type === 'function' ? functionName(type) : type.name || type);\n}\n\nexport function nodeTypeFromType(type) {\n  if (typeof type === 'string') {\n    return 'host';\n  }\n  if (type && type.prototype && type.prototype.isReactComponent) {\n    return 'class';\n  }\n  return 'function';\n}\n\nfunction getIteratorFn(obj) {\n  const iteratorFn = obj && (\n    (typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' && obj[Symbol.iterator])\n    || obj['@@iterator']\n  );\n\n  if (typeof iteratorFn === 'function') {\n    return iteratorFn;\n  }\n\n  return undefined;\n}\n\nfunction isIterable(obj) {\n  return !!getIteratorFn(obj);\n}\n\nexport function isArrayLike(obj) {\n  return Array.isArray(obj) || (typeof obj !== 'string' && isIterable(obj));\n}\n\nexport function flatten(arrs) {\n  // optimize for the most common case\n  if (Array.isArray(arrs)) {\n    return arrs.reduce(\n      (flatArrs, item) => flatArrs.concat(isArrayLike(item) ? flatten(item) : item),\n      [],\n    );\n  }\n\n  // fallback for arbitrary iterable children\n  let flatArrs = [];\n\n  const iteratorFn = getIteratorFn(arrs);\n  const iterator = iteratorFn.call(arrs);\n\n  let step = iterator.next();\n\n  while (!step.done) {\n    const item = step.value;\n    let flatItem;\n\n    if (isArrayLike(item)) {\n      flatItem = flatten(item);\n    } else {\n      flatItem = item;\n    }\n\n    flatArrs = flatArrs.concat(flatItem);\n\n    step = iterator.next();\n  }\n\n  return flatArrs;\n}\n\nexport function ensureKeyOrUndefined(key) {\n  return key || (key === '' ? '' : undefined);\n}\n\nexport function elementToTree(el, recurse = elementToTree) {\n  if (typeof recurse !== 'function' && arguments.length === 3) {\n    // special case for backwards compat for `.map(elementToTree)`\n    recurse = elementToTree; // eslint-disable-line no-param-reassign\n  }\n  if (el === null || typeof el !== 'object' || !('type' in el)) {\n    return el;\n  }\n  const {\n    type,\n    props,\n    key,\n    ref,\n  } = el;\n  const { children } = props;\n  let rendered = null;\n  if (isArrayLike(children)) {\n    rendered = flatten(children).map((x) => recurse(x));\n  } else if (typeof children !== 'undefined') {\n    rendered = recurse(children);\n  }\n\n  const nodeType = nodeTypeFromType(type);\n\n  if (nodeType === 'host' && props.dangerouslySetInnerHTML) {\n    if (props.children != null) {\n      const error = new Error('Can only set one of `children` or `props.dangerouslySetInnerHTML`.');\n      error.name = 'Invariant Violation';\n      throw error;\n    }\n  }\n\n  return {\n    nodeType,\n    type,\n    props,\n    key: ensureKeyOrUndefined(key),\n    ref,\n    instance: null,\n    rendered,\n  };\n}\n\nfunction mapFind(arraylike, mapper, finder) {\n  let found;\n  const isFound = Array.prototype.find.call(arraylike, (item) => {\n    found = mapper(item);\n    return finder(found);\n  });\n  return isFound ? found : undefined;\n}\n\nexport function findElement(el, predicate) {\n  if (el === null || typeof el !== 'object' || !('type' in el)) {\n    return undefined;\n  }\n  if (predicate(el)) {\n    return el;\n  }\n  const { rendered } = el;\n  if (isArrayLike(rendered)) {\n    return mapFind(rendered, (x) => findElement(x, predicate), (x) => typeof x !== 'undefined');\n  }\n  return findElement(rendered, predicate);\n}\n\nexport function propsWithKeysAndRef(node) {\n  if (node.ref !== null || node.key !== null) {\n    return {\n      ...node.props,\n      key: node.key,\n      ref: node.ref,\n    };\n  }\n  return node.props;\n}\n\nexport function getComponentStack(\n  hierarchy,\n  getNodeType = nodeTypeFromType,\n  getDisplayName = displayNameOfNode,\n) {\n  const tuples = hierarchy.filter((node) => node.type !== RootFinder).map((x) => [\n    getNodeType(x.type),\n    getDisplayName(x),\n  ]).concat([[\n    'class',\n    'WrapperComponent',\n  ]]);\n\n  return tuples.map(([, name], i, arr) => {\n    const [, closestComponent] = arr.slice(i + 1).find(([nodeType]) => nodeType !== 'host') || [];\n    return `\\n    in ${name}${closestComponent ? ` (created by ${closestComponent})` : ''}`;\n  }).join('');\n}\n\nexport function simulateError(\n  error,\n  catchingInstance,\n  rootNode, // TODO: remove `rootNode` next semver-major\n  hierarchy,\n  getNodeType = nodeTypeFromType,\n  getDisplayName = displayNameOfNode,\n  catchingType = {},\n) {\n  const instance = catchingInstance || {};\n\n  const { componentDidCatch } = instance;\n\n  const { getDerivedStateFromError } = catchingType;\n\n  if (!componentDidCatch && !getDerivedStateFromError) {\n    throw error;\n  }\n\n  if (getDerivedStateFromError) {\n    const stateUpdate = getDerivedStateFromError.call(catchingType, error);\n    instance.setState(stateUpdate);\n  }\n\n  if (componentDidCatch) {\n    const componentStack = getComponentStack(hierarchy, getNodeType, getDisplayName);\n    componentDidCatch.call(instance, error, { componentStack });\n  }\n}\n\nexport function getMaskedContext(contextTypes, unmaskedContext) {\n  if (!contextTypes || !unmaskedContext) {\n    return {};\n  }\n  return fromEntries(Object.keys(contextTypes).map((key) => [key, unmaskedContext[key]]));\n}\n\nexport function getNodeFromRootFinder(isCustomComponent, tree, options) {\n  if (!isCustomComponent(options.wrappingComponent)) {\n    return tree.rendered;\n  }\n  const rootFinder = findElement(tree, (node) => node.type === RootFinder);\n  if (!rootFinder) {\n    throw new Error('`wrappingComponent` must render its children!');\n  }\n  return rootFinder.rendered;\n}\n\nexport function wrapWithWrappingComponent(createElement, node, options) {\n  const { wrappingComponent, wrappingComponentProps } = options;\n  if (!wrappingComponent) {\n    return node;\n  }\n  return createElement(\n    wrappingComponent,\n    wrappingComponentProps,\n    createElement(RootFinder, null, node),\n  );\n}\n\nexport function getWrappingComponentMountRenderer({ toTree, getMountWrapperInstance }) {\n  return {\n    getNode() {\n      const instance = getMountWrapperInstance();\n      return instance ? toTree(instance).rendered : null;\n    },\n    render(el, context, callback) {\n      const instance = getMountWrapperInstance();\n      if (!instance) {\n        throw new Error('The wrapping component may not be updated if the root is unmounted.');\n      }\n      return instance.setWrappingComponentProps(el.props, callback);\n    },\n  };\n}\n\nexport function fakeDynamicImport(moduleToImport) {\n  return Promise.resolve({ default: moduleToImport });\n}\n\nexport function compareNodeTypeOf(node, matchingTypeOf) {\n  if (!node) {\n    return false;\n  }\n  return node.$$typeof === matchingTypeOf;\n}\n\n// TODO: when enzyme v3.12.0 is required, delete this\nexport function spyMethod(instance, methodName, getStub = () => {}) {\n  let lastReturnValue;\n  const originalMethod = instance[methodName];\n  const hasOwnProp = hasOwn(instance, methodName);\n  let descriptor;\n  if (hasOwnProp) {\n    descriptor = Object.getOwnPropertyDescriptor(instance, methodName);\n  }\n  Object.defineProperty(instance, methodName, {\n    configurable: true,\n    enumerable: !descriptor || !!descriptor.enumerable,\n    value: getStub(originalMethod) || function spied(...args) {\n      const result = originalMethod.apply(this, args);\n      lastReturnValue = result;\n      return result;\n    },\n  });\n  return {\n    restore() {\n      if (hasOwnProp) {\n        if (descriptor) {\n          Object.defineProperty(instance, methodName, descriptor);\n        } else {\n          /* eslint-disable no-param-reassign */\n          instance[methodName] = originalMethod;\n          /* eslint-enable no-param-reassign */\n        }\n      } else {\n        /* eslint-disable no-param-reassign */\n        delete instance[methodName];\n        /* eslint-enable no-param-reassign */\n      }\n    },\n    getLastReturnValue() {\n      return lastReturnValue;\n    },\n  };\n}\n\n// TODO: when enzyme v3.12.0 is required, delete this\nexport function spyProperty(instance, propertyName, handlers = {}) {\n  const originalValue = instance[propertyName];\n  const hasOwnProp = hasOwn(instance, propertyName);\n  let descriptor;\n  if (hasOwnProp) {\n    descriptor = Object.getOwnPropertyDescriptor(instance, propertyName);\n  }\n  let wasAssigned = false;\n  let holder = originalValue;\n  const getV = handlers.get ? () => {\n    const value = descriptor && descriptor.get ? descriptor.get.call(instance) : holder;\n    return handlers.get.call(instance, value);\n  } : () => holder;\n  const set = handlers.set ? (newValue) => {\n    wasAssigned = true;\n    const handlerNewValue = handlers.set.call(instance, holder, newValue);\n    holder = handlerNewValue;\n    if (descriptor && descriptor.set) {\n      descriptor.set.call(instance, holder);\n    }\n  } : (v) => {\n    wasAssigned = true;\n    holder = v;\n  };\n  Object.defineProperty(instance, propertyName, {\n    configurable: true,\n    enumerable: !descriptor || !!descriptor.enumerable,\n    get: getV,\n    set,\n  });\n\n  return {\n    restore() {\n      if (hasOwnProp) {\n        if (descriptor) {\n          Object.defineProperty(instance, propertyName, descriptor);\n        } else {\n          /* eslint-disable no-param-reassign */\n          instance[propertyName] = holder;\n          /* eslint-enable no-param-reassign */\n        }\n      } else {\n        /* eslint-disable no-param-reassign */\n        delete instance[propertyName];\n        /* eslint-enable no-param-reassign */\n      }\n    },\n    wasAssigned() {\n      return wasAssigned;\n    },\n  };\n}\n"
  },
  {
    "path": "packages/enzyme-adapter-utils/src/createMountWrapper.jsx",
    "content": "import React from 'react';\nimport PropTypes from 'prop-types';\nimport { ref } from 'airbnb-prop-types';\nimport RootFinder from './RootFinder';\n\n/* eslint react/forbid-prop-types: 0 */\n\nconst stringOrFunction = PropTypes.oneOfType([PropTypes.func, PropTypes.string]);\nconst makeValidElementType = (adapter) => {\n  if (!adapter) {\n    return stringOrFunction;\n  }\n\n  function validElementTypeRequired(props, propName, ...args) {\n    if (!adapter.isValidElementType) {\n      return stringOrFunction.isRequired(props, propName, ...args);\n    }\n    const propValue = props[propName]; // eslint-disable-line react/destructuring-assignment\n    if (adapter.isValidElementType(propValue)) {\n      return null;\n    }\n    return new TypeError(`${propName} must be a valid element type!`);\n  }\n\n  function validElementType(props, propName, ...args) {\n    const propValue = props[propName];\n    if (propValue == null) {\n      return null;\n    }\n    return validElementTypeRequired(props, propName, ...args);\n  }\n  validElementType.isRequired = validElementTypeRequired;\n\n  return validElementType;\n};\n\n/**\n * This is a utility component to wrap around the nodes we are\n * passing in to `mount()`. Theoretically, you could do everything\n * we are doing without this, but this makes it easier since\n * `renderIntoDocument()` doesn't really pass back a reference to\n * the DOM node it rendered to, so we can't really \"re-render\" to\n * pass new props in.\n */\nexport default function createMountWrapper(node, options = {}) {\n  const { adapter, wrappingComponent: WrappingComponent } = options;\n\n  class WrapperComponent extends React.Component {\n    constructor(...args) {\n      super(...args);\n      const { props, wrappingComponentProps, context } = this.props;\n      this.state = {\n        mount: true,\n        props,\n        wrappingComponentProps,\n        context,\n      };\n    }\n\n    // eslint-disable-next-line react/no-unused-class-component-methods\n    setChildProps(newProps, newContext, callback = undefined) {\n      const { props: oldProps, context: oldContext } = this.state;\n      const props = { ...oldProps, ...newProps };\n      const context = { ...oldContext, ...newContext };\n      this.setState({ props, context }, callback);\n    }\n\n    // eslint-disable-next-line react/no-unused-class-component-methods\n    setWrappingComponentProps(props, callback = undefined) {\n      this.setState({ wrappingComponentProps: props }, callback);\n    }\n\n    render() {\n      const { Component, refProp } = this.props;\n      const { mount, props, wrappingComponentProps } = this.state;\n      if (!mount) return null;\n      // eslint-disable-next-line react/jsx-props-no-spreading\n      const component = <Component ref={refProp} {...props} />;\n      if (WrappingComponent) {\n        return (\n          // eslint-disable-next-line react/jsx-props-no-spreading\n          <WrappingComponent {...wrappingComponentProps}>\n            <RootFinder>{component}</RootFinder>\n          </WrappingComponent>\n        );\n      }\n      return component;\n    }\n  }\n  WrapperComponent.propTypes = {\n    Component: makeValidElementType(adapter).isRequired,\n    refProp: PropTypes.oneOfType([PropTypes.string, ref()]),\n    props: PropTypes.object.isRequired,\n    wrappingComponentProps: PropTypes.object,\n    context: PropTypes.object,\n  };\n  WrapperComponent.defaultProps = {\n    refProp: null,\n    context: null,\n    wrappingComponentProps: null,\n  };\n\n  if (options.context && (node.type.contextTypes || options.childContextTypes)) {\n    // For full rendering, we are using this wrapper component to provide context if it is\n    // specified in both the options AND the child component defines `contextTypes` statically\n    // OR the merged context types for all children (the node component or deeper children) are\n    // specified in options parameter under childContextTypes.\n    // In that case, we define both a `getChildContext()` function and a `childContextTypes` prop.\n    const childContextTypes = {\n      ...node.type.contextTypes,\n      ...options.childContextTypes,\n    };\n\n    WrapperComponent.prototype.getChildContext = function getChildContext() {\n      return this.state.context;\n    };\n    WrapperComponent.childContextTypes = childContextTypes;\n  }\n  return WrapperComponent;\n}\n"
  },
  {
    "path": "packages/enzyme-adapter-utils/src/createRenderWrapper.jsx",
    "content": "import React from 'react';\n\nexport default function createRenderWrapper(node, context, childContextTypes) {\n  class ContextWrapper extends React.Component {\n    getChildContext() {\n      return context;\n    }\n\n    render() {\n      return node;\n    }\n  }\n  ContextWrapper.childContextTypes = childContextTypes;\n  return ContextWrapper;\n}\n"
  },
  {
    "path": "packages/enzyme-adapter-utils/src/index.js",
    "content": "/* eslint global-require: 0 */\nmodule.exports = require('./Utils');\n"
  },
  {
    "path": "packages/enzyme-adapter-utils/src/wrapWithSimpleWrapper.jsx",
    "content": "import React from 'react';\nimport { intersects } from 'semver';\nimport { or, explicitNull } from 'airbnb-prop-types';\nimport PropTypes from 'prop-types';\n\nconst propTypes = {\n  children: or([explicitNull().isRequired, PropTypes.node.isRequired]),\n};\n\nconst defaultProps = {\n  children: undefined,\n};\n\nconst Wrapper = (intersects('>= 0.14', React.version)\n  // eslint-disable-next-line prefer-arrow-callback\n  ? () => Object.assign(function SimpleSFCWrapper({ children }) {\n    return children;\n  }, { propTypes, defaultProps })\n  : () => {\n    class SimpleClassWrapper extends React.Component {\n      render() {\n        const { children } = this.props;\n        return children;\n      }\n    }\n    SimpleClassWrapper.propTypes = propTypes;\n    SimpleClassWrapper.defaultProps = defaultProps;\n    return SimpleClassWrapper;\n  }\n)();\n\nexport default function wrap(element) {\n  return <Wrapper>{element}</Wrapper>;\n}\n"
  },
  {
    "path": "packages/enzyme-example-mocha/.babelrc",
    "content": "{\n  \"presets\": [\n    [\"airbnb\", { \"transformRuntime\": false }],\n  ],\n  \"plugins\": [\n    [\"transform-replace-object-assign\", { \"moduleSpecifier\": \"object.assign\" }],\n    [\"add-module-exports\"],\n  ],\n}\n"
  },
  {
    "path": "packages/enzyme-example-mocha/.eslintrc",
    "content": "{\n  \"extends\": \"airbnb\",\n  \"parser\": \"@babel/eslint-parser\",\n  \"root\": true,\n  \"ignorePatterns\": [\"build/\"],\n  \"env\": {\n    \"node\": true,\n    \"mocha\": true,\n  },\n}\n"
  },
  {
    "path": "packages/enzyme-example-mocha/.gitignore",
    "content": "# Logs\nlogs\n*.log\nnpm-debug.log*\n\n# Runtime data\npids\n*.pid\n*.seed\n\n# Dependency directory\nnode_modules\n\n# Optional npm cache directory\n.npm\n\n# Optional REPL history\n.node_repl_history\n\n# Coverage\n.coverage\n.nyc_output\n"
  },
  {
    "path": "packages/enzyme-example-mocha/.nycrc",
    "content": "{\n  \"reporter\": [\n    \"lcov\",\n    \"text-summary\"\n  ],\n  \"extension\": [\n    \".jsx\"\n  ]\n}\n"
  },
  {
    "path": "packages/enzyme-example-mocha/LICENSE",
    "content": "The MIT License (MIT)\n\nCopyright (c) 2016 Leland Richardson\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "packages/enzyme-example-mocha/README.md",
    "content": "# enzyme-example-mocha\nExample project with React + Enzyme + Mocha\n\n# npm scripts\n``` \nnpm test \n\n```\n"
  },
  {
    "path": "packages/enzyme-example-mocha/package.json",
    "content": "{\n  \"name\": \"enzyme-example-mocha\",\n  \"version\": \"0.1.0\",\n  \"description\": \"Example project with React + Enzyme + Mocha\",\n  \"scripts\": {\n    \"prepack\": \"npmignore --auto --commentLines=autogenerated --gitignore=../../.gitignore\",\n    \"lint\": \"eslint ./src/**/*.js*\",\n    \"pretest\": \"npm run lint\",\n    \"test\": \"nyc mocha src/*.spec.js*\",\n    \"test-watch\": \"npm test -- --watch\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/enzymejs/enzyme.git\",\n    \"directory\": \"packages/enzyme-example-mocha\"\n  },\n  \"author\": \"Jordan Harband <ljharb@gmail.com>\",\n  \"license\": \"MIT\",\n  \"homepage\": \"https://github.com/enzymejs/enzyme.git\",\n  \"devDependencies\": {\n    \"@babel/cli\": \"^7.28.3\",\n    \"@babel/core\": \"^7.28.4\",\n    \"@babel/eslint-parser\": \"^7.28.4\",\n    \"babel-plugin-add-module-exports\": \"^1.0.4\",\n    \"babel-plugin-transform-replace-object-assign\": \"^2.0.0\",\n    \"babel-preset-airbnb\": \"^4.5.0\",\n    \"eslint\": \"^7.32.0\",\n    \"eslint-config-airbnb\": \"^18.2.1\",\n    \"eslint-plugin-import\": \"^2.32.0\",\n    \"eslint-plugin-jsx-a11y\": \"^6.10.2\",\n    \"eslint-plugin-react\": \"^7.37.5\",\n    \"eslint-plugin-react-hooks\": \"^4.2.0\",\n    \"in-publish\": \"^2.0.1\",\n    \"jsdom\": \"^11.5.1\",\n    \"mocha\": \"^3.5.3\",\n    \"npmignore\": \"^0.3.0\",\n    \"nyc\": \"^11.4.1\",\n    \"rimraf\": \"^2.7.1\",\n    \"safe-publish-latest\": \"^2.0.0\"\n  },\n  \"dependencies\": {\n    \"chai\": \"^4.3.4\",\n    \"enzyme\": \"^3.3.0\",\n    \"enzyme-adapter-react-16\": \"^1.1.1\",\n    \"object.assign\": \"^4.1.7\",\n    \"react\": \"^16.2.0\",\n    \"react-dom\": \"^16.2.0\"\n  },\n  \"publishConfig\": {\n    \"ignore\": [\n      \"!build\"\n    ]\n  }\n}\n"
  },
  {
    "path": "packages/enzyme-example-mocha/src/Foo.jsx",
    "content": "import React from 'react';\n\nconst Foo = () => <div className=\"foo\" />;\n\nexport default Foo;\n"
  },
  {
    "path": "packages/enzyme-example-mocha/src/Foo.spec.jsx",
    "content": "import React from 'react';\nimport Enzyme, { shallow, mount } from 'enzyme';\nimport Adapter from 'enzyme-adapter-react-16';\nimport { expect } from 'chai';\nimport Foo from './Foo';\n\nEnzyme.configure({ adapter: new Adapter() });\n\ndescribe('A suite', () => {\n  it('contains spec with an expectation', () => {\n    expect(shallow(<Foo />).contains(<div className=\"foo\" />)).to.equal(true);\n  });\n\n  it('contains spec with an expectation', () => {\n    expect(shallow(<Foo />).is('.foo')).to.equal(true);\n  });\n\n  it('contains spec with an expectation', () => {\n    expect(mount(<Foo />).find('.foo').length).to.equal(1);\n  });\n});\n"
  },
  {
    "path": "packages/enzyme-example-mocha/test/.setup.js",
    "content": "import { JSDOM } from 'jsdom';\nimport { expect } from 'chai';\nconst jsdom = new JSDOM('<!doctype html><html><body></body></html>');\nconst { window } = jsdom;\n\nfunction copyProps(src, target) {\n  Object.defineProperties(target, {\n    ...Object.getOwnPropertyDescriptors(src),\n    ...Object.getOwnPropertyDescriptors(target),\n  });\n}\n\nglobal.expect = expect;\nglobal.window = window;\nglobal.document = window.document;\nglobal.navigator = {\n  userAgent: 'node.js',\n};\ncopyProps(window, global);\n"
  },
  {
    "path": "packages/enzyme-example-mocha/test/mocha.opts",
    "content": "--require test/.setup.js\n--compilers js:@babel/register\n"
  },
  {
    "path": "packages/enzyme-shallow-equal/.babelrc",
    "content": "{\n  \"presets\": [\n    [\"airbnb\", { \"transformRuntime\": false }],\n  ],\n  \"plugins\": [\n    [\"transform-replace-object-assign\", { \"moduleSpecifier\": \"object.assign\" }],\n    [\"add-module-exports\"],\n  ],\n  \"sourceMaps\": \"both\",\n}\n"
  },
  {
    "path": "packages/enzyme-shallow-equal/.eslintrc",
    "content": "{\n  \"root\": true,\n  \"extends\": \"airbnb-base\",\n  \"parser\": \"@babel/eslint-parser\",\n  \"ignorePatterns\": [\"build/\"],\n}\n"
  },
  {
    "path": "packages/enzyme-shallow-equal/README.md",
    "content": "# enzyme-shallow-equal\n\nThis is the implementation of shallowEqual that enzyme uses.\n\nIt's adapted from https://github.com/facebook/react/blob/144328fe81719e916b946e22660479e31561bb0b/packages/shared/shallowEqual.js#L36-L68\n"
  },
  {
    "path": "packages/enzyme-shallow-equal/package.json",
    "content": "{\n  \"name\": \"enzyme-shallow-equal\",\n  \"version\": \"1.0.7\",\n  \"description\": \"Adaptation of react-addons-shallow-compare, for independent usage\",\n  \"homepage\": \"https://enzymejs.github.io/enzyme/\",\n  \"main\": \"build\",\n  \"scripts\": {\n    \"prepack\": \"npmignore --auto --commentLines=autogenerated --gitignore=../../.gitignore && cp ../../LICENSE.md ./ && npm run build\",\n    \"prepublishOnly\": \"safe-publish-latest\",\n    \"prepublish\": \"not-in-publish || npm run prepublishOnly\",\n    \"clean\": \"rimraf build\",\n    \"lint\": \"eslint --ext js,jsx .\",\n    \"pretest\": \"npm run lint\",\n    \"prebuild\": \"npm run clean\",\n    \"build\": \"babel --source-maps=both src --out-dir build\",\n    \"watch\": \"npm run build -- -w\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/enzymejs/enzyme.git\",\n    \"directory\": \"packages/enzyme-shallow-equal\"\n  },\n  \"keywords\": [\n    \"javascript\",\n    \"shallow rendering\",\n    \"shallowRender\",\n    \"test\",\n    \"reactjs\",\n    \"react\",\n    \"flux\",\n    \"testing\",\n    \"test utils\",\n    \"assertion helpers\",\n    \"tdd\",\n    \"mocha\"\n  ],\n  \"author\": \"Jordan Harband <ljharb@gmail.com>\",\n  \"funding\": {\n    \"url\": \"https://github.com/sponsors/ljharb\"\n  },\n  \"license\": \"MIT\",\n  \"dependencies\": {\n    \"hasown\": \"^2.0.2\",\n    \"object-is\": \"^1.1.6\"\n  },\n  \"devDependencies\": {\n    \"@babel/cli\": \"^7.28.3\",\n    \"@babel/core\": \"^7.28.4\",\n    \"@babel/eslint-parser\": \"^7.28.4\",\n    \"babel-plugin-add-module-exports\": \"^1.0.4\",\n    \"babel-plugin-transform-replace-object-assign\": \"^2.0.0\",\n    \"babel-preset-airbnb\": \"^4.5.0\",\n    \"eslint\": \"^8.56.0\",\n    \"eslint-config-airbnb-base\": \"^15.0.0\",\n    \"eslint-plugin-import\": \"^2.32.0\",\n    \"in-publish\": \"^2.0.1\",\n    \"npmignore\": \"^0.3.1\",\n    \"rimraf\": \"^2.7.1\",\n    \"safe-publish-latest\": \"^2.0.0\"\n  },\n  \"publishConfig\": {\n    \"ignore\": [\n      \"!build\"\n    ]\n  }\n}\n"
  },
  {
    "path": "packages/enzyme-shallow-equal/src/index.js",
    "content": "import is from 'object-is';\nimport hasOwn from 'hasown';\n\n// adapted from https://github.com/facebook/react/blob/144328fe81719e916b946e22660479e31561bb0b/packages/shared/shallowEqual.js#L36-L68\nexport default function shallowEqual(objA, objB) {\n  if (is(objA, objB)) {\n    return true;\n  }\n\n  if (!objA || !objB || typeof objA !== 'object' || typeof objB !== 'object') {\n    return false;\n  }\n\n  const keysA = Object.keys(objA);\n  const keysB = Object.keys(objB);\n\n  if (keysA.length !== keysB.length) {\n    return false;\n  }\n\n  keysA.sort();\n  keysB.sort();\n\n  // Test for A's keys different from B.\n  for (let i = 0; i < keysA.length; i += 1) {\n    if (!hasOwn(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {\n      return false;\n    }\n  }\n\n  return true;\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/.babelrc",
    "content": "{\n  \"presets\": [\n    [\"airbnb\", { \"transformRuntime\": false }],\n  ],\n  \"plugins\": [\n    [\"transform-replace-object-assign\", { \"moduleSpecifier\": \"object.assign\" }],\n    [\"add-module-exports\"],\n  ],\n  \"sourceMaps\": \"both\",\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/.eslintrc",
    "content": "{\n  \"extends\": \"airbnb\",\n  \"parser\": \"@babel/eslint-parser\",\n  \"root\": true,\n  \"ignorePatterns\": [\"build/\"],\n  \"env\": {\n    \"mocha\": true,\n  },\n  \"plugins\": [\"mocha\"],\n  \"settings\": {\n    \"mocha/additionalTestFunctions\": [\"itIf\", \"describeIf\"],\n    \"react\": {\n      \"version\": \"detect\",\n    },\n  },\n  \"rules\": {\n    \"max-classes-per-file\": 0,\n    \"max-len\": 0,\n    \"no-param-reassign\": 0,\n    \"padded-blocks\": 0,\n    \"react/destructuring-assignment\": 1,\n    \"react/jsx-props-no-spreading\": [1, {\n      \"custom\": \"ignore\",\n      \"explicitSpread\": \"ignore\",\n    }],\n    \"react/no-deprecated\": 0,\n    \"react/no-did-mount-set-state\": 0,\n    \"react/no-will-update-set-state\": 0,\n    \"react/no-multi-comp\": 0,\n    \"react/no-unknown-property\": 0,\n    \"react/prefer-es6-class\": 0,\n    \"react/prefer-stateless-function\": 0,\n    \"react/prop-types\": 0,\n    \"react/no-string-refs\": 0,\n    \"import/no-extraneous-dependencies\": [2, {\n      \"devDependencies\": true\n    }],\n    \"jsx-a11y/click-events-have-key-events\": 0,\n    \"jsx-a11y/no-static-element-interactions\": 0,\n    \"jsx-a11y/anchor-has-content\": 0,\n    \"jsx-a11y/anchor-is-valid\": 0,\n    \"jsx-a11y/label-has-for\": 0,\n    \"jsx-a11y/label-has-associated-control\": 0,\n    \"jsx-a11y/control-has-associated-label\": 0,\n    \"react/jsx-curly-brace-presence\": 0,\n    \"react/no-danger\": 1,\n    \"react/jsx-one-expression-per-line\": 0,\n    \"react/no-access-state-in-setstate\": 1,\n\n    \"mocha/no-exclusive-tests\": 2,\n    \"mocha/no-global-tests\": 2,\n    \"mocha/no-nested-tests\": 2,\n    \"mocha/no-pending-tests\": 2,\n    \"mocha/no-sibling-hooks\": 2,\n    \"mocha/no-skipped-tests\": 1,\n    \"mocha/no-top-level-hooks\": 2,\n    \"mocha/valid-suite-description\": [2, \"^(?!should )\"],\n    \"mocha/valid-test-description\": [2, \"^(?!should )\"],\n  },\n  \"overrides\": [\n    {\n      \"files\": [\n        \"test/_helpers/*\",\n      ],\n      \"rules\": {\n        \"mocha/no-exclusive-tests\": 0,\n      },\n    }\n  ],\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/package.json",
    "content": "{\n  \"name\": \"enzyme-test-suite\",\n  \"private\": true,\n  \"version\": \"1.0.0\",\n  \"description\": \"JavaScript Testing utilities for React\",\n  \"homepage\": \"https://enzymejs.github.io/enzyme/\",\n  \"scripts\": {\n    \"lint\": \"eslint --ext js,jsx .\",\n    \"pretest\": \"npm run lint\",\n    \"clean\": \"rimraf build\",\n    \"prebuild\": \"npm run clean\",\n    \"build\": \"babel --source-maps=both test --out-dir build\",\n    \"watch\": \"npm run build -- -w\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/enzymejs/enzyme.git\",\n    \"directory\": \"packages/enzyme-test-suite\"\n  },\n  \"keywords\": [\n    \"javascript\",\n    \"shallow rendering\",\n    \"shallowRender\",\n    \"test\",\n    \"reactjs\",\n    \"react\",\n    \"flux\",\n    \"testing\",\n    \"test utils\",\n    \"assertion helpers\",\n    \"tdd\",\n    \"mocha\"\n  ],\n  \"author\": \"Jordan Harband <ljharb@gmail.com>\",\n  \"license\": \"MIT\",\n  \"dependencies\": {\n    \"chai\": \"^4.3.4\",\n    \"create-react-class\": \"^15.7.0\",\n    \"enzyme\": \"^3.11.0\",\n    \"enzyme-adapter-react-helper\": \"^1.3.10\",\n    \"enzyme-adapter-utils\": \"^1.14.2\",\n    \"enzyme-shallow-equal\": \"^1.0.7\",\n    \"has-symbols\": \"^1.1.0\",\n    \"html-element-map\": \"^1.3.1\",\n    \"jsdom\": \"^6.5.1\",\n    \"lodash.isequal\": \"^4.5.0\",\n    \"mocha\": \"^3.5.3\",\n    \"mocha-wrap\": \"^2.1.2\",\n    \"object-inspect\": \"^1.11.0\",\n    \"object.assign\": \"^4.1.7\",\n    \"prop-types\": \"^15.8.1\",\n    \"psl\": \"=1.9.0\",\n    \"react-is\": \"^16.13.1\",\n    \"semver\": \"^5.7.2\",\n    \"sinon\": \"^5.1.1\",\n    \"sinon-sandbox\": \"^2.0.6\"\n  },\n  \"peerDependencies\": {\n    \"react\": \"*\",\n    \"react-dom\": \"*\"\n  },\n  \"devDependencies\": {\n    \"@babel/cli\": \"^7.28.3\",\n    \"@babel/core\": \"^7.28.4\",\n    \"@babel/eslint-parser\": \"^7.28.4\",\n    \"babel-plugin-add-module-exports\": \"^1.0.4\",\n    \"eslint\": \"^7.32.0\",\n    \"eslint-config-airbnb\": \"^18.2.1\",\n    \"eslint-plugin-import\": \"^2.32.0\",\n    \"eslint-plugin-jsx-a11y\": \"^6.10.2\",\n    \"eslint-plugin-mocha\": \"^8.1.0\",\n    \"eslint-plugin-react\": \"^7.37.5\",\n    \"eslint-plugin-react-hooks\": \"^4.2.0\",\n    \"rimraf\": \"^2.7.1\",\n    \"safe-publish-latest\": \"^2.0.0\"\n  }\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/Adapter-spec.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\nimport jsdom from 'jsdom';\nimport { get } from 'enzyme/build/configuration';\nimport { configure, shallow, EnzymeAdapter } from 'enzyme';\nimport inspect from 'object-inspect';\nimport {\n  Portal,\n  Memo,\n} from 'react-is';\nimport PropTypes from 'prop-types';\nimport wrap from 'mocha-wrap';\nimport { fakeDynamicImport, wrapWithWrappingComponent, RootFinder } from 'enzyme-adapter-utils';\n\nimport './_helpers/setupAdapters';\nimport Adapter from './_helpers/adapter';\nimport {\n  AsyncMode,\n  ConcurrentMode,\n  createContext,\n  createPortal,\n  forwardRef,\n  Fragment,\n  lazy,\n  Profiler,\n  renderToString,\n  StrictMode,\n  Suspense,\n} from './_helpers/react-compat';\nimport { is } from './_helpers/version';\nimport {\n  itIf,\n  describeWithDOM,\n  describeIf,\n  isMemo,\n} from './_helpers';\n\nconst { adapter } = get();\n\nconst prettyFormat = (x) => inspect(x).replace(/,/g, ',\\n');\n\n// Kind of hacky, but we nullify all the instances to test the tree structure\n// with jasmine's deep equality function, and test the instances separate. We\n// also delete children props because testing them is more annoying and not\n// really important to verify.\nfunction cleanNode(node) {\n  if (!node) {\n    return;\n  }\n  if (node && node.instance) {\n    node.instance = null;\n  }\n  if (node && node.props && node.props.children) {\n    // eslint-disable-next-line no-unused-vars\n    const { children, ...props } = node.props;\n    node.props = props;\n  }\n  if (Array.isArray(node.rendered)) {\n    node.rendered.forEach(cleanNode);\n  } else if (typeof node.rendered === 'object') {\n    cleanNode(node.rendered);\n  }\n}\n\ndescribe('Adapter', () => {\n  class RendersNull extends React.Component {\n    render() {\n      return null;\n    }\n  }\n\n  describe('error message', () => {\n    afterEach(() => {\n      configure({ adapter });\n    });\n\n    it('fails to render when no adapter is configured', () => {\n      configure({ adapter: undefined });\n      expect(() => shallow(<div />)).to.throw(Error, /Enzyme expects an adapter to be configured, but found none/);\n    });\n\n    it('fails to render when an object that does not inherit from the base class is configured', () => {\n      expect(() => configure({ adapter: {} })).to.throw(Error, /configured enzyme adapter did not inherit from the EnzymeAdapter base class/);\n    });\n\n    it('fails to render when an adapter constructor is configured', () => {\n      expect(() => configure({ adapter: Adapter })).to.throw(Error, /you provided an adapter \\*constructor\\*/);\n    });\n\n    it('fails to render when a non-adapter-constructor function is configured', () => {\n      expect(() => configure({ adapter() {} })).to.throw(Error, /an enzyme adapter must be an object instance; you provided a function/);\n    });\n  });\n\n  describe('base class', () => {\n    it('constructs', () => {\n      const instance = new EnzymeAdapter();\n      expect(instance).to.have.property('options');\n      expect(instance.options).to.be.an('object');\n    });\n\n    it('throws on abstract methods', () => {\n      expect(() => new EnzymeAdapter().createRenderer()).to.throw(\n        Error,\n        'createRenderer is a required method of EnzymeAdapter, but was not implemented.',\n      );\n      expect(() => new EnzymeAdapter().nodeToElement()).to.throw(\n        Error,\n        'nodeToElement is a required method of EnzymeAdapter, but was not implemented.',\n      );\n      expect(() => new EnzymeAdapter().isValidElement()).to.throw(\n        Error,\n        'isValidElement is a required method of EnzymeAdapter, but was not implemented.',\n      );\n      expect(() => new EnzymeAdapter().createElement()).to.throw(\n        Error,\n        'createElement is a required method of EnzymeAdapter, but was not implemented.',\n      );\n    });\n\n    describe('invokeSetStateCallback', () => {\n      it('has the right length', () => {\n        expect(EnzymeAdapter.prototype).to.have.property('invokeSetStateCallback');\n        expect(EnzymeAdapter.prototype.invokeSetStateCallback).to.be.a('function');\n        expect(EnzymeAdapter.prototype.invokeSetStateCallback).to.have.lengthOf(2);\n      });\n    });\n  });\n\n  describeWithDOM('mounted render', () => {\n    function hydratedTreeMatchesUnhydrated(element, hydrate = false) {\n      const markup = renderToString(element);\n      const dom = jsdom.jsdom(`<div id=\"root\">${markup}</div>`);\n\n      const rendererA = adapter.createRenderer({\n        mode: 'mount',\n        [hydrate ? 'hydrateIn' : 'attachTo']: dom.querySelector('#root'),\n      });\n\n      rendererA.render(element);\n\n      const nodeA = rendererA.getNode();\n\n      cleanNode(nodeA);\n\n      const rendererB = adapter.createRenderer({\n        mode: 'mount',\n      });\n\n      rendererB.render(element);\n\n      const nodeB = rendererB.getNode();\n\n      cleanNode(nodeB);\n      expect(prettyFormat(nodeA)).to.equal(prettyFormat(nodeB));\n    }\n\n    class BamBam extends React.Component {\n      render() {\n        const { children } = this.props;\n        return (<div>{children}</div>);\n      }\n    }\n    class FooBar extends React.Component {\n      render() {\n        const { children } = this.props;\n        return (<BamBam>{children}</BamBam>);\n      }\n    }\n    class One extends React.Component {\n      render() { return (<FooBar><span><FooBar /></span></FooBar>); }\n    }\n    class Two extends React.Component {\n      render() { return (<FooBar><span>2</span></FooBar>); }\n    }\n    class Three extends React.Component {\n      render() { return (<FooBar><span><div /></span></FooBar>); }\n    }\n    class Four extends React.Component {\n      render() { return (<FooBar><span>{'some string'}4{'another string'}</span></FooBar>); }\n    }\n\n    it('hydrated trees match unhydrated trees', () => {\n      hydratedTreeMatchesUnhydrated(<One />);\n      hydratedTreeMatchesUnhydrated(<Two />);\n      hydratedTreeMatchesUnhydrated(<Three />);\n      hydratedTreeMatchesUnhydrated(<Four />);\n    });\n\n    itIf(is('>= 16'), 'works with ReactDOM.hydrate', () => {\n      hydratedTreeMatchesUnhydrated(<One />, true);\n      hydratedTreeMatchesUnhydrated(<Two />, true);\n      hydratedTreeMatchesUnhydrated(<Three />, true);\n      hydratedTreeMatchesUnhydrated(<Four />, true);\n    });\n\n    it('treats mixed children correctly', () => {\n      class Foo extends React.Component {\n        render() {\n          return (<div>hello{4}{'world'}</div>);\n        }\n      }\n\n      const options = { mode: 'mount' };\n      const renderer = adapter.createRenderer(options);\n\n      renderer.render(<Foo />);\n\n      const node = renderer.getNode();\n\n      cleanNode(node);\n\n      expect(prettyFormat(node)).to.equal(prettyFormat({\n        nodeType: 'class',\n        type: Foo,\n        props: {},\n        key: undefined,\n        ref: null,\n        instance: null,\n        rendered: {\n          nodeType: 'host',\n          type: 'div',\n          props: {},\n          key: undefined,\n          ref: null,\n          instance: null,\n          rendered: [\n            'hello',\n            is('>= 16') ? '4' : 4,\n            'world',\n          ],\n        },\n      }));\n    });\n\n    it('treats null renders correctly', () => {\n      const options = { mode: 'mount' };\n      const renderer = adapter.createRenderer(options);\n\n      renderer.render(<RendersNull />);\n\n      const node = renderer.getNode();\n\n      cleanNode(node);\n\n      expect(prettyFormat(node)).to.equal(prettyFormat({\n        nodeType: 'class',\n        type: RendersNull,\n        props: {},\n        key: undefined,\n        ref: null,\n        instance: null,\n        rendered: null,\n      }));\n    });\n\n    itIf(is('>= 16'), 'renders react portals', () => {\n      const document = jsdom.jsdom();\n      const options = { mode: 'mount' };\n      const renderer = adapter.createRenderer(options);\n      const innerDiv = <div className=\"Foo\">Hello World!</div>;\n      const Foo = () => (\n        createPortal(\n          innerDiv,\n          document.body,\n        )\n      );\n\n      renderer.render(<Foo />);\n\n      const node = renderer.getNode();\n\n      const { rendered: { props: { children } } } = node;\n      expect(children).to.equal(innerDiv);\n\n      cleanNode(node);\n\n      expect(prettyFormat(node)).to.equal(prettyFormat({\n        nodeType: 'function',\n        type: Foo,\n        props: {},\n        key: undefined,\n        ref: null,\n        instance: null,\n        rendered: {\n          nodeType: 'portal',\n          type: Portal,\n          props: {\n            containerInfo: document.body,\n          },\n          key: undefined,\n          ref: null,\n          instance: null,\n          rendered: {\n            nodeType: 'host',\n            type: 'div',\n            props: { className: 'Foo' },\n            key: undefined,\n            ref: null,\n            instance: null,\n            rendered: ['Hello World!'],\n          },\n        },\n      }));\n    });\n\n    itIf(is('>= 16'), 'shallow renders react portals', () => {\n      const options = { mode: 'shallow' };\n      const renderer = adapter.createRenderer(options);\n      const innerDiv = <div className=\"Foo\">Hello World!</div>;\n      const containerDiv = { nodeType: 1 };\n      const Foo = () => (\n        createPortal(\n          innerDiv,\n          containerDiv,\n        )\n      );\n\n      renderer.render(<Foo />);\n\n      const node = renderer.getNode();\n\n      const { rendered: { props: { children } } } = node;\n      expect(children).to.equal(innerDiv);\n\n      cleanNode(node);\n\n      expect(prettyFormat(node)).to.equal(prettyFormat({\n        nodeType: 'function',\n        type: Foo,\n        props: {},\n        key: undefined,\n        ref: null,\n        instance: null,\n        rendered: {\n          nodeType: 'portal',\n          type: Portal,\n          props: {\n            containerInfo: containerDiv,\n          },\n          key: undefined,\n          ref: null,\n          instance: null,\n          rendered: {\n            nodeType: 'host',\n            type: 'div',\n            props: { className: 'Foo' },\n            key: undefined,\n            ref: null,\n            instance: null,\n            rendered: 'Hello World!',\n          },\n        },\n      }));\n    });\n\n    itIf(is('> 0.13'), 'renders simple components returning host components', () => {\n      const options = { mode: 'mount' };\n      const renderer = adapter.createRenderer(options);\n\n      const Qoo = () => <span className=\"Qoo\">Hello World!</span>;\n\n      renderer.render(<Qoo />);\n\n      const node = renderer.getNode();\n\n      cleanNode(node);\n\n      expect(prettyFormat(node)).to.equal(prettyFormat({\n        nodeType: 'function',\n        type: Qoo,\n        props: {},\n        key: undefined,\n        ref: null,\n        instance: null,\n        rendered: {\n          nodeType: 'host',\n          type: 'span',\n          props: { className: 'Qoo' },\n          key: undefined,\n          ref: null,\n          instance: null,\n          rendered: ['Hello World!'],\n        },\n      }));\n    });\n\n    it('renders simple components returning host components', () => {\n      const options = { mode: 'mount' };\n      const renderer = adapter.createRenderer(options);\n\n      class Qoo extends React.Component {\n        render() {\n          return (\n            <span className=\"Qoo\">Hello World!</span>\n          );\n        }\n      }\n\n      renderer.render(<Qoo />);\n\n      const node = renderer.getNode();\n\n      cleanNode(node);\n\n      expect(prettyFormat(node)).to.equal(prettyFormat({\n        nodeType: 'class',\n        type: Qoo,\n        props: {},\n        key: undefined,\n        ref: null,\n        instance: null,\n        rendered: {\n          nodeType: 'host',\n          type: 'span',\n          props: { className: 'Qoo' },\n          key: undefined,\n          ref: null,\n          instance: null,\n          rendered: ['Hello World!'],\n        },\n      }));\n    });\n\n    it('handles null rendering components', () => {\n      const options = { mode: 'mount' };\n      const renderer = adapter.createRenderer(options);\n\n      renderer.render(<RendersNull />);\n\n      const node = renderer.getNode();\n\n      expect(node.instance).to.be.instanceof(RendersNull);\n\n      cleanNode(node);\n\n      expect(prettyFormat(node)).to.equal(prettyFormat({\n        nodeType: 'class',\n        type: RendersNull,\n        props: {},\n        key: undefined,\n        ref: null,\n        instance: null,\n        rendered: null,\n      }));\n    });\n\n    itIf(is('> 0.13'), 'renders complicated trees of composites and hosts', () => {\n      // SFC returning host. no children props.\n      const Qoo = () => <span className=\"Qoo\">Hello World!</span>;\n\n      // SFC returning host. passes through children.\n      const Foo = ({ className, children }) => (\n        <div className={`Foo ${className}`}>\n          <span className=\"Foo2\">Literal</span>\n          {children}\n        </div>\n      );\n\n      // class composite returning composite. passes through children.\n      class Bar extends React.Component {\n        render() {\n          const { special, children } = this.props;\n          return (\n            <Foo className={special ? 'special' : 'normal'}>\n              {children}\n            </Foo>\n          );\n        }\n      }\n\n      // class composite return composite. no children props.\n      class Bam extends React.Component {\n        render() {\n          return (\n            <Bar special>\n              <Qoo />\n            </Bar>\n          );\n        }\n      }\n\n      const options = { mode: 'mount' };\n      const renderer = adapter.createRenderer(options);\n\n      renderer.render(<Bam />);\n\n      const tree = renderer.getNode();\n\n      // we test for the presence of instances before nulling them out\n      expect(tree.instance).to.be.instanceof(Bam);\n      expect(tree.rendered.instance).to.be.instanceof(Bar);\n\n      cleanNode(tree);\n\n      expect(prettyFormat(tree)).to.equal(prettyFormat({\n        nodeType: 'class',\n        type: Bam,\n        props: {},\n        key: undefined,\n        ref: null,\n        instance: null,\n        rendered: {\n          nodeType: 'class',\n          type: Bar,\n          props: { special: true },\n          key: undefined,\n          ref: null,\n          instance: null,\n          rendered: {\n            nodeType: 'function',\n            type: Foo,\n            props: { className: 'special' },\n            key: undefined,\n            ref: null,\n            instance: null,\n            rendered: {\n              nodeType: 'host',\n              type: 'div',\n              props: { className: 'Foo special' },\n              key: undefined,\n              ref: null,\n              instance: null,\n              rendered: [\n                {\n                  nodeType: 'host',\n                  type: 'span',\n                  props: { className: 'Foo2' },\n                  key: undefined,\n                  ref: null,\n                  instance: null,\n                  rendered: ['Literal'],\n                },\n                {\n                  nodeType: 'function',\n                  type: Qoo,\n                  props: {},\n                  key: undefined,\n                  ref: null,\n                  instance: null,\n                  rendered: {\n                    nodeType: 'host',\n                    type: 'span',\n                    props: { className: 'Qoo' },\n                    key: undefined,\n                    ref: null,\n                    instance: null,\n                    rendered: ['Hello World!'],\n                  },\n                },\n              ],\n            },\n          },\n        },\n      }));\n    });\n\n    it('renders complicated trees of composites and hosts', () => {\n      // class returning host. no children props.\n      class Qoo extends React.Component {\n        render() {\n          return (\n            <span className=\"Qoo\">Hello World!</span>\n          );\n        }\n      }\n\n      class Foo extends React.Component {\n        render() {\n          const { className, children } = this.props;\n          return (\n            <div className={`Foo ${className}`}>\n              <span className=\"Foo2\">Literal</span>\n              {children}\n            </div>\n          );\n        }\n      }\n\n      // class composite returning composite. passes through children.\n      class Bar extends React.Component {\n        render() {\n          const { special, children } = this.props;\n          return (\n            <Foo className={special ? 'special' : 'normal'}>\n              {children}\n            </Foo>\n          );\n        }\n      }\n\n      // class composite return composite. no children props.\n      class Bam extends React.Component {\n        render() {\n          return (\n            <Bar special>\n              <Qoo />\n            </Bar>\n          );\n        }\n      }\n\n      const options = { mode: 'mount' };\n      const renderer = adapter.createRenderer(options);\n\n      renderer.render(<Bam />);\n\n      const tree = renderer.getNode();\n\n      // we test for the presence of instances before nulling them out\n      expect(tree.instance).to.be.instanceof(Bam);\n      expect(tree.rendered.instance).to.be.instanceof(Bar);\n\n      cleanNode(tree);\n\n      expect(prettyFormat(tree)).to.equal(prettyFormat({\n        nodeType: 'class',\n        type: Bam,\n        props: {},\n        key: undefined,\n        ref: null,\n        instance: null,\n        rendered: {\n          nodeType: 'class',\n          type: Bar,\n          props: { special: true },\n          key: undefined,\n          ref: null,\n          instance: null,\n          rendered: {\n            nodeType: 'class',\n            type: Foo,\n            props: { className: 'special' },\n            key: undefined,\n            ref: null,\n            instance: null,\n            rendered: {\n              nodeType: 'host',\n              type: 'div',\n              props: { className: 'Foo special' },\n              key: undefined,\n              ref: null,\n              instance: null,\n              rendered: [\n                {\n                  nodeType: 'host',\n                  type: 'span',\n                  props: { className: 'Foo2' },\n                  key: undefined,\n                  ref: null,\n                  instance: null,\n                  rendered: ['Literal'],\n                },\n                {\n                  nodeType: 'class',\n                  type: Qoo,\n                  props: {},\n                  key: undefined,\n                  ref: null,\n                  instance: null,\n                  rendered: {\n                    nodeType: 'host',\n                    type: 'span',\n                    props: { className: 'Qoo' },\n                    key: undefined,\n                    ref: null,\n                    instance: null,\n                    rendered: ['Hello World!'],\n                  },\n                },\n              ],\n            },\n          },\n        },\n      }));\n    });\n  });\n\n  describeWithDOM('mount renderer', () => {\n    it('render node with updated props', () => {\n      class Counter extends React.Component {\n        constructor(props) {\n          super(props);\n          this.state = { count: 0 };\n        }\n\n        increment() {\n          this.setState(({ count }) => ({ count: count + 1 }));\n        }\n\n        render() {\n          return <RendersNull {...this.state} />;\n        }\n      }\n\n      const options = { mode: 'mount' };\n      const renderer = adapter.createRenderer(options);\n\n      renderer.render(<Counter />);\n\n      let tree = renderer.getNode();\n      expect(tree.rendered.props).to.have.property('count', 0);\n      tree.instance.increment();\n      tree = renderer.getNode();\n      expect(tree.rendered.props).to.have.property('count', 1);\n      tree.instance.increment();\n      tree = renderer.getNode();\n      expect(tree.rendered.props).to.have.property('count', 2);\n    });\n  });\n\n  it('renders basic shallow as well', () => {\n    class Bar extends React.Component {\n      constructor(props) {\n        super(props);\n        throw new Error('Bar constructor should not be called');\n      }\n\n      render() { // eslint-disable-line react/require-render-return\n        throw new Error('Bar render method should not be called');\n      }\n    }\n\n    class Foo extends React.Component {\n      render() { // eslint-disable-line react/require-render-return\n        throw new Error('Foo render method should not be called');\n      }\n    }\n\n    // class composite return composite. no children props.\n    class Bam extends React.Component {\n      render() {\n        return (\n          <Bar>\n            <Foo />\n            <Foo />\n            <Foo />\n          </Bar>\n        );\n      }\n    }\n\n    const options = { mode: 'shallow' };\n    const renderer = adapter.createRenderer(options);\n\n    renderer.render(<Bam />);\n\n    const tree = renderer.getNode();\n\n    cleanNode(tree);\n\n    expect(prettyFormat(tree)).to.equal(prettyFormat({\n      nodeType: 'class',\n      type: Bam,\n      props: {},\n      key: undefined,\n      ref: null,\n      instance: null,\n      rendered: {\n        nodeType: 'class',\n        type: Bar,\n        props: {},\n        key: undefined,\n        ref: null,\n        instance: null,\n        rendered: [\n          {\n            nodeType: 'class',\n            type: Foo,\n            props: {},\n            key: undefined,\n            ref: null,\n            instance: null,\n            rendered: null,\n          },\n          {\n            nodeType: 'class',\n            type: Foo,\n            props: {},\n            key: undefined,\n            ref: null,\n            instance: null,\n            rendered: null,\n          },\n          {\n            nodeType: 'class',\n            type: Foo,\n            props: {},\n            key: undefined,\n            ref: null,\n            instance: null,\n            rendered: null,\n          },\n        ],\n      },\n    }));\n  });\n\n  it('does not erroneously add a key when refs are present', () => {\n    class Inner extends React.Component {\n      constructor(props) {\n        super(props);\n        throw new Error('Inner constructor should not be called');\n      }\n\n      render() { // eslint-disable-line react/require-render-return\n        throw new Error('Inner render method should not be called');\n      }\n    }\n\n    class Outer extends React.Component {\n      constructor(props) {\n        super(props);\n        this.setRef = this.setRef.bind(this);\n      }\n\n      setRef(r) {\n        this.inner = r;\n      }\n\n      render() {\n        return <Inner ref={this.setRef} />;\n      }\n    }\n\n    const options = { mode: 'shallow' };\n    const renderer = adapter.createRenderer(options);\n\n    renderer.render(<Outer />);\n\n    const tree = renderer.getNode();\n\n    cleanNode(tree);\n\n    expect(prettyFormat(tree)).to.equal(prettyFormat({\n      nodeType: 'class',\n      type: Outer,\n      props: {},\n      key: undefined,\n      ref: null,\n      instance: null,\n      rendered: {\n        nodeType: 'class',\n        type: Inner,\n        props: {},\n        key: undefined,\n        ref: tree.rendered.ref, // prettyFormat loses the reference to \"ref\"\n        instance: null,\n        rendered: null,\n      },\n    }));\n  });\n\n  it('adds keys correctly to elements that have them', () => {\n    class Inner extends React.Component {\n      constructor(props) {\n        super(props);\n        throw new Error('Inner constructor should not be called');\n      }\n\n      render() { // eslint-disable-line react/require-render-return\n        throw new Error('Inner render method should not be called');\n      }\n    }\n\n    class Outer extends React.Component {\n      render() {\n        return <Inner key=\"foo\" />;\n      }\n    }\n\n    const options = { mode: 'shallow' };\n    const renderer = adapter.createRenderer(options);\n\n    renderer.render(<Outer />);\n\n    const tree = renderer.getNode();\n\n    cleanNode(tree);\n\n    expect(prettyFormat(tree)).to.equal(prettyFormat({\n      nodeType: 'class',\n      type: Outer,\n      props: {},\n      key: undefined,\n      ref: null,\n      instance: null,\n      rendered: {\n        nodeType: 'class',\n        type: Inner,\n        props: {},\n        key: 'foo',\n        ref: null,\n        instance: null,\n        rendered: null,\n      },\n    }));\n  });\n\n  it('adds null keys to elements correctly', () => {\n    class Inner extends React.Component {\n      constructor(props) {\n        super(props);\n        throw new Error('Inner constructor should not be called');\n      }\n\n      render() { // eslint-disable-line react/require-render-return\n        throw new Error('Inner render method should not be called');\n      }\n    }\n\n    class Outer extends React.Component {\n      render() {\n        return <Inner key={null} />;\n      }\n    }\n\n    const options = { mode: 'shallow' };\n    const renderer = adapter.createRenderer(options);\n\n    renderer.render(<Outer />);\n\n    const tree = renderer.getNode();\n\n    cleanNode(tree);\n\n    expect(prettyFormat(tree)).to.equal(prettyFormat({\n      nodeType: 'class',\n      type: Outer,\n      props: {},\n      key: undefined,\n      ref: null,\n      instance: null,\n      rendered: {\n        nodeType: 'class',\n        type: Inner,\n        props: {},\n        key: 'null',\n        ref: null,\n        instance: null,\n        rendered: null,\n      },\n    }));\n  });\n\n  describe('determines valid element types', () => {\n    itIf(is('> 0.13'), 'supports stateless function components', () => {\n      const SFC = () => null;\n\n      expect(adapter.isValidElementType(SFC)).to.equal(true);\n    });\n\n    it('supports custom components', () => {\n      class Component extends React.Component {\n        render() { return null; }\n      }\n\n      expect(adapter.isValidElementType(Component)).to.equal(true);\n    });\n\n    it('supports HTML elements', () => {\n      expect(adapter.isValidElementType('div')).to.equal(true);\n    });\n\n    itIf(is('>= 16'), 'supports Portals', () => {\n      expect(adapter.isValidElementType(createPortal(<div />, { nodeType: 1 }))).to.equal(false);\n    });\n\n    itIf(is('>= 16.3'), 'supports Context', () => {\n      const Context = createContext({ });\n      expect(adapter.isValidElementType(Context.Consumer)).to.equal(true);\n      expect(adapter.isValidElementType(Context.Provider)).to.equal(true);\n    });\n\n    itIf(is('>= 16.3'), 'supports forward refs', () => {\n      expect(adapter.isValidElementType(forwardRef(() => null))).to.equal(true);\n    });\n  });\n\n  itIf(is('>0.13'), 'supports wrapping elements in a WrappingComponent', () => {\n    class WrappingComponent extends React.Component {\n      render() {\n        return null;\n      }\n    }\n    const node = <div />;\n    const options = {\n      mode: 'shallow',\n      wrappingComponent: WrappingComponent,\n      wrappingComponentProps: { foo: 'bar' },\n    };\n    const { RootFinder: ReturnedRootFinder, node: wrappedNode } = adapter.wrapWithWrappingComponent(node, options);\n    expect(ReturnedRootFinder).to.equal(RootFinder);\n    expect(wrappedNode).to.eql(wrapWithWrappingComponent(React.createElement, node, options));\n  });\n\n  describe('provides node displayNames', () => {\n    const getDisplayName = (el) => adapter.displayNameOfNode(adapter.elementToNode(el));\n\n    itIf(is('> 0.13'), 'supports stateless function components', () => {\n      const SFC = () => null;\n\n      expect(getDisplayName(<SFC />)).to.equal('SFC');\n    });\n\n    it('supports custom components', () => {\n      class Component extends React.Component {\n        render() { return null; }\n      }\n      class Something extends React.Component {\n        render() { return null; }\n      }\n      Something.displayName = 'MyComponent';\n\n      expect(getDisplayName(<Component />)).to.equal('Component');\n      expect(getDisplayName(<Something />)).to.equal('MyComponent');\n    });\n\n    it('supports HTML elements', () => {\n      expect(getDisplayName(<div />)).to.equal('div');\n    });\n\n    itIf(is('>= 16.2'), 'supports Fragments', () => {\n      expect(getDisplayName(<Fragment />)).to.equal('Fragment');\n    });\n\n    itIf(is('>= 16'), 'supports Portals', () => {\n      expect(getDisplayName(createPortal(<div />, { nodeType: 1 }))).to.equal('Portal');\n    });\n\n    itIf(is('>= 16.3'), 'supports Context', () => {\n      const Context = createContext({});\n      expect(getDisplayName(<Context.Consumer />)).to.equal('ContextConsumer');\n      expect(getDisplayName(<Context.Provider />)).to.equal('ContextProvider');\n    });\n\n    itIf(is('>= 16.3'), 'supports forward refs', () => {\n      const ForwaredRef = forwardRef(() => null);\n      // eslint-disable-next-line prefer-arrow-callback\n      const NamedForwardedRef = forwardRef(function Named() { return null; });\n\n      expect(getDisplayName(<ForwaredRef />)).to.equal('ForwardRef');\n      expect(getDisplayName(<NamedForwardedRef />)).to.equal('ForwardRef(Named)');\n    });\n\n    itIf(is('>= 16.3'), 'supports StrictMode', () => {\n      expect(getDisplayName(<StrictMode />)).to.equal('StrictMode');\n    });\n\n    itIf(is('>= 16.3') && is('< 16.6'), 'supports AsyncMode', () => {\n      expect(getDisplayName(<AsyncMode />)).to.equal('AsyncMode');\n    });\n\n    itIf(is('>= 16.4'), 'supports Profiler', () => {\n      expect(getDisplayName(<Profiler />)).to.equal('Profiler');\n    });\n\n    itIf((is('>= 16.6') && is('<16.9')), 'supports ConcurrentMode', () => {\n      expect(getDisplayName(<ConcurrentMode />)).to.equal('ConcurrentMode');\n    });\n\n    itIf(is('>= 16.6'), 'supports Suspense', () => {\n      expect(getDisplayName(<Suspense />)).to.equal('Suspense');\n    });\n\n    itIf(is('>= 16.6'), 'supports lazy', () => {\n      class DynamicComponent extends React.Component {\n        render() {\n          return <div>DynamicComponent</div>;\n        }\n      }\n      const LazyComponent = lazy(() => fakeDynamicImport(DynamicComponent));\n      expect(getDisplayName(<LazyComponent />)).to.equal('lazy');\n    });\n  });\n\n  describeIf(is('>= 16.2'), 'determines if node isFragment', () => {\n    it('correctly identifies Fragment', () => {\n      expect(adapter.isFragment(<Fragment />)).to.equal(true);\n    });\n\n    it('correctly identifies a non-Fragment', () => {\n      expect(adapter.isFragment(<div />)).to.equal(false);\n    });\n  });\n\n  describe('.wrap()', () => {\n    it('returns a valid element', () => {\n      const element = <div a=\"b\" c=\"d\" />;\n      const wrapped = adapter.wrap(element);\n      expect(adapter.isValidElement(wrapped)).to.equal(true);\n    });\n\n    it('renders the children provided', () => {\n      const element = <div a=\"b\" c=\"d\" />;\n      const wrapped = adapter.wrap(element);\n      expect(wrapped.props).to.contain.keys({ children: element });\n    });\n  });\n\n  describeIf(is('>= 16'), 'checkPropTypes', () => {\n    let renderer;\n\n    class Root extends React.Component {\n      render() {\n        return <A />;\n      }\n    }\n    function A() {\n      return <B />;\n    }\n    class B extends React.Component {\n      render() {\n        return <C />;\n      }\n    }\n    class C extends React.Component {\n      render() {\n        return null;\n      }\n    }\n    const typeSpecs = {\n      foo: PropTypes.number,\n    };\n    const values = {\n      foo: 'foo',\n    };\n    const location = 'Adapter-spec';\n    const hierarchy = [\n      <A />,\n      <div />,\n      <span />,\n      <B />,\n      <C />,\n    ];\n\n    beforeEach(() => {\n      renderer = adapter.createRenderer({ mode: 'shallow' });\n      renderer.render(<Root />, {});\n    });\n\n    wrap()\n      .withConsoleThrows()\n      .it('checks prop types', () => {\n        expect(() => renderer.checkPropTypes(typeSpecs, values, location, hierarchy)).to.throw(`\nWarning: Failed Adapter-spec type: Invalid Adapter-spec \\`foo\\` of type \\`string\\` supplied to \\`Root\\`, expected \\`number\\`.\n    in A (created by B)\n    in div (created by B)\n    in span (created by B)\n    in B (created by C)\n    in C (created by Root)\n    in Root (created by WrapperComponent)\n    in WrapperComponent\n        `.trim());\n      });\n  });\n\n  describe('isCustomComponent', () => {\n    function FunctionComponent() {\n      return null;\n    }\n    class ClassComponent extends React.Component {\n      render() {\n        return null;\n      }\n    }\n\n    it('returns true for functional/class components', () => {\n      expect(adapter.isCustomComponent(FunctionComponent)).to.equal(true);\n      expect(adapter.isCustomComponent(ClassComponent)).to.equal(true);\n    });\n\n    it('returns false for everything else', () => {\n      expect(adapter.isCustomComponent({})).to.equal(false);\n      expect(adapter.isCustomComponent(true)).to.equal(false);\n      expect(adapter.isCustomComponent(null)).to.equal(false);\n      expect(adapter.isCustomComponent(undefined)).to.equal(false);\n    });\n\n    itIf(is('>=16.3'), 'returns true for forward refs', () => {\n      expect(adapter.isCustomComponent(forwardRef(() => null))).to.equal(true);\n    });\n  });\n\n  describeIf(is('>= 16.3'), 'isContextConsumer(type)', () => {\n    it('returns true for createContext() Consumers', () => {\n      expect(adapter.isContextConsumer(createContext().Consumer)).to.equal(true);\n    });\n\n    it('returns false for everything else', () => {\n      expect(adapter.isContextConsumer(null)).to.equal(false);\n      expect(adapter.isContextConsumer(true)).to.equal(false);\n      expect(adapter.isContextConsumer(undefined)).to.equal(false);\n      expect(adapter.isContextConsumer(false)).to.equal(false);\n      expect(adapter.isContextConsumer(() => <div />)).to.equal(false);\n      expect(adapter.isContextConsumer(forwardRef(() => null))).to.equal(false);\n      expect(adapter.isContextConsumer(createContext().Provider)).to.equal(false);\n    });\n  });\n\n  describeIf(is('>= 16.3'), 'getProviderFromConsumer(Consumer)', () => {\n    it('gets a createContext() Provider from a Consumer', () => {\n      const Context = createContext();\n\n      expect(adapter.getProviderFromConsumer(Context.Consumer)).to.equal(Context.Provider);\n    });\n\n    it('throws an internal error if something that is not a Consumer is passed', () => {\n      expect(() => adapter.getProviderFromConsumer(null)).to.throw(\n        'Enzyme Internal Error: can’t figure out how to get Provider from Consumer',\n      );\n      expect(() => adapter.getProviderFromConsumer({})).to.throw(\n        'Enzyme Internal Error: can’t figure out how to get Provider from Consumer',\n      );\n    });\n  });\n\n  describe('matchesElementType(node, matchingType)', () => {\n    it('returns a falsy node', () => {\n      expect(adapter.matchesElementType()).to.equal();\n      expect(adapter.matchesElementType(null)).to.equal(null);\n      expect(adapter.matchesElementType(false)).to.equal(false);\n      expect(adapter.matchesElementType('')).to.equal('');\n      expect(adapter.matchesElementType(0)).to.equal(0);\n    });\n\n    it('compares the node’s `type` property to `matchingType`', () => {\n      const sentinel = {};\n      expect(adapter.matchesElementType({ type: sentinel }, sentinel)).to.equal(true);\n      expect(adapter.matchesElementType({ type: {} }, sentinel)).to.equal(false);\n    });\n\n    describeIf(is('>= 16.6'), 'memoized components', () => {\n      const matchingType = {};\n      const node = { type: matchingType };\n      const memoNode = {\n        $$typeof: Memo,\n        type: node.type,\n      };\n      const memoMatchingType = {\n        $$typeof: Memo,\n        type: matchingType,\n      };\n\n      beforeEach(() => {\n        expect(isMemo(memoNode)).to.equal(true); // sanity check\n        expect(isMemo(memoMatchingType)).to.equal(true); // sanity check\n      });\n\n      it('unmemoizes the node’s type', () => {\n        expect(adapter.matchesElementType(memoNode, matchingType)).to.equal(true);\n      });\n\n      it('unmemoizes the matchingType', () => {\n        expect(adapter.matchesElementType(node, memoMatchingType)).to.equal(true);\n      });\n\n      it('unmemoizes both the node’s type and matchingType', () => {\n        expect(adapter.matchesElementType(memoNode, memoMatchingType)).to.equal(true);\n      });\n    });\n  });\n});\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/Debug-spec.jsx",
    "content": "import { expect } from 'chai';\nimport React from 'react';\nimport wrap from 'mocha-wrap';\nimport sinon from 'sinon-sandbox';\nimport hasSymbols from 'has-symbols';\n\nimport { mount, shallow } from 'enzyme';\nimport { get } from 'enzyme/build/configuration';\nimport {\n  spaces,\n  indent,\n  debugNode,\n  debugNodes,\n  typeName,\n} from 'enzyme/build/Debug';\n\nimport './_helpers/setupAdapters';\nimport {\n  forwardRef,\n} from './_helpers/react-compat';\nimport {\n  describeWithDOM,\n  describeIf,\n  itIf,\n} from './_helpers';\nimport { is } from './_helpers/version';\n\nconst { adapter } = get();\n\nconst debugElement = (element) => debugNode(adapter.elementToNode(element));\n\ndescribe('debug', () => {\n  wrap()\n    .withOverride(() => adapter, 'displayNameOfNode', () => undefined)\n    .describe('typeName(node)', () => {\n      it('returns `.type` when not a function', () => {\n        const type = {};\n        expect(typeName({ type })).to.equal(type);\n      });\n\n      describe('when `.type` is a function', () => {\n        it('returns the function’s name', () => {\n          function Foo() {}\n          expect(typeName({ type: Foo })).to.equal('Foo');\n        });\n\n        it('returns the function’s `.displayName` when present', () => {\n          function Foo() {}\n          Foo.displayName = 'Bar';\n          expect(typeName({ type: Foo })).to.equal('Bar');\n        });\n\n        it('returns \"Component\" when the function is anonymous', () => {\n          const anon = Object(() => {});\n          expect(typeName({ type: anon })).to.equal('Component');\n        });\n      });\n\n      wrap()\n        .withOverride(() => adapter, 'displayNameOfNode', () => sinon.stub())\n        .describe('when the adapter has a `displayNameOfNode` function', () => {\n          it('calls it, and returns its return value', () => {\n            const stub = adapter.displayNameOfNode;\n            const sentinel = {};\n            stub.returns(sentinel);\n\n            const node = {};\n            expect(typeName(node)).to.equal(sentinel);\n\n            expect(stub).to.have.property('callCount', 1);\n            const { args } = stub.firstCall;\n            expect(args).to.eql([node]);\n          });\n\n          it('returns \"Component\" when `adapter.displayNameOfNode` returns something falsy', () => {\n            const stub = adapter.displayNameOfNode;\n            stub.returns('');\n\n            expect(typeName()).to.equal('Component');\n          });\n        });\n    });\n\n  describe('spaces(n)', () => {\n    it('returnsn spaces', () => {\n      expect(spaces(4)).to.equal('    ');\n      expect(spaces(2)).to.equal('  ');\n      expect(spaces(0)).to.equal('');\n    });\n  });\n\n  describe('indent(depth, string)', () => {\n    it('indents a single-line string by (n) spaces', () => {\n      expect(indent(4, 'hello')).to.equal('    hello');\n      expect(indent(2, 'hello')).to.equal('  hello');\n      expect(indent(0, 'hello')).to.equal('hello');\n    });\n\n    it('intents a multiline string by (n) spaces', () => {\n      expect(indent(2, 'foo\\nbar')).to.equal('  foo\\n  bar');\n    });\n  });\n\n  describe('debugNode(node)', () => {\n    it('renders a node with no props or children as single single xml tag', () => {\n      expect(debugElement(<div />)).to.equal('<div />');\n    });\n\n    it('renders props inline inline', () => {\n      expect(debugElement((\n        <div id=\"foo\" className=\"bar\" />\n      ))).to.equal((\n        '<div id=\"foo\" className=\"bar\" />'\n      ));\n    });\n\n    itIf(hasSymbols(), 'renders symbol props', () => {\n      expect(debugElement((\n        <div symbol={Symbol.iterator} other={Symbol('foo')} />\n      ))).to.equal((\n        '<div symbol={[Symbol(Symbol.iterator)]} other={[Symbol(foo)]} />'\n      ));\n    });\n\n    it('renders children on newline and indented', () => {\n      expect(debugElement((\n        <div>\n          <span />\n        </div>\n      ))).to.equal((\n        `<div>\n  <span />\n</div>`\n      ));\n    });\n\n    it('renders mixed children', () => {\n      expect(debugElement((\n        <div>hello{'world'}</div>\n      ))).to.equal((\n        `<div>\n  hello\n  world\n</div>`\n      ));\n    });\n\n    it('renders props on root and children', () => {\n      expect(debugElement((\n        <div id=\"foo\">\n          <span id=\"bar\" />\n        </div>\n      ))).to.equal((\n        `<div id=\"foo\">\n  <span id=\"bar\" />\n</div>`\n      ));\n    });\n\n    it('renders text on new line and indented', () => {\n      expect(debugElement((\n        <span>some text</span>\n      ))).to.equal((\n        `<span>\n  some text\n</span>`\n      ));\n    });\n\n    it('renders composite components as tags w/ displayName', () => {\n      class Foo extends React.Component {\n        render() { return <div />; }\n      }\n      Foo.displayName = 'Bar';\n\n      expect(debugElement((\n        <div>\n          <Foo />\n        </div>\n      ))).to.equal((\n        `<div>\n  <Bar />\n</div>`\n      ));\n    });\n\n    it('renders composite components as tags w/ name', () => {\n      class Foo extends React.Component {\n        render() { return <div />; }\n      }\n\n      expect(debugElement((\n        <div>\n          <Foo />\n        </div>\n      ))).to.equal((\n        `<div>\n  <Foo />\n</div>`\n      ));\n    });\n\n    itIf(is('> 0.13'), 'renders stateless components as tags w/ name', () => {\n      const Foo = () => <div />;\n\n      expect(debugElement((\n        <div>\n          <Foo />\n        </div>\n      ))).to.equal((\n        `<div>\n  <Foo />\n</div>`\n      ));\n    });\n\n    it('renders mapped children properly', () => {\n      expect(debugElement((\n        <div>\n          <i>not in array</i>\n          {['a', 'b', 'c']}\n        </div>\n      ))).to.equal((\n        `<div>\n  <i>\n    not in array\n  </i>\n  a\n  b\n  c\n</div>`\n      ));\n    });\n\n    it('renders number children properly', () => {\n      expect(debugElement((\n        <div>\n          {-1}\n          {0}\n          {1}\n        </div>\n      ))).to.equal((\n        `<div>\n  -1\n  0\n  1\n</div>`\n      ));\n    });\n\n    it('renders html entities properly', () => {\n      expect(debugElement((\n        <div>&gt;</div>\n      ))).to.equal((\n        `<div>\n  &gt;\n</div>`\n      ));\n    });\n\n    it('does not render falsy children ', () => {\n      expect(debugElement((\n        <div id=\"foo\">\n          {false}\n          {null}\n          {undefined}\n          {''}\n        </div>\n      ))).to.equal('<div id=\"foo\" />');\n    });\n\n    it('renders boxed primitives as the primitive', () => {\n      expect(debugElement((\n        <div a={Object('foo')} b={Object(3)} c={Object(true)} />\n      ))).to.equal('<div a=\"foo\" b={3} c={true} />');\n    });\n  });\n\n  describeWithDOM('debugInst(inst)', () => {\n    it('renders basic debug of mounted components', () => {\n      class Foo extends React.Component {\n        render() {\n          return (\n            <div className=\"foo\">\n              <span>Foo</span>\n            </div>\n          );\n        }\n      }\n      expect(mount(<Foo id=\"2\" />).debug()).to.eql((\n        `<Foo id=\"2\">\n  <div className=\"foo\">\n    <span>\n      Foo\n    </span>\n  </div>\n</Foo>`\n      ));\n    });\n\n    it('renders basic debug of components with mixed children', () => {\n      class Foo extends React.Component {\n        render() {\n          return (\n            <div>hello{'world'}</div>\n          );\n        }\n      }\n      expect(mount(<Foo id=\"2\" />).debug()).to.eql((\n        `<Foo id=\"2\">\n  <div>\n    hello\n    world\n  </div>\n</Foo>`\n      ));\n    });\n\n    it('renders debug of compositional components', () => {\n      class Foo extends React.Component {\n        render() {\n          return (\n            <div className=\"foo\">\n              <span>Foo</span>\n            </div>\n          );\n        }\n      }\n      class Bar extends React.Component {\n        render() {\n          return (\n            <div className=\"bar\">\n              <span>Non-Foo</span>\n              <Foo baz=\"bax\" />\n            </div>\n          );\n        }\n      }\n      expect(mount(<Bar id=\"2\" />).debug()).to.eql((\n        `<Bar id=\"2\">\n  <div className=\"bar\">\n    <span>\n      Non-Foo\n    </span>\n    <Foo baz=\"bax\">\n      <div className=\"foo\">\n        <span>\n          Foo\n        </span>\n      </div>\n    </Foo>\n  </div>\n</Bar>`\n      ));\n    });\n\n    it('renders a subtree of a mounted tree', () => {\n      class Foo extends React.Component {\n        render() {\n          return (\n            <div className=\"foo\">\n              <span>Foo</span>\n            </div>\n          );\n        }\n      }\n      class Bar extends React.Component {\n        render() {\n          return (\n            <div className=\"bar\">\n              <span>Non-Foo</span>\n              <Foo baz=\"bax\" />\n            </div>\n          );\n        }\n      }\n      expect(mount(<Bar id=\"2\" />).find(Foo).debug()).to.eql((\n        `<Foo baz=\"bax\">\n  <div className=\"foo\">\n    <span>\n      Foo\n    </span>\n  </div>\n</Foo>`\n      ));\n    });\n\n    it('renders passed children properly', () => {\n      class Foo extends React.Component {\n        render() {\n          const { children } = this.props;\n          return (\n            <div className=\"foo\">\n              <span>From Foo</span>\n              {children}\n            </div>\n          );\n        }\n      }\n      class Bar extends React.Component {\n        render() {\n          return (\n            <div className=\"bar\">\n              <Foo baz=\"bax\">\n                <span>From Bar</span>\n              </Foo>\n            </div>\n          );\n        }\n      }\n\n      expect(mount(<Bar id=\"2\" />).debug()).to.eql((\n        `<Bar id=\"2\">\n  <div className=\"bar\">\n    <Foo baz=\"bax\">\n      <div className=\"foo\">\n        <span>\n          From Foo\n        </span>\n        <span>\n          From Bar\n        </span>\n      </div>\n    </Foo>\n  </div>\n</Bar>`\n      ));\n    });\n\n    describeIf(is('> 0.13'), 'stateless function components', () => {\n      it('renders basic debug of mounted components', () => {\n        const Foo = () => (\n          <div className=\"foo\">\n            <span>Foo</span>\n          </div>\n        );\n        expect(mount(<Foo id=\"2\" />).debug()).to.eql((\n          `<Foo id=\"2\">\n  <div className=\"foo\">\n    <span>\n      Foo\n    </span>\n  </div>\n</Foo>`\n        ));\n      });\n\n      it('renders debug of compositional components', () => {\n        const Foo = () => (\n          <div className=\"foo\">\n            <span>Foo</span>\n          </div>\n        );\n        const Bar = () => (\n          <div className=\"bar\">\n            <span>Non-Foo</span>\n            <Foo baz=\"bax\" />\n          </div>\n        );\n        expect(mount(<Bar id=\"2\" />).debug()).to.eql((\n          `<Bar id=\"2\">\n  <div className=\"bar\">\n    <span>\n      Non-Foo\n    </span>\n    <Foo baz=\"bax\">\n      <div className=\"foo\">\n        <span>\n          Foo\n        </span>\n      </div>\n    </Foo>\n  </div>\n</Bar>`\n        ));\n      });\n\n      it('renders a subtree of a mounted tree', () => {\n        const Foo = () => (\n          <div className=\"foo\">\n            <span>Foo</span>\n          </div>\n        );\n        const Bar = () => (\n          <div className=\"bar\">\n            <span>Non-Foo</span>\n            <Foo baz=\"bax\" />\n          </div>\n        );\n        expect(mount(<Bar id=\"2\" />).find(Foo).debug()).to.eql((\n          `<Foo baz=\"bax\">\n  <div className=\"foo\">\n    <span>\n      Foo\n    </span>\n  </div>\n</Foo>`\n        ));\n      });\n\n      it('renders passed children properly', () => {\n        const Foo = ({ children }) => (\n          <div className=\"foo\">\n            <span>From Foo</span>\n            {children}\n          </div>\n        );\n\n        const Bar = () => (\n          <div className=\"bar\">\n            <Foo baz=\"bax\">\n              <span>From Bar</span>\n            </Foo>\n          </div>\n        );\n\n        expect(mount(<Bar id=\"2\" />).debug()).to.eql((\n          `<Bar id=\"2\">\n  <div className=\"bar\">\n    <Foo baz=\"bax\">\n      <div className=\"foo\">\n        <span>\n          From Foo\n        </span>\n        <span>\n          From Bar\n        </span>\n      </div>\n    </Foo>\n  </div>\n</Bar>`\n        ));\n      });\n    });\n  });\n\n  describe('shallow', () => {\n    it('renders shallow wrapper properly', () => {\n      class Foo extends React.Component {\n        render() {\n          const { children } = this.props;\n          return (\n            <div className=\"foo\">\n              <span>From Foo</span>\n              {children}\n            </div>\n          );\n        }\n      }\n\n      class Bar extends React.Component {\n        render() {\n          return (\n            <div className=\"bar\">\n              <Foo baz=\"bax\">\n                <span>From Bar</span>\n              </Foo>\n            </div>\n          );\n        }\n      }\n\n      expect(shallow(<Bar id=\"2\" />).debug()).to.eql((\n        `<div className=\"bar\">\n  <Foo baz=\"bax\">\n    <span>\n      From Bar\n    </span>\n  </Foo>\n</div>`\n      ));\n    });\n  });\n\n  describe('debugNodes', () => {\n    it('can render a single node', () => {\n      class Foo extends React.Component {\n        render() {\n          return (\n            <div className=\"foo\">\n              <span>inside Foo</span>\n            </div>\n          );\n        }\n      }\n\n      expect(debugNodes(shallow(<Foo />).getNodesInternal())).to.eql((\n        `<div className=\"foo\">\n  <span>\n    inside Foo\n  </span>\n</div>`\n      ));\n    });\n\n    it('can render multiple nodes', () => {\n      class Foo extends React.Component {\n        render() {\n          return (\n            <div className=\"foo\">\n              <span>inside Foo</span>\n            </div>\n          );\n        }\n      }\n\n      class Bar extends React.Component {\n        render() {\n          return (\n            <div className=\"bar\">\n              <Foo key=\"foo1\" />\n              <Foo key=\"foo2\" />\n              <Foo key=\"foo3\" />\n            </div>\n          );\n        }\n      }\n\n      expect(debugNodes(shallow(<Bar />).children().getElements())).to.eql((\n        `<Foo />\n\n\n<Foo />\n\n\n<Foo />`\n      ));\n    });\n\n    it('can render multiple nodes with indent', () => {\n      class Foo extends React.Component {\n        render() {\n          return (\n            <div className=\"bar\">\n              <span>span1 text</span>\n              <span>span2 text</span>\n              <span>span3 text</span>\n            </div>\n          );\n        }\n      }\n\n      expect(debugNodes(shallow(<Foo />).children().getNodesInternal())).to.eql((\n        `<span>\n  span1 text\n</span>\n\n\n<span>\n  span2 text\n</span>\n\n\n<span>\n  span3 text\n</span>`\n      ));\n    });\n  });\n\n  describe('debug shallow wrapper', () => {\n    it('options.ignoreProps causes props to be omitted', () => {\n      class Foo extends React.Component {\n        render() {\n          const { fooVal } = this.props;\n          return (\n            <div className=\"foo\">\n              {fooVal}\n            </div>\n          );\n        }\n      }\n\n      class Bar extends React.Component {\n        render() {\n          return (\n            <div className=\"class1\">\n              <Foo fooVal=\"baz\" />\n              <span className=\"class2\">span text</span>\n            </div>\n          );\n        }\n      }\n\n      expect(shallow(<Bar />).debug({ ignoreProps: false })).to.eql((\n        `<div className=\"class1\">\n  <Foo fooVal=\"baz\" />\n  <span className=\"class2\">\n    span text\n  </span>\n</div>`\n      ));\n\n      expect(shallow(<Bar />).debug({ ignoreProps: true })).to.eql((\n        `<div>\n  <Foo />\n  <span>\n    span text\n  </span>\n</div>`\n      ));\n    });\n\n    it('options.verbose causes arrays and objects to be verbosely printed', () => {\n      class Foo extends React.Component {\n        render() {\n          const nestedData = {\n            a: [1, 3, { true: true }],\n            b: false,\n            c: { d: 'f' },\n          };\n          nestedData.d = nestedData.a;\n          const arry = [1, 2, { f: nestedData.c }];\n          return (\n            <div data-json={nestedData} data-arry={arry}>Test Component</div>\n          );\n        }\n      }\n\n      const wrapper = shallow(<Foo />);\n      expect(wrapper.debug({ verbose: true })).to.equal((\n        `<div data-json={{ a: [ 1, 3, { true: true } ], b: false, c: { d: 'f' }, d: [ 1, 3, { true: true } ] }} data-arry={[ 1, 2, { f: { d: 'f' } } ]}>\n  Test Component\n</div>`\n      ));\n\n      expect(wrapper.debug({ verbose: false })).to.equal((\n        `<div data-json={{...}} data-arry={{...}}>\n  Test Component\n</div>`\n      ));\n    });\n  });\n\n  describeWithDOM('debug React wrapper', () => {\n    it('options.ignoreProps causes props to be omitted', () => {\n      class Foo extends React.Component {\n        render() {\n          const { fooVal } = this.props;\n          return (\n            <div className=\"foo\">\n              {fooVal}\n            </div>\n          );\n        }\n      }\n\n      class Bar extends React.Component {\n        render() {\n          return (\n            <div className=\"class1\">\n              <Foo fooVal=\"baz\" />\n              <span className=\"class2\">span text</span>\n            </div>\n          );\n        }\n      }\n\n      expect(mount(<Bar />).debug({ ignoreProps: false })).to.eql((\n        `<Bar>\n  <div className=\"class1\">\n    <Foo fooVal=\"baz\">\n      <div className=\"foo\">\n        baz\n      </div>\n    </Foo>\n    <span className=\"class2\">\n      span text\n    </span>\n  </div>\n</Bar>`\n      ));\n\n      expect(mount(<Bar />).debug({ ignoreProps: true })).to.eql((\n        `<Bar>\n  <div>\n    <Foo>\n      <div>\n        baz\n      </div>\n    </Foo>\n    <span>\n      span text\n    </span>\n  </div>\n</Bar>`\n      ));\n    });\n\n    it('options.verbose causes arrays and objects to be verbosely printed', () => {\n      class Foo extends React.Component {\n        render() {\n          const nestedData = {\n            a: [1, 3, { true: true }],\n            b: false,\n            c: { d: 'f' },\n          };\n          nestedData.d = nestedData.a;\n          const arry = [1, 2, { f: nestedData.c }];\n          return (\n            <div data-json={nestedData} data-arry={arry}>Test Component</div>\n          );\n        }\n      }\n\n      const wrapper = mount(<Foo />);\n      expect(wrapper.debug({ verbose: true })).to.equal((\n        `<Foo>\n  <div data-json={{ a: [ 1, 3, { true: true } ], b: false, c: { d: 'f' }, d: [ 1, 3, { true: true } ] }} data-arry={[ 1, 2, { f: { d: 'f' } } ]}>\n    Test Component\n  </div>\n</Foo>`\n      ));\n\n      expect(wrapper.debug({ verbose: false })).to.equal((\n        `<Foo>\n  <div data-json={{...}} data-arry={{...}}>\n    Test Component\n  </div>\n</Foo>`\n      ));\n    });\n\n    it('handles function children', () => {\n      class Abomination extends React.Component {\n        render() {\n          /* eslint no-unused-vars: 0, func-names: 0, react/no-children-prop: 0 */\n          return (\n            <div>\n              {function Foo() { /* hi */ }}\n              {<span />}\n              {(arrow) => arrow('function')}\n              {[1, 2, NaN]}\n              {function (anonymous) {}}\n              {{ a: 'b' }}\n              <span children={{ c: 'd' }} />\n            </div>\n          );\n        }\n      }\n\n      const wrapper = shallow(<Abomination />);\n      expect(wrapper.debug()).to.equal((\n        `<div>\n  [function Foo]\n  <span />\n  [function]\n  1\n  2\n  NaN\n  [function]\n  {{ a: 'b' }}\n  <span>\n    {{ c: 'd' }}\n  </span>\n</div>`\n      ));\n    });\n  });\n\n  describeIf(is('>= 16.3'), 'forwarded ref Components', () => {\n    let Parent;\n    let ParentOfNamed;\n    let SomeComponent;\n    let NamedComponent;\n    beforeEach(() => {\n      SomeComponent = forwardRef((props, ref) => (\n        <div ref={ref}>\n          <span className=\"child1\" />\n        </div>\n      ));\n      Parent = () => <span><SomeComponent foo=\"hello\" /></span>;\n\n      NamedComponent = forwardRef((props, ref) => (<div />));\n      NamedComponent.displayName = 'a named forward ref!';\n      ParentOfNamed = () => <NamedComponent />;\n    });\n\n    describeWithDOM('', () => {\n      it('works with a `mount` wrapper', () => {\n        const wrapper = mount(<Parent foo=\"hello\" />);\n        expect(wrapper.debug()).to.equal((\n          `<Parent foo=\"hello\">\n  <span>\n    <ForwardRef foo=\"hello\">\n      <div>\n        <span className=\"child1\" />\n      </div>\n    </ForwardRef>\n  </span>\n</Parent>`\n        ));\n      });\n\n      it('works with a `mount` `.find` wrapper', () => {\n        const wrapper = mount(<Parent foo=\"hello\" />);\n        const results = wrapper.find(SomeComponent);\n        expect(results.debug()).to.equal((\n          `<ForwardRef foo=\"hello\">\n  <div>\n    <span className=\"child1\" />\n  </div>\n</ForwardRef>`\n        ));\n      });\n\n      it('works with a displayName with mount', () => {\n        const wrapper = mount(<ParentOfNamed />);\n        expect(wrapper.debug()).to.equal((\n          `<ParentOfNamed>\n  <${NamedComponent.displayName}>\n    <div />\n  </${NamedComponent.displayName}>\n</ParentOfNamed>`\n        ));\n      });\n    });\n\n    it('works with a displayName with shallow', () => {\n      const wrapper = shallow(<ParentOfNamed />);\n      expect(wrapper.debug()).to.equal((\n        `<${NamedComponent.displayName} />`\n      ));\n    });\n  });\n});\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/RSTTraversal-spec.jsx",
    "content": "import React from 'react';\nimport sinon from 'sinon-sandbox';\nimport { expect } from 'chai';\nimport { elementToTree } from 'enzyme-adapter-utils';\nimport {\n  hasClassName,\n  treeForEach,\n  treeFilter,\n  pathToNode,\n  getTextFromNode,\n} from 'enzyme/build/RSTTraversal';\n\nimport './_helpers/setupAdapters';\nimport { describeIf } from './_helpers';\nimport { is } from './_helpers/version';\n\nconst $ = elementToTree;\n\ndescribe('RSTTraversal', () => {\n  describe('hasClassName', () => {\n    it('works for standalone classNames', () => {\n      const node = $(<div className=\"foo\" />);\n      expect(hasClassName(node, 'foo')).to.equal(true);\n      expect(hasClassName(node, 'bar')).to.equal(false);\n    });\n\n    it('works for multiple classNames', () => {\n      const node = $(<div className=\"foo bar baz\" />);\n      expect(hasClassName(node, 'foo')).to.equal(true);\n      expect(hasClassName(node, 'bar')).to.equal(true);\n      expect(hasClassName(node, 'baz')).to.equal(true);\n      expect(hasClassName(node, 'bax')).to.equal(false);\n    });\n\n    it('also allows hyphens', () => {\n      const node = $(<div className=\"foo-bar\" />);\n      expect(hasClassName(node, 'foo-bar')).to.equal(true);\n    });\n\n    it('works if className has a function in toString property', () => {\n      function classes() {}\n      classes.toString = () => 'foo-bar';\n      const node = $(<div className={classes} />);\n      expect(hasClassName(node, 'foo-bar')).to.equal(true);\n    });\n\n    it('works if searching with a RegExp', () => {\n      const node = $(<div className=\"ComponentName-classname-123\" />);\n      expect(hasClassName(node, /(ComponentName)-(classname)-(\\d+)/)).to.equal(true);\n    });\n\n    it('fails if searching for a missing classname with a RegExp', () => {\n      const node = $(<div className=\"ComponentName-classname-123 ComponentName-otherclassname-23\" />);\n      expect(hasClassName(node, /(ComponentName)-(other)-(\\d+)/)).to.equal(false);\n    });\n  });\n\n  describe('treeForEach', () => {\n    it('is called once for a leaf node', () => {\n      const spy = sinon.spy();\n      const node = $(<div />);\n      treeForEach(node, spy);\n      expect(spy).to.have.property('callCount', 1);\n    });\n\n    it('handles a single child', () => {\n      const spy = sinon.spy();\n      const node = $((\n        <div>\n          <div />\n        </div>\n      ));\n      treeForEach(node, spy);\n      expect(spy).to.have.property('callCount', 2);\n    });\n\n    it('handles several children', () => {\n      const spy = sinon.spy();\n      const node = $((\n        <div>\n          <div />\n          <div />\n        </div>\n      ));\n      treeForEach(node, spy);\n      expect(spy).to.have.property('callCount', 3);\n    });\n\n    it('handles multiple hierarchies', () => {\n      const spy = sinon.spy();\n      const node = $((\n        <div>\n          <div>\n            <div />\n            <div />\n          </div>\n        </div>\n      ));\n      treeForEach(node, spy);\n      expect(spy).to.have.property('callCount', 4);\n    });\n\n    it('handles array children', () => {\n      const spy = sinon.spy();\n      const twoDivArray = [\n        <div key=\"a\" />,\n        <div key=\"b\" />,\n      ];\n      const divA = $(<div key=\"a\" />);\n      const divB = $(<div key=\"b\" />);\n      const node = $((\n        <div>\n          {twoDivArray}\n        </div>\n      ));\n      treeForEach(node, spy);\n      expect(spy).to.have.property('callCount', 3);\n      const nodes = spy.args.map((arg) => arg[0]);\n      expect(nodes).to.deep.equal([node, divA, divB]);\n    });\n\n    it('handles array siblings', () => {\n      const spy = sinon.spy();\n      const array1 = [\n        <div key=\"a\" />,\n        <div key=\"b\" />,\n      ];\n      const array2 = [\n        <div key=\"c\" />,\n        <div key=\"d\" />,\n      ];\n      const divA = $(<div key=\"a\" />);\n      const divB = $(<div key=\"b\" />);\n      const divC = $(<div key=\"c\" />);\n      const divD = $(<div key=\"d\" />);\n      const node = $((\n        <div>\n          {array1}\n          {array2}\n        </div>\n      ));\n      treeForEach(node, spy);\n      expect(spy).to.have.property('callCount', 5);\n      const nodes = spy.args.map((arg) => arg[0]);\n      expect(nodes).to.deep.equal([node, divA, divB, divC, divD]);\n    });\n\n    it('handles Map children', () => {\n      const spy = sinon.spy();\n      const twoDivMap = new Map([\n        [<div key=\"a\" />],\n        [<div key=\"b\" />],\n      ]);\n      const divA = $(<div key=\"a\" />);\n      const divB = $(<div key=\"b\" />);\n      const node = $((\n        <div>\n          {twoDivMap}\n        </div>\n      ));\n      treeForEach(node, spy);\n      expect(spy).to.have.property('callCount', 3);\n      const nodes = spy.args.map((arg) => arg[0]);\n      expect(nodes).to.deep.equal([node, divA, divB]);\n    });\n\n    it('handles Map siblings', () => {\n      const spy = sinon.spy();\n      const map1 = new Map([\n        [<div key=\"a\" />],\n        [<div key=\"b\" />],\n      ]);\n      const map2 = new Map([\n        [<div key=\"c\" />],\n        [<div key=\"d\" />],\n      ]);\n      const divA = $(<div key=\"a\" />);\n      const divB = $(<div key=\"b\" />);\n      const divC = $(<div key=\"c\" />);\n      const divD = $(<div key=\"d\" />);\n      const node = $((\n        <div>\n          {map1}\n          {map2}\n        </div>\n      ));\n      treeForEach(node, spy);\n      expect(spy).to.have.property('callCount', 5);\n      const nodes = spy.args.map((arg) => arg[0]);\n      expect(nodes).to.deep.equal([node, divA, divB, divC, divD]);\n    });\n\n    it('handles Set children', () => {\n      const spy = sinon.spy();\n      const twoDivSet = new Set([\n        <div key=\"a\" />,\n        <div key=\"b\" />,\n      ]);\n      const divA = $(<div key=\"a\" />);\n      const divB = $(<div key=\"b\" />);\n      const node = $((\n        <div>\n          {twoDivSet}\n        </div>\n      ));\n      treeForEach(node, spy);\n      expect(spy).to.have.property('callCount', 3);\n      const nodes = spy.args.map((arg) => arg[0]);\n      expect(nodes).to.deep.equal([node, divA, divB]);\n    });\n\n    it('handles Set siblings', () => {\n      const spy = sinon.spy();\n      const set1 = new Set([\n        <div key=\"a\" />,\n        <div key=\"b\" />,\n      ]);\n      const set2 = new Set([\n        <div key=\"c\" />,\n        <div key=\"d\" />,\n      ]);\n      const divA = $(<div key=\"a\" />);\n      const divB = $(<div key=\"b\" />);\n      const divC = $(<div key=\"c\" />);\n      const divD = $(<div key=\"d\" />);\n      const node = $((\n        <div>\n          {set1}\n          {set2}\n        </div>\n      ));\n      treeForEach(node, spy);\n      expect(spy).to.have.property('callCount', 5);\n      const nodes = spy.args.map((arg) => arg[0]);\n      expect(nodes).to.deep.equal([node, divA, divB, divC, divD]);\n    });\n\n    describe('support for arbitrary iterable children', () => {\n      const makeDivIterator = (lowerBound, upperBound) => {\n        const baseCode = 'a'.charCodeAt(0);\n        let counter = lowerBound;\n\n        return {\n          next() {\n            if (counter < upperBound) {\n              const key = String.fromCharCode(baseCode + counter);\n\n              const nextValue = {\n                value: <div key={key} />,\n                done: false,\n              };\n\n              counter += 1;\n\n              return nextValue;\n            }\n\n            return { done: true };\n          },\n        };\n      };\n\n      it('handles iterable with Symbol.iterator property children', () => {\n        const spy = sinon.spy();\n\n        const iterableChildren = { [Symbol.iterator]: () => makeDivIterator(0, 2) };\n\n        const divA = $(<div key=\"a\" />);\n        const divB = $(<div key=\"b\" />);\n        const node = $((\n          <div>\n            {iterableChildren}\n          </div>\n        ));\n\n        treeForEach(node, spy);\n        expect(spy).to.have.property('callCount', 3);\n        const nodes = spy.args.map((arg) => arg[0]);\n        expect(nodes).to.deep.equal([node, divA, divB]);\n      });\n\n      it('handles iterable with Symbol.iterator property siblings', () => {\n        const spy = sinon.spy();\n\n        const iterableChildren1 = { [Symbol.iterator]: () => makeDivIterator(0, 2) };\n        const iterableChildren2 = { [Symbol.iterator]: () => makeDivIterator(2, 4) };\n\n        const divA = $(<div key=\"a\" />);\n        const divB = $(<div key=\"b\" />);\n        const divC = $(<div key=\"c\" />);\n        const divD = $(<div key=\"d\" />);\n        const node = $((\n          <div>\n            {iterableChildren1}\n            {iterableChildren2}\n          </div>\n        ));\n\n        treeForEach(node, spy);\n        expect(spy).to.have.property('callCount', 5);\n        const nodes = spy.args.map((arg) => arg[0]);\n        expect(nodes).to.deep.equal([node, divA, divB, divC, divD]);\n      });\n\n      it('handles iterable with @@iterator property children', () => {\n        const spy = sinon.spy();\n\n        const legacyIterableChildren = { '@@iterator': () => makeDivIterator(0, 2) };\n\n        const divA = $(<div key=\"a\" />);\n        const divB = $(<div key=\"b\" />);\n        const node = $((\n          <div>\n            {legacyIterableChildren}\n          </div>\n        ));\n\n        treeForEach(node, spy);\n        expect(spy).to.have.property('callCount', 3);\n        const nodes = spy.args.map((arg) => arg[0]);\n        expect(nodes).to.deep.equal([node, divA, divB]);\n      });\n\n      it('handles iterable with @@iterator property siblings', () => {\n        const spy = sinon.spy();\n\n        const legacyIterableChildren1 = { '@@iterator': () => makeDivIterator(0, 2) };\n        const legacyIterableChildren2 = { '@@iterator': () => makeDivIterator(2, 4) };\n\n        const divA = $(<div key=\"a\" />);\n        const divB = $(<div key=\"b\" />);\n        const divC = $(<div key=\"c\" />);\n        const divD = $(<div key=\"d\" />);\n        const node = $((\n          <div>\n            {legacyIterableChildren1}\n            {legacyIterableChildren2}\n          </div>\n        ));\n\n        treeForEach(node, spy);\n        expect(spy).to.have.property('callCount', 5);\n        const nodes = spy.args.map((arg) => arg[0]);\n        expect(nodes).to.deep.equal([node, divA, divB, divC, divD]);\n      });\n    });\n\n    it('does not get trapped from empty strings', () => {\n      const spy = sinon.spy();\n      const node = $((\n        <div>\n          <p>{''}</p>\n          <p>Test</p>\n        </div>\n      ));\n      treeForEach(node, spy);\n      expect(spy).to.have.property('callCount', 4); // div, p, p, 'Test'\n    });\n\n    it('passes in the node', () => {\n      const spy = sinon.spy();\n      const node = $((\n        <div>\n          <button type=\"button\" />\n          <nav>\n            <input />\n          </nav>\n        </div>\n      ));\n      treeForEach(node, spy);\n      expect(spy).to.have.property('callCount', 4);\n      expect(spy.args[0][0]).to.have.property('type', 'div');\n      expect(spy.args[1][0]).to.have.property('type', 'button');\n      expect(spy.args[2][0]).to.have.property('type', 'nav');\n      expect(spy.args[3][0]).to.have.property('type', 'input');\n    });\n\n  });\n\n  describe('treeFilter', () => {\n    const tree = $((\n      <div>\n        <button type=\"button\" />\n        <button type=\"button\" />\n        <nav>\n          <input />\n        </nav>\n      </div>\n    ));\n\n    it('returnsan empty array for falsy test', () => {\n      expect(treeFilter(tree, () => false).length).to.equal(0);\n    });\n\n    it('returnsthe full array for truthy test', () => {\n      expect(treeFilter(tree, () => true).length).to.equal(5);\n    });\n\n    it('filters for truthiness', () => {\n      expect(treeFilter(tree, (node) => node.type === 'nav').length).to.equal(1);\n      expect(treeFilter(tree, (node) => node.type === 'button').length).to.equal(2);\n    });\n\n  });\n\n  describe('pathToNode', () => {\n    it('returnsnull if no queue length', () => {\n      const result = pathToNode({}, []);\n\n      expect(result).to.equal(null);\n    });\n\n    it('returnstrees from the root node', () => {\n      const node = <label htmlFor=\"foo\" />;\n      const tree = $((\n        <div>\n          <button type=\"button\" />\n          <nav>\n            {node}\n            <input id=\"foo\" />\n          </nav>\n        </div>\n      ));\n\n      const nodeInTree = tree.rendered[1].rendered[0];\n      const result = pathToNode(nodeInTree, tree);\n      expect(result).to.have.lengthOf(2);\n      expect(result[0]).to.have.property('type', 'div');\n      expect(result[1]).to.have.property('type', 'nav');\n    });\n\n    it('returnstrees from the root node except the sibling node', () => {\n      const node = <label htmlFor=\"foo\" />;\n      const tree = $((\n        <div>\n          <button type=\"button\" />\n          <nav>\n            {node}\n            <div><input id=\"foo\" /></div>\n          </nav>\n        </div>\n      ));\n\n      const nodeInTree = tree.rendered[1].rendered[0];\n      const result = pathToNode(nodeInTree, tree);\n      expect(result).to.have.lengthOf(2);\n      expect(result[0]).to.have.property('type', 'div');\n      expect(result[1]).to.have.property('type', 'nav');\n    });\n\n  });\n\n  describe('getTextFromNode', () => {\n    it('returnsempty string for nodes which do not exist', () => {\n      const result = getTextFromNode(null);\n      expect(result).to.equal('');\n    });\n\n    it('returnsdisplayName for functions that provides one', () => {\n      class Subject extends React.Component {\n        render() {\n          return (\n            <div />\n          );\n        }\n      }\n      Subject.displayName = 'CustomSubject';\n      const node = $(<Subject />);\n      const result = getTextFromNode(node);\n      expect(result).to.equal('<CustomSubject />');\n    });\n\n    it('returnsfunction name if displayName is not provided', () => {\n      class Subject extends React.Component {\n        render() {\n          return (\n            <div />\n          );\n        }\n      }\n      const node = $(<Subject />);\n      const result = getTextFromNode(node);\n      expect(result).to.equal('<Subject />');\n    });\n\n    describeIf(is('> 0.13'), 'stateless function components', () => {\n\n      it('returnsdisplayName for functions that provides one', () => {\n        const Subject = () => <div />;\n        Subject.displayName = 'CustomSubject';\n\n        const node = $(<Subject />);\n        const result = getTextFromNode(node);\n        expect(result).to.equal('<CustomSubject />');\n      });\n\n      it('returnsfunction name if displayName is not provided', () => {\n        const Subject = () => <div />;\n\n        const node = $(<Subject />);\n        const result = getTextFromNode(node);\n        expect(result).to.equal('<Subject />');\n      });\n    });\n  });\n});\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/ReactWrapper-spec.jsx",
    "content": "/* globals document */\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport { expect } from 'chai';\nimport sinon from 'sinon-sandbox';\nimport wrap from 'mocha-wrap';\nimport {\n  mount,\n  ReactWrapper,\n} from 'enzyme';\nimport mountEntry from 'enzyme/mount';\nimport ReactWrapperEntry from 'enzyme/ReactWrapper';\nimport {\n  withSetStateAllowed,\n} from 'enzyme/build/Utils';\nimport getAdapter from 'enzyme/build/getAdapter';\nimport { fakeDynamicImport } from 'enzyme-adapter-utils';\n\nimport './_helpers/setupAdapters';\nimport {\n  createClass,\n  createContext,\n  createPortal,\n  createRef,\n  forwardRef,\n  Fragment,\n  lazy,\n  memo,\n  Profiler,\n  Suspense,\n  useState,\n  useEffect,\n} from './_helpers/react-compat';\nimport {\n  describeWithDOM,\n  describeIf,\n  itIf,\n} from './_helpers';\nimport getLoadedLazyComponent from './_helpers/getLoadedLazyComponent';\nimport describeMethods from './_helpers/describeMethods';\nimport describeLifecycles from './_helpers/describeLifecycles';\nimport describeHooks from './_helpers/describeHooks';\nimport {\n  is,\n} from './_helpers/version';\n\ndescribeWithDOM('mount', () => {\n  describe('top level entry points', () => {\n    expect(mountEntry).to.equal(mount);\n    expect(ReactWrapperEntry).to.equal(ReactWrapper);\n  });\n\n  describe('top level wrapper', () => {\n    wrap()\n      .withGlobal('document', () => null)\n      .withGlobal('window', () => null)\n      .it('throws without a global document and window', () => {\n        expect(() => mount(<div />)).to.throw(\n          Error,\n          'It looks like you called `mount()` without a global document being loaded.',\n        );\n\n        expect(() => new ReactWrapper(<div />)).to.throw(\n          Error,\n          'It looks like you called `mount()` without a global document being loaded.',\n        );\n      });\n\n    it('does what i expect', () => {\n      class Box extends React.Component {\n        render() {\n          const { children } = this.props;\n          return <div className=\"box\">{children}</div>;\n        }\n      }\n\n      class Foo extends React.Component {\n        render() {\n          return (\n            <Box bam>\n              <div className=\"div\" />\n            </Box>\n          );\n        }\n      }\n\n      const wrapper = mount(<Foo bar />);\n\n      expect(wrapper.type()).to.equal(Foo);\n      expect(wrapper.props()).to.deep.equal({ bar: true });\n      expect(wrapper.instance()).to.be.instanceOf(Foo);\n      expect(wrapper.children().at(0).type()).to.equal(Box);\n      expect(wrapper.find(Box).children().props().className).to.equal('box');\n      expect(wrapper.find(Box).instance()).to.be.instanceOf(Box);\n      expect(wrapper.find(Box).children().at(0).props().className).to.equal('box');\n      expect(wrapper.find(Box).children().props().className).to.equal('box');\n      expect(wrapper.children().type()).to.equal(Box);\n      expect(wrapper.children().instance()).to.be.instanceOf(Box);\n      expect(wrapper.children().props().bam).to.equal(true);\n    });\n\n    it('works with numeric literals', () => {\n      const wrapper = mount(<div>{50}</div>);\n      expect(wrapper.debug()).to.equal(`<div>\n  50\n</div>`);\n    });\n\n    describeWithDOM('refs', () => {\n      it('calls ref', () => {\n        const spy = sinon.spy();\n        mount(<div ref={spy} />);\n        expect(spy).to.have.property('callCount', 1);\n      });\n\n      /* global HTMLElement */\n\n      itIf(is('> 0.13'), 'passes an HTML element to `ref` when root rendered', () => {\n        const spy = sinon.spy();\n        mount(<div ref={spy} />);\n        expect(spy).to.have.property('callCount', 1);\n\n        // sanity check\n        expect(document.createElement('div')).to.be.instanceOf(HTMLElement);\n\n        const [[firstArg]] = spy.args;\n        expect(firstArg).to.be.instanceOf(HTMLElement);\n      });\n\n      itIf(is('> 0.13'), 'passes an HTML element to `ref` when sub-rendered', () => {\n        const spy = sinon.spy();\n        class Foo extends React.Component {\n          render() {\n            return <div ref={spy} />;\n          }\n        }\n        mount(<Foo />);\n        expect(spy).to.have.property('callCount', 1);\n\n        // sanity check\n        expect(document.createElement('div')).to.be.instanceOf(HTMLElement);\n\n        const [[firstArg]] = spy.args;\n        expect(firstArg).to.be.instanceOf(HTMLElement);\n      });\n    });\n\n    describe('wrapping invalid elements', () => {\n      it('throws with combined dangerouslySetInnerHTML and children on host nodes', () => {\n        /* eslint react/no-danger-with-children: 0 */\n        expect(() => mount((\n          <div dangerouslySetInnerHTML={{ __html: '{}' }}>child</div>\n        ))).to.throw(Error, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.');\n      });\n\n      itIf(is('>= 16'), 'throws when mounting Portals', () => {\n        const portal = createPortal(\n          <div />,\n          { nodeType: 1 },\n        );\n\n        expect(() => mount(portal)).to.throw(\n          Error,\n          'ReactWrapper can only wrap valid elements',\n        );\n      });\n\n      it('throws when mounting plain text', () => {\n        expect(() => mount('Foo')).to.throw(\n          Error,\n          'ReactWrapper can only wrap valid elements',\n        );\n      });\n\n      it('throws when mounting multiple elements', () => {\n        expect(() => mount([<div />])).to.throw(\n          TypeError,\n          'ReactWrapper can only wrap valid elements',\n        );\n      });\n    });\n\n    it('mounts built in components', () => {\n      expect(() => mount(<div />)).not.to.throw();\n    });\n\n    it('mounts composite components', () => {\n      class Foo extends React.Component {\n        render() {\n          return <div />;\n        }\n      }\n\n      expect(() => mount(<Foo />)).not.to.throw();\n    });\n\n    it('starts out with undefined state', () => {\n      class Foo extends React.Component {\n        render() {\n          return (\n            <div>\n              {typeof this.state}\n              {JSON.stringify(this.state)}\n            </div>\n          );\n        }\n      }\n\n      const wrapper = mount(<Foo />);\n      expect(wrapper.state()).to.equal(null);\n      expect(wrapper.debug()).to.equal(`\n<Foo>\n  <div>\n    object\n    null\n  </div>\n</Foo>\n      `.trim());\n      expect(() => wrapper.state('key')).to.throw('ReactWrapper::state(\"key\") requires that `state` not be `null` or `undefined`');\n    });\n\n    describeIf(is('>= 0.14'), 'wrappingComponent', () => {\n      const realCreateMountRenderer = getAdapter().createMountRenderer;\n\n      class More extends React.Component {\n        render() {\n          return null;\n        }\n      }\n\n      class TestProvider extends React.Component {\n        getChildContext() {\n          const { value, renderMore } = this.props;\n\n          return {\n            testContext: value || 'Hello world!',\n            renderMore: renderMore || false,\n          };\n        }\n\n        render() {\n          const { children } = this.props;\n\n          return children;\n        }\n      }\n      TestProvider.childContextTypes = {\n        testContext: PropTypes.string,\n        renderMore: PropTypes.bool,\n      };\n\n      class MyWrappingComponent extends React.Component {\n        render() {\n          const { children, contextValue, renderMore } = this.props;\n\n          return (\n            <div>\n              <TestProvider value={contextValue} renderMore={renderMore}>{children}</TestProvider>\n            </div>\n          );\n        }\n      }\n\n      class MyComponent extends React.Component {\n        render() {\n          const { testContext, renderMore } = this.context;\n\n          return (\n            <div>\n              <div>Context says: {testContext}</div>\n              {renderMore && <More />}\n            </div>\n          );\n        }\n      }\n      MyComponent.contextTypes = TestProvider.childContextTypes;\n\n      it('mounts the passed node as the root as per usual', () => {\n        const wrapper = mount(<MyComponent />, {\n          wrappingComponent: MyWrappingComponent,\n        });\n        expect(wrapper.type()).to.equal(MyComponent);\n        expect(wrapper.parent().exists()).to.equal(false);\n        expect(() => wrapper.setProps({ foo: 'bar' })).not.to.throw();\n      });\n\n      it('renders the root in the wrapping component', () => {\n        const wrapper = mount(<MyComponent />, {\n          wrappingComponent: MyWrappingComponent,\n        });\n        // Context will only be set properly if the root node is rendered as a descendent of the wrapping component.\n        expect(wrapper.text()).to.equal('Context says: Hello world!');\n      });\n\n      it('supports mounting the wrapping component with initial props', () => {\n        const wrapper = mount(<MyComponent />, {\n          wrappingComponent: MyWrappingComponent,\n          wrappingComponentProps: { contextValue: 'I can be set!' },\n        });\n        expect(wrapper.text()).to.equal('Context says: I can be set!');\n      });\n\n      describeIf(is('>= 16.3'), 'with createContext()', () => {\n        let Context1;\n        let Context2;\n\n        function WrappingComponent(props) {\n          const { value1, value2, children } = props;\n          return (\n            <Context1.Provider value={value1}>\n              <Context2.Provider value={value2}>\n                {children}\n              </Context2.Provider>\n            </Context1.Provider>\n          );\n        }\n\n        function Component() {\n          return (\n            <Context1.Consumer>\n              {(value1) => (\n                <Context2.Consumer>\n                  {(value2) => (\n                    <div>Value 1: {value1}; Value 2: {value2}</div>\n                  )}\n                </Context2.Consumer>\n              )}\n            </Context1.Consumer>\n          );\n        }\n\n        beforeEach(() => {\n          Context1 = createContext('default1');\n          Context2 = createContext('default2');\n        });\n\n        it('renders', () => {\n          const wrapper = mount(<Component />, {\n            wrappingComponent: WrappingComponent,\n            wrappingComponentProps: {\n              value1: 'one',\n              value2: 'two',\n            },\n          });\n\n          expect(wrapper.text()).to.equal('Value 1: one; Value 2: two');\n        });\n      });\n\n      it('throws an error if the wrappingComponent does not render its children', () => {\n        class BadWrapper extends React.Component {\n          render() {\n            return <div />;\n          }\n        }\n        expect(() => mount(<MyComponent />, {\n          wrappingComponent: BadWrapper,\n        })).to.throw('`wrappingComponent` must render its children!');\n      });\n\n      wrap()\n        .withOverrides(() => getAdapter(), () => ({\n          isCustomComponent: undefined,\n          RootFinder: undefined,\n          wrapWithWrappingComponent: undefined,\n          createMountRenderer: (...args) => {\n            const renderer = realCreateMountRenderer(...args);\n            delete renderer.getWrappingComponentRenderer;\n            renderer.getNode = () => null;\n            return renderer;\n          },\n        }))\n        .describe('with an old adapter', () => {\n          it('renders fine when wrappingComponent is not passed', () => {\n            const wrapper = mount(<MyComponent />);\n            expect(wrapper.debug()).to.equal('');\n          });\n\n          it('throws an error if wrappingComponent is passed', () => {\n            expect(() => mount(<MyComponent />, {\n              wrappingComponent: MyWrappingComponent,\n            })).to.throw('your adapter does not support `wrappingComponent`. Try upgrading it!');\n          });\n        });\n    });\n\n    class RendersChildren extends React.Component {\n      render() {\n        const { children } = this.props;\n        return children;\n      }\n    }\n\n    itIf(is('<=0.13'), 'throws an error if wrappingComponent is passed', () => {\n      expect(() => mount(<div />, {\n        wrappingComponent: RendersChildren,\n      })).to.throw('your adapter does not support `wrappingComponent`. Try upgrading it!');\n    });\n\n    describeIf(is('>= 16.3'), 'uses the isValidElementType from the Adapter to validate the prop type of Component', () => {\n      const Foo = () => null;\n      const Bar = () => null;\n      wrap()\n        .withConsoleThrows()\n        .withOverride(() => getAdapter(), 'isValidElementType', () => (val) => val === Foo)\n        .it('with isValidElementType defined on the Adapter', () => {\n          expect(() => {\n            mount(<Bar />);\n          }).to.throw('Warning: Failed prop type: Component must be a valid element type!\\n    in WrapperComponent');\n        });\n    });\n  });\n\n  describe('context', () => {\n    it('can pass in context', () => {\n      const SimpleComponent = createClass({\n        contextTypes: {\n          name: PropTypes.string,\n        },\n        render() {\n          const { name } = this.context;\n          return <div>{name}</div>;\n        },\n      });\n\n      const context = { name: 'foo' };\n      const wrapper = mount(<SimpleComponent />, { context });\n      expect(wrapper.text()).to.equal('foo');\n    });\n\n    it('can pass context to the child of mounted component', () => {\n      const SimpleComponent = createClass({\n        contextTypes: {\n          name: PropTypes.string,\n        },\n        render() {\n          const { name } = this.context;\n          return <div>{name}</div>;\n        },\n      });\n      const ComplexComponent = createClass({\n        render() {\n          return <div><SimpleComponent /></div>;\n        },\n      });\n\n      const childContextTypes = {\n        name: PropTypes.string.isRequired,\n      };\n      const context = { name: 'foo' };\n      const wrapper = mount(<ComplexComponent />, { context, childContextTypes });\n      expect(wrapper.find(SimpleComponent)).to.have.lengthOf(1);\n    });\n\n    describe('does not attempt to mutate Component.childContextTypes', () => {\n      const SimpleComponent = createClass({\n        displayName: 'Simple',\n        render() {\n          return <div />;\n        },\n      });\n\n      class ClassComponent extends React.Component {\n        render() {\n          const { a } = this.context;\n          return (\n            <div>\n              {a}\n              <SimpleComponent />\n            </div>\n          );\n        }\n      }\n      ClassComponent.contextTypes = Object.freeze({ a: PropTypes.string });\n\n      const CreateClassComponent = createClass({\n        contextTypes: ClassComponent.contextTypes,\n        render: ClassComponent.prototype.render,\n      });\n\n      it('works without options', () => {\n        expect(() => mount(<ClassComponent />)).not.to.throw();\n        expect(() => mount(<CreateClassComponent />)).not.to.throw();\n      });\n\n      it('works with a childContextTypes option', () => {\n        const options = {\n          childContextTypes: { b: PropTypes.string },\n          context: { a: 'hello', b: 'world' },\n        };\n        expect(() => mount(<ClassComponent />, options)).not.to.throw();\n        expect(() => mount(<CreateClassComponent />, options)).not.to.throw();\n      });\n    });\n\n    it('does not throw if context is passed in but contextTypes is missing', () => {\n      const SimpleComponent = createClass({\n        render() {\n          const { name } = this.context;\n          return <div>{name}</div>;\n        },\n      });\n\n      const context = { name: 'foo' };\n      expect(() => mount(<SimpleComponent />, { context })).not.to.throw();\n    });\n\n    it('is introspectable through context API', () => {\n      const SimpleComponent = createClass({\n        contextTypes: {\n          name: PropTypes.string,\n        },\n        render() {\n          const { name } = this.context;\n          return <div>{name}</div>;\n        },\n      });\n\n      const context = { name: 'foo' };\n      const wrapper = mount(<SimpleComponent />, { context });\n\n      expect(wrapper.context().name).to.equal(context.name);\n      expect(wrapper.context('name')).to.equal(context.name);\n    });\n\n    describeIf(is('>= 16.3'), 'createContext()', () => {\n      let Context;\n\n      beforeEach(() => {\n        Context = createContext('hello');\n      });\n\n      it('finds elements through Context elements', () => {\n        class Foo extends React.Component {\n          render() {\n            return (\n              <Context.Consumer>{(value) => <span>{value}</span>}</Context.Consumer>\n            );\n          }\n        }\n\n        const wrapper = mount(<Context.Provider value=\"foo\"><div><Foo /></div></Context.Provider>);\n\n        expect(wrapper.find('span').text()).to.equal('foo');\n      });\n\n      it('can render a <Provider /> as the root', () => {\n        const wrapper = mount(\n          <Context.Provider value=\"cool\">\n            <Context.Consumer>{(value) => <div>{value}</div>}</Context.Consumer>\n          </Context.Provider>,\n        );\n        expect(wrapper.text()).to.equal('cool');\n\n        wrapper.setProps({ value: 'test' });\n        expect(wrapper.text()).to.equal('test');\n      });\n\n      it('can render a <Consumer /> as the root', () => {\n        const wrapper = mount(\n          <Context.Consumer>{(value) => <div>{value}</div>}</Context.Consumer>,\n        );\n        expect(wrapper.text()).to.equal('hello');\n\n        wrapper.setProps({\n          children: (value) => <div>Value is: {value}</div>,\n        });\n        expect(wrapper.text()).to.equal('Value is: hello');\n      });\n    });\n\n    describeIf(is('>= 16.3'), 'forwarded ref Components', () => {\n      wrap().withConsoleThrows().it('mounts without complaint', () => {\n        const SomeComponent = forwardRef((props, ref) => (\n          <div {...props} ref={ref} />\n        ));\n\n        expect(() => mount(<SomeComponent />)).not.to.throw();\n      });\n\n      it('finds elements through forwardedRef elements', () => {\n        const testRef = () => {};\n        const SomeComponent = forwardRef((props, ref) => (\n          <div ref={ref}>\n            <span className=\"child1\" />\n            <span className=\"child2\" />\n          </div>\n        ));\n\n        const wrapper = mount(<div><SomeComponent ref={testRef} /></div>);\n\n        expect(wrapper.find('.child2')).to.have.lengthOf(1);\n      });\n\n      it('finds forwardRef element', () => {\n        const SomeComponent = forwardRef((props, ref) => (\n          <div ref={ref}>\n            <span className=\"child1\" />\n          </div>\n        ));\n        const Parent = () => <span><SomeComponent foo=\"hello\" /></span>;\n\n        const wrapper = mount(<Parent foo=\"hello\" />);\n        const results = wrapper.find(SomeComponent);\n\n        expect(results).to.have.lengthOf(1);\n        expect(results.props()).to.eql({ foo: 'hello' });\n      });\n\n      it('actually passes the ref', () => {\n        class A extends React.PureComponent {\n          render() {\n            return <div>FOO</div>;\n          }\n        }\n\n        class B extends React.PureComponent {\n          render() {\n            const { forwardedRef } = this.props;\n            return <A ref={forwardedRef} />;\n          }\n        }\n\n        const BForwarded = forwardRef((props, ref) => (\n          <B {...props} forwardedRef={ref} />\n        ));\n\n        const ref = createRef();\n        mount(<BForwarded ref={ref} />);\n        expect(ref.current).to.be.an.instanceOf(A);\n      });\n    });\n\n    describeIf(is('> 0.13'), 'stateless function components (SFCs)', () => {\n      it('can pass in context', () => {\n        const SimpleComponent = (props, { name }) => (\n          <div>{name}</div>\n        );\n        SimpleComponent.contextTypes = { name: PropTypes.string };\n\n        const context = { name: 'foo' };\n        const wrapper = mount(<SimpleComponent />, { context });\n        expect(wrapper.text()).to.equal('foo');\n      });\n\n      it('can pass context to the child of mounted component', () => {\n        const SimpleComponent = (props, { name }) => (\n          <div>{name}</div>\n        );\n        SimpleComponent.contextTypes = { name: PropTypes.string };\n\n        const ComplexComponent = () => (\n          <div><SimpleComponent /></div>\n        );\n\n        const childContextTypes = {\n          name: PropTypes.string.isRequired,\n        };\n\n        const context = { name: 'foo' };\n        const wrapper = mount(<ComplexComponent />, { context, childContextTypes });\n        expect(wrapper.find(SimpleComponent)).to.have.lengthOf(1);\n      });\n\n      it('does not throw if context is passed in but contextTypes is missing', () => {\n        const SimpleComponent = (props, { name }) => (\n          <div>{name}</div>\n        );\n\n        const context = { name: 'foo' };\n        expect(() => mount(<SimpleComponent />, { context })).not.to.throw();\n      });\n\n      itIf(is('< 16'), 'is introspectable through context API', () => {\n        const SimpleComponent = (props, { name }) => (\n          <div>{name}</div>\n        );\n        SimpleComponent.contextTypes = { name: PropTypes.string };\n\n        const context = { name: 'foo' };\n        const wrapper = mount(<SimpleComponent />, { context });\n\n        expect(wrapper.context().name).to.equal(context.name);\n        expect(wrapper.context('name')).to.equal(context.name);\n      });\n    });\n  });\n\n  describeIf(is('> 0.13'), 'stateless function components (SFCs)', () => {\n    it('works with SFCs', () => {\n      const Foo = ({ foo }) => (\n        <div>\n          <div className=\"bar\">bar</div>\n          <div className=\"qoo\">{foo}</div>\n        </div>\n      );\n      const wrapper = mount(<Foo foo=\"qux\" />);\n      expect(wrapper.type()).to.equal(Foo);\n      expect(wrapper.find('.bar')).to.have.lengthOf(1);\n      expect(wrapper.find('.qoo').text()).to.equal('qux');\n    });\n\n    it('supports findDOMNode with SFCs', () => {\n      const Foo = ({ foo }) => (\n        <div>{foo}</div>\n      );\n\n      const wrapper = mount(<Foo foo=\"qux\" />);\n      expect(wrapper.text()).to.equal('qux');\n    });\n\n    it('works with nested stateless', () => {\n      const TestItem = () => (\n        <div className=\"item\">1</div>\n      );\n      const Test = () => (\n        <div className=\"box\">\n          <TestItem test=\"123\" />\n          <TestItem />\n          <TestItem />\n        </div>\n      );\n      const wrapper = mount(<Test />);\n      const children = wrapper.find('.box').children();\n      expect(children).to.have.lengthOf(3);\n      expect(children.at(0).props().test).to.equal('123');\n      expect(wrapper.find(TestItem)).to.have.lengthOf(3);\n      expect(wrapper.find(TestItem).first().props().test).to.equal('123');\n    });\n\n    describeIf(is('>= 16.6'), 'React.memo', () => {\n      it('works with an SFC', () => {\n        const InnerComp = () => <div><span>Hello</span></div>;\n        const InnerFoo = ({ foo }) => (\n          <div>\n            <InnerComp />\n            <div className=\"bar\">bar</div>\n            <div className=\"qoo\">{foo}</div>\n          </div>\n        );\n        const Foo = memo(InnerFoo);\n\n        const wrapper = mount(<Foo foo=\"qux\" />);\n        expect(wrapper.debug()).to.equal(`<Memo(InnerFoo) foo=\"qux\">\n  <div>\n    <InnerComp>\n      <div>\n        <span>\n          Hello\n        </span>\n      </div>\n    </InnerComp>\n    <div className=\"bar\">\n      bar\n    </div>\n    <div className=\"qoo\">\n      qux\n    </div>\n  </div>\n</Memo(InnerFoo)>`);\n        expect(wrapper.find('InnerComp')).to.have.lengthOf(1);\n        expect(wrapper.find('.bar')).to.have.lengthOf(1);\n        expect(wrapper.find('.qoo').text()).to.equal('qux');\n      });\n\n      it('works with a class component', () => {\n        class InnerComp extends React.Component {\n          render() {\n            return <div><span>Hello</span></div>;\n          }\n        }\n\n        class Foo extends React.Component {\n          render() {\n            const { foo } = this.props;\n            return (\n              <div>\n                <InnerComp />\n                <div className=\"bar\">bar</div>\n                <div className=\"qoo\">{foo}</div>\n              </div>\n            );\n          }\n        }\n        const FooMemo = memo(Foo);\n\n        const wrapper = mount(<FooMemo foo=\"qux\" />);\n        expect(wrapper.debug()).to.equal(`<Foo foo=\"qux\">\n  <div>\n    <InnerComp>\n      <div>\n        <span>\n          Hello\n        </span>\n      </div>\n    </InnerComp>\n    <div className=\"bar\">\n      bar\n    </div>\n    <div className=\"qoo\">\n      qux\n    </div>\n  </div>\n</Foo>`);\n        expect(wrapper.find('InnerComp')).to.have.lengthOf(1);\n        expect(wrapper.find('.bar')).to.have.lengthOf(1);\n        expect(wrapper.find('.qoo').text()).to.equal('qux');\n      });\n    });\n  });\n\n  describeIf(is('>= 16'), 'portals', () => {\n    it('shows portals in mount debug tree', () => {\n      const containerDiv = global.document.createElement('div');\n      const Foo = () => (\n        <div>\n          {createPortal(\n            <div className=\"in-portal\">InPortal</div>,\n            containerDiv,\n          )}\n        </div>\n      );\n\n      const wrapper = mount(<Foo />);\n      expect(wrapper.debug()).to.equal(`<Foo>\n  <div>\n    <Portal containerInfo={{...}}>\n      <div className=\"in-portal\">\n        InPortal\n      </div>\n    </Portal>\n  </div>\n</Foo>`);\n    });\n\n    it('shows portal container in debug tree', () => {\n      const containerDiv = global.document.createElement('div');\n      containerDiv.setAttribute('data-foo', 'bar');\n      const Foo = () => (\n        <div className=\"foo\">\n          {createPortal(\n            <div className=\"in-portal\">InPortal</div>,\n            containerDiv,\n          )}\n        </div>\n      );\n\n      const wrapper = mount(<Foo />);\n      expect(wrapper.debug({ verbose: true })).to.equal(`<Foo>\n  <div className=\"foo\">\n    <Portal containerInfo={<div data-foo=\"bar\">...</div>}>\n      <div className=\"in-portal\">\n        InPortal\n      </div>\n    </Portal>\n  </div>\n</Foo>`);\n    });\n\n    it('shows nested portal children in debug tree', () => {\n      const Bar = () => null;\n\n      const containerDiv = global.document.createElement('div');\n      const Foo = () => (\n        <div className=\"foo\">\n          {createPortal(\n            <div className=\"in-portal\">\n              <div className=\"nested-in-portal\">\n                <Bar />\n              </div>\n            </div>,\n            containerDiv,\n          )}\n        </div>\n      );\n\n      const wrapper = mount(<Foo />);\n      expect(wrapper.debug()).to.equal(`<Foo>\n  <div className=\"foo\">\n    <Portal containerInfo={{...}}>\n      <div className=\"in-portal\">\n        <div className=\"nested-in-portal\">\n          <Bar />\n        </div>\n      </div>\n    </Portal>\n  </div>\n</Foo>`);\n    });\n\n    it('has top level portals in debug tree', () => {\n      const containerDiv = global.document.createElement('div');\n      const Foo = () => createPortal(\n        <div className=\"in-portal\">InPortal</div>,\n        containerDiv,\n      );\n\n      const wrapper = mount(<Foo />);\n      expect(wrapper.debug()).to.equal(`<Foo>\n  <Portal containerInfo={{...}}>\n    <div className=\"in-portal\">\n      InPortal\n    </div>\n  </Portal>\n</Foo>`);\n    });\n  });\n\n  describeIf(is('>= 16.4'), 'Profiler', () => {\n    function SomeComponent() {\n      return (\n        <Profiler id=\"SomeComponent\" onRender={() => {}}>\n          <main>\n            <div className=\"child\" />\n          </main>\n        </Profiler>\n      );\n    }\n\n    wrap()\n      .withConsoleThrows()\n      .it('mounts without complaint', () => {\n        expect(() => mount(<SomeComponent />)).not.to.throw();\n      });\n\n    it('renders', () => {\n      const wrapper = mount(<SomeComponent />);\n      expect(wrapper.debug()).to.equal(`<SomeComponent>\n  <Profiler id=\"SomeComponent\" onRender={[Function: onRender]}>\n    <main>\n      <div className=\"child\" />\n    </main>\n  </Profiler>\n</SomeComponent>`);\n    });\n\n    it('finds elements through Profiler elements', () => {\n      const wrapper = mount(<SomeComponent />);\n\n      expect(wrapper.find('.child')).to.have.lengthOf(1);\n    });\n\n    it('finds Profiler element', () => {\n      const Parent = () => <span><SomeComponent foo=\"hello\" /></span>;\n\n      const wrapper = mount(<Parent foo=\"hello\" />);\n      const results = wrapper.find(SomeComponent);\n\n      expect(results).to.have.lengthOf(1);\n      expect(results.type()).to.equal(SomeComponent);\n      expect(results.props()).to.eql({ foo: 'hello' });\n    });\n\n    it('can find Profiler by id', () => {\n      const wrapper = mount(<SomeComponent />);\n      expect(wrapper.find('[id=\"SomeComponent\"]').exists()).to.equal(true);\n    });\n\n    it('can find Profiler by display name', () => {\n      const wrapper = mount(<SomeComponent />);\n      const profiler = wrapper.find('Profiler');\n      expect(profiler).to.have.lengthOf(1);\n      expect(profiler.type()).to.equal(Profiler);\n    });\n\n    it('recognizes render phases', () => {\n      const handleRender = sinon.spy();\n      function AnotherComponent() {\n        return (\n          <Profiler id=\"AnotherComponent\" onRender={handleRender}>\n            <div />\n          </Profiler>\n        );\n      }\n\n      const wrapper = mount(<AnotherComponent />);\n      expect(handleRender).to.have.property('callCount', 1);\n      expect(handleRender.args[0][1]).to.equal('mount');\n\n      wrapper.setProps({ unusedProp: true });\n      expect(handleRender).to.have.property('callCount', 2);\n      expect(handleRender.args[1][1]).to.equal('update');\n    });\n\n    it('measures timings', () => {\n      /**\n       * test environment has no access to the performance API at which point\n       * the profiling API has to fallback to Date.now() which isn't precise enough\n       * which results in 0 duration for these simple examples most of the time.\n       * With performance API it should test for greaterThan(0) instead of least(0)\n       */\n      const handleRender = sinon.spy();\n      function AnotherComponent() {\n        return (\n          <Profiler id=\"AnotherComponent\" onRender={handleRender}>\n            <div />\n          </Profiler>\n        );\n      }\n\n      const wrapper = mount(<AnotherComponent />);\n      expect(handleRender).to.have.property('callCount', 1);\n      const [firstArgs] = handleRender.args;\n      if (typeof performance === 'undefined') {\n        expect(firstArgs[2]).to.be.least(0);\n        expect(firstArgs[3]).to.be.least(0);\n      } else if (!is('^16.9')) {\n        // React ^16.9 returns `0` here\n        expect(firstArgs[2]).to.be.greaterThan(0);\n        expect(firstArgs[3]).to.be.greaterThan(0);\n      }\n\n      wrapper.setProps({ unusedProp: true });\n      expect(handleRender).to.have.property('callCount', 2);\n      const [, secondArgs] = handleRender.args;\n      if (typeof performance === 'undefined') {\n        expect(secondArgs[2]).to.be.least(0);\n        expect(secondArgs[3]).to.be.least(0);\n      } else if (!is('^16.9')) {\n        // React ^16.9 returns `0` here\n        expect(secondArgs[2]).to.be.greaterThan(0);\n        expect(secondArgs[3]).to.be.greaterThan(0);\n      }\n    });\n  });\n\n  itIf(is('>= 16.2'), 'supports fragments', () => {\n    const wrapper = mount((\n      <Fragment>\n        <p>hello</p>\n        <span>boo</span>\n      </Fragment>\n    ));\n\n    expect(wrapper).to.have.lengthOf(2);\n  });\n\n  const Wrap = mount;\n  const Wrapper = ReactWrapper;\n  describeMethods(\n    { Wrap, Wrapper },\n    'deprecatedInstanceProperties',\n    '@@iterator',\n    'at',\n    'childAt',\n    'children',\n    'closest',\n    'contains',\n    'containsAllMatchingElements',\n    'containsAnyMatchingElements',\n    'containsMatchingElement',\n    'context',\n    'debug',\n    'equals',\n    'every',\n    'everyWhere',\n    'exists',\n    'filter',\n    'filterWhere',\n    'find',\n    'findWhere',\n    'first',\n    'flatMap',\n    'forEach',\n    'get',\n    'getElement',\n    'getElements',\n    'getNode',\n    'getNodes',\n    'getWrappingComponent',\n    'hasClass',\n    'hostNodes',\n    'html',\n    'instance',\n    'invoke',\n    'is',\n    'isEmpty',\n    'isEmptyRender',\n    'key',\n    'last',\n    'map',\n    'matchesElement',\n    'name',\n    'not',\n    'parent',\n    'parents',\n    'prop',\n    'props',\n    'reduce',\n    'reduceRight',\n    'render',\n    'renderProp',\n    'root',\n    'setContext',\n    'setProps',\n    'setState',\n    'simulate',\n    'simulateError',\n    'single',\n    'slice',\n    'some',\n    'someWhere',\n    'state',\n    'tap',\n    'text',\n    'unmount',\n    'wrap',\n  );\n  describeLifecycles(\n    { Wrap, Wrapper },\n    'componentDidCatch',\n    'componentDidMount',\n    'componentDidUpdate',\n    'componentWillUnmount',\n    'getDerivedStateFromError',\n    'getDerivedStateFromProps',\n    'getSnapshotBeforeUpdate',\n    'misc',\n  );\n  describeHooks(\n    { Wrap, Wrapper },\n    'useCallback',\n    'useContext',\n    'useDebugValue',\n    'useEffect',\n    'useImperativeHandle',\n    'useLayoutEffect',\n    'useMemo',\n    'useReducer',\n    'useRef',\n    'useState',\n    'custom',\n  );\n\n  describeIf(is('>= 16.6'), 'Suspense & lazy', () => {\n    class DynamicComponent extends React.Component {\n      render() {\n        return (\n          <div>Dynamic Component</div>\n        );\n      }\n    }\n\n    class Fallback extends React.Component {\n      render() {\n        return (\n          <div>Fallback</div>\n        );\n      }\n    }\n\n    it('finds Suspense and its children when no lazy component', () => {\n      class Component extends React.Component {\n        render() {\n          return (\n            <div>test</div>\n          );\n        }\n      }\n\n      const SuspenseComponent = () => (\n        <Suspense fallback={Fallback}>\n          <Component />\n        </Suspense>\n      );\n\n      const wrapper = mount(<SuspenseComponent />);\n\n      expect(wrapper.is(SuspenseComponent)).to.equal(true);\n      expect(wrapper.find(Component)).to.have.lengthOf(1);\n      expect(wrapper.find(Fallback)).to.have.lengthOf(0);\n    });\n\n    it('works with Suspense with multiple children', () => {\n      const SuspenseComponent = () => (\n        <Suspense fallback={<Fallback />}>\n          <div />\n          <span />\n          <main />\n        </Suspense>\n      );\n\n      const wrapper = mount(<SuspenseComponent />);\n      expect(wrapper.debug()).to.equal(`<SuspenseComponent>\n  <Suspense fallback={{...}}>\n    <div />\n    <span />\n    <main />\n  </Suspense>\n</SuspenseComponent>`);\n    });\n\n    it('throws with Suspense with multiple children if options.suspenseFallback=false', () => {\n      const SuspenseComponent = () => (\n        <Suspense fallback={<Fallback />}>\n          <div />\n          <div />\n        </Suspense>\n      );\n      expect(() => mount(<SuspenseComponent />, { suspenseFallback: false })).to.throw();\n    });\n\n    it('can mount Suspense directly', () => {\n      const wrapper = mount(<Suspense fallback={Fallback} />);\n      expect(wrapper.is(Suspense)).to.equal(true);\n    });\n\n    it('finds fallback when given lazy component in initial mount', () => {\n      const LazyComponent = lazy(() => fakeDynamicImport(DynamicComponent));\n      const SuspenseComponent = () => (\n        <Suspense fallback={<Fallback />}>\n          <LazyComponent />\n        </Suspense>\n      );\n\n      const wrapper = mount(<SuspenseComponent />);\n\n      expect(wrapper.is(SuspenseComponent)).to.equal(true);\n      expect(wrapper.find(LazyComponent)).to.have.lengthOf(0);\n      expect(wrapper.find(Fallback)).to.have.lengthOf(1);\n    });\n\n    it('return fallback string when given lazy component in initial mount and call .debug()', () => {\n      const LazyComponent = lazy(() => fakeDynamicImport(DynamicComponent));\n      const SuspenseComponent = () => (\n        <Suspense fallback={<Fallback />}>\n          <LazyComponent />\n        </Suspense>\n      );\n\n      const wrapper = mount(<SuspenseComponent />);\n\n      expect(wrapper.debug()).to.equal(`<SuspenseComponent>\n  <Suspense fallback={{...}}>\n    <Fallback>\n      <div>\n        Fallback\n      </div>\n    </Fallback>\n  </Suspense>\n</SuspenseComponent>`);\n    });\n\n    it('return wrapped component when given loaded lazy component in initial mount', () => {\n      const LazyComponent = getLoadedLazyComponent(DynamicComponent);\n      const SuspenseComponent = () => (\n        <Suspense fallback={<Fallback />}>\n          <LazyComponent />\n        </Suspense>\n      );\n\n      const wrapper = mount(<SuspenseComponent />);\n\n      expect(wrapper.is(SuspenseComponent)).to.equal(true);\n      expect(wrapper.find(LazyComponent)).to.have.lengthOf(0);\n      expect(wrapper.find(DynamicComponent)).to.have.lengthOf(1);\n      expect(wrapper.find(Fallback)).to.have.lengthOf(0);\n    });\n\n    it('return wrapped component string when given loaded lazy component in initial mount and call .debug()', () => {\n      const LazyComponent = getLoadedLazyComponent(DynamicComponent);\n      const SuspenseComponent = () => (\n        <Suspense fallback={<Fallback />}>\n          <LazyComponent />\n        </Suspense>\n      );\n\n      const wrapper = mount(<SuspenseComponent />);\n\n      expect(wrapper.debug()).to.equal(`<SuspenseComponent>\n  <Suspense fallback={{...}}>\n    <DynamicComponent>\n      <div>\n        Dynamic Component\n      </div>\n    </DynamicComponent>\n  </Suspense>\n</SuspenseComponent>`);\n    });\n\n    it('throws if options.suspenseFallback is specified', () => {\n      const LazyComponent = lazy(fakeDynamicImport(DynamicComponent));\n      const SuspenseComponent = () => (\n        <Suspense fallback={<Fallback />}>\n          <LazyComponent />\n        </Suspense>\n      );\n      expect(() => mount(<SuspenseComponent />, { suspenseFallback: false })).to.throw();\n    });\n\n    itIf(!!(useState && useEffect), 'avoids a TypeError', () => {\n      const Component2 = lazy(() => Promise.resolve({ default: () => <div /> }));\n\n      function Component() {\n        const [alreadyRun, setAlreadyRun] = useState(false);\n\n        useEffect(() => {\n          setAlreadyRun(true);\n        }, []);\n\n        if (!alreadyRun) {\n          return null;\n        }\n\n        return <Component2 />;\n      }\n\n      const wrapper = mount(\n        <Suspense fallback={<div>loading</div>}>\n          <Component />\n        </Suspense>,\n      );\n      expect(wrapper.debug()).to.equal(\n        `<Suspense fallback={{...}}>\n  <Component />\n  <div>\n    loading\n  </div>\n</Suspense>`,\n      );\n    });\n  });\n\n  describe('.mount()', () => {\n    it('calls componentWillUnmount()', () => {\n      const willMount = sinon.spy();\n      const didMount = sinon.spy();\n      const willUnmount = sinon.spy();\n\n      class Foo extends React.Component {\n        constructor(props) {\n          super(props);\n          this.componentWillUnmount = willUnmount;\n          this.componentWillMount = willMount;\n          this.componentDidMount = didMount;\n        }\n\n        render() {\n          const { id } = this.props;\n          return (\n            <div className={id}>\n              {id}\n            </div>\n          );\n        }\n      }\n      const wrapper = mount(<Foo id=\"foo\" />);\n      expect(willMount).to.have.property('callCount', 1);\n      expect(didMount).to.have.property('callCount', 1);\n      expect(willUnmount).to.have.property('callCount', 0);\n      wrapper.unmount();\n      expect(willMount).to.have.property('callCount', 1);\n      expect(didMount).to.have.property('callCount', 1);\n      expect(willUnmount).to.have.property('callCount', 1);\n      wrapper.mount();\n      expect(willMount).to.have.property('callCount', 2);\n      expect(didMount).to.have.property('callCount', 2);\n      expect(willUnmount).to.have.property('callCount', 1);\n    });\n\n    it('throws on non-root', () => {\n      class Foo extends React.Component {\n        render() {\n          return <div />;\n        }\n      }\n      const wrapper = mount(<Foo />);\n      const child = wrapper.find('div');\n      expect(() => child.mount()).to.throw(Error);\n    });\n  });\n\n  describe('.getDOMNode()', () => {\n    class Test extends React.Component {\n      render() {\n        return (\n          <div className=\"outer\">\n            <div className=\"inner\">\n              <span />\n              <span />\n            </div>\n          </div>\n        );\n      }\n    }\n    class TestZero extends React.Component {\n      render() {\n        return <div />;\n      }\n    }\n\n    it('returns the outermost DOMComponent of the root wrapper', () => {\n      const wrapper = mount(<Test />);\n      expect(wrapper.getDOMNode()).to.have.property('className', 'outer');\n    });\n\n    it('returns the outermost DOMComponent of the inner div wrapper', () => {\n      const wrapper = mount(<Test />);\n      expect(wrapper.find('.inner').getDOMNode()).to.have.property('className', 'inner');\n    });\n\n    it('throws when wrapping multiple elements', () => {\n      const wrapper = mount(<Test />).find('span');\n      expect(() => wrapper.getDOMNode()).to.throw(\n        Error,\n        'Method “getDOMNode” is meant to be run on 1 node. 2 found instead.',\n      );\n    });\n\n    it('throws when wrapping zero elements', () => {\n      const wrapper = mount(<TestZero />).find('span');\n      expect(() => wrapper.getDOMNode()).to.throw(\n        Error,\n        'Method “getDOMNode” is meant to be run on 1 node. 0 found instead.',\n      );\n    });\n\n    it('throws when wrapping zero elements', () => {\n      const wrapper = mount(<TestZero />).find('span');\n      expect(() => wrapper.getDOMNode()).to.throw(\n        Error,\n        'Method “getDOMNode” is meant to be run on 1 node. 0 found instead.',\n      );\n    });\n\n    describeIf(is('> 0.13'), 'stateless function components (SFCs)', () => {\n      const SFC = () => (\n        <div className=\"outer\">\n          <div className=\"inner\">\n            <span />\n            <span />\n          </div>\n        </div>\n      );\n\n      it('returns the outermost DOMComponent of the root wrapper', () => {\n        const wrapper = mount(<SFC />);\n        expect(wrapper.getDOMNode()).to.have.property('className', 'outer');\n      });\n\n      it('returns the outermost DOMComponent of the inner div wrapper', () => {\n        const wrapper = mount(<SFC />);\n        expect(wrapper.find('.inner').getDOMNode()).to.have.property('className', 'inner');\n      });\n\n      it('throws when wrapping multiple elements', () => {\n        const wrapper = mount(<SFC />).find('span');\n        expect(() => wrapper.getDOMNode()).to.throw(\n          Error,\n          'Method “getDOMNode” is meant to be run on 1 node. 2 found instead.',\n        );\n      });\n    });\n\n    it('lets you read the value of an input', () => {\n      const wrapper = mount(<div><input value=\"0\" /></div>);\n      const inputNode = wrapper.find('input').getDOMNode();\n      expect(inputNode.value).to.equal('0');\n    });\n  });\n\n  describe('.ref(refName)', () => {\n    class WithoutRef extends React.Component {\n      render() { return <div />; }\n    }\n\n    class WithRef extends React.Component {\n      render() { return <div ref=\"r\" />; }\n    }\n\n    class RendersWithRef extends React.Component {\n      render() { return <WithRef />; }\n    }\n\n    it('throws when called on not the root', () => {\n      const wrapper = mount(<RendersWithRef />);\n      const found = wrapper.find(WithRef);\n      expect(found).to.have.lengthOf(1);\n      expect(() => found.ref('ref')).to.throw(\n        Error,\n        'ReactWrapper::ref(refname) can only be called on the root',\n      );\n    });\n\n    it('unavailable ref should return undefined', () => {\n      const wrapper = mount(<WithoutRef />);\n      const ref = wrapper.ref('not-a-ref');\n\n      expect(ref).to.equal(undefined);\n    });\n\n    it('gets a wrapper of the node matching the provided refName', () => {\n      class Foo extends React.Component {\n        render() {\n          return (\n            <div>\n              <span ref=\"firstRef\" data-amount={2}>First</span>\n              <span ref=\"secondRef\" data-amount={4}>Second</span>\n              <span ref=\"thirdRef\" data-amount={8}>Third</span>\n            </div>\n          );\n        }\n      }\n      const wrapper = mount(<Foo />);\n      // React 13 and 14 return instances whereas 15+ returns actual DOM nodes. In this case,\n      // the public API of enzyme is to just return what `this.refs[refName]` would be expected\n      // to return for the version of react you're using.\n      if (is('< 15')) {\n        expect(wrapper.ref('secondRef').getDOMNode().getAttribute('data-amount')).to.equal('4');\n        expect(wrapper.ref('secondRef').getDOMNode().textContent).to.equal('Second');\n      } else {\n        expect(wrapper.ref('secondRef').getAttribute('data-amount')).to.equal('4');\n        expect(wrapper.ref('secondRef').textContent).to.equal('Second');\n      }\n    });\n  });\n\n  describe('.detach', () => {\n    class Comp extends React.Component {\n      render() {\n        return <div><span>hi</span></div>;\n      }\n    }\n    it('throws on non-root', () => {\n      const div = global.document.createElement('div');\n      global.document.body.appendChild(div);\n\n      const wrapper = mount(<Comp />, { attachTo: div });\n      const span = wrapper.find('span');\n      expect(span).to.have.lengthOf(1);\n      expect(() => span.detach()).to.throw(\n        Error,\n        'ReactWrapper::detach() can only be called on the root',\n      );\n    });\n\n    it('throws without the attachTo option', () => {\n      const wrapper = mount(<Comp />);\n      expect(() => wrapper.detach()).to.throw(\n        Error,\n        'ReactWrapper::detach() can only be called on when the `attachTo` option was passed into `mount()`.',\n      );\n    });\n  });\n\n  describe('attachTo option', () => {\n    it('attaches and stuff', () => {\n      class Foo extends React.Component {\n        render() {\n          return (<div className=\"in-foo\" />);\n        }\n      }\n      const div = global.document.createElement('div');\n\n      const initialBodyChildren = document.body.childNodes.length;\n      global.document.body.appendChild(div);\n\n      expect(document.body.childNodes).to.have.lengthOf(initialBodyChildren + 1);\n      expect(div.childNodes).to.have.lengthOf(0);\n\n      const wrapper = mount(<Foo />, { attachTo: div });\n\n      expect(wrapper.find('.in-foo')).to.have.lengthOf(1);\n      expect(document.body.childNodes).to.have.lengthOf(initialBodyChildren + 1);\n      expect(div.childNodes).to.have.lengthOf(1);\n\n      wrapper.detach();\n\n      expect(document.body.childNodes).to.have.lengthOf(initialBodyChildren + 1);\n      expect(div.childNodes).to.have.lengthOf(0);\n\n      global.document.body.removeChild(div);\n\n      expect(document.body.childNodes).to.have.lengthOf(initialBodyChildren);\n      expect(div.childNodes).to.have.lengthOf(0);\n    });\n\n    it('allows for multiple attaches/detaches on same node', () => {\n      class Foo extends React.Component {\n        render() {\n          return (<div className=\"in-foo\" />);\n        }\n      }\n      class Bar extends React.Component {\n        render() {\n          return (<section className=\"in-bar\" />);\n        }\n      }\n      let wrapper;\n      const div = global.document.createElement('div');\n\n      const initialBodyChildren = document.body.childNodes.length;\n      global.document.body.appendChild(div);\n\n      expect(document.body.childNodes).to.have.lengthOf(initialBodyChildren + 1);\n      expect(div.childNodes).to.have.lengthOf(0);\n\n      wrapper = mount(<Foo />, { attachTo: div });\n\n      expect(wrapper.find('.in-foo')).to.have.lengthOf(1);\n      expect(document.body.childNodes).to.have.lengthOf(initialBodyChildren + 1);\n      expect(div.childNodes).to.have.lengthOf(1);\n\n      wrapper.detach();\n\n      wrapper = mount(<Bar />, { attachTo: div });\n\n      expect(wrapper.find('.in-bar')).to.have.lengthOf(1);\n      expect(document.body.childNodes).to.have.lengthOf(initialBodyChildren + 1);\n      expect(div.childNodes).to.have.lengthOf(1);\n\n      wrapper.detach();\n\n      expect(document.body.childNodes).to.have.lengthOf(initialBodyChildren + 1);\n      expect(div.childNodes).to.have.lengthOf(0);\n\n      global.document.body.removeChild(div);\n\n      expect(document.body.childNodes).to.have.lengthOf(initialBodyChildren);\n      expect(div.childNodes).to.have.lengthOf(0);\n    });\n\n    it('will attach to the body successfully', () => {\n      class Bar extends React.Component {\n        render() {\n          return (<section className=\"in-bar\" />);\n        }\n      }\n      const wrapper = mount(<Bar />, { attachTo: document.body });\n\n      expect(wrapper.find('.in-bar')).to.have.lengthOf(1);\n      expect(document.body.childNodes).to.have.lengthOf(1);\n\n      wrapper.detach();\n\n      expect(document.body.childNodes).to.have.lengthOf(0);\n    });\n\n    describeIf(is('> 0.13'), 'stateless function components (SFCs)', () => {\n      it('attaches and stuff', () => {\n        const Foo = () => <div className=\"in-foo\" />;\n\n        const div = global.document.createElement('div');\n        const initialBodyChildren = document.body.childNodes.length;\n        global.document.body.appendChild(div);\n\n        expect(document.body.childNodes).to.have.lengthOf(initialBodyChildren + 1);\n        expect(div.childNodes).to.have.lengthOf(0);\n\n        const wrapper = mount(<Foo />, { attachTo: div });\n\n        expect(wrapper.find('.in-foo')).to.have.lengthOf(1);\n        expect(document.body.childNodes).to.have.lengthOf(initialBodyChildren + 1);\n        expect(div.childNodes).to.have.lengthOf(1);\n\n        wrapper.detach();\n\n        expect(document.body.childNodes).to.have.lengthOf(initialBodyChildren + 1);\n        expect(div.childNodes).to.have.lengthOf(0);\n\n        global.document.body.removeChild(div);\n\n        expect(document.body.childNodes).to.have.lengthOf(initialBodyChildren);\n        expect(div.childNodes).to.have.lengthOf(0);\n      });\n\n      it('allows for multiple attaches/detaches on same node', () => {\n        const Foo = () => <div className=\"in-foo\" />;\n        const Bar = () => <div className=\"in-bar\" />;\n\n        let wrapper;\n        const div = global.document.createElement('div');\n        const initialBodyChildren = document.body.childNodes.length;\n        global.document.body.appendChild(div);\n\n        expect(document.body.childNodes).to.have.lengthOf(initialBodyChildren + 1);\n        expect(div.childNodes).to.have.lengthOf(0);\n\n        wrapper = mount(<Foo />, { attachTo: div });\n\n        expect(wrapper.find('.in-foo')).to.have.lengthOf(1);\n        expect(document.body.childNodes).to.have.lengthOf(initialBodyChildren + 1);\n        expect(div.childNodes).to.have.lengthOf(1);\n\n        wrapper.detach();\n\n        wrapper = mount(<Bar />, { attachTo: div });\n\n        expect(wrapper.find('.in-bar')).to.have.lengthOf(1);\n        expect(document.body.childNodes).to.have.lengthOf(initialBodyChildren + 1);\n        expect(div.childNodes).to.have.lengthOf(1);\n\n        wrapper.detach();\n\n        expect(document.body.childNodes).to.have.lengthOf(initialBodyChildren + 1);\n        expect(div.childNodes).to.have.lengthOf(0);\n\n        global.document.body.removeChild(div);\n\n        expect(document.body.childNodes).to.have.lengthOf(initialBodyChildren + 0);\n        expect(div.childNodes).to.have.lengthOf(0);\n      });\n\n      it('will attach to the body successfully', () => {\n        const Bar = () => <div className=\"in-bar\" />;\n\n        const wrapper = mount(<Bar />, { attachTo: document.body });\n\n        expect(wrapper.find('.in-bar')).to.have.lengthOf(1);\n        expect(document.body.childNodes).to.have.lengthOf(1);\n\n        wrapper.detach();\n\n        expect(document.body.childNodes).to.have.lengthOf(0);\n      });\n    });\n  });\n\n  it('works with class components that return null', () => {\n    class Foo extends React.Component {\n      render() {\n        return null;\n      }\n    }\n    const wrapper = mount(<Foo />);\n    expect(wrapper).to.have.lengthOf(1);\n    expect(wrapper.type()).to.equal(Foo);\n    expect(wrapper.html()).to.equal(null);\n    const rendered = wrapper.render();\n    expect(rendered).to.have.lengthOf(0);\n    expect(rendered.html()).to.equal(null);\n  });\n\n  itIf(is('>= 16'), 'works with class components that return arrays', () => {\n    class Foo extends React.Component {\n      render() {\n        return [<div />, <div />];\n      }\n    }\n    const wrapper = mount(<Foo />);\n    expect(wrapper).to.have.lengthOf(1);\n    expect(wrapper.type()).to.equal(Foo);\n    expect(wrapper.children()).to.have.lengthOf(2);\n    expect(wrapper.find('div')).to.have.lengthOf(2);\n  });\n\n  itIf(is('>=15 || ^16.0.0-alpha'), 'works with SFCs that return null', () => {\n    const Foo = () => null;\n\n    const wrapper = mount(<Foo />);\n    expect(wrapper).to.have.lengthOf(1);\n    expect(wrapper.type()).to.equal(Foo);\n    expect(wrapper.html()).to.equal(null);\n    const rendered = wrapper.render();\n    expect(rendered).to.have.lengthOf(0);\n    expect(rendered.html()).to.equal(null);\n  });\n\n  describe('out-of-band state updates', () => {\n    class Child extends React.Component {\n      render() {\n        return <span />;\n      }\n    }\n\n    class Test extends React.Component {\n      componentWillMount() {\n        this.state = {};\n      }\n\n      safeSetState(newState) {\n        withSetStateAllowed(() => {\n          this.setState(newState);\n        });\n      }\n\n      asyncSetState() {\n        setImmediate(() => {\n          this.safeSetState({ showSpan: true });\n        });\n      }\n\n      callbackSetState() {\n        this.safeSetState({ showSpan: true });\n      }\n\n      render() {\n        /* eslint-disable react/destructuring-assignment */\n        return (\n          <div>\n            {this.state && this.state.showSpan && <span className=\"show-me\" />}\n            <button type=\"button\" className=\"async-btn\" onClick={() => this.asyncSetState()} />\n            <Child callback={() => this.callbackSetState()} />\n          </div>\n        );\n        /* eslint-enable react/destructuring-assignment */\n      }\n    }\n\n    // FIXME: figure out why this fails on 15.0 and 15.1\n    itIf(!is('~15.0 || ~15.1'), 'has updated output after an asynchronous setState', () => {\n      const wrapper = mount(<Test />);\n      wrapper.find('.async-btn').simulate('click');\n      return new Promise((resolve) => {\n        setImmediate(() => {\n          wrapper.update();\n          resolve();\n        });\n      }).then(() => {\n        expect(wrapper.find('.show-me')).to.have.lengthOf(1);\n      });\n    });\n\n    it('has updated output after child prop callback invokes setState', () => {\n      const wrapper = mount(<Test />);\n      wrapper.find(Child).props().callback();\n      wrapper.update();\n      expect(wrapper.find('.show-me')).to.have.lengthOf(1);\n    });\n  });\n\n  describe('setState through a props method', () => {\n    class Child extends React.Component {\n      render() {\n        const { onClick } = this.props;\n        return <button type=\"button\" onClick={onClick}>click</button>;\n      }\n    }\n\n    // FIXME: figure out why this fails on 15.0 and 15.1\n    itIf(!is('~15.0 || ~15.1'), 'is able to get the latest state value', () => {\n      class App extends React.Component {\n        constructor(props) {\n          super(props);\n          this.state = {\n            count: 0,\n          };\n        }\n\n        onIncrement() {\n          this.setState({\n            count: this.state.count + 1, // eslint-disable-line react/destructuring-assignment\n          });\n        }\n\n        render() {\n          const { count } = this.state;\n          return (\n            <div>\n              <Child onClick={() => this.onIncrement()} />\n              <p>{count}</p>\n            </div>\n          );\n        }\n      }\n      const wrapper = mount(<App />);\n      const p = wrapper.find('p');\n      expect(wrapper.find('p').text()).to.equal('0');\n      wrapper.find(Child).prop('onClick')();\n      // TODO: this is a difference between mount and shallow\n      // this is 1, because the wrapper has updated\n      expect(p.text()).to.equal('1');\n      expect(wrapper.find('p').text()).to.equal('1');\n    });\n  });\n\n  describe('setState through a props method in async', () => {\n    class Child extends React.Component {\n      render() {\n        const { onClick } = this.props;\n        return <button type=\"button\" onClick={onClick}>click</button>;\n      }\n    }\n\n    // FIXME: figure out why this fails on 15.0 and 15.1\n    itIf(!is('~15.0 || ~15.1'), 'is able to get the latest state value', () => {\n      let App;\n      const promise = new Promise((resolve) => {\n        App = class extends React.Component {\n          constructor(props) {\n            super(props);\n            this.state = {\n              count: 0,\n            };\n          }\n\n          onIncrement() {\n            setTimeout(() => {\n              this.setState({\n                count: this.state.count + 1, // eslint-disable-line react/destructuring-assignment\n              }, resolve);\n            });\n          }\n\n          render() {\n            const { count } = this.state;\n            return (\n              <div>\n                <Child onClick={() => this.onIncrement()} />\n                <p>{count}</p>\n              </div>\n            );\n          }\n        };\n      });\n      const wrapper = mount(<App />);\n      expect(wrapper.find('p').text()).to.equal('0');\n      wrapper.find(Child).prop('onClick')();\n      return promise.then(() => {\n        expect(wrapper.find('p').text()).to.equal('1');\n      });\n    });\n  });\n\n  describe('cloning elements', () => {\n    class Foo extends React.Component {\n      render() {\n        const { children } = this.props;\n        const mappedChildren = [];\n        React.Children.forEach(children, (child, i) => {\n          const clonedChild = React.cloneElement(child, {\n            key: i, // eslint-disable-line react/no-array-index-key\n            onClick() {\n              return child.props.name;\n            },\n          });\n          mappedChildren.push(clonedChild);\n        });\n        return (\n          <div>\n            {mappedChildren}\n          </div>\n        );\n      }\n    }\n\n    it('merges cloned element props', () => {\n      const wrapper = mount((\n        <Foo>\n          <span data-foo=\"1\">1</span>\n          <div data-bar=\"2\">2</div>\n        </Foo>\n      ));\n\n      const children = wrapper.childAt(0).children();\n      expect(children).to.have.lengthOf(2);\n\n      const span = children.at(0);\n      expect(span.is('span')).to.equal(true);\n      const spanProps = span.props();\n      expect(spanProps).to.have.keys({\n        children: 1,\n        'data-foo': 1,\n        onClick: spanProps.onClick,\n      });\n      expect(spanProps.onClick).to.be.a('function');\n\n      const div = children.at(1);\n      expect(div.is('div')).to.equal(true);\n      const divProps = div.props();\n      expect(divProps).to.have.keys({\n        children: 2,\n        'data-bar': 2,\n        onClick: divProps.onClick,\n      });\n      expect(divProps.onClick).to.be.a('function');\n    });\n  });\n});\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/ShallowWrapper-spec.jsx",
    "content": "import React from 'react';\nimport PropTypes from 'prop-types';\nimport { expect } from 'chai';\nimport sinon from 'sinon-sandbox';\nimport wrap from 'mocha-wrap';\nimport inspect from 'object-inspect';\n\nimport {\n  shallow,\n  ShallowWrapper,\n} from 'enzyme';\nimport shallowEntry from 'enzyme/shallow';\nimport ShallowWrapperEntry from 'enzyme/ShallowWrapper';\nimport {\n  withSetStateAllowed,\n} from 'enzyme/build/Utils';\nimport getAdapter from 'enzyme/build/getAdapter';\nimport { fakeDynamicImport } from 'enzyme-adapter-utils';\n\nimport './_helpers/setupAdapters';\nimport {\n  createClass,\n  createContext,\n  createPortal,\n  forwardRef,\n  Fragment,\n  lazy,\n  memo,\n  Profiler,\n  Suspense,\n  useCallback,\n} from './_helpers/react-compat';\nimport {\n  describeIf,\n  itIf,\n} from './_helpers';\nimport describeMethods from './_helpers/describeMethods';\nimport describeLifecycles from './_helpers/describeLifecycles';\nimport describeHooks from './_helpers/describeHooks';\nimport {\n  is,\n} from './_helpers/version';\n\ndescribe('shallow', () => {\n  describe('top level entry points', () => {\n    expect(shallowEntry).to.equal(shallow);\n    expect(ShallowWrapperEntry).to.equal(ShallowWrapper);\n  });\n\n  describe('top level wrapper', () => {\n    it('does what i expect', () => {\n      class Box extends React.Component {\n        render() {\n          const { children } = this.props;\n          return <div className=\"box\">{children}</div>;\n        }\n      }\n      class Foo extends React.Component {\n        render() {\n          return (\n            <Box bam>\n              <div className=\"div\" />\n            </Box>\n          );\n        }\n      }\n\n      const wrapper = shallow(<Foo bar />);\n\n      expect(wrapper.type()).to.equal(Box);\n      expect(wrapper.props().bam).to.equal(true);\n      expect(wrapper.instance()).to.be.instanceOf(Foo);\n      expect(wrapper.children().at(0).type()).to.equal('div');\n      expect(wrapper.find(Box).children().props().className).to.equal('div');\n      expect(wrapper.find(Box).children().at(0).props().className).to.equal('div');\n      expect(wrapper.find(Box).children().props().className).to.equal('div');\n      expect(wrapper.children().type()).to.equal('div');\n      expect(wrapper.children().props().bam).to.equal(undefined);\n    });\n\n    it('works with numeric literals', () => {\n      const wrapper = shallow(<div>{50}</div>);\n      expect(wrapper.debug()).to.equal(`<div>\n  50\n</div>`);\n    });\n\n    describe('wrapping invalid elements', () => {\n      it('throws with combined dangerouslySetInnerHTML and children on host nodes', () => {\n        /* eslint react/no-danger-with-children: 0 */\n        expect(() => shallow((\n          <div dangerouslySetInnerHTML={{ __html: '{}' }}>child</div>\n        ))).to.throw(Error, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.');\n      });\n\n      itIf(is('>= 16'), 'throws when shallow rendering Portals', () => {\n        const portal = createPortal(\n          <div />,\n          { nodeType: 1 },\n        );\n\n        expect(() => shallow(portal)).to.throw(\n          Error,\n          'ShallowWrapper can only wrap valid elements',\n        );\n      });\n\n      it('throws when shallow rendering plain text', () => {\n        expect(() => shallow('Foo')).to.throw(\n          Error,\n          'ShallowWrapper can only wrap valid elements',\n        );\n      });\n\n      it('throws when shallow rendering multiple elements', () => {\n        expect(() => shallow([<div />])).to.throw(\n          TypeError,\n          'ShallowWrapper can only wrap valid elements',\n        );\n      });\n    });\n\n    it('shallow renders built in components', () => {\n      expect(() => shallow(<div />)).not.to.throw();\n    });\n\n    it('shallow renders composite components', () => {\n      class Foo extends React.Component {\n        render() {\n          return <div />;\n        }\n      }\n\n      expect(() => shallow(<Foo />)).not.to.throw();\n    });\n\n    it('starts out with undefined state', () => {\n      class Foo extends React.Component {\n        render() {\n          return (\n            <div>\n              {typeof this.state}\n              {JSON.stringify(this.state)}\n            </div>\n          );\n        }\n      }\n\n      const wrapper = shallow(<Foo />);\n      expect(wrapper.state()).to.equal(null);\n      expect(wrapper.debug()).to.equal(`\n<div>\n  object\n  null\n</div>\n      `.trim());\n      expect(() => wrapper.state('key')).to.throw('ShallowWrapper::state(\"key\") requires that `state` not be `null` or `undefined`');\n    });\n\n    describeIf(is('>= 0.14'), 'wrappingComponent', () => {\n      class More extends React.Component {\n        render() {\n          return null;\n        }\n      }\n\n      class StateTester extends React.Component {\n        render() {\n          return null;\n        }\n      }\n\n      class TestProvider extends React.Component {\n        getChildContext() {\n          const { value, renderMore, renderStateTester } = this.props;\n\n          return {\n            testContext: value || 'Hello world!',\n            renderMore: renderMore || false,\n            renderStateTester: renderStateTester || false,\n          };\n        }\n\n        render() {\n          const { children } = this.props;\n\n          return <span>{children}</span>;\n        }\n      }\n      TestProvider.childContextTypes = {\n        testContext: PropTypes.string,\n        renderMore: PropTypes.bool,\n        renderStateTester: PropTypes.bool,\n      };\n\n      class MyWrappingComponent extends React.Component {\n        constructor() {\n          super();\n          this.state = { renderStateTester: false };\n        }\n\n        render() {\n          const { children, contextValue, renderMore } = this.props;\n          const { renderStateTester } = this.state;\n\n          return (\n            <div>\n              <TestProvider\n                value={contextValue}\n                renderMore={renderMore}\n                renderStateTester={renderStateTester}\n              >\n                <div>\n                  {children}\n                </div>\n              </TestProvider>\n            </div>\n          );\n        }\n      }\n\n      class MyComponent extends React.Component {\n        render() {\n          const {\n            testContext,\n            renderMore = true,\n            renderStateTester,\n            explicitContext,\n          } = this.context;\n          return (\n            <div>\n              <div>Context says: {testContext}{explicitContext}</div>\n              {renderMore && <More />}\n              {renderStateTester && <StateTester />}\n            </div>\n          );\n        }\n      }\n      MyComponent.contextTypes = {\n        ...TestProvider.childContextTypes,\n        explicitContext: PropTypes.bool,\n      };\n\n      it('mounts the passed node as the root as per usual', () => {\n        const wrapper = shallow(<MyComponent />, {\n          wrappingComponent: MyWrappingComponent,\n          context: {\n            explicitContext: ' stop!',\n          },\n        });\n        expect(wrapper.type()).to.equal('div');\n        expect(wrapper.parent().exists()).to.equal(false);\n        expect(() => wrapper.setProps({ foo: 'bar' })).not.to.throw();\n      });\n\n      it('renders the root in the wrapping component', () => {\n        const wrapper = shallow(<MyComponent />, {\n          wrappingComponent: MyWrappingComponent,\n          context: {\n            explicitContext: ' stop!',\n          },\n        });\n        // Context will only be set properly if the root node is rendered as a descendent of the wrapping component.\n        expect(wrapper.text()).to.equal('Context says: Hello world! stop!');\n      });\n\n      it('supports mounting the wrapping component with initial props', () => {\n        const wrapper = shallow(<MyComponent />, {\n          wrappingComponent: MyWrappingComponent,\n          wrappingComponentProps: { contextValue: 'I can be set!' },\n        });\n        expect(wrapper.text()).to.equal('Context says: I can be set!');\n      });\n\n      describeIf(is('>= 16.3'), 'with createContext()', () => {\n        let Context1;\n        let Context2;\n        beforeEach(() => {\n          Context1 = createContext('default1');\n          Context2 = createContext('default2');\n        });\n\n        function WrappingComponent(props) {\n          const { value1, value2, children } = props;\n          return (\n            <Context1.Provider value={value1}>\n              <Context2.Provider value={value2}>\n                {children}\n              </Context2.Provider>\n            </Context1.Provider>\n          );\n        }\n\n        function Component() {\n          return (\n            <Context1.Consumer>\n              {(value1) => (\n                <Context2.Consumer>\n                  {(value2) => (\n                    <div>Value 1: {value1}; Value 2: {value2}</div>\n                  )}\n                </Context2.Consumer>\n              )}\n            </Context1.Consumer>\n          );\n        }\n\n        it('renders', () => {\n          const wrapper = shallow(<Component />, {\n            wrappingComponent: WrappingComponent,\n            wrappingComponentProps: {\n              value1: 'one',\n              value2: 'two',\n            },\n          });\n          const consumer1 = wrapper.find(Context1.Consumer).dive();\n          const consumer2 = consumer1.find(Context2.Consumer).dive();\n\n          expect(consumer2.text()).to.equal('Value 1: one; Value 2: two');\n        });\n      });\n\n      it('throws an error if the wrappingComponent does not render its children', () => {\n        class BadWrapper extends React.Component {\n          render() {\n            return <div />;\n          }\n        }\n        expect(() => shallow(<MyComponent />, {\n          wrappingComponent: BadWrapper,\n        })).to.throw('`wrappingComponent` must render its children!');\n      });\n\n      wrap()\n        .withOverrides(() => getAdapter(), () => ({\n          isCustomComponent: undefined,\n          RootFinder: undefined,\n          wrapWithWrappingComponent: undefined,\n        }))\n        .describe('with an old adapter', () => {\n          it('renders fine when wrappingComponent is not passed', () => {\n            const wrapper = shallow(<MyComponent />);\n            expect(wrapper.debug()).to.equal(`<div>\n  <div>\n    Context says:${' '}\n  </div>\n  <More />\n</div>`);\n          });\n\n          it('throws an error if wrappingComponent is passed', () => {\n            expect(() => shallow(<MyComponent />, {\n              wrappingComponent: MyWrappingComponent,\n            })).to.throw('your adapter does not support `wrappingComponent`. Try upgrading it!');\n          });\n        });\n    });\n\n    class RendersChildren extends React.Component {\n      render() {\n        const { children } = this.props;\n        return children;\n      }\n    }\n\n    itIf.skip(is('<=0.13'), 'throws an error if wrappingComponent is passed', () => {\n      expect(() => shallow(<div />, {\n        wrappingComponent: RendersChildren,\n      })).to.throw('your adapter does not support `wrappingComponent`. Try upgrading it!');\n    });\n\n    describeIf.skip(is('>= 16.3'), 'uses the isValidElementType from the Adapter to validate the prop type of Component', () => {\n      const Foo = () => null;\n      const Bar = () => null;\n      wrap()\n        .withConsoleThrows()\n        .withOverride(() => getAdapter(), 'isValidElementType', () => (val) => val === Foo)\n        .it('with isValidElementType defined on the Adapter', () => {\n          expect(() => {\n            shallow(<Bar />);\n          }).to.throw('Warning: Failed prop type: Component must be a valid element type!\\n    in WrapperComponent');\n        });\n    });\n  });\n\n  describe('context', () => {\n    it('can pass in context', () => {\n      const SimpleComponent = createClass({\n        contextTypes: {\n          name: PropTypes.string,\n        },\n        render() {\n          const { name } = this.context;\n          return <div>{name}</div>;\n        },\n      });\n\n      const context = { name: 'foo' };\n      const wrapper = shallow(<SimpleComponent />, { context });\n      expect(wrapper.text()).to.equal('foo');\n    });\n\n    it('does not throw if context is passed in but contextTypes is missing', () => {\n      const SimpleComponent = createClass({\n        render() {\n          const { name } = this.context;\n          return <div>{name}</div>;\n        },\n      });\n\n      const context = { name: 'foo' };\n      expect(() => shallow(<SimpleComponent />, { context })).not.to.throw();\n    });\n\n    it('is introspectable through context API', () => {\n      const SimpleComponent = createClass({\n        contextTypes: {\n          name: PropTypes.string,\n        },\n        render() {\n          const { name } = this.context;\n          return <div>{name}</div>;\n        },\n      });\n\n      const context = { name: 'foo' };\n      const wrapper = shallow(<SimpleComponent />, { context });\n\n      expect(wrapper.context().name).to.equal(context.name);\n      expect(wrapper.context('name')).to.equal(context.name);\n    });\n\n    itIf(is('>= 16.3'), 'finds elements through Context elements', () => {\n      const { Provider, Consumer } = createContext('');\n\n      class Consumes extends React.Component {\n        render() {\n          return (\n            <span>\n              <Consumer>{(value) => <span>{value}</span>}</Consumer>\n            </span>\n          );\n        }\n      }\n\n      class Provides extends React.Component {\n        render() {\n          return (\n            <Provider value=\"foo\"><div><Consumes /></div></Provider>\n          );\n        }\n      }\n\n      expect(shallow(<Consumes />).find('span')).to.have.lengthOf(1);\n      expect(shallow(<Provides />).find(Consumes)).to.have.lengthOf(1);\n    });\n\n    itIf(is('>= 16.3'), 'finds elements through forwarded refs elements', () => {\n      const SomeComponent = forwardRef((props, ref) => (\n        <div ref={ref}>\n          <span className=\"child1\" />\n          <span className=\"child2\" />\n        </div>\n      ));\n\n      const wrapper = shallow(<SomeComponent />);\n\n      expect(wrapper.find('.child2')).to.have.lengthOf(1);\n    });\n\n    describeIf(is('>= 16.3'), 'createContext()', () => {\n      describe('rendering as root:', () => {\n        let Context;\n\n        beforeEach(() => {\n          Context = createContext('cool');\n        });\n\n        describe('<Provider />', () => {\n          it('can be rendered as the root', () => {\n            const wrapper = shallow(\n              <Context.Provider value=\"hello\">\n                <Context.Consumer>\n                  {(value) => <div>{value}</div>}\n                </Context.Consumer>\n              </Context.Provider>,\n            );\n            expect(wrapper.debug()).to.eql(`\n<ContextConsumer>\n  [function]\n</ContextConsumer>\n            `.trim());\n          });\n\n          it('supports changing the value', () => {\n            const wrapper = shallow(\n              <Context.Provider value=\"hello\">\n                <Context.Consumer>\n                  {(value) => <div>{value}</div>}\n                </Context.Consumer>\n              </Context.Provider>,\n            );\n            wrapper.setProps({ value: 'world' });\n            expect(wrapper.find(Context.Consumer).dive().text()).to.eql('world');\n          });\n        });\n\n        describe('<Consumer />', () => {\n          function DivRenderer({ children }) {\n            return <div>{children}</div>;\n          }\n          it('can be rendered as the root', () => {\n            const wrapper = shallow(\n              <Context.Consumer>\n                {(value) => <DivRenderer>{value}</DivRenderer>}\n              </Context.Consumer>,\n            );\n            expect(wrapper.debug()).to.eql(`\n<DivRenderer>\n  cool\n</DivRenderer>\n            `.trim());\n          });\n\n          it('supports changing the children', () => {\n            const wrapper = shallow(\n              <Context.Consumer>\n                {(value) => <DivRenderer>{value}</DivRenderer>}\n              </Context.Consumer>,\n            );\n            wrapper.setProps({ children: (value) => <DivRenderer>Changed: {value}</DivRenderer> });\n            expect(wrapper.find(DivRenderer).dive().text()).to.eql('Changed: cool');\n          });\n        });\n      });\n\n      describe('dive() on Provider and Consumer', () => {\n        let Provider;\n        let Consumer;\n\n        beforeEach(() => {\n          ({ Provider, Consumer } = React.createContext('howdy!'));\n        });\n\n        class Consumes extends React.Component {\n          render() {\n            return (\n              <span>\n                <Consumer>{(value) => <span>{value}</span>}</Consumer>\n              </span>\n            );\n          }\n        }\n\n        class Provides extends React.Component {\n          render() {\n            const { children } = this.props;\n\n            return (\n              <Provider value=\"foo\"><div><div />{children}</div></Provider>\n            );\n          }\n        }\n\n        class MyComponent extends React.Component {\n          render() {\n            return (\n              <Provides><Consumes /></Provides>\n            );\n          }\n        }\n\n        it('works on a Provider', () => {\n          const wrapper = shallow(<MyComponent />);\n          const provides = wrapper.find(Provides).dive();\n          const provider = provides.find(Provider).dive();\n          expect(provider.text()).to.equal('<Consumes />');\n        });\n\n        it('always gives the default provider value if dive()ing directly to a <Consumer />', () => {\n          // Diving directly on a consumer will give you the default value\n          const wrapper = shallow(<MyComponent />);\n          const consumes = wrapper.find(Consumes).dive();\n          const consumer = consumes.find(Consumer).dive();\n          expect(consumer.text()).to.equal('howdy!');\n        });\n\n        it('gives the actual <Provider /> value if one dive()s it', () => {\n          const wrapper = shallow(<MyComponent />);\n          const provides = wrapper.find(Provides).dive();\n          const provider = provides.find(Provider).dive();\n          const consumes = provider.find(Consumes).dive();\n          const consumer = consumes.find(Consumer).dive();\n          expect(consumer.text()).to.equal('foo');\n        });\n\n        it('does not leak values across roots', () => {\n          const wrapper = shallow(<MyComponent />);\n          const provides = wrapper.find(Provides).dive();\n          const provider = provides.find(Provider).dive();\n          expect(provider).to.have.lengthOf(1);\n\n          const consumes = wrapper.find(Consumes).dive();\n          const consumer = consumes.find(Consumer).dive();\n          expect(consumer.text()).to.equal('howdy!');\n        });\n      });\n\n      describe('shallow() on Provider and Consumer', () => {\n        let Provider;\n        let Consumer;\n\n        beforeEach(() => {\n          ({ Provider, Consumer } = React.createContext('howdy!'));\n        });\n\n        class Consumes extends React.Component {\n          render() {\n            return (\n              <span>\n                <Consumer>{(value) => <span>{value}</span>}</Consumer>\n              </span>\n            );\n          }\n        }\n\n        class Provides extends React.Component {\n          render() {\n            const { children } = this.props;\n\n            return (\n              <Provider value=\"foo\"><div><div />{children}</div></Provider>\n            );\n          }\n        }\n\n        class MyComponent extends React.Component {\n          render() {\n            return (\n              <Provides><Consumes /></Provides>\n            );\n          }\n        }\n\n        it('works on a Provider', () => {\n          const wrapper = shallow(<MyComponent />);\n          const provides = wrapper.find(Provides).dive();\n          const provider = provides.find(Provider).shallow();\n          expect(provider.text()).to.equal('<Consumes />');\n        });\n\n        it('always gives the default provider value if shallow() rendering a <Consumer /> directly', () => {\n          // Diving directly on a consumer will give you the default value\n          const wrapper = shallow(<MyComponent />);\n          const consumes = wrapper.find(Consumes).shallow();\n          const consumer = consumes.find(Consumer).shallow();\n          expect(consumer.text()).to.equal('howdy!');\n        });\n\n        it('gives the actual <Provider /> value if one dive()s it', () => {\n          const wrapper = shallow(<MyComponent />);\n          const provides = wrapper.find(Provides).shallow();\n          const provider = provides.find(Provider).shallow();\n          const consumes = provider.find(Consumes).shallow();\n          const consumer = consumes.find(Consumer).shallow();\n          expect(consumer.text()).to.equal('foo');\n        });\n      });\n    });\n\n    describeIf(is('> 0.13'), 'stateless function components (SFCs)', () => {\n      it('can pass in context', () => {\n        const SimpleComponent = (props, { name }) => (\n          <div>{name}</div>\n        );\n        SimpleComponent.contextTypes = { name: PropTypes.string };\n\n        const context = { name: 'foo' };\n        const wrapper = shallow(<SimpleComponent />, { context });\n        expect(wrapper.text()).to.equal('foo');\n      });\n\n      it('does not throw if context is passed in but contextTypes is missing', () => {\n        const SimpleComponent = (props, { name }) => (\n          <div>{name}</div>\n        );\n\n        const context = { name: 'foo' };\n        expect(() => shallow(<SimpleComponent />, { context })).not.to.throw();\n      });\n\n      itIf(is('< 16'), 'is introspectable through context API', () => {\n        const SimpleComponent = (props, { name }) => (\n          <div>{name}</div>\n        );\n        SimpleComponent.contextTypes = { name: PropTypes.string };\n\n        const context = { name: 'foo' };\n        const wrapper = shallow(<SimpleComponent />, { context });\n\n        expect(wrapper.context().name).to.equal(context.name);\n        expect(wrapper.context('name')).to.equal(context.name);\n      });\n\n      itIf(is('>= 16'), 'is not introspectable through context API', () => {\n        const SimpleComponent = (props, { name }) => (\n          <div>{name}</div>\n        );\n        SimpleComponent.contextTypes = { name: PropTypes.string };\n\n        const wrapper = shallow(<SimpleComponent />, { context });\n\n        expect(() => wrapper.context()).to.throw(\n          Error,\n          'ShallowWrapper::context() can only be called on wrapped nodes that have a non-null instance',\n        );\n        expect(() => wrapper.context('name')).to.throw(\n          Error,\n          'ShallowWrapper::context() can only be called on wrapped nodes that have a non-null instance',\n        );\n      });\n    });\n\n    describe('getChildContext()', () => {\n      class FooProvider extends React.Component {\n        getChildContext() {\n          const { value } = this.props;\n          return { foo: value };\n        }\n\n        render() {\n          const { children } = this.props;\n          return children;\n        }\n      }\n      FooProvider.childContextTypes = {\n        foo: PropTypes.string,\n      };\n\n      class BarProvider extends React.Component {\n        constructor(...args) {\n          super(...args);\n\n          this.state = { value: 'love' };\n        }\n\n        getChildContext() {\n          const { value } = this.state;\n          return { bar: value };\n        }\n\n        render() {\n          const { children } = this.props;\n          return children;\n        }\n      }\n      BarProvider.childContextTypes = {\n        bar: PropTypes.string,\n      };\n\n      class FooBarBazConsumer extends React.Component {\n        render() {\n          return <div />;\n        }\n      }\n      FooBarBazConsumer.contextTypes = {\n        foo: PropTypes.string,\n        bar: PropTypes.string,\n        baz: PropTypes.string,\n      };\n\n      class TestComponent extends React.Component {\n        render() {\n          return (\n            <FooProvider value=\"i\">\n              <BarProvider>\n                <FooBarBazConsumer />\n              </BarProvider>\n            </FooProvider>\n          );\n        }\n      }\n\n      let fooProviderSpy;\n      let barProviderSpy;\n      beforeEach(() => {\n        fooProviderSpy = sinon.spy(FooProvider.prototype, 'getChildContext');\n        barProviderSpy = sinon.spy(BarProvider.prototype, 'getChildContext');\n      });\n      afterEach(() => {\n        fooProviderSpy.restore();\n        barProviderSpy.restore();\n      });\n\n      describeIf(is('<= 0.13'), 'owner-based context', () => {\n        it('is not implemented', () => {\n          const wrapper = shallow(<TestComponent />, { context: { baz: 'enzyme' } });\n\n          const fooProvider = wrapper.find(FooProvider).dive();\n          const barProvider = fooProvider.find(BarProvider).dive();\n          const consumer = barProvider.find(FooBarBazConsumer).dive();\n\n          const expectedContext = { baz: 'enzyme', foo: undefined, bar: undefined };\n          expect(consumer.context()).to.eql(expectedContext);\n        });\n      });\n\n      describeIf(is('>= 0.14'), 'parent-based context', () => {\n        const adapter = getAdapter();\n        const {\n          createShallowRenderer: realCreateShallowRenderer,\n          options: realAdapterOptions,\n        } = adapter;\n\n        wrap()\n          .withOverride(() => adapter, 'options', () => {\n            const {\n              legacyContextMode, // omit legacyContextMode\n              lifecycles: {\n                getChildContext, // omit getChildContext\n                ...lifecycles\n              },\n              ...options\n            } = realAdapterOptions;\n\n            return {\n              ...options,\n              lifecycles,\n            };\n          })\n          .describe('with older adapters', () => {\n            it('still supports the context option', () => {\n              const wrapper = shallow(<TestComponent />, { context: { baz: 'enzyme' } });\n\n              const fooProvider = wrapper.find(FooProvider).dive();\n              const barProvider = fooProvider.find(BarProvider).dive();\n              const consumer = barProvider.find(FooBarBazConsumer).dive();\n\n              const expectedContext = { baz: 'enzyme', foo: undefined, bar: undefined };\n              expect(consumer.context()).to.eql(expectedContext);\n            });\n          });\n\n        it('is called on mount', () => {\n          const wrapper = shallow(<TestComponent />, { context: { baz: 'enzyme' } });\n\n          const fooProvider = wrapper.find(FooProvider).dive();\n          const barProvider = fooProvider.find(BarProvider).dive();\n          const consumer = barProvider.find(FooBarBazConsumer).dive();\n\n          const expectedContext = { foo: 'i', bar: 'love', baz: 'enzyme' };\n          expect(consumer.context()).to.eql(expectedContext);\n\n          expect(fooProviderSpy).to.have.property('callCount', 1);\n        });\n\n        it('is called when the component re-renders', () => {\n          const wrapper = shallow(<TestComponent />, { context: { baz: 'enzyme' } });\n          const fooProvider = wrapper.find(FooProvider).dive();\n          fooProvider.setProps({ value: 'we' });\n\n          const barProvider = fooProvider.find(BarProvider).dive();\n          barProvider.setState({ value: 'like' });\n\n          const consumer = barProvider.find(FooBarBazConsumer).dive();\n\n          expect(fooProviderSpy).to.have.property('callCount', 2);\n          expect(barProviderSpy).to.have.property('callCount', 2);\n\n          const expectedContext = { foo: 'we', bar: 'like', baz: 'enzyme' };\n          expect(consumer.context()).to.eql(expectedContext);\n        });\n\n        it('propagates updates to rendered children', () => {\n          const wrapper = shallow(<TestComponent />, { context: { baz: 'enzyme' } });\n\n          const fooProvider = wrapper.find(FooProvider).dive();\n          const barProvider = fooProvider.find(BarProvider).dive();\n          const consumer = barProvider.find(FooBarBazConsumer).dive();\n\n          expect(consumer.context()).to.eql({ foo: 'i', bar: 'love', baz: 'enzyme' });\n\n          fooProvider.setProps({ value: 'we' });\n\n          const nextBarProvider = fooProvider.find(BarProvider).dive();\n          nextBarProvider.setState({ value: 'maintain' });\n          const nextConsumer = nextBarProvider.find(FooBarBazConsumer).dive();\n\n          const expectedContext = { foo: 'we', bar: 'maintain', baz: 'enzyme' };\n          expect(nextConsumer.context()).to.eql(expectedContext);\n        });\n\n        it('does nothing if disableLifecycleMethods is true', () => {\n          const wrapper = shallow(<TestComponent />, {\n            context: { baz: 'enzyme' },\n            disableLifecycleMethods: true,\n          });\n          const fooProvider = wrapper.find(FooProvider).dive();\n\n          const consumer = () => {\n            const barProvider = fooProvider.find(BarProvider).dive();\n            return barProvider.find(FooBarBazConsumer).dive();\n          };\n\n          const expectedContext = { baz: 'enzyme', foo: undefined, bar: undefined };\n          expect(consumer().context()).to.eql(expectedContext);\n\n          fooProvider.setProps({ value: 'we' });\n          expect(consumer().context()).to.eql(expectedContext);\n        });\n\n        it('throws like react if a child context is returned and there is no propType', () => {\n          class FaultyFooProvider extends React.Component {\n            getChildContext() {\n              const { value } = this.props;\n              return { foo: value };\n            }\n\n            render() {\n              const { children } = this.props;\n              return children;\n            }\n          }\n          FaultyFooProvider.childContextTypes = {};\n\n          expect(() => shallow((\n            <FaultyFooProvider value=\"foo\">\n              <div />\n            </FaultyFooProvider>\n          ))).to.throw('FaultyFooProvider.getChildContext(): key \"foo\" is not defined in childContextTypes');\n        });\n\n        it('allows overriding context with the context option', () => {\n          const wrapper = shallow(<TestComponent />);\n\n          const fooProvider = wrapper.find(FooProvider).dive();\n          const barProvider = fooProvider.find(BarProvider).dive();\n          const consumer = barProvider.find(FooBarBazConsumer).dive({ context: { foo: 'you' } });\n\n          const expectedContext = { foo: 'you', bar: undefined, baz: undefined };\n          expect(consumer.context()).to.eql(expectedContext);\n        });\n\n        class Provider extends React.Component {\n          getChildContext() {\n            return {\n              foo: 'foo!',\n              bar: 'bar!',\n            };\n          }\n\n          render() {\n            const { children } = this.props;\n            return children;\n          }\n        }\n\n        class Receiver extends React.Component {\n          render() {\n            return <div>{inspect(this.context)}</div>;\n          }\n        }\n\n        // react 0.14 and 15 throw an invariant exception in this case\n        itIf(is('0.13 || > 15'), 'warns and works but provides no context, without childContextTypes', () => {\n          const stub = sinon.stub(console, 'warn');\n          const wrapper = shallow(<Provider><Receiver /></Provider>).dive();\n          expect(wrapper.debug()).to.equal(`<div>\n  {}\n</div>`);\n          expect(stub).to.have.property('callCount', 1);\n          expect(stub.args).to.eql([['Provider.getChildContext(): childContextTypes must be defined in order to use getChildContext().']]);\n        });\n\n        wrap()\n          .withConsoleThrows()\n          .it('warns if childContextTypes is not defined', () => {\n            class FaultyFooProvider extends React.Component {\n              getChildContext() {\n                const { value } = this.props;\n                return {\n                  foo: value,\n                };\n              }\n\n              render() {\n                return null;\n              }\n            }\n            expect(() => shallow((\n              <FaultyFooProvider />\n            ))).to.throw('FaultyFooProvider.getChildContext(): childContextTypes must be defined in order to use getChildContext().');\n          });\n\n        wrap()\n          .withConsoleThrows()\n          .describe('checks', () => {\n            // FIXME: figure out why this fails on 15.0 and 15.1\n            itIf(!is('~15.0 || ~15.1 || ~15.2'), 'prop types', () => {\n              try {\n                shallow(<FooProvider value={1612}><div /></FooProvider>);\n                throw new EvalError('shallow() did not throw!');\n              } catch (error) {\n                expect(error.message).to.contain('`foo` of type `number` supplied to `FooProvider`, expected `string`');\n                expect(error.message).to.match(/context/i);\n              }\n            });\n          });\n\n        wrap()\n          .withOverride(() => getAdapter(), 'createShallowRenderer', () => (...args) => {\n            const renderer = realCreateShallowRenderer(...args);\n            delete renderer.checkPropTypes;\n            return renderer;\n          })\n          .it('if the adapter can‘t check propTypes, it works, but does not check prop types', () => {\n            expect(() => {\n              const wrapper = shallow(<TestComponent />, { context: { baz: 'enzyme' } });\n              const fooProvider = wrapper.find(FooProvider).dive();\n              const barProvider = fooProvider.find(BarProvider).dive();\n              return barProvider.find(FooBarBazConsumer).dive();\n            }).not.to.throw();\n          });\n      });\n    });\n  });\n\n  describeIf(is('> 0.13'), 'stateless function components (SFCs)', () => {\n    it('works with SFCs', () => {\n      const Foo = ({ foo }) => (\n        <div>\n          <div className=\"bar\">bar</div>\n          <div className=\"qoo\">{foo}</div>\n        </div>\n      );\n      const wrapper = shallow(<Foo foo=\"qux\" />);\n      expect(wrapper.type()).to.equal('div');\n      expect(wrapper.find('.bar')).to.have.lengthOf(1);\n      expect(wrapper.find('.qoo').text()).to.equal('qux');\n    });\n  });\n\n  describeIf(is('>= 16'), 'portals', () => {\n    it('shows portals in shallow debug tree', () => {\n      const Foo = () => (\n        <div className=\"foo\">\n          {createPortal(\n            <div className=\"in-portal\">InPortal</div>,\n            { nodeType: 1 },\n          )}\n        </div>\n      );\n\n      const wrapper = shallow(<Foo />);\n      expect(wrapper.debug()).to.equal(`<div className=\"foo\">\n  <Portal containerInfo={{...}}>\n    <div className=\"in-portal\">\n      InPortal\n    </div>\n  </Portal>\n</div>`);\n    });\n\n    it('shows portal container in shallow debug tree', () => {\n      const Foo = () => (\n        <div className=\"foo\">\n          {createPortal(\n            <div className=\"in-portal\">InPortal</div>,\n            { nodeType: 1 },\n          )}\n        </div>\n      );\n\n      const wrapper = shallow(<Foo />);\n      expect(wrapper.debug({ verbose: true })).to.equal(`<div className=\"foo\">\n  <Portal containerInfo={{ nodeType: 1 }}>\n    <div className=\"in-portal\">\n      InPortal\n    </div>\n  </Portal>\n</div>`);\n    });\n\n    it('shows nested portal children in shallow debug tree', () => {\n      const Bar = () => null;\n\n      const Foo = () => (\n        <div className=\"foo\">\n          {createPortal(\n            <div className=\"in-portal\">\n              <div className=\"nested-in-portal\">\n                <Bar />\n              </div>\n            </div>,\n            { nodeType: 1 },\n          )}\n        </div>\n      );\n\n      const wrapper = shallow(<Foo />);\n      expect(wrapper.debug()).to.equal(`<div className=\"foo\">\n  <Portal containerInfo={{...}}>\n    <div className=\"in-portal\">\n      <div className=\"nested-in-portal\">\n        <Bar />\n      </div>\n    </div>\n  </Portal>\n</div>`);\n    });\n\n    it('has top level portals in debug tree', () => {\n      const Foo = () => (\n        createPortal(\n          <div className=\"in-portal\">InPortal</div>,\n          { nodeType: 1 },\n        )\n      );\n\n      const wrapper = shallow(<Foo />);\n      expect(wrapper.debug()).to.equal(`<Portal containerInfo={{...}}>\n  <div className=\"in-portal\">\n    InPortal\n  </div>\n</Portal>`);\n    });\n  });\n\n  describeIf(is('>= 16.4'), 'Profiler', () => {\n    function SomeComponent() {\n      return (\n        <Profiler id=\"SomeComponent\" onRender={() => {}}>\n          <main>\n            <div className=\"child\" />\n          </main>\n        </Profiler>\n      );\n    }\n\n    wrap()\n      .withConsoleThrows()\n      .it('mounts without complaint', () => {\n        expect(() => shallow(<SomeComponent />)).not.to.throw();\n      });\n\n    it('renders', () => {\n      const wrapper = shallow(<SomeComponent />);\n      expect(wrapper.debug()).to.equal(`<Profiler id=\"SomeComponent\" onRender={[Function: onRender]}>\n  <main>\n    <div className=\"child\" />\n  </main>\n</Profiler>`);\n    });\n\n    it('finds elements through Profiler elements', () => {\n      const wrapper = shallow(<SomeComponent />);\n\n      expect(wrapper.find('.child')).to.have.lengthOf(1);\n    });\n\n    it('finds Profiler element', () => {\n      const Parent = () => <span><SomeComponent foo=\"hello\" /></span>;\n\n      const wrapper = shallow(<Parent foo=\"hello\" />);\n      const results = wrapper.find(SomeComponent);\n\n      expect(results).to.have.lengthOf(1);\n      expect(results.type()).to.equal(SomeComponent);\n      expect(results.props()).to.eql({ foo: 'hello' });\n    });\n\n    it('can find Profiler by id', () => {\n      const wrapper = shallow(<SomeComponent />);\n      expect(wrapper.find('[id=\"SomeComponent\"]').exists()).to.equal(true);\n    });\n\n    it('can find Profiler by display name', () => {\n      const wrapper = shallow(<SomeComponent />);\n      const profiler = wrapper.find('Profiler');\n      expect(profiler).to.have.lengthOf(1);\n      expect(profiler.type()).to.equal(Profiler);\n    });\n\n    // TODO: enable when Profiler is no longer unstable\n    it.skip('recognizes render phases', () => {\n      const handleRender = sinon.spy();\n      function AnotherComponent() {\n        return (\n          <Profiler id=\"AnotherComponent\" onRender={handleRender}>\n            <div />\n          </Profiler>\n        );\n      }\n\n      const wrapper = shallow(<AnotherComponent />);\n      expect(handleRender).to.have.property('callCount', 1);\n      expect(handleRender.args[0][1]).to.equal('mount');\n\n      wrapper.setProps({ unusedProp: true });\n      expect(handleRender).to.have.property('callCount', 2);\n      expect(handleRender.args[1][1]).to.equal('update');\n    });\n\n    // TODO: enable when Profiler is no longer unstable\n    it.skip('measures timings', () => {\n      /**\n       * test environment has no access to the performance API at which point\n       * the profiling API has to fallback to Date.now() which isn't precise enough\n       * which results in 0 duration for these simple examples most of the time.\n       * With performance API it should test for greaterThan(0) instead of least(0)\n       */\n      const handleRender = sinon.spy();\n      function AnotherComponent() {\n        return (\n          <Profiler id=\"AnotherComponent\" onRender={handleRender}>\n            <div />\n          </Profiler>\n        );\n      }\n\n      const wrapper = shallow(<AnotherComponent />);\n      expect(handleRender).to.have.property('callCount', 1);\n      const [firstArgs] = handleRender.args;\n      if (typeof performance === 'undefined') {\n        expect(firstArgs[2]).to.be.least(0);\n        expect(firstArgs[3]).to.be.least(0);\n      } else {\n        expect(firstArgs[2]).to.be.greaterThan(0);\n        expect(firstArgs[3]).to.be.greaterThan(0);\n      }\n\n      wrapper.setProps({ unusedProp: true });\n      expect(handleRender).to.have.property('callCount', 2);\n      const [, secondArgs] = handleRender.args;\n      if (typeof performance === 'undefined') {\n        expect(secondArgs[2]).to.be.least(0);\n        expect(secondArgs[3]).to.be.least(0);\n      } else {\n        expect(secondArgs[2]).to.be.greaterThan(0);\n        expect(secondArgs[3]).to.be.greaterThan(0);\n      }\n    });\n  });\n\n  itIf(is('>= 16.2'), 'does not support fragments', () => {\n    const wrapper = () => shallow((\n      <Fragment>\n        <p>hello</p>\n        <span>boo</span>\n      </Fragment>\n    ));\n\n    expect(wrapper).to.throw('ReactShallowRenderer render(): Shallow rendering works only with custom components, but the provided element type was `symbol`.');\n  });\n\n  const Wrap = shallow;\n  const Wrapper = ShallowWrapper;\n  describeMethods(\n    { Wrap, Wrapper },\n    'deprecatedInstanceProperties',\n    '@@iterator',\n    'at',\n    'childAt',\n    'children',\n    'closest',\n    'contains',\n    'containsAllMatchingElements',\n    'containsAnyMatchingElements',\n    'containsMatchingElement',\n    'context',\n    'debug',\n    'equals',\n    'every',\n    'everyWhere',\n    'exists',\n    'filter',\n    'filterWhere',\n    'find',\n    'findWhere',\n    'first',\n    'flatMap',\n    'forEach',\n    'get',\n    'getElement',\n    'getElements',\n    'getNode',\n    'getNodes',\n    'getWrappingComponent',\n    'hasClass',\n    'hostNodes',\n    'html',\n    'instance',\n    'invoke',\n    'is',\n    'isEmpty',\n    'isEmptyRender',\n    'key',\n    'last',\n    'map',\n    'matchesElement',\n    'name',\n    'not',\n    'parent',\n    'parents',\n    'prop',\n    'props',\n    'reduce',\n    'reduceRight',\n    'render',\n    'renderProp',\n    'root',\n    'setContext',\n    'setProps',\n    'setState',\n    'simulate',\n    'simulateError',\n    'single',\n    'slice',\n    'some',\n    'someWhere',\n    'state',\n    'tap',\n    'text',\n    'unmount',\n    'wrap',\n  );\n  describeLifecycles(\n    { Wrap, Wrapper },\n    'componentDidCatch',\n    'componentDidMount',\n    'componentDidUpdate',\n    'componentWillUnmount',\n    'getDerivedStateFromError',\n    'getDerivedStateFromProps',\n    'getSnapshotBeforeUpdate',\n    'misc',\n  );\n  describeHooks(\n    { Wrap, Wrapper },\n    'useCallback',\n    'useContext',\n    'useDebugValue',\n    'useEffect',\n    'useImperativeHandle',\n    'useLayoutEffect',\n    'useMemo',\n    'useReducer',\n    'useRef',\n    'useState',\n    'custom',\n  );\n\n  describe('.shallow()', () => {\n    it('returns a shallow rendered instance of the current node', () => {\n      class Bar extends React.Component {\n        render() {\n          return (\n            <div>\n              <div className=\"in-bar\" />\n            </div>\n          );\n        }\n      }\n      class Foo extends React.Component {\n        render() {\n          return (\n            <div>\n              <Bar />\n            </div>\n          );\n        }\n      }\n      const wrapper = shallow(<Foo />);\n      expect(wrapper.find('.in-bar')).to.have.lengthOf(0);\n      expect(wrapper.find(Bar)).to.have.lengthOf(1);\n      expect(wrapper.find(Bar).shallow().find('.in-bar')).to.have.lengthOf(1);\n    });\n\n    describe('context', () => {\n      it('can pass in context', () => {\n        class Bar extends React.Component {\n          render() {\n            const { name } = this.context;\n            return <div>{name}</div>;\n          }\n        }\n        Bar.contextTypes = {\n          name: PropTypes.string,\n        };\n        class Foo extends React.Component {\n          render() {\n            return (\n              <div>\n                <Bar />\n              </div>\n            );\n          }\n        }\n\n        const context = { name: 'foo' };\n        const wrapper = shallow(<Foo />);\n        expect(wrapper.find(Bar)).to.have.lengthOf(1);\n        expect(wrapper.find(Bar).shallow({ context }).text()).to.equal('foo');\n      });\n\n      it('does not throw if context is passed in but contextTypes is missing', () => {\n        class Bar extends React.Component {\n          render() {\n            const { name } = this.context;\n            return <div>{name}</div>;\n          }\n        }\n        class Foo extends React.Component {\n          render() {\n            return (\n              <div>\n                <Bar />\n              </div>\n            );\n          }\n        }\n\n        const context = { name: 'foo' };\n        const wrapper = shallow(<Foo />);\n        expect(() => wrapper.find(Bar).shallow({ context })).not.to.throw();\n      });\n\n      it('is introspectable through context API', () => {\n        class Bar extends React.Component {\n          render() {\n            const { name } = this.context;\n            return <div>{name}</div>;\n          }\n        }\n        Bar.contextTypes = {\n          name: PropTypes.string,\n        };\n        class Foo extends React.Component {\n          render() {\n            return (\n              <div>\n                <Bar />\n              </div>\n            );\n          }\n        }\n\n        const context = { name: 'foo' };\n        const wrapper = shallow(<Foo />).find(Bar).shallow({ context });\n\n        expect(wrapper.context().name).to.equal(context.name);\n        expect(wrapper.context('name')).to.equal(context.name);\n      });\n\n      it('filters context to childContextTypes', () => {\n        class Bar extends React.Component {\n          render() {\n            return <div />;\n          }\n        }\n        Bar.contextTypes = {\n          name: PropTypes.string,\n        };\n        class Foo extends React.Component {\n          render() {\n            return (\n              <div>\n                <Bar />\n              </div>\n            );\n          }\n        }\n\n        const context = { name: 'foo', hello: 'world' };\n        const wrapper = shallow(<Foo />, { context });\n        expect(wrapper.find(Bar).dive().context()).to.eql({ name: 'foo' });\n      });\n    });\n\n    describeIf(is('> 0.13'), 'stateless function components (SFCs)', () => {\n      it('returns a shallow rendered instance of the current node', () => {\n        const Bar = () => (\n          <div>\n            <div className=\"in-bar\" />\n          </div>\n        );\n        const Foo = () => (\n          <div>\n            <Bar />\n          </div>\n        );\n\n        const wrapper = shallow(<Foo />);\n        expect(wrapper.find('.in-bar')).to.have.lengthOf(0);\n        expect(wrapper.find(Bar)).to.have.lengthOf(1);\n        expect(wrapper.find(Bar).shallow().find('.in-bar')).to.have.lengthOf(1);\n      });\n\n      describe('context', () => {\n        it('can pass in context', () => {\n          const Bar = (props, { name }) => (\n            <div>{name}</div>\n          );\n          Bar.contextTypes = { name: PropTypes.string };\n          const Foo = () => (\n            <div>\n              <Bar />\n            </div>\n          );\n\n          const context = { name: 'foo' };\n          const wrapper = shallow(<Foo />);\n          expect(wrapper.find(Bar).shallow({ context }).text()).to.equal('foo');\n        });\n\n        it('does not throw if context is passed in but contextTypes is missing', () => {\n          const Bar = (props, { name }) => (\n            <div>{name}</div>\n          );\n          const Foo = () => (\n            <div>\n              <Bar />\n            </div>\n          );\n\n          const context = { name: 'foo' };\n          const wrapper = shallow(<Foo />);\n          expect(() => wrapper.find(Bar).shallow({ context })).not.to.throw();\n        });\n\n        itIf(is('< 16'), 'is introspectable through context API', () => {\n          const Bar = (props, { name }) => (\n            <div>{name}</div>\n          );\n          Bar.contextTypes = { name: PropTypes.string };\n          const Foo = () => (\n            <div>\n              <Bar />\n            </div>\n          );\n\n          const context = { name: 'foo' };\n          const wrapper = shallow(<Foo />).find(Bar).shallow({ context });\n\n          expect(wrapper.context().name).to.equal(context.name);\n          expect(wrapper.context('name')).to.equal(context.name);\n        });\n\n        itIf(is('>= 16'), 'will throw when trying to inspect context', () => {\n          const Bar = (props, { name }) => (\n            <div>{name}</div>\n          );\n          Bar.contextTypes = { name: PropTypes.string };\n          const Foo = () => (\n            <div>\n              <Bar />\n            </div>\n          );\n\n          const context = { name: 'foo' };\n          const wrapper = shallow(<Foo />).find(Bar).shallow({ context });\n\n          expect(() => wrapper.context()).to.throw(\n            Error,\n            'ShallowWrapper::context() can only be called on wrapped nodes that have a non-null instance',\n          );\n          expect(() => wrapper.context('name')).to.throw(\n            Error,\n            'ShallowWrapper::context() can only be called on wrapped nodes that have a non-null instance',\n          );\n        });\n      });\n    });\n  });\n\n  describe('.dive()', () => {\n    class RendersDOM extends React.Component {\n      render() {\n        return <div><i /></div>;\n      }\n    }\n    class RendersNull extends React.Component {\n      render() {\n        return null;\n      }\n    }\n    class RendersMultiple extends React.Component {\n      render() {\n        return (\n          <div>\n            <RendersNull />\n            <RendersDOM />\n          </div>\n        );\n      }\n    }\n    class RendersZero extends React.Component {\n      render() {\n        return <div />;\n      }\n    }\n    class WrapsRendersDOM extends React.Component {\n      render() {\n        return <RendersDOM />;\n      }\n    }\n    WrapsRendersDOM.contextTypes = { foo: PropTypes.string };\n    class DoubleWrapsRendersDOM extends React.Component {\n      render() {\n        return <WrapsRendersDOM />;\n      }\n    }\n    class ContextWrapsRendersDOM extends React.Component {\n      render() {\n        return <WrapsRendersDOM />;\n      }\n    }\n    ContextWrapsRendersDOM.contextTypes = { foo: PropTypes.string };\n\n    it('throws on a DOM node', () => {\n      const wrapper = shallow(<RendersDOM />);\n      expect(wrapper.is('div')).to.equal(true);\n\n      expect(() => { wrapper.dive(); }).to.throw(\n        TypeError,\n        'ShallowWrapper::dive() can not be called on Host Components',\n      );\n    });\n\n    it('throws on a non-component', () => {\n      const wrapper = shallow(<RendersNull />);\n      expect(wrapper.type()).to.equal(null);\n\n      expect(() => { wrapper.dive(); }).to.throw(\n        TypeError,\n        'ShallowWrapper::dive() can only be called on components',\n      );\n    });\n\n    it('throws on multiple children found', () => {\n      const wrapper = shallow(<RendersMultiple />).find('div').children();\n      expect(() => { wrapper.dive(); }).to.throw(\n        Error,\n        'Method “dive” is meant to be run on 1 node. 2 found instead.',\n      );\n    });\n\n    it('throws on zero children found', () => {\n      const wrapper = shallow(<RendersZero />).find('div').children();\n      expect(() => { wrapper.dive(); }).to.throw(\n        Error,\n        'Method “dive” is meant to be run on 1 node. 0 found instead.',\n      );\n    });\n\n    it('throws on zero children found', () => {\n      const wrapper = shallow(<RendersZero />).find('div').children();\n      expect(() => { wrapper.dive(); }).to.throw(\n        Error,\n        'Method “dive” is meant to be run on 1 node. 0 found instead.',\n      );\n    });\n\n    it('dives + shallow-renders when there is one component child', () => {\n      const wrapper = shallow(<DoubleWrapsRendersDOM />);\n      expect(wrapper.is(WrapsRendersDOM)).to.equal(true);\n\n      const underwater = wrapper.dive();\n      expect(underwater.is(RendersDOM)).to.equal(true);\n    });\n\n    describeIf(is('>=16.3.0'), 'forwardRef Elements', () => {\n      const ForwardRefWrapsRendersDOM = forwardRef && forwardRef(() => <WrapsRendersDOM />);\n      const NestedForwarRefsWrapsRendersDom = forwardRef && forwardRef(() => <ForwardRefWrapsRendersDOM />);\n\n      if (forwardRef) {\n        NestedForwarRefsWrapsRendersDom.contextTypes = { foo: PropTypes.string };\n        ForwardRefWrapsRendersDOM.contextTypes = { foo: PropTypes.string };\n      }\n\n      it('dives + shallow-renders a forwardRef component', () => {\n        const wrapper = shallow(<ForwardRefWrapsRendersDOM />);\n        expect(wrapper.is(WrapsRendersDOM)).to.equal(true);\n\n        const underwater = wrapper.dive();\n        expect(underwater.is(RendersDOM)).to.equal(true);\n      });\n\n      it('dives + shallow-renders a with nested forwardRefs component', () => {\n        const wrapper = shallow(<NestedForwarRefsWrapsRendersDom />);\n        expect(wrapper.is(ForwardRefWrapsRendersDOM)).to.equal(true);\n\n        const underwater = wrapper.dive();\n        expect(underwater.is(WrapsRendersDOM)).to.equal(true);\n      });\n    });\n\n    it('merges and pass options through', () => {\n      const wrapper = shallow(<ContextWrapsRendersDOM />, { context: { foo: 'hello' } });\n      expect(wrapper.context()).to.deep.equal({ foo: 'hello' });\n\n      let underwater = wrapper.dive();\n      expect(underwater.context()).to.deep.equal({ foo: 'hello' });\n\n      underwater = wrapper.dive({ context: { foo: 'enzyme!' } });\n      expect(underwater.context()).to.deep.equal({ foo: 'enzyme!' });\n    });\n\n    describeIf(is('>= 16.6'), 'memo', () => {\n      const App = () => <div>Guest</div>;\n\n      const AppMemoized = memo && Object.assign(memo(App), { displayName: 'AppMemoized' });\n\n      const RendersApp = () => <App />;\n      const RendersAppMemoized = () => <AppMemoized />;\n\n      it('works without memoizing', () => {\n        const wrapper = shallow(<RendersApp />);\n        expect(wrapper.debug()).to.equal('<App />');\n        expect(wrapper.dive().debug()).to.equal(`<div>\n  Guest\n</div>`);\n        expect(() => wrapper.dive().dive()).to.throw(TypeError);\n      });\n\n      it('works with memoizing', () => {\n        const wrapper = shallow(<RendersAppMemoized />);\n        expect(wrapper.debug()).to.equal('<AppMemoized />');\n        expect(wrapper.dive().debug()).to.equal(`<div>\n  Guest\n</div>`);\n        expect(() => wrapper.dive().dive()).to.throw(TypeError);\n      });\n    });\n  });\n\n  describeIf(is('>= 16.6'), 'Suspense & lazy', () => {\n    class DynamicComponent extends React.Component {\n      render() {\n        return (\n          <div>Dynamic Component</div>\n        );\n      }\n    }\n\n    class Fallback extends React.Component {\n      render() {\n        return (\n          <div>Fallback</div>\n        );\n      }\n    }\n\n    it('finds Suspense and its children when no lazy component', () => {\n      class Component extends React.Component {\n        render() {\n          return (\n            <div>test</div>\n          );\n        }\n      }\n\n      const SuspenseComponent = () => (\n        <Suspense fallback={<Fallback />}>\n          <Component />\n        </Suspense>\n      );\n\n      const wrapper = shallow(<SuspenseComponent />);\n\n      expect(wrapper.is(Suspense)).to.equal(true);\n      expect(wrapper.find(Component)).to.have.lengthOf(1);\n      expect(wrapper.find(Fallback)).to.have.lengthOf(0);\n    });\n\n    it('works with Suspense with multiple children if options.suspenseFallback=true', () => {\n      const wrapper = shallow((\n        <Suspense fallback={<Fallback />}>\n          <div />\n          <div />\n        </Suspense>\n      ), { suspenseFallback: true });\n      expect(wrapper.debug()).to.equal(`<Suspense fallback={{...}}>\n  <div />\n  <div />\n</Suspense>`);\n    });\n\n    it('works with Suspense with multiple children if options.suspenseFallback=false', () => {\n      const wrapper = shallow((\n        <Suspense fallback={<Fallback />}>\n          <div />\n          <div />\n        </Suspense>\n      ), { suspenseFallback: false });\n      expect(wrapper.debug()).to.equal(`<Suspense fallback={{...}}>\n  <div />\n  <div />\n</Suspense>`);\n    });\n\n    it('finds LazyComponent when render component wrapping lazy component', () => {\n      const LazyComponent = lazy(() => fakeDynamicImport(DynamicComponent));\n      const SuspenseComponent = () => (\n        <Suspense fallback={<Fallback />}>\n          <LazyComponent />\n        </Suspense>\n      );\n\n      const wrapper = shallow(<SuspenseComponent />);\n\n      expect(wrapper.is(Suspense)).to.equal(true);\n      expect(wrapper.find(LazyComponent)).to.have.lengthOf(1);\n      expect(wrapper.find(Fallback)).to.have.lengthOf(0);\n    });\n\n    it('returns suspense and lazy component string when debug() is called', () => {\n      const LazyComponent = lazy(() => fakeDynamicImport(DynamicComponent));\n      const SuspenseComponent = () => (\n        <Suspense fallback={<Fallback />}>\n          <LazyComponent />\n        </Suspense>\n      );\n\n      const wrapper = shallow(<SuspenseComponent />);\n\n      expect(wrapper.debug()).to.equal(`<Suspense fallback={{...}}>\n  <lazy />\n</Suspense>`);\n    });\n\n    it('renders lazy component when render Suspense without option', () => {\n      const LazyComponent = lazy(() => fakeDynamicImport(DynamicComponent));\n\n      const wrapper = shallow((\n        <Suspense fallback={<Fallback />}>\n          <LazyComponent />\n        </Suspense>\n      ));\n\n      expect(wrapper.find(LazyComponent)).to.have.lengthOf(1);\n      expect(wrapper.find(Fallback)).to.have.lengthOf(0);\n    });\n\n    it('returns lazy component string when debug() is called', () => {\n      const LazyComponent = lazy(() => fakeDynamicImport(DynamicComponent));\n\n      const wrapper = shallow((\n        <Suspense fallback={<Fallback />}>\n          <LazyComponent />\n        </Suspense>\n      ));\n\n      expect(wrapper.debug()).to.equal(`<Suspense fallback={{...}}>\n  <lazy />\n</Suspense>`);\n    });\n\n    it('replaces LazyComponent with Fallback when render Suspense if options.suspenseFallback=true', () => {\n      const LazyComponent = lazy(() => fakeDynamicImport(DynamicComponent));\n\n      const wrapper = shallow((\n        <Suspense fallback={<Fallback />}>\n          <LazyComponent />\n        </Suspense>\n      ), { suspenseFallback: true });\n\n      expect(wrapper.find(LazyComponent)).to.have.lengthOf(0);\n      expect(wrapper.find(Fallback)).to.have.lengthOf(1);\n    });\n\n    it('returns fallback component string when debug() is called if options.suspenseFallback=true', () => {\n      const LazyComponent = lazy(() => fakeDynamicImport(DynamicComponent));\n\n      const wrapper = shallow((\n        <Suspense fallback={<Fallback />}>\n          <LazyComponent />\n        </Suspense>\n      ), { suspenseFallback: true });\n\n      expect(wrapper.debug()).to.equal(`<Suspense fallback={{...}}>\n  <Fallback />\n</Suspense>`);\n    });\n\n    it('throws if options.suspenseFallback is not boolean or undefined', () => {\n      const LazyComponent = lazy(() => fakeDynamicImport(DynamicComponent));\n      const SuspenseComponent = () => (\n        <Suspense fallback={<Fallback />}>\n          <LazyComponent />\n        </Suspense>\n      );\n      expect(() => shallow(<SuspenseComponent />, { suspenseFallback: 'true' })).to.throw();\n    });\n\n    it('finds fallback after dive into functional component wrapping Suspense', () => {\n      const LazyComponent = lazy(() => fakeDynamicImport(DynamicComponent));\n      const SuspenseComponent = () => (\n        <Suspense fallback={<Fallback />}>\n          <LazyComponent />\n        </Suspense>\n      );\n\n      const wrapper = shallow(<SuspenseComponent />, { suspenseFallback: true });\n      const inner = wrapper.dive();\n\n      expect(inner.find(LazyComponent)).to.have.lengthOf(0);\n      expect(inner.find(Fallback)).to.have.lengthOf(1);\n    });\n\n    it('replaces nested LazyComponent with Fallback when render Suspense with options.suspenseFallback=true', () => {\n      const LazyComponent = lazy(() => fakeDynamicImport(DynamicComponent));\n\n      const wrapper = shallow((\n        <Suspense fallback={<Fallback />}>\n          <div className=\"should-be-rendered\" />\n          <LazyComponent />\n          <div className=\"should-be-rendered\">\n            <LazyComponent />\n            <div className=\"inner\" />\n          </div>\n        </Suspense>\n      ), { suspenseFallback: true });\n\n      expect(wrapper.find(LazyComponent)).to.have.lengthOf(0);\n      expect(wrapper.find(Fallback)).to.have.lengthOf(2);\n      expect(wrapper.find('.should-be-rendered')).to.have.lengthOf(2);\n      expect(wrapper.find('.should-be-rendered > .inner')).to.have.lengthOf(1);\n    });\n\n    it('does not replace LazyComponent with Fallback when render Suspense if options.suspenseFallback=false', () => {\n      const LazyComponent = lazy(() => fakeDynamicImport(DynamicComponent));\n\n      const wrapper = shallow((\n        <Suspense fallback={<Fallback />}>\n          <LazyComponent />\n        </Suspense>\n      ), { suspenseFallback: false });\n\n      expect(wrapper.find(LazyComponent)).to.have.lengthOf(1);\n      expect(wrapper.find(Fallback)).to.have.lengthOf(0);\n    });\n\n    it('does not replace nested LazyComponent with Fallback when render Suspense if option.suspenseFallback=false', () => {\n      const LazyComponent = lazy(() => fakeDynamicImport(DynamicComponent));\n\n      const wrapper = shallow((\n        <Suspense fallback={<Fallback />}>\n          <div className=\"should-be-rendered\" />\n          <LazyComponent />\n          <div className=\"should-be-rendered\">\n            <LazyComponent />\n            <div className=\"inner\" />\n          </div>\n        </Suspense>\n      ), { suspenseFallback: false });\n\n      expect(wrapper.find(LazyComponent)).to.have.lengthOf(2);\n      expect(wrapper.find(Fallback)).to.have.lengthOf(0);\n      expect(wrapper.find('.should-be-rendered')).to.have.lengthOf(2);\n      expect(wrapper.find('.should-be-rendered > .inner')).to.have.lengthOf(1);\n    });\n\n    it('throws when rendering lazy component', () => {\n      const LazyComponent = lazy(() => fakeDynamicImport(DynamicComponent));\n      expect(() => shallow(<LazyComponent />)).to.throw();\n    });\n\n    it('returns the correct instance if using Suspense in stateful components', () => {\n      const LazyComponent = lazy(() => fakeDynamicImport(DynamicComponent));\n\n      class Bar extends React.Component {\n        render() {\n          return (\n            <Suspense fallback={<Fallback />}>\n              <LazyComponent />\n            </Suspense>\n          );\n        }\n      }\n\n      const wrapper = shallow(<Bar />);\n\n      expect(wrapper.instance()).to.instanceOf(Bar);\n    });\n\n    describe('propType errors', () => {\n      class MyComponent extends React.Component {\n        render() {\n          const { fallback, requiredString } = this.props;\n          return (\n            <Suspense fallback={fallback}>\n              hello world {requiredString}\n            </Suspense>\n          );\n        }\n      }\n      MyComponent.propTypes = {\n        fallback: PropTypes.node.isRequired,\n        requiredString: PropTypes.string.isRequired,\n      };\n\n      function MySFC({ fallback, requiredString }) {\n        return (\n          <Suspense fallback={fallback}>\n            hello world {requiredString}\n          </Suspense>\n        );\n      }\n      MySFC.propTypes = MyComponent.propTypes;\n\n      wrap()\n        .withConsoleThrows()\n        .it('renders with no propType errors with a string fallback', () => {\n          shallow(<MyComponent requiredString=\"abc\" fallback=\"loading...\" />);\n        });\n\n      wrap()\n        .withConsoleThrows()\n        .it('renders with no propType errors with a component fallback', () => {\n          shallow(<MyComponent requiredString=\"abc\" fallback={<Fallback />} />);\n        });\n\n      describeIf(is('> 0.13'), 'stateless function components (SFCs)', () => {\n        wrap()\n          .withConsoleThrows()\n          .it('renders with no propType errors with a string fallback', () => {\n            shallow(<MySFC requiredString=\"abc\" fallback=\"loading...\" />);\n          });\n\n        wrap()\n          .withConsoleThrows()\n          .it('renders with no propType errors with a component fallback', () => {\n            shallow(<MySFC requiredString=\"abc\" fallback={<Fallback />} />);\n          });\n      });\n    });\n\n    // TODO: fix in v16.6 and v16.7\n    describeIf(is('>= 16.8'), 'avoids regressing #2200', () => {\n      const Home = lazy && lazy(() => new Promise(() => {}));\n\n      const PageSwitchFallback = memo ? memo(() => <div aria-live=\"polite\" aria-busy />) : {};\n      PageSwitchFallback.displayName = 'PageSwitchFallback';\n\n      const PageSwitch = memo ? memo(({ pageData }) => {\n        const renderPageComponent = useCallback ? useCallback(() => {\n          if (pageData === 'NOT_FOUND') return null;\n\n          switch (pageData.key) {\n            case 'home':\n              return <Home />;\n            default:\n              return null;\n          }\n        }, [pageData]) : () => {};\n\n        return (\n          <Suspense fallback={<PageSwitchFallback />}>\n            {renderPageComponent()}\n          </Suspense>\n        );\n      }) : {};\n      PageSwitch.displayName = 'PageSwitch';\n\n      it('works with suspenseFallback: true', () => {\n        const wrapper = shallow(<PageSwitch pageData={{ key: 'home' }} />, { suspenseFallback: true });\n        expect(wrapper.find(PageSwitchFallback)).to.have.lengthOf(1);\n        expect(wrapper.find(Home)).to.have.lengthOf(0);\n      });\n\n      it('works with suspenseFallback: false', () => {\n        const wrapper = shallow(<PageSwitch pageData={{ key: 'home' }} />, { suspenseFallback: false });\n        expect(wrapper.find(PageSwitchFallback)).to.have.lengthOf(0);\n        expect(wrapper.find(Home)).to.have.lengthOf(1);\n      });\n    });\n  });\n\n  describe('lifecycle methods', () => {\n    describe('disableLifecycleMethods option', () => {\n      describe('validation', () => {\n        it('throws for a non-boolean value', () => {\n          ['value', 42, null].forEach((value) => {\n            expect(() => shallow(<div />, {\n              disableLifecycleMethods: value,\n            })).to.throw(/true or false/);\n          });\n        });\n\n        it('does not throw for a boolean value or undefined', () => {\n          [true, false, undefined].forEach((value) => {\n            expect(() => shallow(<div />, {\n              disableLifecycleMethods: value,\n            })).not.to.throw();\n          });\n        });\n\n        it('does not throw when no lifecycle flags are provided in options', () => {\n          expect(() => shallow(<div />, {})).not.to.throw();\n        });\n\n        it('throws when used with lifecycleExperimental in invalid combinations', () => {\n          [true, false].forEach((value) => {\n            expect(() => shallow(<div />, {\n              lifecycleExperimental: value,\n              disableLifecycleMethods: value,\n            })).to.throw(/same value/);\n          });\n        });\n      });\n\n      describe('when disabled', () => {\n        const spy = sinon.spy();\n        class Foo extends React.Component {\n          componentWillMount() { spy('componentWillMount'); }\n\n          componentDidMount() { spy('componentDidMount'); }\n\n          componentWillReceiveProps() { spy('componentWillReceiveProps'); }\n\n          shouldComponentUpdate() {\n            spy('shouldComponentUpdate');\n            return true;\n          }\n\n          componentWillUpdate() { spy('componentWillUpdate'); }\n\n          componentDidUpdate() { spy('componentDidUpdate'); }\n\n          componentWillUnmount() { spy('componentWillUnmount'); }\n\n          render() {\n            spy('render');\n            return <div>foo</div>;\n          }\n        }\n\n        Foo.contextTypes = {\n          foo: PropTypes.string,\n        };\n\n        const options = {\n          disableLifecycleMethods: true,\n          context: {\n            foo: 'foo',\n          },\n        };\n\n        beforeEach(() => {\n          spy.resetHistory();\n        });\n\n        it('does not call componentDidMount when mounting', () => {\n          shallow(<Foo />, options);\n          expect(spy.args).to.deep.equal([\n            ['componentWillMount'],\n            ['render'],\n          ]);\n        });\n\n        it('calls expected methods when receiving new props', () => {\n          const wrapper = shallow(<Foo />, options);\n          expect(spy.args).to.deep.equal([\n            ['componentWillMount'],\n            ['render'],\n          ]);\n          spy.resetHistory();\n          wrapper.setProps({ foo: 'foo' });\n          expect(spy.args).to.deep.equal([\n            ['componentWillReceiveProps'],\n            ['shouldComponentUpdate'],\n            ['componentWillUpdate'],\n            ['render'],\n          ]);\n        });\n\n        describe('setContext', () => {\n          it('calls expected methods when receiving new context', () => {\n            const wrapper = shallow(<Foo />, options);\n            expect(spy.args).to.deep.equal([\n              ['componentWillMount'],\n              ['render'],\n            ]);\n            spy.resetHistory();\n\n            wrapper.setContext({ foo: 'bar' });\n\n            expect(spy.args).to.deep.equal([\n              ['componentWillReceiveProps'],\n              ['shouldComponentUpdate'],\n              ['componentWillUpdate'],\n              ['render'],\n            ]);\n          });\n        });\n\n        itIf(is('< 16'), 'calls expected methods for setState', () => {\n          const wrapper = shallow(<Foo />, options);\n          expect(spy.args).to.deep.equal([\n            ['componentWillMount'],\n            ['render'],\n          ]);\n          spy.resetHistory();\n          wrapper.setState({ bar: 'bar' });\n          expect(spy.args).to.deep.equal([\n            ['shouldComponentUpdate'],\n            ['componentWillUpdate'],\n            ['render'],\n            ['componentDidUpdate'],\n          ]);\n        });\n\n        // componentDidUpdate is not called in react 16\n        itIf(is('>= 16'), 'calls expected methods for setState', () => {\n          const wrapper = shallow(<Foo />, options);\n          expect(spy.args).to.deep.equal([\n            ['componentWillMount'],\n            ['render'],\n          ]);\n          spy.resetHistory();\n          wrapper.setState({ bar: 'bar' });\n          expect(spy.args).to.deep.equal([\n            ['shouldComponentUpdate'],\n            ['componentWillUpdate'],\n            ['render'],\n          ]);\n        });\n\n        it('calls expected methods when unmounting', () => {\n          const wrapper = shallow(<Foo />, options);\n          expect(spy.args).to.deep.equal([\n            ['componentWillMount'],\n            ['render'],\n          ]);\n          spy.resetHistory();\n          wrapper.unmount();\n          expect(spy.args).to.deep.equal([\n            ['componentWillUnmount'],\n          ]);\n        });\n      });\n\n      it('does not call when disableLifecycleMethods flag is true', () => {\n        const spy = sinon.spy();\n        class Foo extends React.Component {\n          componentDidMount() {\n            spy();\n          }\n\n          render() {\n            return <div>foo</div>;\n          }\n        }\n        shallow(<Foo />, { disableLifecycleMethods: true });\n        expect(spy).to.have.property('callCount', 0);\n      });\n\n      it('calls `componentDidMount` directly when disableLifecycleMethods is true', () => {\n        class Table extends React.Component {\n          render() {\n            return (<table />);\n          }\n        }\n\n        class MyComponent extends React.Component {\n          constructor(props) {\n            super(props);\n            this.state = {\n              showTable: false,\n            };\n          }\n\n          componentDidMount() {\n            this.setState({ showTable: true });\n          }\n\n          render() {\n            const { showTable } = this.state;\n            return (<div>{showTable ? <Table /> : null}</div>);\n          }\n        }\n        const wrapper = shallow(<MyComponent />, { disableLifecycleMethods: true });\n        expect(wrapper.find(Table).length).to.equal(0);\n        wrapper.instance().componentDidMount();\n        expect(wrapper.find(Table).length).to.equal(1);\n      });\n\n      it('calls shouldComponentUpdate when disableLifecycleMethods flag is true', () => {\n        const spy = sinon.spy();\n        class Foo extends React.Component {\n          constructor(props) {\n            super(props);\n            this.state = {\n              foo: 'bar',\n            };\n          }\n\n          shouldComponentUpdate() {\n            spy();\n            return false;\n          }\n\n          render() {\n            const { foo } = this.state;\n            return <div>{foo}</div>;\n          }\n        }\n        const wrapper = shallow(\n          <Foo foo=\"foo\" />,\n          {\n            context: { foo: 'foo' },\n            disableLifecycleMethods: true,\n          },\n        );\n        expect(spy).to.have.property('callCount', 0);\n        wrapper.setProps({ foo: 'bar' });\n        expect(spy).to.have.property('callCount', 1);\n        wrapper.setState({ foo: 'bar' });\n        expect(spy).to.have.property('callCount', 2);\n        wrapper.setContext({ foo: 'bar' });\n        expect(spy).to.have.property('callCount', 3);\n      });\n    });\n\n    describe('lifecycleExperimental option', () => {\n      describe('validation', () => {\n        it('throws for a non-boolean value', () => {\n          ['value', 42, null].forEach((value) => {\n            expect(() => shallow(<div />, {\n              lifecycleExperimental: value,\n            })).to.throw(/true or false/);\n          });\n        });\n\n        it('does not throw for a boolean value or when not provided', () => {\n          [true, false, undefined].forEach((value) => {\n            expect(() => shallow(<div />, {\n              lifecycleExperimental: value,\n            })).not.to.throw();\n          });\n        });\n      });\n    });\n\n    describe('malformed lifecycle options', () => {\n      it('throws on invalid `enableComponentDidUpdateOnSetState` lifecycle config', () => {\n        const adapter = getAdapter();\n        const { lifecycles = {} } = adapter;\n        const options = {\n          enableComponentDidUpdateOnSetState: !!adapter.enableComponentDidUpdateOnSetState,\n          lifecycles: {\n            ...lifecycles,\n            componentDidUpdate: {\n              ...lifecycles.componentDidUpdate,\n              onSetState: !adapter.enableComponentDidUpdateOnSetState,\n            },\n          },\n        };\n        expect(() => shallow(<div />, options)).to.throw(\n          TypeError,\n          'the legacy enableComponentDidUpdateOnSetState option should be matched by `lifecycles: { componentDidUpdate: { onSetState: true } }`, for compatibility',\n        );\n      });\n\n      it('throws on invalid `supportPrevContextArgumentOfComponentDidUpdate` lifecycle config', () => {\n        const adapter = getAdapter();\n        const { lifecycles = {} } = adapter;\n        const options = {\n          supportPrevContextArgumentOfComponentDidUpdate: !!adapter.supportPrevContextArgumentOfComponentDidUpdate,\n          lifecycles: {\n            ...lifecycles,\n            componentDidUpdate: {\n              ...lifecycles.componentDidUpdate,\n              prevContext: !adapter.supportPrevContextArgumentOfComponentDidUpdate,\n            },\n          },\n        };\n        expect(() => shallow(<div />, options)).to.throw(\n          TypeError,\n          'the legacy supportPrevContextArgumentOfComponentDidUpdate option should be matched by `lifecycles: { componentDidUpdate: { prevContext: true } }`, for compatibility',\n        );\n      });\n    });\n  });\n\n  it('works with class components that return null', () => {\n    class Foo extends React.Component {\n      render() {\n        return null;\n      }\n    }\n    const wrapper = shallow(<Foo />);\n    expect(wrapper).to.have.lengthOf(1);\n    expect(wrapper.html()).to.equal(null);\n    expect(wrapper.type()).to.equal(null);\n    const rendered = wrapper.render();\n    expect(rendered).to.have.lengthOf(0);\n    expect(rendered.html()).to.equal(null);\n  });\n\n  itIf(is('>= 16'), 'works with class components that return arrays', () => {\n    class Foo extends React.Component {\n      render() {\n        return [<div />, <div />];\n      }\n    }\n    const wrapper = shallow(<Foo />);\n    expect(wrapper).to.have.lengthOf(2);\n    expect(wrapper.find('div')).to.have.lengthOf(2);\n  });\n\n  itIf(is('>=15 || ^16.0.0-alpha'), 'works with SFCs that return null', () => {\n    const Foo = () => null;\n\n    const wrapper = shallow(<Foo />);\n    expect(wrapper).to.have.lengthOf(1);\n    expect(wrapper.html()).to.equal(null);\n    expect(wrapper.type()).to.equal(null);\n    const rendered = wrapper.render();\n    expect(rendered).to.have.lengthOf(0);\n    expect(rendered.html()).to.equal(null);\n  });\n\n  describe('out-of-band state updates', () => {\n    class Child extends React.Component {\n      render() {\n        return <span />;\n      }\n    }\n\n    class Test extends React.Component {\n      componentWillMount() {\n        this.state = {};\n      }\n\n      safeSetState(newState) {\n        withSetStateAllowed(() => {\n          this.setState(newState);\n        });\n      }\n\n      asyncSetState() {\n        setImmediate(() => {\n          this.safeSetState({ showSpan: true });\n        });\n      }\n\n      callbackSetState() {\n        this.safeSetState({ showSpan: true });\n      }\n\n      render() {\n        /* eslint-disable react/destructuring-assignment */\n        return (\n          <div>\n            {this.state && this.state.showSpan && <span className=\"show-me\" />}\n            <button type=\"button\" className=\"async-btn\" onClick={() => this.asyncSetState()} />\n            <Child callback={() => this.callbackSetState()} />\n          </div>\n        );\n        /* eslint-enable react/destructuring-assignment */\n      }\n    }\n\n    it('has updated output after an asynchronous setState', () => {\n      const wrapper = shallow(<Test />);\n      wrapper.find('.async-btn').simulate('click');\n      return new Promise((resolve) => {\n        setImmediate(() => {\n          wrapper.update();\n          resolve();\n        });\n      }).then(() => {\n        expect(wrapper.find('.show-me')).to.have.lengthOf(1);\n      });\n    });\n\n    it('has updated output after child prop callback invokes setState', () => {\n      const wrapper = shallow(<Test />);\n      wrapper.find(Child).props().callback();\n      wrapper.update();\n      expect(wrapper.find('.show-me')).to.have.lengthOf(1);\n    });\n  });\n\n  describe('setState through a props method', () => {\n    class Child extends React.Component {\n      render() {\n        const { onClick } = this.props;\n        return <button type=\"button\" onClick={onClick}>click</button>;\n      }\n    }\n\n    it('can get the latest state value', () => {\n      class App extends React.Component {\n        constructor(props) {\n          super(props);\n          this.state = {\n            count: 0,\n          };\n        }\n\n        onIncrement() {\n          this.setState({\n            count: this.state.count + 1, // eslint-disable-line react/destructuring-assignment\n          });\n        }\n\n        render() {\n          const { count } = this.state;\n          return (\n            <div>\n              <Child onClick={() => this.onIncrement()} />\n              <p>{count}</p>\n            </div>\n          );\n        }\n      }\n      const wrapper = shallow(<App />);\n      const p = wrapper.find('p');\n      expect(wrapper.find('p').text()).to.equal('0');\n      wrapper.find(Child).prop('onClick')();\n      // TODO: this is a difference between mount and shallow\n      // this is still 0 because the wrapper won't be updated\n      expect(p.text()).to.equal('0');\n      expect(wrapper.find('p').text()).to.equal('1');\n    });\n  });\n\n  describe('setState through a props method in async', () => {\n    class Child extends React.Component {\n      render() {\n        const { onClick } = this.props;\n        return <button type=\"button\" onClick={onClick}>click</button>;\n      }\n    }\n\n    it('can get the latest state value', () => {\n      let App;\n      const promise = new Promise((resolve) => {\n        App = class extends React.Component {\n          constructor(props) {\n            super(props);\n            this.state = {\n              count: 0,\n            };\n          }\n\n          onIncrement() {\n            setTimeout(() => {\n              this.setState({\n                count: this.state.count + 1, // eslint-disable-line react/destructuring-assignment\n              }, resolve);\n            });\n          }\n\n          render() {\n            const { count } = this.state;\n            return (\n              <div>\n                <Child onClick={() => this.onIncrement()} />\n                <p>{count}</p>\n              </div>\n            );\n          }\n        };\n      });\n      const wrapper = shallow(<App />);\n      expect(wrapper.find('p').text()).to.equal('0');\n      wrapper.find(Child).prop('onClick')();\n      return promise.then(() => {\n        expect(wrapper.find('p').text()).to.equal('1');\n      });\n    });\n  });\n\n  describe('cloning elements', () => {\n    class Foo extends React.Component {\n      render() {\n        const { children } = this.props;\n        const mappedChildren = [];\n        React.Children.forEach(children, (child, i) => {\n          const clonedChild = React.cloneElement(child, {\n            key: i, // eslint-disable-line react/no-array-index-key\n            onClick() {\n              return child.props.name;\n            },\n          });\n          mappedChildren.push(clonedChild);\n        });\n        return (\n          <div>\n            {mappedChildren}\n          </div>\n        );\n      }\n    }\n\n    it('merges cloned element props', () => {\n      const wrapper = shallow((\n        <Foo>\n          <span data-foo=\"1\">1</span>\n          <div data-bar=\"2\">2</div>\n        </Foo>\n      ));\n\n      const children = wrapper.children();\n      expect(children).to.have.lengthOf(2);\n\n      const span = children.at(0);\n      expect(span.is('span')).to.equal(true);\n      const spanProps = span.props();\n      expect(spanProps).to.have.keys({\n        children: 1,\n        'data-foo': 1,\n        onClick: spanProps.onClick,\n      });\n      expect(spanProps.onClick).to.be.a('function');\n\n      const div = children.at(1);\n      expect(div.is('div')).to.equal(true);\n      const divProps = div.props();\n      expect(divProps).to.have.keys({\n        children: 2,\n        'data-bar': 2,\n        onClick: divProps.onClick,\n      });\n      expect(divProps.onClick).to.be.a('function');\n    });\n  });\n});\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/Utils-spec.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\nimport wrap from 'mocha-wrap';\nimport sinon from 'sinon-sandbox';\nimport {\n  childrenToSimplifiedArray,\n  nodeEqual,\n  nodeMatches,\n  displayNameOfNode,\n  spyMethod,\n  spyProperty,\n  nodeHasType,\n  isCustomComponentElement,\n  makeOptions,\n  isEmptyValue,\n  renderedDive,\n  isCustomComponent,\n  loadCheerioRoot,\n  AND,\n} from 'enzyme/build/Utils';\nimport getAdapter from 'enzyme/build/getAdapter';\nimport EnzymeAdapter from 'enzyme/build/EnzymeAdapter';\nimport {\n  flatten,\n  mapNativeEventNames,\n  propFromEvent,\n} from 'enzyme-adapter-utils';\nimport { get, reset, merge as configure } from 'enzyme/build/configuration';\n\nimport './_helpers/setupAdapters';\n\nimport { describeIf } from './_helpers';\nimport { is } from './_helpers/version';\n\ndescribe('Utils', () => {\n  describe('nodeEqual', () => {\n    it('matches empty elements of same tag', () => {\n      expect(nodeEqual(\n        <div />,\n        <div />,\n      )).to.equal(true);\n    });\n\n    it('does not match empty elements of different type', () => {\n      expect(nodeEqual(\n        <div />,\n        <nav />,\n      )).to.equal(false);\n    });\n\n    it('matches basic prop types', () => {\n      expect(nodeEqual(\n        <div className=\"foo\" />,\n        <div className=\"foo\" />,\n      )).to.equal(true);\n\n      expect(nodeEqual(\n        <div id=\"foo\" className=\"bar\" />,\n        <div id=\"foo\" className=\"bar\" />,\n      )).to.equal(true);\n\n      expect(nodeEqual(\n        <div id=\"foo\" className=\"baz\" />,\n        <div id=\"foo\" className=\"bar\" />,\n      )).to.equal(false);\n    });\n\n    it('skips undefined props', () => {\n      expect(nodeEqual(\n        <div id=\"foo\" className={undefined} />,\n        <div id=\"foo\" />,\n      )).to.equal(true);\n    });\n\n    it('checks children as well', () => {\n      expect(nodeEqual(\n        <div>\n          <div />\n        </div>,\n        <div />,\n      )).to.equal(false);\n\n      expect(nodeEqual(\n        <div>\n          <div />\n        </div>,\n        <div>\n          <div />\n        </div>,\n      )).to.equal(true);\n\n      expect(nodeEqual(\n        <div>\n          <div className=\"foo\" />\n        </div>,\n        <div>\n          <div className=\"foo\" />\n        </div>,\n      )).to.equal(true);\n\n      expect(nodeEqual(\n        <div>\n          <div className=\"foo\" />\n        </div>,\n        <div>\n          <div />\n        </div>,\n      )).to.equal(false);\n    });\n\n    it('tests deepEquality with object props', () => {\n      expect(nodeEqual(\n        <div foo={{ a: 1, b: 2 }} />,\n        <div foo={{ a: 1, b: 2 }} />,\n      )).to.equal(true);\n\n      expect(nodeEqual(\n        <div foo={{ a: 2, b: 2 }} />,\n        <div foo={{ a: 1, b: 2 }} />,\n      )).to.equal(false);\n\n    });\n\n    describe('children props', () => {\n      it('matches equal nodes', () => {\n        expect(nodeEqual(\n          <div>child</div>,\n          <div>child</div>,\n        )).to.equal(true);\n      });\n\n      it('does not match not equal nodes', () => {\n        expect(nodeEqual(\n          <div>child</div>,\n          <div />,\n        )).to.equal(false);\n\n        expect(nodeEqual(\n          <div />,\n          <div>child</div>,\n        )).to.equal(false);\n      });\n\n      it('matches children before and after interpolation', () => {\n        expect(nodeEqual(\n          <div>{2}{' children'}{<span />} abc {'hey'}</div>,\n          <div>2 children<span /> abc hey</div>,\n        )).to.equal(true);\n      });\n\n      it('skips null children', () => {\n        expect(nodeEqual(\n          <div>{null}</div>,\n          <div />,\n        )).to.equal(true);\n      });\n\n      it('skips undefined children', () => {\n        expect(nodeEqual(\n          <div>{undefined}</div>,\n          <div />,\n        )).to.equal(true);\n      });\n\n      it('skips empty children', () => {\n        expect(nodeEqual(\n          <div>{[]}</div>,\n          <div />,\n        )).to.equal(true);\n      });\n\n      it('skips array of null children', () => {\n        expect(nodeEqual(\n          <div>{[null, null, null]}</div>,\n          <div />,\n        )).to.equal(true);\n      });\n    });\n\n    describe('basic props and children mixed', () => {\n      it('matches equal nodes', () => {\n        expect(nodeEqual(\n          <div className=\"foo\">child</div>,\n          <div className=\"foo\">child</div>,\n        )).to.equal(true);\n      });\n\n      it('does not match when basic props are not equal', () => {\n        expect(nodeEqual(\n          <div className=\"foo\">child</div>,\n          <div className=\"bar\">child</div>,\n        )).to.equal(false);\n\n        expect(nodeEqual(\n          <div className=\"foo\">child</div>,\n          <div className=\"bar\">child</div>,\n        )).to.equal(false);\n      });\n\n      it('does not match when children are not equal', () => {\n        expect(nodeEqual(\n          <div className=\"foo\">child</div>,\n          <div className=\"foo\">other child</div>,\n        )).to.equal(false);\n\n        expect(nodeEqual(\n          <div className=\"foo\">child</div>,\n          <div className=\"foo\">other child</div>,\n        )).to.equal(false);\n      });\n\n      it('matches nodes when children are different but falsy', () => {\n        expect(nodeEqual(\n          <div className=\"foo\">{null}</div>,\n          <div className=\"foo\" />,\n        )).to.equal(true);\n\n        expect(nodeEqual(\n          <div children={null} className=\"foo\" />, // eslint-disable-line react/no-children-prop\n          <div className=\"foo\" />,\n        )).to.equal(true);\n      });\n    });\n  });\n\n  describe('nodeMatches', () => {\n    function nodesMatchTwoWays(aProps, bProps, LeftTag = 'div', RightTag = 'div', matches = true) {\n      expect(nodeMatches(\n        <LeftTag {...aProps} />,\n        <RightTag {...bProps} />,\n      )).to.equal(matches);\n\n      expect(nodeMatches(\n        <LeftTag {...bProps} />,\n        <RightTag {...aProps} />,\n      )).to.equal(matches);\n    }\n    function nodesDoNotMatchTwoWays(aProps, bProps, LeftTag = 'div', RightTag = 'div') {\n      return nodesMatchTwoWays(aProps, bProps, LeftTag, RightTag, false);\n    }\n\n    it('matches empty elements of same tag, not distinguishing null/undefined/absent', () => {\n      nodesMatchTwoWays({}, {});\n      nodesMatchTwoWays({}, { id: null });\n      nodesMatchTwoWays({}, { id: undefined });\n\n      nodesMatchTwoWays({ id: null }, {});\n      nodesMatchTwoWays({ id: null }, { id: null });\n      nodesMatchTwoWays({ id: null }, { id: undefined });\n\n      nodesMatchTwoWays({ id: undefined }, {});\n      nodesMatchTwoWays({ id: undefined }, { id: null });\n      nodesMatchTwoWays({ id: undefined }, { id: undefined });\n    });\n\n    it('does not match empty elements of different type, not distinguishing null/undefined/absent', () => {\n      nodesDoNotMatchTwoWays({}, {}, 'div', 'nav');\n      nodesDoNotMatchTwoWays({}, { id: null }, 'div', 'nav');\n      nodesDoNotMatchTwoWays({}, { id: undefined }, 'div', 'nav');\n\n      nodesDoNotMatchTwoWays({ id: null }, {}, 'div', 'nav');\n      nodesDoNotMatchTwoWays({ id: null }, { id: null }, 'div', 'nav');\n      nodesDoNotMatchTwoWays({ id: null }, { id: undefined }, 'div', 'nav');\n\n      nodesDoNotMatchTwoWays({ id: undefined }, {}, 'div', 'nav');\n      nodesDoNotMatchTwoWays({ id: undefined }, { id: null }, 'div', 'nav');\n      nodesDoNotMatchTwoWays({ id: undefined }, { id: undefined }, 'div', 'nav');\n    });\n\n    it('matches basic prop types', () => {\n      nodesMatchTwoWays({ className: 'foo' }, { className: 'foo' });\n      nodesMatchTwoWays({ id: 'foo', className: 'bar' }, { id: 'foo', className: 'bar' });\n      nodesDoNotMatchTwoWays({ id: 'foo', className: 'bar' }, { id: 'foo', className: 'baz' });\n    });\n\n    it('checks children as well, not distinguishing null/undefined/absent', () => {\n      expect(nodeMatches(\n        <div>\n          <div />\n        </div>,\n        <div />,\n      )).to.equal(false);\n\n      expect(nodeMatches(\n        <div><div /></div>,\n        <div><div /></div>,\n      )).to.equal(true);\n\n      expect(nodeMatches(\n        <div><div id={null} /></div>,\n        <div><div /></div>,\n      )).to.equal(true);\n      expect(nodeMatches(\n        <div><div /></div>,\n        <div><div id={null} /></div>,\n      )).to.equal(true);\n\n      expect(nodeMatches(\n        <div><div id={undefined} /></div>,\n        <div><div /></div>,\n      )).to.equal(true);\n      expect(nodeMatches(\n        <div><div /></div>,\n        <div><div id={undefined} /></div>,\n      )).to.equal(true);\n\n      expect(nodeMatches(\n        <div><div id={undefined} /></div>,\n        <div><div id={null} /></div>,\n      )).to.equal(true);\n      expect(nodeMatches(\n        <div><div id={null} /></div>,\n        <div><div id={undefined} /></div>,\n      )).to.equal(true);\n\n      expect(nodeMatches(\n        <div>\n          <div className=\"foo\" />\n        </div>,\n        <div>\n          <div className=\"foo\" />\n        </div>,\n      )).to.equal(true);\n\n      expect(nodeMatches(\n        <div>\n          <div className=\"foo\" />\n        </div>,\n        <div>\n          <div />\n        </div>,\n      )).to.equal(false);\n    });\n\n    it('tests deepEquality with object props', () => {\n      expect(nodeMatches(\n        <div foo={{ a: 1, b: 2 }} />,\n        <div foo={{ a: 1, b: 2 }} />,\n      )).to.equal(true);\n\n      expect(nodeMatches(\n        <div foo={{ a: 2, b: 2 }} />,\n        <div foo={{ a: 1, b: 2 }} />,\n      )).to.equal(false);\n\n    });\n\n    describe('children props', () => {\n      it('matches equal nodes', () => {\n        expect(nodeMatches(\n          <div>child</div>,\n          <div>child</div>,\n        )).to.equal(true);\n      });\n\n      it('does not match not equal nodes', () => {\n        expect(nodeMatches(\n          <div>child</div>,\n          <div />,\n        )).to.equal(false);\n\n        expect(nodeMatches(\n          <div />,\n          <div>child</div>,\n        )).to.equal(false);\n      });\n\n      it('skips null children', () => {\n        expect(nodeMatches(\n          <div>{null}</div>,\n          <div />,\n        )).to.equal(true);\n      });\n\n      it('skips undefined children', () => {\n        expect(nodeMatches(\n          <div>{undefined}</div>,\n          <div />,\n        )).to.equal(true);\n      });\n\n      it('skips empty children', () => {\n        expect(nodeMatches(\n          <div>{[]}</div>,\n          <div />,\n        )).to.equal(true);\n      });\n\n      it('skips array of null children', () => {\n        expect(nodeMatches(\n          <div>{[null, null, null]}</div>,\n          <div />,\n        )).to.equal(true);\n      });\n    });\n\n    describe('basic props and children mixed', () => {\n      it('matches equal nodes', () => {\n        expect(nodeMatches(\n          <div className=\"foo\">child</div>,\n          <div className=\"foo\">child</div>,\n        )).to.equal(true);\n      });\n\n      it('does not match when basic props are not equal', () => {\n        expect(nodeMatches(\n          <div className=\"foo\">child</div>,\n          <div className=\"bar\">child</div>,\n        )).to.equal(false);\n\n        expect(nodeMatches(\n          <div className=\"foo\">child</div>,\n          <div className=\"bar\">child</div>,\n        )).to.equal(false);\n      });\n\n      it('does not match when children are not equal', () => {\n        expect(nodeMatches(\n          <div className=\"foo\">child</div>,\n          <div className=\"foo\">other child</div>,\n        )).to.equal(false);\n\n        expect(nodeMatches(\n          <div className=\"foo\">child</div>,\n          <div className=\"foo\">other child</div>,\n        )).to.equal(false);\n      });\n\n      it('matches nodes when children are different but falsy', () => {\n        expect(nodeMatches(\n          <div className=\"foo\">{null}</div>,\n          <div className=\"foo\" />,\n        )).to.equal(true);\n\n        expect(nodeMatches(\n          <div children={null} className=\"foo\" />, // eslint-disable-line react/no-children-prop\n          <div className=\"foo\" />,\n        )).to.equal(true);\n\n        expect(nodeMatches(\n          <div foo=\"\" />,\n          <div foo={0} />,\n        )).to.equal(false);\n\n        expect(nodeMatches(\n          <div>{''}</div>,\n          <div>{0}</div>,\n        )).to.equal(false);\n      });\n    });\n  });\n\n  describe('propFromEvent', () => {\n    it('works', () => {\n      expect(propFromEvent('click')).to.equal('onClick');\n      expect(propFromEvent('mouseenter')).to.equal('onMouseEnter');\n    });\n\n    describe('conditionally supported events', () => {\n      it('transforms animation events when supported', () => {\n        expect(propFromEvent('animationiteration', { animation: false })).to.equal('onAnimationiteration');\n        expect(propFromEvent('animationiteration', { animation: true })).to.equal('onAnimationIteration');\n      });\n\n      it('transforms pointer events when supported', () => {\n        expect(propFromEvent('pointerover', { pointerEvents: false })).to.equal('onPointerover');\n        expect(propFromEvent('pointerover', { pointerEvents: true })).to.equal('onPointerOver');\n      });\n\n      it('transforms aux click events when supported', () => {\n        expect(propFromEvent('auxclick', { auxClick: false })).to.equal('onAuxclick');\n        expect(propFromEvent('auxclick', { auxClick: true })).to.equal('onAuxClick');\n      });\n    });\n  });\n\n  describe('mapNativeEventNames', () => {\n    describe('given an event that isn‘t a mapped', () => {\n      it('returns the original event', () => {\n        const result = mapNativeEventNames('click');\n        expect(result).to.equal('click');\n      });\n\n    });\n\n    describe('given a React capitalised mouse event', () => {\n      it('returns the original event', () => {\n        const result = mapNativeEventNames('mouseEnter');\n        expect(result).to.equal('mouseEnter');\n      });\n    });\n\n    describe('given a native lowercase event', () => {\n      it('transforms it into the React capitalised event', () => {\n        const result = mapNativeEventNames('dragenter');\n        expect(result).to.equal('dragEnter');\n      });\n    });\n\n    describe('conditionally supported events', () => {\n      it('ignores unsupported events', () => {\n        const result = mapNativeEventNames('animationiteration');\n        expect(result).to.equal('animationiteration');\n      });\n\n      it('transforms animation events when supported', () => {\n        const result = mapNativeEventNames('animationiteration', { animation: true });\n        expect(result).to.equal('animationIteration');\n      });\n\n      it('transforms pointer events when supported', () => {\n        const result = mapNativeEventNames('pointerover', { pointerEvents: true });\n        expect(result).to.equal('pointerOver');\n      });\n    });\n  });\n\n  describe('displayNameOfNode', () => {\n    describe('given a node with displayName', () => {\n      it('returns the displayName', () => {\n        class Foo extends React.Component {\n          render() { return <div />; }\n        }\n\n        Foo.displayName = 'CustomWrapper';\n\n        expect(displayNameOfNode(<Foo />)).to.equal('CustomWrapper');\n      });\n\n      describeIf(is('> 0.13'), 'stateless function components', () => {\n        it('returns the displayName', () => {\n          const Foo = () => <div />;\n          Foo.displayName = 'CustomWrapper';\n\n          expect(displayNameOfNode(<Foo />)).to.equal('CustomWrapper');\n        });\n      });\n    });\n\n    describe('given a node without displayName', () => {\n      it('returns the name', () => {\n        class Foo extends React.Component {\n          render() { return <div />; }\n        }\n\n        expect(displayNameOfNode(<Foo />)).to.equal('Foo');\n      });\n\n      it('returns the name even if it is falsy', () => {\n        const makeFoo = () => () => <div />;\n\n        const Foo = makeFoo();\n\n        expect(displayNameOfNode(<Foo />)).to.equal('');\n      });\n\n      describeIf(is('> 0.13'), 'stateless function components', () => {\n        it('returns the name', () => {\n          const Foo = () => <div />;\n\n          expect(displayNameOfNode(<Foo />)).to.equal('Foo');\n        });\n      });\n    });\n\n    describe('given a DOM node', () => {\n      it('returns the type', () => {\n        expect(displayNameOfNode(<div />)).to.equal('div');\n      });\n    });\n\n    describeIf(is('>= 16.6'), 'given an inner displayName in Memo', () => {\n      it('returns the displayName', () => {\n        const adapter = getAdapter();\n        const Foo = () => <div />;\n        Foo.displayName = 'CustomWrapper';\n\n        const MemoFoo = React.memo(Foo);\n\n        expect(adapter.displayNameOfNode(<MemoFoo />)).to.equal('Memo(CustomWrapper)');\n      });\n    });\n\n    describeIf(is('>= 16.6'), 'given an inner displayName in forwardedRef', () => {\n      it('returns the displayName', () => {\n        const adapter = getAdapter();\n        const Foo = () => <div />;\n        Foo.displayName = 'CustomWrapper';\n\n        const ForwardedFoo = React.forwardRef(Foo);\n\n        expect(adapter.displayNameOfNode(<ForwardedFoo />)).to.equal('ForwardRef(CustomWrapper)');\n      });\n    });\n\n    describeIf(is('>= 16.6'), 'given an inner displayName wrapped in Memo and forwardRef', () => {\n      it('returns the displayName', () => {\n        const adapter = getAdapter();\n        const Foo = () => <div />;\n        Foo.displayName = 'CustomWrapper';\n\n        const MemoForwardFoo = React.memo(React.forwardRef(Foo));\n        expect(adapter.displayNameOfNode(<MemoForwardFoo />)).to.equal('Memo(ForwardRef(CustomWrapper))');\n      });\n    });\n  });\n\n  describe('childrenToSimplifiedArray', () => {\n    function expectEqualArrays(a, b) {\n      expect(a.length).to.be.equal(b.length);\n\n      const nodesAreEqual = a.every((n, i) => nodeEqual(a[i], b[i]));\n      expect(nodesAreEqual).to.equal(true);\n    }\n\n    it('joins string and numerical children as a string', () => {\n      const children = [3, 'textual', 'children'];\n      const simplified = ['3textualchildren'];\n      expectEqualArrays(childrenToSimplifiedArray(children), simplified);\n    });\n\n    it('handles non-textual nodes', () => {\n      const children = ['with', 1, <div />, 'other node'];\n      const simplified = ['with1', <div />, 'other node'];\n      expectEqualArrays(childrenToSimplifiedArray(children), simplified);\n    });\n  });\n\n  describe('flatten', () => {\n    it('recursively flattens a nested iterable structure', () => {\n      const nested = [1, [2, [3, [4]], 5], 6, [7, [8, 9]], 10];\n      const flat = flatten(nested);\n      expect(flat).to.deep.equal([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);\n    });\n  });\n\n  describe('makeOptions', () => {\n    let originalConfig;\n    const adapter = getAdapter();\n    const initialConfig = {\n      adapter,\n      foo: 'bar',\n    };\n    const node = {};\n    const otherNode = {};\n\n    beforeEach(() => {\n      originalConfig = get();\n      reset(initialConfig);\n    });\n\n    afterEach(() => {\n      reset(originalConfig);\n    });\n\n    it('throws when passed attachTo and hydrateIn do not agree', () => {\n      expect(() => makeOptions({ attachTo: node, hydrateIn: otherNode })).to.throw(\n        TypeError,\n        'If both the `attachTo` and `hydrateIn` options are provided, they must be === (for backwards compatibility)',\n      );\n    });\n\n    it('throws when config attachTo and hydrateIn do not agree', () => {\n      configure({ attachTo: node, hydrateIn: otherNode });\n      expect(() => makeOptions({})).to.throw(\n        TypeError,\n        'If both the `attachTo` and `hydrateIn` options are provided, they must be === (for backwards compatibility)',\n      );\n    });\n\n    it('returns an object that includes the config', () => {\n      expect(makeOptions({ bar: 'baz' })).to.eql({\n        ...initialConfig,\n        bar: 'baz',\n      });\n    });\n\n    it('sets attachTo and hydrateIn to hydrateIn, when attachTo is missing', () => {\n      expect(makeOptions({ hydrateIn: node })).to.eql({\n        ...initialConfig,\n        hydrateIn: node,\n        attachTo: node,\n      });\n    });\n\n    it('sets attachTo and hydrateIn to hydrateIn, when attachTo === hydrateIn', () => {\n      expect(makeOptions({ hydrateIn: node, attachTo: node })).to.eql({\n        ...initialConfig,\n        hydrateIn: node,\n        attachTo: node,\n      });\n    });\n\n    it('only sets attachTo, when hydrateIn is missing', () => {\n      expect(makeOptions({ attachTo: node })).to.eql({\n        ...initialConfig,\n        attachTo: node,\n      });\n    });\n\n    describe('when DOM node options are set in the config', () => {\n      it('inherits attachTo', () => {\n        reset({ ...initialConfig, attachTo: node });\n        expect(makeOptions({})).to.eql({\n          ...initialConfig,\n          attachTo: node,\n        });\n      });\n\n      it('inherits hydrateIn', () => {\n        reset({ ...initialConfig, hydrateIn: node });\n        expect(makeOptions({})).to.eql({\n          ...initialConfig,\n          attachTo: node,\n          hydrateIn: node,\n        });\n      });\n\n      it('allows overriding of attachTo', () => {\n        reset({ ...initialConfig, attachTo: node });\n        expect(makeOptions({ attachTo: otherNode })).to.eql({\n          ...initialConfig,\n          attachTo: otherNode,\n        });\n      });\n\n      it('allows overriding of hydrateIn', () => {\n        reset({ ...initialConfig, hydrateIn: node });\n        expect(makeOptions({ hydrateIn: otherNode })).to.eql({\n          ...initialConfig,\n          attachTo: otherNode,\n          hydrateIn: otherNode,\n        });\n      });\n    });\n  });\n\n  describe('isEmptyValue', () => {\n    it('returns true with `false` or `null`', () => {\n      const validValues = [false, null];\n\n      validValues.forEach((value) => {\n        expect([value, isEmptyValue(value)]).to.eql([value, true]);\n      });\n    });\n\n    it('returns false when it receives any other value than \"false\" or null', () => {\n      const values = [undefined, true, 'test', []];\n\n      values.forEach((value) => {\n        expect([value, isEmptyValue(value)]).to.eql([value, false]);\n      });\n    });\n  });\n\n  describe('renderedDive', () => {\n    const emptyNodetestData = [\n      [{ rendered: null }, { rendered: false }],\n      { rendered: { rendered: false } },\n      false,\n      null,\n      { rendered: false },\n      { rendered: null },\n    ];\n    const nonEmptyNodeData = [\n      [{ rendered: null }, { rendered: <div /> }],\n      [{ rendered: null }, { rendered: { rendered: 'hello test' } }],\n      [{ rendered: null }, { rendered: { rendered: [{ rendered: null }, { rendered: <span /> }] } }],\n      { rendered: '' },\n      { rendered: { rendered: [{ rendered: null }, { rendered: <span /> }] } },\n    ];\n\n    it('returns true when renderedDive receives nodes that render validEmpty values', () => {\n      emptyNodetestData.forEach((node) => expect(renderedDive(node)).to.equal(true));\n    });\n\n    it('returns false when renderedDive receives nodes that render non-valid empty values', () => {\n      nonEmptyNodeData.forEach((node) => expect(renderedDive(node)).to.equal(false));\n    });\n  });\n\n  describe('spyMethod', () => {\n    it('can spy last return value and restore it', () => {\n      class Counter {\n        constructor() {\n          this.count = 1;\n        }\n\n        incrementAndGet() {\n          this.count += 1;\n          return this.count;\n        }\n      }\n      const instance = new Counter();\n      const obj = {\n        count: 1,\n        incrementAndGet() {\n          this.count += 1;\n          return this.count;\n        },\n      };\n\n      // test an instance method and an object property function\n      const targets = [instance, obj];\n      targets.forEach((target) => {\n        const original = target.incrementAndGet;\n        const spy = spyMethod(target, 'incrementAndGet');\n        target.incrementAndGet();\n        target.incrementAndGet();\n        expect(spy.getLastReturnValue()).to.equal(3);\n        spy.restore();\n        expect(target.incrementAndGet).to.equal(original);\n        expect(target.incrementAndGet()).to.equal(4);\n      });\n    });\n\n    it('restores the property descriptor', () => {\n      const obj = {};\n      const descriptor = {\n        configurable: true,\n        enumerable: true,\n        writable: true,\n        value: () => {},\n      };\n      Object.defineProperty(obj, 'method', descriptor);\n      const spy = spyMethod(obj, 'method');\n      spy.restore();\n      expect(Object.getOwnPropertyDescriptor(obj, 'method')).to.deep.equal(descriptor);\n    });\n\n    it('accepts an optional `getStub` argument', () => {\n      const obj = {};\n      const descriptor = {\n        configurable: true,\n        enumerable: true,\n        writable: true,\n        value: () => {},\n      };\n      Object.defineProperty(obj, 'method', descriptor);\n      let stub;\n      let original;\n      spyMethod(obj, 'method', (originalMethod) => {\n        original = originalMethod;\n        stub = () => { throw new EvalError('stubbed'); };\n        return stub;\n      });\n      expect(original).to.equal(descriptor.value);\n      expect(obj).to.have.property('method', stub);\n      expect(() => obj.method()).to.throw(EvalError);\n    });\n  });\n\n  describe('spyProperty', () => {\n    it('can spy \"was assigned\" status and restore it', () => {\n      let holder = 1;\n      const obj = {\n        count: 1,\n        get accessor() {\n          return holder;\n        },\n        set accessor(v) {\n          holder = v;\n        },\n      };\n\n      // test an instance method and an object property function\n      const targets = ['count', 'accessor'];\n      targets.forEach((target) => {\n        const originalValue = obj[target];\n\n        const spy = spyProperty(obj, target);\n\n        obj[target] += 1;\n\n        expect(spy.wasAssigned()).to.equal(true);\n\n        spy.restore();\n\n        expect(obj[target]).to.equal(originalValue);\n      });\n    });\n\n    it('restores the property descriptor', () => {\n      const obj = {};\n      const descriptor = {\n        configurable: true,\n        enumerable: true,\n        writable: true,\n        value: () => {},\n      };\n      const propertyName = 'foo';\n      Object.defineProperty(obj, propertyName, descriptor);\n      const spy = spyMethod(obj, propertyName);\n      spy.restore();\n      expect(Object.getOwnPropertyDescriptor(obj, propertyName)).to.deep.equal(descriptor);\n    });\n\n    it('accepts an optional `handlers` argument', () => {\n      const getSpy = sinon.stub().returns(1);\n      const setSpy = sinon.stub().returns(2);\n\n      const propertyName = 'foo';\n      const obj = {\n        [propertyName]: 1,\n      };\n\n      const spy = spyProperty(obj, propertyName, { get: getSpy, set: setSpy });\n\n      obj[propertyName] += 1;\n\n      spy.restore();\n\n      expect(getSpy.args).to.deep.equal([\n        [1],\n      ]);\n      expect(setSpy.args).to.deep.equal([\n        [1, 2],\n      ]);\n    });\n  });\n\n  describe('isCustomComponentElement()', () => {\n    const adapter = getAdapter();\n\n    wrap()\n      .withOverride(() => adapter, 'isCustomComponentElement', () => undefined)\n      .describe('with an adapter lacking `.isCustomComponentElement`', () => {\n        describe('given a valid CustomComponentElement', () => {\n          it('returns true', () => {\n            class Foo extends React.Component {\n              render() { return <div />; }\n            }\n            expect(isCustomComponentElement(<Foo />, adapter)).to.equal(true);\n          });\n\n          describeIf(is('> 0.13'), 'stateless function elements', () => {\n            it('returns true', () => {\n              const Foo = () => <div />;\n\n              expect(isCustomComponentElement(<Foo />, adapter)).to.equal(true);\n            });\n          });\n\n          describeIf(is('>=16.3.0'), 'forwardRef Elements', () => {\n            it('returns false', () => {\n              const Foo = React.forwardRef(() => <div />);\n              expect(isCustomComponentElement(<Foo />, adapter)).to.equal(false);\n            });\n          });\n        });\n\n        describe('given an invalid CustomComponentElement', () => {\n          it('returns false for HTML elements', () => {\n            expect(isCustomComponentElement(<div />, adapter)).to.equal(false);\n          });\n\n          it('returns false for non-Components', () => {\n            [\n              class Foo {},\n              {},\n              () => {},\n              'div',\n              'Foo',\n              null,\n            ].forEach((nonComponent) => {\n              expect(isCustomComponentElement(nonComponent, adapter)).to.equal(false);\n            });\n          });\n        });\n      });\n\n    wrap()\n      .withOverride(() => adapter, 'isCustomComponentElement', () => () => false)\n      .describe('with an adapter that has `.isCustomComponentElement` that always returns false', () => {\n        describe('given a valid CustomComponentElement', () => {\n          it('returns false', () => {\n            class Foo extends React.Component {\n              render() { return <div />; }\n            }\n            expect(isCustomComponentElement(<Foo />, adapter)).to.equal(false);\n          });\n\n          describeIf(is('> 0.13'), 'stateless function elements', () => {\n            it('returns false', () => {\n              const Foo = () => <div />;\n\n              expect(isCustomComponentElement(<Foo />, adapter)).to.equal(false);\n            });\n          });\n\n          describeIf(is('>=16.3.0'), 'forwardRef Elements', () => {\n            it('returns false', () => {\n              const Foo = React.forwardRef(() => <div />);\n              expect(isCustomComponentElement(<Foo />, adapter)).to.equal(false);\n            });\n          });\n        });\n\n        describe('given an invalid CustomComponentElement', () => {\n          it('returns false for HTML elements', () => {\n            expect(isCustomComponentElement(<div />, adapter)).to.equal(false);\n          });\n\n          it('returns false for non-Components', () => {\n            [\n              class Foo {},\n              {},\n              () => {},\n              'div',\n              'Foo',\n              null,\n            ].forEach((nonComponent) => {\n              expect(isCustomComponentElement(nonComponent, adapter)).to.equal(false);\n            });\n          });\n        });\n      });\n\n    wrap()\n      .withOverride(() => adapter, 'isCustomComponentElement', () => () => true)\n      .describe('with an adapter that has `.isCustomComponentElement` that always returns true', () => {\n        describe('given a valid CustomComponentElement', () => {\n          it('returns true', () => {\n            class Foo extends React.Component {\n              render() { return <div />; }\n            }\n            expect(isCustomComponentElement(<Foo />, adapter)).to.equal(true);\n          });\n\n          describeIf(is('> 0.13'), 'stateless function elements', () => {\n            it('returns true', () => {\n              const Foo = () => <div />;\n\n              expect(isCustomComponentElement(<Foo />, adapter)).to.equal(true);\n            });\n          });\n\n          describeIf(is('>=16.3.0'), 'forwardRef Elements', () => {\n            it('returns true', () => {\n              const Foo = React.forwardRef(() => <div />);\n              expect(isCustomComponentElement(<Foo />, adapter)).to.equal(true);\n            });\n          });\n        });\n\n        describe('given an invalid CustomComponentElement', () => {\n          it('returns true for HTML elements', () => {\n            expect(isCustomComponentElement(<div />, adapter)).to.equal(true);\n          });\n\n          it('returns true for non-Components', () => {\n            [\n              class Foo {},\n              {},\n              () => {},\n              'div',\n              'Foo',\n              null,\n            ].forEach((nonComponent) => {\n              expect(isCustomComponentElement(nonComponent, adapter)).to.equal(true);\n            });\n          });\n        });\n      });\n  });\n\n  wrap()\n    .withOverride(() => getAdapter(), 'displayNameOfNode', () => undefined)\n    .describe('nodeHasType', () => {\n      it('is `false` if either argument is falsy', () => {\n        expect(nodeHasType(null, {})).to.equal(false);\n        expect(nodeHasType({}, null)).to.equal(false);\n      });\n\n      it('is `false` if `node` has a falsy `type`', () => {\n        expect(nodeHasType({}, {})).to.equal(false);\n        expect(nodeHasType({ type: null }, {})).to.equal(false);\n        expect(nodeHasType({ type: false }, {})).to.equal(false);\n        expect(nodeHasType({ type: '' }, {})).to.equal(false);\n        expect(nodeHasType({ type: 0 }, {})).to.equal(false);\n      });\n\n      it('compares `node.type` to `type` when `node.type` is a non-empty string', () => {\n        expect(nodeHasType({ type: 'foo' }, 'foo')).to.equal(true);\n        expect(nodeHasType({ type: 'foo' }, 'bar')).to.equal(false);\n      });\n\n      describe('when only `node.type.displayName` matches `type`', () => {\n        const x = {};\n        it('is `true` when `node.type` is an object', () => {\n          expect(nodeHasType(\n            { type: { displayName: x } },\n            x,\n          )).to.equal(true);\n        });\n\n        it('is `true` when `node.type` is a function', () => {\n          expect(nodeHasType(\n            { type: Object.assign(() => {}, { displayName: x }) },\n            x,\n          )).to.equal(true);\n        });\n      });\n\n      describe('when only `node.type.name` matches `type`', () => {\n        const x = {};\n        it('is `true` when `node.type` is an object', () => {\n          expect(nodeHasType(\n            { type: { name: x } },\n            x,\n          )).to.equal(true);\n        });\n\n        it('is `true` when `node.type` is a function', () => {\n          function namedType() {}\n\n          expect(nodeHasType({ type: namedType }, 'namedType')).to.equal(true);\n        });\n      });\n\n      wrap()\n        .withOverride(() => getAdapter(), 'displayNameOfNode', () => sinon.stub())\n        .describe('when the adapter has a `displayNameOfNode` function', () => {\n          it('is `true` when `displayNameOfNode` matches `type`', () => {\n            const stub = getAdapter().displayNameOfNode;\n            const sentinel = {};\n            stub.returns(sentinel);\n\n            const node = {};\n            expect(nodeHasType(node, sentinel)).to.equal(true);\n\n            expect(stub).to.have.property('callCount', 1);\n            const { args } = stub.firstCall;\n            expect(args).to.eql([node]);\n          });\n\n          it('is `false` when `displayNameOfNode` does not match `type`', () => {\n            const stub = getAdapter().displayNameOfNode;\n            const sentinel = {};\n            stub.returns(sentinel);\n\n            const node = {};\n            expect(nodeHasType(node, {})).to.equal(false);\n          });\n        });\n    });\n\n  describe('isCustomComponent', () => {\n    class TestAdapter extends EnzymeAdapter {\n      isCustomComponent() {} // eslint-disable-line class-methods-use-this\n    }\n\n    it('delegates to the adapter has method', () => {\n      const component = {};\n      const result = {};\n      const adapter = new TestAdapter();\n      sinon.stub(adapter, 'isCustomComponent').returns(result);\n\n      const actual = isCustomComponent(component, adapter);\n\n      expect(actual).to.equal(!!result);\n\n      expect(adapter.isCustomComponent).to.have.property('callCount', 1);\n      const [args] = adapter.isCustomComponent.args;\n      expect(args).to.eql([component]);\n    });\n\n    it('returns \"is a function\" when adapter lacks method', () => {\n      const adapter = new TestAdapter();\n      adapter.isCustomComponent = null;\n\n      expect(isCustomComponent({}, adapter)).to.equal(false);\n      expect(isCustomComponent(() => {}, adapter)).to.equal(true);\n    });\n\n    it('throws without a valid adapter', () => {\n      expect(() => isCustomComponent({})).to.throw(Error);\n      expect(() => isCustomComponent({}, null)).to.throw(Error);\n      expect(() => isCustomComponent({}, false)).to.throw(Error);\n      expect(() => isCustomComponent({}, {})).to.throw(Error);\n    });\n  });\n\n  describe('loadCheerioRoot', () => {\n    it('always returns a Cheerio instance', () => {\n      expect(loadCheerioRoot()).to.have.property('cheerio', '[cheerio object]');\n      expect(loadCheerioRoot(null)).to.have.property('cheerio', '[cheerio object]');\n      expect(loadCheerioRoot('')).to.have.property('cheerio', '[cheerio object]');\n      expect(loadCheerioRoot('foo')).to.have.property('cheerio', '[cheerio object]');\n      expect(loadCheerioRoot('123')).to.have.property('cheerio', '[cheerio object]');\n      expect(loadCheerioRoot('<div>bar</div>')).to.have.property('cheerio', '[cheerio object]');\n      expect(loadCheerioRoot('leading <span>text</span>')).to.have.property('cheerio', '[cheerio object]');\n      expect(loadCheerioRoot('<div>malformed</><<html')).to.have.property('cheerio', '[cheerio object]');\n    });\n  });\n\n  describe('AND', () => {\n    it('throws on a non-array', () => {\n      expect(() => AND({})).to.throw(TypeError);\n    });\n\n    it('does not mutate the array', () => {\n      const fn1 = () => {};\n      const fn2 = () => {};\n      const arr = [fn1, fn2];\n      AND(arr);\n      expect(arr).to.eql([fn1, fn2]);\n    });\n\n    it('returns a thunk that calls each function in reverse order', () => {\n      const spy = sinon.spy();\n      const fn1 = (...args) => {\n        spy(1, args);\n        return true;\n      };\n      const fn2 = (...args) => {\n        spy(2, args);\n        return true;\n      };\n\n      const thunk = AND([fn1, fn2]);\n\n      expect(thunk).to.be.a('function');\n      expect(thunk()).to.equal(true);\n\n      expect(spy).to.have.property('callCount', 2);\n      const { args } = spy;\n      expect(args).to.eql([\n        [2, [undefined]],\n        [1, [undefined]],\n      ]);\n    });\n\n    it('matches `every`', () => {\n      expect(AND([() => true, () => false])()).to.equal(false);\n      expect(AND([() => true, () => true])()).to.equal(true);\n    });\n  });\n});\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/_helpers/adapter.js",
    "content": "/* eslint global-require: 0, import/no-extraneous-dependencies: 0, import/no-unresolved: 0 */\n/**\n * This file is needed only because we run our unit tests on multiple\n * versions of React at a time. This file basically figures out which\n * version of React is loaded, and exports the correct adapter for configuring.\n */\nconst { is } = require('./version');\n\nlet Adapter = null;\n\nif (process.env.ADAPTER) {\n  // eslint-disable-next-line import/no-dynamic-require\n  Adapter = require(`enzyme-adapter-react-${process.env.ADAPTER}`);\n} else if (is('^0.13')) {\n  Adapter = require('enzyme-adapter-react-13');\n} else if (is('^0.14')) {\n  Adapter = require('enzyme-adapter-react-14');\n} else if (is('^15.5')) {\n  Adapter = require('enzyme-adapter-react-15');\n} else if (is('^15') && is('< 15.5')) {\n  Adapter = require('enzyme-adapter-react-15.4');\n} else if (is('~16.0.0-0 || ~16.1')) {\n  Adapter = require('enzyme-adapter-react-16.1');\n} else if (is('~16.2')) {\n  Adapter = require('enzyme-adapter-react-16.2');\n} else if (is('~16.3.0-0')) {\n  Adapter = require('enzyme-adapter-react-16.3');\n} else if (is('^16.4.0-0')) {\n  Adapter = require('enzyme-adapter-react-16');\n}\n\nmodule.exports = Adapter;\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/_helpers/beforeEach.js",
    "content": "import sinon from 'sinon-sandbox';\n\nbeforeEach(() => { // eslint-disable-line mocha/no-top-level-hooks\n  sinon.restore();\n});\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/_helpers/describeHooks.js",
    "content": "import { is } from './version';\n\nexport default function describeHooks({\n  Wrap,\n  Wrapper,\n}, ...hooks) {\n  const WrapperName = Wrapper.name;\n  const isShallow = WrapperName === 'ShallowWrapper';\n  const isMount = WrapperName === 'ReactWrapper';\n  const hasDOM = isMount;\n  const makeDOMElement = () => (hasDOM ? global.document.createElement('div') : { nodeType: 1 });\n\n  hooks.forEach((hook) => {\n    // eslint-disable-next-line global-require, import/no-dynamic-require\n    require(`../shared/hooks/${hook}`)({\n      hasHooks: is('>= 16.8'),\n      Wrap,\n      WrapRendered: isShallow ? Wrap : (...args) => Wrap(...args).children(),\n      Wrapper,\n      WrapperName,\n      isShallow,\n      isMount,\n      hasDOM,\n      makeDOMElement,\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/_helpers/describeLifecycles.js",
    "content": "export default function describeLifecycles({\n  Wrap,\n  Wrapper,\n}, ...lifecycles) {\n  const WrapperName = Wrapper.name;\n  const isShallow = WrapperName === 'ShallowWrapper';\n  const isMount = WrapperName === 'ReactWrapper';\n  const hasDOM = isMount;\n  const makeDOMElement = () => (hasDOM ? global.document.createElement('div') : { nodeType: 1 });\n\n  lifecycles.forEach((lifecycle) => {\n    // eslint-disable-next-line global-require, import/no-dynamic-require\n    require(`../shared/lifecycles/${lifecycle}`)({\n      Wrap,\n      WrapRendered: isShallow ? Wrap : (...args) => Wrap(...args).children(),\n      Wrapper,\n      WrapperName,\n      isShallow,\n      isMount,\n      hasDOM,\n      makeDOMElement,\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/_helpers/describeMethods.js",
    "content": "export default function describeMethods({\n  Wrap,\n  Wrapper,\n}, ...methods) {\n  const WrapperName = Wrapper.name;\n  const isShallow = WrapperName === 'ShallowWrapper';\n  const isMount = WrapperName === 'ReactWrapper';\n  const hasDOM = isMount;\n  const makeDOMElement = () => (hasDOM ? global.document.createElement('div') : { nodeType: 1 });\n\n  methods.forEach((method) => {\n    // eslint-disable-next-line global-require, import/no-dynamic-require\n    require(`../shared/methods/${method}`)({\n      Wrap,\n      WrapRendered: isShallow ? Wrap : (...args) => Wrap(...args).children(),\n      Wrapper,\n      WrapperName,\n      isShallow,\n      isMount,\n      hasDOM,\n      makeDOMElement,\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/_helpers/getLoadedLazyComponent.js",
    "content": "import { fakeDynamicImport } from 'enzyme-adapter-utils';\nimport { lazy } from './react-compat';\nimport { is, VERSION } from './version';\n\nfunction fakeSyncThenable(result) {\n  return {\n    then(resolve) {\n      return resolve({ default: result });\n    },\n  };\n}\n\nexport default function getLoadedLazyComponent(wrappedComponent) {\n  if (is('>= 16.8')) {\n    return lazy(() => fakeSyncThenable(wrappedComponent));\n  }\n  if (is('>= 16.6')) {\n    const LazyComponent = lazy(() => fakeDynamicImport(wrappedComponent));\n    /**\n     * Before React v16.8 there's no public api to synchronously / await\n     * loaded lazy component.\n     * So we have to hack this by setting `_result` and `_status` implementation.\n     */\n    /* eslint-disable no-underscore-dangle */\n    LazyComponent._result = wrappedComponent;\n    /* eslint-disable no-underscore-dangle */\n    LazyComponent._status = 1;\n    return LazyComponent;\n  }\n  throw Error(`Current React version ${VERSION} doesn't support \\`lazy()\\` api.`);\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/_helpers/index.jsx",
    "content": "/* globals jsdom */\n\nimport React from 'react';\nimport { Memo } from 'react-is';\nimport { compareNodeTypeOf } from 'enzyme-adapter-utils';\nimport sinon from 'sinon-sandbox';\nimport { expect } from 'chai';\n\n/**\n * Simple wrapper around mocha describe which allows a boolean to be passed in first which\n * determines whether or not the test will be run\n */\nexport function describeIf(test, a, b) {\n  if (typeof test !== 'boolean') {\n    throw new TypeError(`a boolean is required, you passed a ${typeof test}`);\n  }\n\n  if (test) {\n    describe(a, b);\n  } else {\n    describe.skip(a, b);\n  }\n}\n\ndescribeIf.only = (test, a, b) => {\n  if (typeof test !== 'boolean') {\n    throw new TypeError(`a boolean is required, you passed a ${typeof test}`);\n  }\n\n  if (test) {\n    describe.only(a, b);\n  } else {\n    describe.only('only:', () => {\n      describe.skip(a, b);\n    });\n  }\n};\n\ndescribeIf.skip = (test, a, b) => {\n  if (typeof test !== 'boolean') {\n    throw new TypeError(`a boolean is required, you passed a ${typeof test}`);\n  }\n\n  describeIf(false, a, b);\n};\n\n/**\n * Simple wrapper around mocha it which allows a boolean to be passed in first which\n * determines whether or not the test will be run\n */\nexport function itIf(test, a, b) {\n  if (typeof test !== 'boolean') {\n    throw new TypeError(`a boolean is required, you passed a ${typeof test}`);\n  }\n\n  if (test) {\n    it(a, b);\n  } else {\n    it.skip(a, b);\n  }\n}\n\nitIf.only = (test, a, b) => {\n  if (typeof test !== 'boolean') {\n    throw new TypeError(`a boolean is required, you passed a ${typeof test}`);\n  }\n\n  if (test) {\n    it.only(a, b);\n  } else {\n    it.skip(a, b);\n  }\n};\n\nitIf.skip = (test, a, b) => {\n  if (typeof test !== 'boolean') {\n    throw new TypeError(`a boolean is required, you passed a ${typeof test}`);\n  }\n\n  itIf(false, a, b);\n};\n\n/**\n * Simple wrapper around mocha it which allows an array of possible values to test against.\n * Each test will be wrapped in a try/catch block to handle any errors.\n *\n * @param {Object[]} data\n * @param {String} message\n * @param {Function} factory\n */\nexport function itWithData(data, message, factory) {\n  data.forEach((testCase) => {\n    it(`${message} ${testCase.message}`, () => factory(testCase));\n  });\n}\n\nfunction only(a, b) {\n  describe('(uses jsdom)', () => {\n    if (typeof jsdom === 'function') {\n      jsdom();\n      describe.only(a, b);\n    } else {\n      // if jsdom isn't available, skip every test in this describe context\n      describe.skip(a, b);\n    }\n  });\n}\n\nfunction skip(a, b) {\n  describe('(uses jsdom)', () => {\n    if (typeof jsdom === 'function') {\n      jsdom();\n      describe.skip(a, b);\n    } else {\n      // if jsdom isn't available, skip every test in this describe context\n      describe.skip(a, b);\n    }\n  });\n}\n\nexport function describeWithDOM(a, b) {\n  describe('(uses jsdom)', () => {\n    if (global.document) {\n      describe(a, b);\n    } else {\n      // if jsdom isn't available, skip every test in this describe context\n      describe.skip(a, b);\n    }\n  });\n}\n\ndescribeWithDOM.only = only;\ndescribeWithDOM.skip = skip;\n\n/**\n * React component used for testing.\n */\nclass TestHelper extends React.Component {\n  render() {\n    return <div />;\n  }\n}\n\n/**\n * Possible values for React render() checks.\n */\nexport function generateEmptyRenderData() {\n  return [\n    // Returns true for empty\n    { message: 'false', value: false, expectResponse: true },\n    { message: 'null', value: null, expectResponse: true },\n\n    // Returns false for empty, valid returns\n    { message: 'React component', value: <TestHelper />, expectResponse: false },\n    { message: 'React element', value: <span />, expectResponse: false },\n    { message: 'React element', value: <noscript />, expectResponse: false },\n  ];\n}\n\nexport function delay(ms) {\n  return new Promise((resolve) => {\n    setTimeout(resolve, ms);\n  });\n}\n\nexport function isMemo(type) {\n  return compareNodeTypeOf(type, Memo);\n}\n\nexport function argSpy() {\n  const spy = sinon.spy();\n  spy(1);\n  return spy;\n}\n\nexport function expectArgs(spy, counter, args) {\n  spy(counter);\n  expect(spy.args).to.deep.equal([\n    [counter],\n    ...args,\n    [counter],\n  ]);\n  spy.resetHistory();\n  spy(counter + 1);\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/_helpers/react-compat.js",
    "content": "/* eslint\n  global-require: 0,\n  import/no-mutable-exports: 0,\n  import/prefer-default-export: 0,\n*/\n\nimport { is } from './version';\n\nconst { createFactory } = require('react');\n\nlet createClass;\nlet renderToString;\nlet createPortal;\nlet createContext;\nlet createRef;\nlet forwardRef;\nlet Fragment;\nlet StrictMode;\nlet AsyncMode;\nlet ConcurrentMode;\nlet createRoot;\nlet Profiler;\nlet PureComponent;\nlet Suspense;\nlet lazy;\nlet memo;\nlet useCallback;\nlet useContext;\nlet useDebugValue;\nlet useEffect;\nlet useImperativeHandle;\nlet useLayoutEffect;\nlet useMemo;\nlet useReducer;\nlet useRef;\nlet useState;\nlet act;\n\nif (is('>=15.5 || ^16.0.0-alpha || ^16.3.0-alpha')) {\n  // eslint-disable-next-line import/no-extraneous-dependencies\n  createClass = require('create-react-class');\n} else {\n  ({ createClass } = require('react'));\n}\n\nif (is('^0.13.0')) {\n  renderToString = require('react').renderToStaticMarkup;\n} else {\n  // eslint-disable-next-line import/no-extraneous-dependencies\n  ({ renderToString } = require('react-dom/server'));\n}\n\nif (is('^16.0.0-0 || ^16.3.0-0')) {\n  ({ createPortal } = require('react-dom'));\n} else {\n  createPortal = null;\n}\n\nif (is('>=15.3')) {\n  ({ PureComponent } = require('react'));\n} else {\n  PureComponent = null;\n}\n\nif (is('^16.2.0-0')) {\n  ({ Fragment } = require('react'));\n} else {\n  Fragment = null;\n}\n\nif (is('^16.3.0-0')) {\n  ({\n    createContext,\n    createRef,\n    forwardRef,\n    StrictMode,\n    unstable_AsyncMode: AsyncMode,\n  } = require('react'));\n} else {\n  createContext = null;\n  createRef = null;\n  forwardRef = null;\n  StrictMode = null;\n  AsyncMode = null;\n}\n\nif (is('^16.9.0-0')) {\n  ({ Profiler } = require('react'));\n} else if (is('^16.4.0-0')) {\n  ({\n    unstable_Profiler: Profiler,\n  } = require('react'));\n} else {\n  Profiler = null;\n}\n\nif (is('^16.6.0-0')) {\n  ({\n    Suspense,\n    lazy,\n    memo,\n  } = require('react'));\n} else {\n  Suspense = null;\n  lazy = null;\n  memo = null;\n}\n\nif (is('^16.6.0-0') && !is('^16.9.0-0')) {\n  ({\n    unstable_ConcurrentMode: ConcurrentMode,\n  } = require('react'));\n} else {\n  ConcurrentMode = null;\n}\n\nif (is('^16.9.0-0')) {\n  ({\n    unstable_createRoot: createRoot,\n  } = require('react'));\n} else {\n  createRoot = null;\n}\n\nif (is('^16.8.0-0')) {\n  ({\n    useCallback,\n    useContext,\n    useDebugValue,\n    useEffect,\n    useImperativeHandle,\n    useLayoutEffect,\n    useMemo,\n    useReducer,\n    useRef,\n    useState,\n  } = require('react'));\n\n  ({\n    act,\n  } = require('react-dom/test-utils'));\n\n} else {\n  useCallback = null;\n  useContext = null;\n  useDebugValue = null;\n  useEffect = null;\n  useImperativeHandle = null;\n  useLayoutEffect = null;\n  useMemo = null;\n  useReducer = null;\n  useRef = null;\n  useState = null;\n  act = null;\n}\n\nexport {\n  createClass,\n  createFactory,\n  renderToString,\n  createPortal,\n  createContext,\n  createRef,\n  createRoot,\n  forwardRef,\n  Fragment,\n  StrictMode,\n  AsyncMode,\n  ConcurrentMode,\n  Profiler,\n  PureComponent,\n  Suspense,\n  lazy,\n  memo,\n  useCallback,\n  useContext,\n  useDebugValue,\n  useEffect,\n  useImperativeHandle,\n  useLayoutEffect,\n  useMemo,\n  useReducer,\n  useRef,\n  useState,\n  act,\n};\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/_helpers/realArrowFunction.js",
    "content": "try {\n  // eslint-disable-next-line global-require\n  module.exports = require('./untranspiledArrowFunction');\n} catch (e) {\n  module.exports = (x) => () => x;\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/_helpers/selectors.js",
    "content": "export const getElementPropSelector = (prop) => (x) => x.props[prop];\n\nexport const getWrapperPropSelector = (prop) => (x) => x.prop(prop);\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/_helpers/setupAdapters.js",
    "content": "const util = require('util');\nconst Enzyme = require('enzyme');\nconst wrap = require('mocha-wrap');\nconst inspect = require('object-inspect');\n\n// eslint-disable-next-line prefer-destructuring\nconst resetWarningCache = require('prop-types').checkPropTypes.resetWarningCache;\n\nconst { VERSION } = require('./version');\n\nconst Adapter = require('./adapter');\n\nconsole.error(`*** React version: v${VERSION}`);\nconsole.error(`*** Adapter: ${inspect(Adapter)}`);\n\nEnzyme.configure({ adapter: new Adapter() });\n\nconst origWarn = console.warn;\nconst origError = console.error;\nwrap.register(function withConsoleThrows() {\n  return this.withOverrides(() => console, () => ({\n    error(msg) {\n      /* eslint prefer-rest-params: 1 */\n      origError.apply(console, arguments);\n      throw new EvalError(arguments.length > 1 ? util.format.apply(util, arguments) : msg);\n    },\n    warn(msg) {\n      /* eslint prefer-rest-params: 1, prefer-spread: 1 */\n      origWarn.apply(console, arguments);\n      throw new EvalError(arguments.length > 1 ? util.format.apply(util, arguments) : msg);\n    },\n  })).extend('with console throws', {\n    beforeEach() {\n      resetWarningCache();\n    },\n    afterEach() {\n      resetWarningCache();\n    },\n  });\n});\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/_helpers/untranspiledArrowFunction.js",
    "content": "// this file is ignored in babelrc, specifically so that tests will be able to run\n// on a real arrow function that lacks a .prototype\nmodule.exports = (x) => () => x;\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/_helpers/untranspiledSloppyReturnThis.js",
    "content": "/* eslint\n  prefer-spread: 0,\n  func-names: 0,\n  prefer-rest-params: 0,\n*/\nmodule.exports = function (fn) {\n  return function () {\n    return fn.apply(null, [this].concat(Array.prototype.slice.call(arguments)));\n  };\n};\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/_helpers/version.js",
    "content": "import React from 'react';\nimport semver from 'semver';\n\nexport const VERSION = React.version;\n\nexport function is(range) {\n  if (/&&/.test(range)) {\n    throw new RangeError('&& may not work properly in ranges, apparently');\n  }\n  return semver.satisfies(VERSION, range);\n}\n\nexport const REACT16 = is('16');\n\n// The shallow renderer in react 16 does not yet support batched updates. When it does,\n// we should be able to go un-skip all of the tests that are skipped with this flag.\nexport const BATCHING = !REACT16;\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/adapter-utils-spec.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\nimport sinon from 'sinon-sandbox';\nimport PropTypes from 'prop-types';\nimport { shallow } from 'enzyme';\nimport {\n  displayNameOfNode,\n  ensureKeyOrUndefined,\n  getMaskedContext,\n  getComponentStack,\n  findElement,\n  elementToTree,\n  RootFinder,\n  getNodeFromRootFinder,\n  wrapWithWrappingComponent,\n  getWrappingComponentMountRenderer,\n  fakeDynamicImport,\n  assertDomAvailable,\n  createMountWrapper,\n  simulateError,\n  spyMethod,\n  spyProperty,\n} from 'enzyme-adapter-utils';\nimport wrap from 'mocha-wrap';\n\nimport './_helpers/setupAdapters';\nimport { describeIf, describeWithDOM } from './_helpers';\nimport { is } from './_helpers/version';\n\ndescribe('enzyme-adapter-utils', () => {\n  describe('ensureKeyOrUndefined', () => {\n    it('returns the key if truthy', () => {\n      [true, 42, 'foo', [], {}, () => {}].forEach((truthy) => {\n        expect(ensureKeyOrUndefined(truthy)).to.equal(truthy);\n      });\n    });\n\n    it('returns the empty string if the key is the empty string', () => {\n      expect(ensureKeyOrUndefined('')).to.equal('');\n    });\n\n    it('returns undefined if falsy and not the empty string', () => {\n      [null, undefined, false, 0, NaN].forEach((falsy) => {\n        expect(ensureKeyOrUndefined(falsy)).to.equal(undefined);\n      });\n    });\n  });\n\n  describe('displayNameOfNode', () => {\n    describe('given a node with displayName', () => {\n      it('returns the displayName', () => {\n        class Foo extends React.Component {\n          render() { return <div />; }\n        }\n\n        Foo.displayName = 'CustomWrapper';\n\n        expect(displayNameOfNode(<Foo />)).to.equal('CustomWrapper');\n      });\n\n      describeIf(is('> 0.13'), 'stateless function components', () => {\n        it('returns the displayName', () => {\n          const Foo = () => <div />;\n          Foo.displayName = 'CustomWrapper';\n\n          expect(displayNameOfNode(<Foo />)).to.equal('CustomWrapper');\n        });\n      });\n\n      describeIf(is('>= 16.6'), 'stateless memoized function components', () => {\n        it('returns the displayName', () => {\n          const Foo = Object.assign(React.memo(() => <div />), { displayName: 'Memoized(CustomWrapper)' });\n\n          expect(displayNameOfNode(<Foo />)).to.equal('Memoized(CustomWrapper)');\n        });\n      });\n    });\n\n    describe('given a node without displayName', () => {\n      it('returns the name', () => {\n        class Foo extends React.Component {\n          render() { return <div />; }\n        }\n\n        expect(displayNameOfNode(<Foo />)).to.equal('Foo');\n      });\n\n      it('returns the name even if it is falsy', () => {\n        const makeFoo = () => () => <div />;\n\n        const Foo = makeFoo();\n\n        expect(displayNameOfNode(<Foo />)).to.equal('');\n      });\n\n      describeIf(is('> 0.13'), 'stateless function components', () => {\n        it('returns the name', () => {\n          const Foo = () => <div />;\n\n          expect(displayNameOfNode(<Foo />)).to.equal('Foo');\n        });\n      });\n    });\n\n    describe('given a DOM node', () => {\n      it('returns the type', () => {\n        expect(displayNameOfNode(<div />)).to.equal('div');\n      });\n    });\n  });\n\n  describe('getMaskedContext', () => {\n    const contextTypes = {\n      a() {},\n      c() {},\n    };\n    const unmaskedContext = {\n      a: 1,\n      b: 2,\n      c: 3,\n    };\n    const falsies = [undefined, null, false, '', NaN, 0];\n\n    it('returns an empty object with falsy `contextTypes`', () => {\n      falsies.forEach((falsy) => {\n        expect(getMaskedContext(falsy, unmaskedContext)).to.eql({});\n      });\n    });\n\n    it('returns an empty object with falsy `unmaskedContext`', () => {\n      falsies.forEach((falsy) => {\n        expect(getMaskedContext(contextTypes, falsy)).to.eql({});\n      });\n    });\n\n    it('filters `unmaskedContext` down to `contextTypes`', () => {\n      expect(getMaskedContext(contextTypes, unmaskedContext)).to.eql({\n        a: unmaskedContext.a,\n        c: unmaskedContext.c,\n      });\n    });\n  });\n\n  describe('getComponentStack', () => {\n    function A() {\n      return <B />;\n    }\n    class B extends React.Component {\n      render() {\n        return <C />;\n      }\n    }\n    class C extends React.Component {\n      render() {\n        return null;\n      }\n    }\n    const hierarchy = [\n      <A />,\n      <div />,\n      <span />,\n      <B />,\n      <C />,\n      <RootFinder />,\n    ];\n\n    it('outputs a formatted stack of react components', () => {\n      expect(getComponentStack(hierarchy)).to.equal(`\n    in A (created by B)\n    in div (created by B)\n    in span (created by B)\n    in B (created by C)\n    in C (created by WrapperComponent)\n    in WrapperComponent`);\n    });\n\n    it('handles an empty hierarchy', () => {\n      expect(getComponentStack([])).to.equal(`\n    in WrapperComponent`);\n    });\n\n    it('allows getNodeType and getDisplayName to be overridden', () => {\n      function getNodeType(type) {\n        // Not considering C a component\n        if (type === A || type === B) {\n          return 'class';\n        }\n\n        return 'host';\n      }\n      function getDisplayName(node) {\n        if (node.type === A) {\n          return 'Eyy';\n        }\n        if (node.type === B) {\n          return 'Bee';\n        }\n        if (node.type === C) {\n          return 'Sea';\n        }\n        return node.type;\n      }\n\n      // Nothing is created by Sea/C because it is not considered a component\n      // by getNodeType.\n      expect(getComponentStack(hierarchy, getNodeType, getDisplayName)).to.equal(`\n    in Eyy (created by Bee)\n    in div (created by Bee)\n    in span (created by Bee)\n    in Bee (created by WrapperComponent)\n    in Sea (created by WrapperComponent)\n    in WrapperComponent`);\n    });\n  });\n\n  describe('elementToTree', () => {\n    class Target extends React.Component { render() { return null; } }\n    const classNodeType = is('< 0.14') ? 'function' : 'class';\n\n    it('produces a tree', () => {\n      const target = elementToTree(<Target a=\"1\"><div /></Target>);\n      expect(target).to.eql({\n        nodeType: classNodeType,\n        type: Target,\n        props: {\n          a: '1',\n          children: <div />,\n        },\n        key: undefined,\n        ref: null,\n        instance: null,\n        rendered: {\n          instance: null,\n          key: undefined,\n          nodeType: 'host',\n          props: {},\n          ref: null,\n          rendered: null,\n          type: 'div',\n        },\n      });\n    });\n\n    it('works with Array map', () => {\n      const targets = [<Target a=\"1\"><div /></Target>];\n      expect(targets.map(elementToTree)).to.eql([{\n        nodeType: classNodeType,\n        type: Target,\n        props: {\n          a: '1',\n          children: <div />,\n        },\n        key: undefined,\n        ref: null,\n        instance: null,\n        rendered: {\n          instance: null,\n          key: undefined,\n          nodeType: 'host',\n          props: {},\n          ref: null,\n          rendered: null,\n          type: 'div',\n        },\n      }]);\n    });\n\n    it('throws when `dangerouslySetInnerHTML` and `children` are combined on host elements', () => {\n      /* eslint react/no-danger-with-children: 0 */\n      expect(() => elementToTree(<div dangerouslySetInnerHTML=\"hi\">nope</div>)).to.throw();\n      expect(() => elementToTree(<Target dangerouslySetInnerHTML=\"hi\">yep</Target>)).not.to.throw();\n    });\n  });\n\n  describe('findElement', () => {\n    class Target extends React.Component { render() { return null; } }\n    class Other extends React.Component { render() { return null; } }\n    class Unfound extends React.Component { render() { return null; } }\n\n    const other = elementToTree(<Other><div /></Other>);\n    const target = elementToTree(<Target><div><Other /></div></Target>);\n    const tree = elementToTree(\n      <div>\n        <span>\n          {other}\n        </span>\n        <div>\n          {target}\n        </div>\n      </div>,\n    );\n\n    it('finds an element in the render tree using a predicate', () => {\n      expect(findElement(tree, (node) => node.type === Target)).to.eql(target);\n    });\n\n    it('returns undefined if the element cannot be found', () => {\n      expect(findElement(tree, (node) => node.type === Unfound)).to.equal(undefined);\n    });\n\n    it('returns undefined if some non-element is passed', () => {\n      expect(findElement({}, (node) => node.type === Target)).to.equal(undefined);\n    });\n  });\n\n  describe('getNodeFromRootFinder', () => {\n    const isCustomComponent = (component) => typeof component === 'function';\n    class Target extends React.Component { render() { return null; } }\n    class WrappingComponent extends React.Component { render() { return null; } }\n\n    const target = <Target><div /></Target>;\n\n    it('returns the RootFinder‘s children', () => {\n      const tree = elementToTree(\n        <WrappingComponent>\n          <span>\n            <RootFinder>{target}</RootFinder>\n          </span>\n        </WrappingComponent>,\n      );\n      expect(getNodeFromRootFinder(\n        isCustomComponent,\n        tree,\n        { wrappingComponent: WrappingComponent },\n      )).to.eql(elementToTree(target));\n    });\n\n    it('throws an error if wrappingComponent is passed but RootFinder is not found', () => {\n      const treeMissing = elementToTree((\n        <WrappingComponent>\n          <span>\n            {target}\n          </span>\n        </WrappingComponent>\n      ));\n      expect(() => getNodeFromRootFinder(\n        isCustomComponent,\n        treeMissing,\n        { wrappingComponent: WrappingComponent },\n      )).to.throw(\n        '`wrappingComponent` must render its children!',\n      );\n    });\n\n    it('returns the node if there is no wrapping component and rootFinder can‘t be found', () => {\n      const treeMissing = elementToTree((\n        <WrappingComponent>\n          <span>\n            {target}\n          </span>\n        </WrappingComponent>\n      ));\n      expect(getNodeFromRootFinder(\n        isCustomComponent,\n        treeMissing,\n        {},\n      )).to.eql(treeMissing.rendered);\n    });\n  });\n\n  describe('wrapWithWrappingComponent', () => {\n    class Target extends React.Component { render() { return null; } }\n    class WrappingComponent extends React.Component { render() { return null; } }\n\n    it('wraps the node in the wrappingComponent and RootFinder', () => {\n      const node = <Target foo=\"bar\" />;\n      const expected = (\n        <WrappingComponent hello=\"world\">\n          <RootFinder>{node}</RootFinder>\n        </WrappingComponent>\n      );\n\n      expect(wrapWithWrappingComponent(React.createElement, node, {\n        wrappingComponent: WrappingComponent,\n        wrappingComponentProps: { hello: 'world' },\n      })).to.eql(expected);\n    });\n\n    it('handles no wrappingComponentProps', () => {\n      const node = <Target foo=\"bar\" />;\n      const expected = (\n        <WrappingComponent>\n          <RootFinder>{node}</RootFinder>\n        </WrappingComponent>\n      );\n\n      expect(wrapWithWrappingComponent(React.createElement, node, {\n        wrappingComponent: WrappingComponent,\n      })).to.eql(expected);\n    });\n\n    it('handles no wrappingComponent', () => {\n      const node = <Target foo=\"bar\" />;\n\n      expect(wrapWithWrappingComponent(React.createElement, node, {})).to.eql(node);\n    });\n  });\n\n  describeWithDOM('getWrappingComponentMountRenderer', () => {\n    let instance;\n    let renderer;\n    let tree;\n\n    beforeEach(() => {\n      tree = {\n        nodeType: 'host',\n        type: 'div',\n        props: { children: <span /> },\n        key: undefined,\n        ref: undefined,\n        instance: global.document.createElement('div'),\n        rendered: {\n          nodeType: 'host',\n          type: 'span',\n          props: {},\n          key: undefined,\n          ref: undefined,\n          instance: global.document.createElement('span'),\n        },\n      };\n      instance = {\n        setWrappingComponentProps: sinon.spy(),\n      };\n      renderer = getWrappingComponentMountRenderer({\n        getMountWrapperInstance: () => instance,\n        toTree: () => tree,\n      });\n    });\n\n    describe('getNode', () => {\n      it('can get the node', () => {\n        expect(renderer.getNode()).to.eql(tree.rendered);\n      });\n\n      it('returns null if there is no instance', () => {\n        instance = undefined;\n        expect(renderer.getNode()).to.equal(null);\n      });\n    });\n\n    describe('render', () => {\n      it('sets the wrapping component props on the instance', () => {\n        const callback = sinon.spy();\n        const props = { foo: 'bar', children: <span /> };\n        expect(instance.setWrappingComponentProps).to.have.property('callCount', 0);\n        renderer.render(<div {...props} />, null, callback);\n        expect(instance.setWrappingComponentProps).to.have.property('callCount', 1);\n        const [args] = instance.setWrappingComponentProps.args;\n        expect(args).to.eql([props, callback]);\n      });\n\n      it('throws an error if there is no instance', () => {\n        instance = undefined;\n        expect(() => renderer.render(<div />, null, () => {})).to.throw('The wrapping component may not be updated if the root is unmounted.');\n      });\n    });\n  });\n\n  describe('fakeDynamicImport', () => {\n    it('is a function', () => {\n      expect(fakeDynamicImport).to.be.a('function');\n    });\n\n    it('returns a promise', () => {\n      const promise = fakeDynamicImport();\n      expect(Promise.resolve(promise)).to.equal(promise);\n    });\n\n    it('returns a promise for an object containing the provided argument', () => {\n      const signal = {};\n      return fakeDynamicImport(signal).then((actual) => {\n        expect(actual).to.have.property('default', signal);\n      });\n    });\n  });\n\n  describe('assertDomAvailable', () => {\n    describeWithDOM('with DOM', () => {\n      it('throws', () => {\n        expect(global).to.have.property('document');\n        expect(global.document).to.have.property('createElement');\n        expect(assertDomAvailable).not.to.throw();\n      });\n    });\n\n    describe('without DOM', () => {\n      wrap().withGlobal('document', () => null).it('noops', () => {\n        expect(!!global.document).to.equal(false);\n        expect(assertDomAvailable).to.throw();\n      });\n    });\n  });\n\n  describe('createMountWrapper', () => {\n    class Foo extends React.Component {\n      render() {\n        const { foo } = this.context;\n        return <div>{foo}</div>;\n      }\n    }\n    Foo.contextTypes = {\n      foo: PropTypes.string,\n    };\n\n    it('returns a component', () => {\n      const node = <Foo />;\n      const Wrapper = createMountWrapper(node);\n      expect(React.isValidElement(<Wrapper />)).to.equal(true);\n    });\n\n    it('returns the wrapped component’s instance', () => {\n      const node = <Foo />;\n      const Wrapper = createMountWrapper(node);\n      const wrapper = shallow(<Wrapper />);\n      expect(wrapper.instance()).to.be.instanceOf(Wrapper);\n    });\n\n    it('uses the passed `wrappingComponent`', () => {});\n  });\n\n  describe('simulateError', () => {\n    const error = new SyntaxError('hi');\n\n    it('throws the error if neither cDC nor gDSFE exist', () => {\n      const instance = {};\n      expect(() => simulateError(error, instance)).to.throw(error);\n    });\n\n    it('calls gDSFE if it exists', () => {\n      const catchingInstance = {\n        setState: sinon.spy(),\n      };\n      const hierarchy = undefined;\n      const stateUpdate = {};\n      const getDerivedStateFromError = sinon.spy(() => stateUpdate);\n      const catchingType = { getDerivedStateFromError };\n\n      simulateError(error, catchingInstance, undefined, hierarchy, undefined, undefined, catchingType);\n\n      expect(catchingInstance.setState).to.have.property('callCount', 1);\n      const setStateCall = catchingInstance.setState.getCall(0);\n      expect(setStateCall).to.contain.keys({\n        args: [stateUpdate],\n        thisValue: catchingInstance,\n      });\n\n      expect(getDerivedStateFromError).to.have.property('callCount', 1);\n      const gDSFECall = getDerivedStateFromError.getCall(0);\n      expect(gDSFECall).to.have.property('thisValue', catchingType);\n      expect(gDSFECall.args).to.eql([error]);\n    });\n\n    class Foo extends React.Component {\n      render() { return <div />; }\n    }\n    class FooBang extends React.Component {\n      render() { return <div />; }\n    }\n    FooBang.displayName = 'Foo!';\n    const hierarchy = [\n      { type: 'a', displayName: '<a>!' },\n      { type: FooBang },\n      { type: 'b', displayName: '<b>!' },\n      { type: Foo },\n    ];\n    function Bar() { return null; }\n    const hasSFCs = is('> 0.14');\n    if (hasSFCs) {\n      hierarchy.push({ type: Bar });\n    }\n\n    it('calls cDC if it exists', () => {\n      const catchingInstance = {\n        componentDidCatch: sinon.spy(),\n        setState: sinon.spy(),\n      };\n      const catchingType = {};\n\n      simulateError(error, catchingInstance, undefined, hierarchy, undefined, undefined, catchingType);\n\n      expect(catchingInstance.setState).to.have.property('callCount', 0);\n\n      expect(catchingInstance.componentDidCatch).to.have.property('callCount', 1);\n      const cDCCall = catchingInstance.componentDidCatch.getCall(0);\n      const componentStack = hasSFCs\n        ? `\n    in a (created by Foo!)\n    in Foo! (created by Foo)\n    in b (created by Foo)\n    in Foo (created by Bar)\n    in Bar (created by WrapperComponent)\n    in WrapperComponent`\n        : `\n    in a (created by Foo!)\n    in Foo! (created by Foo)\n    in b (created by Foo)\n    in Foo (created by WrapperComponent)\n    in WrapperComponent`;\n      expect(cDCCall).to.have.property('thisValue', catchingInstance);\n      expect(cDCCall.args).to.eql([error, { componentStack }]);\n    });\n\n    it('calls both if both exist', () => {\n      const catchingInstance = {\n        componentDidCatch: sinon.spy(),\n        setState: sinon.spy(),\n      };\n      const stateUpdate = {};\n      const getDerivedStateFromError = sinon.spy(() => stateUpdate);\n      const catchingType = { getDerivedStateFromError };\n\n      simulateError(error, catchingInstance, undefined, hierarchy, undefined, undefined, catchingType);\n\n      expect(catchingInstance.setState).to.have.property('callCount', 1);\n\n      expect(catchingInstance.componentDidCatch).to.have.property('callCount', 1);\n\n      expect(getDerivedStateFromError).to.have.property('callCount', 1);\n    });\n  });\n\n  describe('spyMethod', () => {\n    it('can spy last return value and restore it', () => {\n      class Counter {\n        constructor() {\n          this.count = 1;\n        }\n\n        incrementAndGet() {\n          this.count += 1;\n          return this.count;\n        }\n      }\n      const instance = new Counter();\n      const obj = {\n        count: 1,\n        incrementAndGet() {\n          this.count += 1;\n          return this.count;\n        },\n      };\n\n      // test an instance method and an object property function\n      const targets = [instance, obj];\n      targets.forEach((target) => {\n        const original = target.incrementAndGet;\n        const spy = spyMethod(target, 'incrementAndGet');\n        target.incrementAndGet();\n        target.incrementAndGet();\n        expect(spy.getLastReturnValue()).to.equal(3);\n        spy.restore();\n        expect(target.incrementAndGet).to.equal(original);\n        expect(target.incrementAndGet()).to.equal(4);\n      });\n    });\n\n    it('restores the property descriptor', () => {\n      const obj = {};\n      const descriptor = {\n        configurable: true,\n        enumerable: true,\n        writable: true,\n        value: () => {},\n      };\n      Object.defineProperty(obj, 'method', descriptor);\n      const spy = spyMethod(obj, 'method');\n      spy.restore();\n      expect(Object.getOwnPropertyDescriptor(obj, 'method')).to.deep.equal(descriptor);\n    });\n\n    it('accepts an optional `getStub` argument', () => {\n      const obj = {};\n      const descriptor = {\n        configurable: true,\n        enumerable: true,\n        writable: true,\n        value: () => {},\n      };\n      Object.defineProperty(obj, 'method', descriptor);\n      let stub;\n      let original;\n      spyMethod(obj, 'method', (originalMethod) => {\n        original = originalMethod;\n        stub = () => { throw new EvalError('stubbed'); };\n        return stub;\n      });\n      expect(original).to.equal(descriptor.value);\n      expect(obj).to.have.property('method', stub);\n      expect(() => obj.method()).to.throw(EvalError);\n    });\n  });\n\n  describe('spyProperty', () => {\n    it('can spy \"was assigned\" status and restore it', () => {\n      let holder = 1;\n      const obj = {\n        count: 1,\n        get accessor() {\n          return holder;\n        },\n        set accessor(v) {\n          holder = v;\n        },\n      };\n\n      // test an instance method and an object property function\n      const targets = ['count', 'accessor'];\n      targets.forEach((target) => {\n        const originalValue = obj[target];\n\n        const spy = spyProperty(obj, target);\n\n        obj[target] += 1;\n\n        expect(spy.wasAssigned()).to.equal(true);\n\n        spy.restore();\n\n        expect(obj[target]).to.equal(originalValue);\n      });\n    });\n\n    it('restores the property descriptor', () => {\n      const obj = {};\n      const descriptor = {\n        configurable: true,\n        enumerable: true,\n        writable: true,\n        value: () => {},\n      };\n      const propertyName = 'foo';\n      Object.defineProperty(obj, propertyName, descriptor);\n      const spy = spyMethod(obj, propertyName);\n      spy.restore();\n      expect(Object.getOwnPropertyDescriptor(obj, propertyName)).to.deep.equal(descriptor);\n    });\n\n    it('accepts an optional `handlers` argument', () => {\n      const getSpy = sinon.stub().returns(1);\n      const setSpy = sinon.stub().returns(2);\n\n      const propertyName = 'foo';\n      const obj = {\n        [propertyName]: 1,\n      };\n\n      const spy = spyProperty(obj, propertyName, { get: getSpy, set: setSpy });\n\n      obj[propertyName] += 1;\n\n      spy.restore();\n\n      expect(getSpy.args).to.deep.equal([\n        [1],\n      ]);\n      expect(setSpy.args).to.deep.equal([\n        [1, 2],\n      ]);\n    });\n  });\n});\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/enzyme-adapter-react-install-spec.js",
    "content": "import { expect } from 'chai';\nimport getAdapterForReactVersion from 'enzyme-adapter-react-helper/build/getAdapterForReactVersion';\n\ndescribe('enzyme-adapter-react-helper', () => {\n  describe('getAdapterForReactVersion', () => {\n    it('returns \"enzyme-adapter-react-16\" when intended', () => {\n      expect(getAdapterForReactVersion('16')).to.equal('enzyme-adapter-react-16');\n\n      expect(getAdapterForReactVersion('16.8')).to.equal('enzyme-adapter-react-16');\n      expect(getAdapterForReactVersion('16.8.0-alpha.1')).to.equal('enzyme-adapter-react-16');\n      expect(getAdapterForReactVersion('16.8.0')).to.equal('enzyme-adapter-react-16');\n      expect(getAdapterForReactVersion('16.8.6')).to.equal('enzyme-adapter-react-16');\n\n      expect(getAdapterForReactVersion('16.7')).to.equal('enzyme-adapter-react-16');\n      expect(getAdapterForReactVersion('16.7.0-alpha.2')).to.equal('enzyme-adapter-react-16');\n      expect(getAdapterForReactVersion('16.7.0')).to.equal('enzyme-adapter-react-16');\n\n      expect(getAdapterForReactVersion('16.6')).to.equal('enzyme-adapter-react-16');\n      expect(getAdapterForReactVersion('16.6.0-alpha.8af6728')).to.equal('enzyme-adapter-react-16');\n      expect(getAdapterForReactVersion('16.6.0')).to.equal('enzyme-adapter-react-16');\n      expect(getAdapterForReactVersion('16.6.3')).to.equal('enzyme-adapter-react-16');\n\n      expect(getAdapterForReactVersion('16.5')).to.equal('enzyme-adapter-react-16');\n      expect(getAdapterForReactVersion('16.5.0')).to.equal('enzyme-adapter-react-16');\n      expect(getAdapterForReactVersion('16.5.2')).to.equal('enzyme-adapter-react-16');\n\n      expect(getAdapterForReactVersion('16.4')).to.equal('enzyme-adapter-react-16');\n      expect(getAdapterForReactVersion('16.4.0-alpha.0911da3')).to.equal('enzyme-adapter-react-16');\n      expect(getAdapterForReactVersion('16.4.0')).to.equal('enzyme-adapter-react-16');\n      expect(getAdapterForReactVersion('16.4.2')).to.equal('enzyme-adapter-react-16');\n    });\n\n    it('returns \"enzyme-adapter-react-16.3\" when intended', () => {\n      expect(getAdapterForReactVersion('16.3')).to.equal('enzyme-adapter-react-16.3');\n      expect(getAdapterForReactVersion('16.3.0-alpha.3')).to.equal('enzyme-adapter-react-16.3');\n      expect(getAdapterForReactVersion('16.3.0-rc.0')).to.equal('enzyme-adapter-react-16.3');\n      expect(getAdapterForReactVersion('16.3.0')).to.equal('enzyme-adapter-react-16.3');\n      expect(getAdapterForReactVersion('16.3.2')).to.equal('enzyme-adapter-react-16.3');\n    });\n\n    it('returns \"enzyme-adapter-react-16.2\" when intended', () => {\n      expect(getAdapterForReactVersion('16.2')).to.equal('enzyme-adapter-react-16.2');\n      expect(getAdapterForReactVersion('16.2.0')).to.equal('enzyme-adapter-react-16.2');\n    });\n\n    it('returns \"enzyme-adapter-react-16.1\" when intended', () => {\n      expect(getAdapterForReactVersion('16.1')).to.equal('enzyme-adapter-react-16.1');\n      expect(getAdapterForReactVersion('16.1.0-beta.1')).to.equal('enzyme-adapter-react-16.1');\n      expect(getAdapterForReactVersion('16.1.0-rc')).to.equal('enzyme-adapter-react-16.1');\n      expect(getAdapterForReactVersion('16.1.0')).to.equal('enzyme-adapter-react-16.1');\n      expect(getAdapterForReactVersion('16.1.1')).to.equal('enzyme-adapter-react-16.1');\n\n      expect(getAdapterForReactVersion('16.0')).to.equal('enzyme-adapter-react-16.1');\n      expect(getAdapterForReactVersion('16.0.0-alpha.13')).to.equal('enzyme-adapter-react-16.1');\n      expect(getAdapterForReactVersion('16.0.0-beta.5')).to.equal('enzyme-adapter-react-16.1');\n      expect(getAdapterForReactVersion('16.0.0-rc.3')).to.equal('enzyme-adapter-react-16.1');\n      expect(getAdapterForReactVersion('16.0.0')).to.equal('enzyme-adapter-react-16.1');\n    });\n\n    it('returns \"enzyme-adapter-react-15\" when intended', () => {\n      expect(getAdapterForReactVersion('15')).to.equal('enzyme-adapter-react-15');\n\n      expect(getAdapterForReactVersion('15.6')).to.equal('enzyme-adapter-react-15');\n      expect(getAdapterForReactVersion('15.6.0-rc.1')).to.equal('enzyme-adapter-react-15');\n      expect(getAdapterForReactVersion('15.6.0')).to.equal('enzyme-adapter-react-15');\n      expect(getAdapterForReactVersion('15.6.1')).to.equal('enzyme-adapter-react-15');\n\n      expect(getAdapterForReactVersion('15.5')).to.equal('enzyme-adapter-react-15');\n      expect(getAdapterForReactVersion('15.5.0-rc.2')).to.equal('enzyme-adapter-react-15');\n      expect(getAdapterForReactVersion('15.5.0')).to.equal('enzyme-adapter-react-15');\n      expect(getAdapterForReactVersion('15.5.4')).to.equal('enzyme-adapter-react-15');\n    });\n\n    it('returns \"enzyme-adapter-react-15.4\" when intended', () => {\n      expect(getAdapterForReactVersion('15.4')).to.equal('enzyme-adapter-react-15.4');\n      expect(getAdapterForReactVersion('15.4.0-rc.4')).to.equal('enzyme-adapter-react-15.4');\n      expect(getAdapterForReactVersion('15.4.0')).to.equal('enzyme-adapter-react-15.4');\n      expect(getAdapterForReactVersion('15.4.2')).to.equal('enzyme-adapter-react-15.4');\n\n      expect(getAdapterForReactVersion('15.3')).to.equal('enzyme-adapter-react-15.4');\n      expect(getAdapterForReactVersion('15.3.0-rc.3')).to.equal('enzyme-adapter-react-15.4');\n      expect(getAdapterForReactVersion('15.3.0')).to.equal('enzyme-adapter-react-15.4');\n      expect(getAdapterForReactVersion('15.3.1-rc.2')).to.equal('enzyme-adapter-react-15.4');\n      expect(getAdapterForReactVersion('15.3.1')).to.equal('enzyme-adapter-react-15.4');\n      expect(getAdapterForReactVersion('15.3.2-rc.1')).to.equal('enzyme-adapter-react-15.4');\n      expect(getAdapterForReactVersion('15.3.2')).to.equal('enzyme-adapter-react-15.4');\n\n      expect(getAdapterForReactVersion('15.2')).to.equal('enzyme-adapter-react-15.4');\n      expect(getAdapterForReactVersion('15.2.0-rc.2')).to.equal('enzyme-adapter-react-15.4');\n      expect(getAdapterForReactVersion('15.2.0')).to.equal('enzyme-adapter-react-15.4');\n      expect(getAdapterForReactVersion('15.2.1')).to.equal('enzyme-adapter-react-15.4');\n\n      expect(getAdapterForReactVersion('15.1')).to.equal('enzyme-adapter-react-15.4');\n      expect(getAdapterForReactVersion('15.1.0-alpha.1')).to.equal('enzyme-adapter-react-15.4');\n      expect(getAdapterForReactVersion('15.1.0')).to.equal('enzyme-adapter-react-15.4');\n\n      expect(getAdapterForReactVersion('15.0')).to.equal('enzyme-adapter-react-15.4');\n      expect(getAdapterForReactVersion('15.0.0')).to.equal('enzyme-adapter-react-15.4');\n      expect(getAdapterForReactVersion('15.0.2')).to.equal('enzyme-adapter-react-15.4');\n      expect(getAdapterForReactVersion('15.0.3-alpha.2')).to.equal('enzyme-adapter-react-15.4');\n    });\n\n    it('returns \"enzyme-adapter-react-14\" when intended', () => {\n      expect(getAdapterForReactVersion('0.14')).to.equal('enzyme-adapter-react-14');\n      expect(getAdapterForReactVersion('0.14.0-alpha3')).to.equal('enzyme-adapter-react-14');\n      expect(getAdapterForReactVersion('0.14.0-beta3')).to.equal('enzyme-adapter-react-14');\n      expect(getAdapterForReactVersion('0.14.0-rc1')).to.equal('enzyme-adapter-react-14');\n      expect(getAdapterForReactVersion('0.14.0')).to.equal('enzyme-adapter-react-14');\n      expect(getAdapterForReactVersion('0.14.8')).to.equal('enzyme-adapter-react-14');\n    });\n\n    it('returns \"enzyme-adapter-react-13\" when intended', () => {\n      expect(getAdapterForReactVersion('0.13')).to.equal('enzyme-adapter-react-13');\n      expect(getAdapterForReactVersion('0.13.0-alpha.2')).to.equal('enzyme-adapter-react-13');\n      expect(getAdapterForReactVersion('0.13.0-beta.2')).to.equal('enzyme-adapter-react-13');\n      expect(getAdapterForReactVersion('0.13.0-rc2')).to.equal('enzyme-adapter-react-13');\n      expect(getAdapterForReactVersion('0.13.0')).to.equal('enzyme-adapter-react-13');\n      expect(getAdapterForReactVersion('0.13.3')).to.equal('enzyme-adapter-react-13');\n    });\n\n    it('throws an error for unrecognized versions', () => {\n      const version = '1337';\n      expect(() => getAdapterForReactVersion(version)).to.throw(\n        RangeError,\n        `No Enzyme adapter could be found for React version “${version}”`,\n      );\n    });\n  });\n});\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/enzyme-shallow-equal-spec.js",
    "content": "import shallowEqual from 'enzyme-shallow-equal';\n\nimport { expect } from 'chai';\n\ndescribe('shallowEqual', () => {\n  it('returns true for things that are SameValue', () => {\n    [{}, [], NaN, 42, 'foo', '', 0, Infinity, () => {}, /a/g, true, false, null, undefined].forEach((x) => {\n      expect(shallowEqual(x, x)).to.equal(true);\n    });\n  });\n\n  it('returns false if one is falsy and one is truthy', () => {\n    [null, undefined, false, 0, NaN].forEach((x) => {\n      expect(shallowEqual(true, x)).to.equal(false);\n    });\n  });\n\n  it('returns true if both have zero keys', () => {\n    expect(shallowEqual({}, {})).to.equal(true);\n  });\n\n  it('returns false if they have different numbers of keys', () => {\n    expect(shallowEqual({ a: 1 }, {})).to.equal(false);\n    expect(shallowEqual({}, { a: 1 })).to.equal(false);\n  });\n\n  it('returns false if they have the same number, but differently named, keys', () => {\n    expect(shallowEqual({ a: 1 }, { b: 1 })).to.equal(false);\n  });\n\n  it('returns false if they have the same keys, with different values', () => {\n    [{}, [], NaN, 42, 'foo', '', 0, Infinity, () => {}, /a/g, true, false, null, undefined].forEach((x) => {\n      expect(shallowEqual({ a: x }, { a: {} })).to.equal(false);\n      expect(shallowEqual({ a: {} }, { a: x })).to.equal(false);\n    });\n  });\n\n  it('returns false if an undefined key in one is absent in the other', () => {\n    expect(shallowEqual({ a: undefined, b: true }, { b: true, c: undefined })).to.equal(false);\n    expect(shallowEqual({ c: undefined, b: true }, { b: true, a: undefined })).to.equal(false);\n  });\n\n  it('returns true if they have the same keys, with the same values', () => {\n    [{}, [], NaN, 42, 'foo', '', 0, Infinity, () => {}, /a/g, true, false, null, undefined].forEach((x) => {\n      expect(shallowEqual({ a: x }, { a: x })).to.equal(true);\n      expect(shallowEqual({ a: x }, { a: x })).to.equal(true);\n    });\n  });\n});\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/selector-spec.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\nimport wrap from 'mocha-wrap';\nimport {\n  mount,\n  shallow,\n} from 'enzyme';\n\nimport './_helpers/setupAdapters';\nimport { describeWithDOM, describeIf, itIf } from './_helpers';\nimport { is } from './_helpers/version';\n\nconst tests = [\n  {\n    name: 'mount',\n    renderMethod: mount,\n    describeMethod: describeWithDOM,\n  },\n  {\n    name: 'shallow',\n    renderMethod: shallow,\n    describeMethod: describe,\n  },\n];\n\ntests.forEach(({ describeMethod, name, renderMethod }) => {\n  describeMethod(`selectors: ${name}`, () => {\n    let expectAttributeMatch;\n    beforeEach(() => { // eslint-disable-line mocha/no-top-level-hooks\n      expectAttributeMatch = (element, selector, expected) => {\n        const wrapper = renderMethod(element);\n        expect(wrapper.is(selector)).to.equal(expected);\n      };\n    });\n\n    it('universal selector *', () => {\n      const wrapper = renderMethod((\n        <div>\n          <div className=\"top-div\">\n            <span>inside top div</span>\n          </div>\n\n          <div className=\"bottom-div\" />\n          <span />\n        </div>\n      ));\n\n      expect(wrapper.find('*')).to.have.lengthOf(5);\n    });\n\n    it('* + *', () => {\n      const wrapper = renderMethod((\n        <div>\n          <div className=\"top-div\">\n            <span>inside top div</span>\n          </div>\n          <div className=\"bottom-div\" />\n          <span />\n        </div>\n      ));\n\n      expect(wrapper.find('* + *')).to.have.lengthOf(2);\n    });\n\n    it('.top-div ~ *', () => {\n      const wrapper = renderMethod((\n        <div>\n          <div className=\"top-div\">\n            <span>inside top div</span>\n          </div>\n          <div className=\"bottom-div\" />\n          <span />\n        </div>\n      ));\n\n      expect(wrapper.find('.top-div ~ *')).to.have.lengthOf(2);\n    });\n\n    it('* > span', () => {\n      const wrapper = renderMethod((\n        <div>\n          <div className=\"top-div\">\n            <span>inside top div</span>\n          </div>\n          <div className=\"bottom-div\" />\n          <span />\n        </div>\n      ));\n\n      expect(wrapper.find('* > span')).to.have.lengthOf(2);\n    });\n\n    it('* .top-div *', () => {\n      const wrapper = renderMethod((\n        <div>\n          <div className=\"top-div\">\n            <span>inside top div</span>\n          </div>\n          <div className=\"bottom-div\" />\n          <span id=\"bottom-span\" />\n        </div>\n      ));\n\n      expect(wrapper.find('* .top-div *')).to.have.lengthOf(1);\n    });\n\n    it('#wrap-div > *', () => {\n      const wrapper = renderMethod((\n        <div id=\"wrap-div\">\n          <div className=\"top-div\">\n            <span>inside top div</span>\n          </div>\n          <div className=\"bottom-div\" />\n          <span id=\"bottom-span\" />\n        </div>\n      ));\n\n      expect(wrapper.find('#wrap-div > *')).to.have.lengthOf(3);\n    });\n\n    it('universal selector should also find component node', () => {\n      class ExampleComponent extends React.Component {\n        render() {\n          return <span>Hello world</span>;\n        }\n      }\n      const wrapper = renderMethod((\n        <div id=\"wrap-div\">\n          <div className=\"top-div\">\n            <ExampleComponent />\n          </div>\n          <div className=\"bottom-div\" />\n          <ExampleComponent />\n        </div>\n      ));\n\n      expect(wrapper.find('* > ExampleComponent')).to.have.lengthOf(2);\n      if (name === 'shallow') {\n        // cannot render span inside ExampleComponent when shallow rendering\n        expect(wrapper.find('*')).to.have.lengthOf(5);\n      } else {\n        expect(wrapper.find('*')).to.have.lengthOf(7);\n      }\n    });\n\n    it('simple descendent', () => {\n      const wrapper = renderMethod((\n        <div>\n          <div className=\"top-div\">\n            <span>inside top div</span>\n          </div>\n\n          <div className=\"bottom-div\" />\n          <span />\n        </div>\n      ));\n\n      expect(wrapper.find('span')).to.have.lengthOf(2);\n      expect(wrapper.find('.top-div span')).to.have.lengthOf(1);\n      expect(wrapper.find('div div')).to.have.lengthOf(2);\n    });\n\n    it('nested descendent', () => {\n      const wrapper = renderMethod((\n        <div>\n          <div className=\"my-div\">\n            <h1>heading</h1>\n            <div>\n              <div className=\"my-div\">\n                <h1>heading</h1>\n              </div>\n            </div>\n          </div>\n          <h1>heading</h1>\n        </div>\n      ));\n\n      expect(wrapper.find('h1')).to.have.lengthOf(3);\n      expect(wrapper.find('.my-div h1')).to.have.lengthOf(2);\n    });\n\n    it('deep descendent', () => {\n      const htmlWrapper = renderMethod((\n        <div>\n          <div>\n            <div className=\"inner\">\n              <span>\n                <div className=\"way-inner\">\n                  <h1>heading</h1>\n                </div>\n              </span>\n            </div>\n          </div>\n          <h1>heading</h1>\n        </div>\n      ));\n\n      expect(htmlWrapper.find('h1')).to.have.lengthOf(2);\n      expect(htmlWrapper.find('div .inner span .way-inner h1')).to.have.lengthOf(1);\n      expect(htmlWrapper.find('div div div div')).to.have.lengthOf(1);\n      expect(htmlWrapper.find('div div div')).to.have.lengthOf(2);\n      expect(htmlWrapper.find('div span div')).to.have.lengthOf(1);\n\n      class ExampleComponent extends React.Component {\n        render() {\n          return <span>Hello world</span>;\n        }\n      }\n\n      const complexWrapper = renderMethod((\n        <div>\n          <div>\n            <ExampleComponent>\n              <main />\n            </ExampleComponent>\n          </div>\n          <ExampleComponent>\n            <nav />\n            <main />\n          </ExampleComponent>\n        </div>\n      ));\n\n      expect(complexWrapper.find('div ExampleComponent')).to.have.lengthOf(2);\n      expect(complexWrapper.find('div div ExampleComponent')).to.have.lengthOf(1);\n      if (name === 'shallow') {\n        expect(complexWrapper.find('div ExampleComponent nav')).to.have.lengthOf(1);\n        expect(complexWrapper.find('div ExampleComponent main')).to.have.lengthOf(2);\n      } else { // shallow does not render the contents of components\n        expect(complexWrapper.find('div ExampleComponent span')).to.have.lengthOf(2);\n        expect(complexWrapper.find('div div ExampleComponent span')).to.have.lengthOf(1);\n        expect(complexWrapper.find('div span')).to.have.lengthOf(2);\n        expect(complexWrapper.find('div div span')).to.have.lengthOf(1);\n      }\n    });\n\n    it('direct descendent', () => {\n      const wrapper = renderMethod((\n        <div>\n          <div className=\"container\">\n            <div className=\"to-find\">Direct</div>\n            <div>\n              <div className=\"to-find\">Nested</div>\n            </div>\n          </div>\n          <div className=\"to-find\">Outside</div>\n        </div>\n      ));\n\n      expect(wrapper.find('.to-find')).to.have.lengthOf(3);\n      const descendent = wrapper.find('.container > .to-find');\n      expect(descendent).to.have.lengthOf(1);\n      expect(descendent.text()).to.equal('Direct');\n    });\n\n    it('simple adjacent', () => {\n      const wrapper = renderMethod((\n        <div>\n          <div className=\"to-find\" />\n          <div className=\"sibling\">Adjacent</div>\n          <div className=\"sibling\">Not Adjacent</div>\n        </div>\n      ));\n\n      expect(wrapper.find('.sibling')).to.have.lengthOf(2);\n      const toFind = wrapper.find('.to-find + .sibling');\n      expect(toFind).to.have.lengthOf(1);\n      expect(toFind.text()).to.equal('Adjacent');\n    });\n\n    it('simple adjacent with arrays', () => {\n      const wrapper = renderMethod((\n        <div>\n          <div className=\"to-find\" />\n          {[<div key=\"0\" className=\"sibling\">Adjacent</div>]}\n        </div>\n      ));\n      const toFind = wrapper.find('.to-find + .sibling');\n      expect(toFind).to.have.lengthOf(1);\n      expect(toFind.text()).to.equal('Adjacent');\n    });\n\n    it('nested adjacent', () => {\n      const wrapper = renderMethod((\n        <div>\n          <div className=\"to-find\" />\n          <div className=\"sibling\">Adjacent</div>\n          <div>\n            <div className=\"sibling\">Not Adjacent</div>\n            <div>\n              <div className=\"to-find\" />\n              <div className=\"sibling\">Adjacent</div>\n            </div>\n            <div className=\"to-find\">Not Adjacent</div>\n          </div>\n        </div>\n      ));\n\n      expect(wrapper.find('.to-find')).to.have.lengthOf(3);\n      const toFind = wrapper.find('.to-find + .sibling');\n      expect(toFind).to.have.lengthOf(2);\n      toFind.map((found) => expect(found.text()).to.equal('Adjacent'));\n    });\n\n    it('simple general siblings', () => {\n      const wrapper = renderMethod((\n        <div>\n          <span className=\"to-find\" />\n          <span />\n          <span />\n          <span />\n          <div>\n            <span />\n          </div>\n        </div>\n      ));\n\n      expect(wrapper.find('.to-find ~ span')).to.have.lengthOf(3);\n    });\n\n    it('nested general siblings', () => {\n      const wrapper = renderMethod((\n        <div>\n          <span>Top</span>\n          <span />\n          <span />\n          <div>\n            <div>\n              <span>Top</span>\n              <span />\n              <span />\n            </div>\n          </div>\n        </div>\n      ));\n\n      const spans = wrapper.find('span');\n      const siblings = wrapper.find('span ~ span');\n      expect(spans.length - 2).to.equal(siblings.length);\n      siblings.map((sibling) => expect(sibling.text()).to.not.equal('Top'));\n    });\n\n    it('handles using general siblings on root', () => {\n      const wrapper = renderMethod(<div className=\"foo\" />);\n      expect(wrapper.find('.foo ~ .bar')).to.have.lengthOf(0);\n    });\n\n    it('not() pseudo selector', () => {\n      const wrapper = renderMethod((\n        <div>\n          <span className=\"bar\">first</span>\n          <span />\n          <span className=\"foo\" />\n          <span />\n          <span />\n        </div>\n      ));\n      expect(wrapper.find('span:not(.foo, .bar)')).to.have.lengthOf(3);\n    });\n\n    it(':empty pseudo selector', () => {\n      const wrapper = renderMethod((\n        <div>\n          <span className=\"bar\">first</span>\n          <span />\n          <span className=\"foo\" />\n          <span />\n          <span />\n        </div>\n      ));\n      expect(wrapper.find('.foo:empty')).to.have.lengthOf(1);\n      expect(wrapper.find('.bar:empty')).to.have.lengthOf(0);\n    });\n\n    it('first-child pseudo', () => {\n      const wrapper = renderMethod((\n        <div>\n          <span>first</span>\n          <span />\n          <span />\n        </div>\n      ));\n      expect(wrapper.find('span:first-child').text()).to.equal('first');\n    });\n\n    it('last-child pseudo', () => {\n      const wrapper = renderMethod((\n        <div>\n          <span />\n          <span />\n          <span>last</span>\n        </div>\n      ));\n      expect(wrapper.find('span:last-child').text()).to.equal('last');\n    });\n\n    describeIf(name !== 'mount', ':focus pseudo selector', () => {\n      // TODO: remove this withGlobal once withDOM is fixed\n      wrap().withGlobal('document', () => {}).it('throws', () => {\n        const wrapper = renderMethod((\n          <input type=\"text\" />\n        ));\n        const inputNode = wrapper.find('input');\n\n        expect(() => inputNode.is(':focus')).to.throw('Enzyme::Selector does not support the \":focus\" pseudo-element without a global `document`.');\n      });\n    });\n\n    describeIf(name === 'mount', ':focus pseudo selector', () => {\n      // FIXME: figure out why this fails on 15.0 and 15.1\n      itIf(!is('~15.0 || ~15.1'), 'works in mount with directly focused DOM node', () => {\n        const wrapper = renderMethod((\n          <input type=\"text\" />\n        ));\n        const inputNode = wrapper.find('input');\n\n        expect(inputNode.is(':focus')).to.equal(false);\n\n        const inputDOMNode = wrapper.getDOMNode();\n        inputDOMNode.focus();\n\n        expect(inputNode.is(':focus')).to.equal(true);\n      });\n\n      it('works on component in mount', () => {\n        class ClassComponent extends React.Component {\n          render() {\n            return (\n              <input type=\"text\" />\n            );\n          }\n        }\n\n        const wrapper = renderMethod((\n          <ClassComponent />\n        ));\n\n        expect(wrapper.find('ClassComponent:focus')).to.have.lengthOf(0);\n\n        const inputDOMNode = wrapper.getDOMNode();\n        inputDOMNode.focus();\n\n        expect(wrapper.find('ClassComponent:focus')).to.have.lengthOf(1);\n      });\n\n      // FIXME: figure out why this fails on 15.0 and 15.1\n      itIf(!is('~15.0 || ~15.1'), 'works on nested component in mount', () => {\n        class InnerComponent extends React.Component {\n          render() {\n            return (\n              <input type=\"text\" />\n            );\n          }\n        }\n        class WrapComponent extends React.Component {\n          render() {\n            return <InnerComponent />;\n          }\n        }\n        const wrapper = renderMethod((\n          <WrapComponent />\n        ));\n\n        expect(wrapper.find('InnerComponent:focus')).to.have.lengthOf(0);\n        expect(wrapper.find('WrapComponent:focus')).to.have.lengthOf(0);\n        expect(wrapper.find('input:focus')).to.have.lengthOf(0);\n\n        const inputDOMNode = wrapper.getDOMNode();\n        inputDOMNode.focus();\n\n        expect(wrapper.find('InnerComponent:focus')).to.have.lengthOf(1);\n        expect(wrapper.find('WrapComponent:focus')).to.have.lengthOf(1);\n        expect(wrapper.find('input:focus')).to.have.lengthOf(1);\n      });\n    });\n\n    it('throws for complex selectors in simple selector methods', () => {\n      const wrapper = renderMethod(<div className=\"foo\" />);\n      ['is', 'filter', 'not', 'every'].forEach((method) => {\n        expect(() => wrapper[method]('.foo + div')).to.throw(\n          TypeError,\n          'This method does not support complex CSS selectors',\n        );\n      });\n    });\n\n    it('throws for unsupported pseudo-element selectors', () => {\n      const wrapper = renderMethod(<div className=\"foo\" />);\n      expect(() => wrapper.find('div::after')).to.throw('Enzyme::Selector does not support the \"after\" pseudo-element or pseudo-class selectors.');\n    });\n\n    it('throws for unsupported pseudo-class selectors', () => {\n      const wrapper = renderMethod(<div className=\"foo\" />);\n      expect(() => wrapper.find('div:hover')).to.throw('Enzyme::Selector does not support the \"hover\" pseudo-element or pseudo-class selectors.');\n    });\n\n    it('.foo + div > span', () => {\n      const wrapper = renderMethod((\n        <div>\n          <div className=\"foo\" />\n          <div>\n            <span />\n          </div>\n          <div>\n            <span />\n          </div>\n        </div>\n      ));\n\n      expect(wrapper.find('.foo + div > span')).to.have.lengthOf(1);\n    });\n\n    it('.foo + .foo + .foo', () => {\n      const wrapper = renderMethod((\n        <div>\n          <div className=\"foo\">foo1</div>\n          <div className=\"foo\">foo2</div>\n          <div className=\"foo\">foo3</div>\n        </div>\n      ));\n      expect(wrapper.find('.foo + .foo')).to.have.lengthOf(2);\n      expect(wrapper.find('.foo + .foo').at(0).text()).to.equal('foo2');\n      expect(wrapper.find('.foo + .foo').at(1).text()).to.equal('foo3');\n      expect(wrapper.find('.foo + .foo + .foo')).to.have.lengthOf(1);\n    });\n\n    it('attribute names with numbers', () => {\n      const wrapper = renderMethod((\n        <div>\n          <div data-foo-1={1} />\n          <div data-foo-1={1} />\n          <div data-foo-2={2} />\n          <div data-foo-2=\"2\" />\n        </div>\n      ));\n      expect(wrapper.find('[data-foo-1=1]')).to.have.lengthOf(2);\n      expect(wrapper.find('[data-foo-1=\"1\"]')).to.have.lengthOf(0);\n      expect(wrapper.find('[data-foo-2=2]')).to.have.lengthOf(1);\n      expect(wrapper.find('[data-foo-2=\"2\"]')).to.have.lengthOf(1);\n    });\n\n    it('hyphens', () => {\n      const wrapper = renderMethod((\n        <div>\n          <div className=\"-foo\" />\n          <div className=\"foo- -bar-\" type=\"foo\" />\n          <div id=\"bar\" className=\"-foo\" />\n          <span className=\"-foo\" />\n        </div>\n      ));\n      expect(wrapper.find('.-foo')).to.have.lengthOf(3);\n      expect(wrapper.find('.foo-')).to.have.lengthOf(1);\n      expect(wrapper.find('[type=\"foo\"].foo-')).to.have.lengthOf(1);\n      expect(wrapper.find('.foo-.-bar-')).to.have.lengthOf(1);\n      expect(wrapper.find('div.foo-')).to.have.lengthOf(1);\n      expect(wrapper.find('div.-foo')).to.have.lengthOf(2);\n      expect(wrapper.find('#bar.-foo')).to.have.lengthOf(1);\n    });\n\n    it('hyphens', () => {\n      const wrapper = renderMethod((\n        <div>\n          <div className=\"-foo\" />\n          <div className=\"foo- -bar-\" type=\"foo\" />\n          <div id=\"bar\" className=\"-foo\" />\n          <span className=\"-foo\" />\n        </div>\n      ));\n      expect(wrapper.find('.-foo')).to.have.lengthOf(3);\n      expect(wrapper.find('.foo-')).to.have.lengthOf(1);\n      expect(wrapper.find('[type=\"foo\"].foo-')).to.have.lengthOf(1);\n      expect(wrapper.find('.foo-.-bar-')).to.have.lengthOf(1);\n      expect(wrapper.find('div.foo-')).to.have.lengthOf(1);\n      expect(wrapper.find('div.-foo')).to.have.lengthOf(2);\n      expect(wrapper.find('#bar.-foo')).to.have.lengthOf(1);\n    });\n\n    it('spaces in attribute values', () => {\n      const wrapper = renderMethod((\n        <div>\n          <div type=\"foo bar\" />\n          <div type=\"foo.bar\" />\n          <div type=\"foobar\" />\n        </div>\n      ));\n      expect(wrapper.find('[type=\"foo bar\"]')).to.have.lengthOf(1);\n    });\n\n    it('dots in attribute values', () => {\n      const wrapper = renderMethod((\n        <div>\n          <div type=\"foo.bar\" />\n          <div type=\"foo bar\" />\n          <div type=\"foobar\" />\n        </div>\n      ));\n      expect(wrapper.find('[type=\"foo.bar\"]')).to.have.lengthOf(1);\n    });\n\n    it('brackets in attribute values', () => {\n      const wrapper = renderMethod((\n        <div>\n          <div type=\"foo[1]\" />\n        </div>\n      ));\n      expect(wrapper.find('[type=\"foo[1]\"]')).to.have.lengthOf(1);\n    });\n\n    it('URLs in attribute values', () => {\n      const wrapper = renderMethod((\n        <div>\n          <a href=\"https://www.foo.com\" />\n          <a href=\"foo.com\" />\n        </div>\n      ));\n      expect(wrapper.find('a[href=\"https://www.foo.com\"]')).to.have.lengthOf(1);\n      expect(wrapper.find('a[href=\"foo.com\"]')).to.have.lengthOf(1);\n    });\n\n    it('parens in displayName', () => {\n      class Foo extends React.Component {\n        render() {\n          return <div />;\n        }\n      }\n      Foo.displayName = 'Wrapped(Foo)';\n      class Bar extends React.Component {\n        render() {\n          return <div />;\n        }\n      }\n      Bar.displayName = 'Wrapped(Twice(Bar))';\n      const wrapper = renderMethod((\n        <div>\n          <Foo />\n          <Bar />\n        </div>\n      ));\n      expect(wrapper.find('Wrapped(Foo)')).to.have.lengthOf(1);\n      expect(wrapper.find('Wrapped(Twice(Bar))')).to.have.lengthOf(1);\n    });\n\n    it('parses booleans', () => {\n      expectAttributeMatch(<div hidden />, '[hidden=true]', true);\n      expectAttributeMatch(<div hidden />, '[hidden=false]', false);\n      expectAttributeMatch(<div hidden />, '[hidden=\"true\"]', false);\n      expectAttributeMatch(<div hidden={false} />, '[hidden=false]', true);\n      expectAttributeMatch(<div hidden={false} />, '[hidden=true]', false);\n      expectAttributeMatch(<div hidden={false} />, '[hidden=\"false\"]', false);\n    });\n\n    it('parses numeric literals', () => {\n      expectAttributeMatch(<div data-foo={2.3} />, '[data-foo=2.3]', true);\n      expectAttributeMatch(<div data-foo={2} />, '[data-foo=2]', true);\n      expectAttributeMatch(<div data-foo={2} />, '[data-foo=\"2abc\"]', false);\n      expectAttributeMatch(<div data-foo={2} />, '[data-foo=\"abc2\"]', false);\n      expectAttributeMatch(<div data-foo={-2} />, '[data-foo=-2]', true);\n      // @TODO this is failing due to a parser issue\n      // expectAttributeMatch(<div data-foo={2e8} />, '[data-foo=2e8]', true);\n      expectAttributeMatch(<div data-foo={Infinity} />, '[data-foo=Infinity]', true);\n      expectAttributeMatch(<div data-foo={Infinity} />, '[data-foo=-Infinity]', false);\n      expectAttributeMatch(<div data-foo={-Infinity} />, '[data-foo=-Infinity]', true);\n      expectAttributeMatch(<div data-foo={-Infinity} />, '[data-foo=Infinity]', false);\n    });\n\n    it('parses zeroes properly', () => {\n      expectAttributeMatch(<div data-foo={0} />, '[data-foo=0]', true);\n      expectAttributeMatch(<div data-foo={0} />, '[data-foo=+0]', true);\n      expectAttributeMatch(<div data-foo={-0} />, '[data-foo=-0]', true);\n      expectAttributeMatch(<div data-foo={-0} />, '[data-foo=0]', false);\n      expectAttributeMatch(<div data-foo={0} />, '[data-foo=-0]', false);\n      expectAttributeMatch(<div data-foo={1} />, '[data-foo=0]', false);\n      expectAttributeMatch(<div data-foo={2} />, '[data-foo=-0]', false);\n    });\n\n    it('works with empty strings', () => {\n      expectAttributeMatch(<div className=\"\" />, '[className=\"\"]', true);\n      expectAttributeMatch(<div className={''} />, '[className=\"\"]', true);\n      expectAttributeMatch(<div className={'bar'} />, '[className=\"\"]', false);\n    });\n\n    it('works with NaN', () => {\n      expectAttributeMatch(<div data-foo={NaN} />, '[data-foo=NaN]', true);\n      expectAttributeMatch(<div data-foo={0} />, '[data-foo=NaN]', false);\n    });\n\n    it('works with null', () => {\n      expectAttributeMatch(<div data-foo={null} />, '[data-foo=null]', true);\n      expectAttributeMatch(<div data-foo={0} />, '[data-foo=null]', false);\n    });\n\n    it('works with false', () => {\n      expectAttributeMatch(<div data-foo={false} />, '[data-foo=false]', true);\n      expectAttributeMatch(<div data-foo={0} />, '[data-foo=false]', false);\n    });\n    it('works with ±Infinity', () => {\n      expectAttributeMatch(<div data-foo={Infinity} />, '[data-foo=Infinity]', true);\n      expectAttributeMatch(<div data-foo={Infinity} />, '[data-foo=+Infinity]', true);\n      expectAttributeMatch(<div data-foo={Infinity} />, '[data-foo=-Infinity]', false);\n      expectAttributeMatch(<div data-foo={Infinity} />, '[data-foo=NaN]', false);\n      expectAttributeMatch(<div data-foo={0} />, '[data-foo=Infinity]', false);\n      expectAttributeMatch(<div data-foo={0} />, '[data-foo=-Infinity]', false);\n      expectAttributeMatch(<div data-foo={-Infinity} />, '[data-foo=-Infinity]', true);\n      expectAttributeMatch(<div data-foo={-Infinity} />, '[data-foo=Infinity]', false);\n      expectAttributeMatch(<div data-foo={-Infinity} />, '[data-foo=\"-Infinity\"]', false);\n      expectAttributeMatch(<div data-foo={-Infinity} />, '[data-foo=NaN]', false);\n      expectAttributeMatch(<div data-foo={NaN} />, '[data-foo=Infinity]', false);\n      expectAttributeMatch(<div data-foo={NaN} />, '[data-foo=-Infinity]', false);\n    });\n\n    it('whitespace list attribute selector', () => {\n      expectAttributeMatch(<div rel=\"foo bar baz\" />, '[rel~=\"bar\"]', true);\n      expectAttributeMatch(<div rel=\"foo bar baz\" />, '[rel~=\"baz\"]', true);\n      expectAttributeMatch(<div rel=\"foo bar baz\" />, '[rel~=\"foo\"]', true);\n      expectAttributeMatch(<div rel=\"foo bar baz\" />, '[rel~=\"foo bar\"]', false);\n      expectAttributeMatch(<div rel={1} />, '[rel~=1]', false);\n      expectAttributeMatch(<div rel=\"1\" />, '[rel~=1]', false);\n    });\n\n    it('hypen attribute selector', () => {\n      expectAttributeMatch(<a hrefLang=\"en-US\" />, '[hrefLang|=\"en\"]', true);\n      expectAttributeMatch(<a hrefLang=\"en-US\" />, '[hrefLang|=\"en-US\"]', true);\n      expectAttributeMatch(<a hrefLang=\"en-US\" />, '[hrefLang|=\"US\"]', false);\n      expectAttributeMatch(<a hrefLang=\"en-US\" />, '[hrefLang|=\"enUS\"]', false);\n      expectAttributeMatch(<a hrefLang={1} />, '[hrefLang|=1]', false);\n      expectAttributeMatch(<a hrefLang=\"1\" />, '[hrefLang|=1]', false);\n    });\n\n    it('prefix attribute operator', () => {\n      expectAttributeMatch(<img alt=\"\" src=\"foo-bar.jpg\" />, '[src^=\"foo\"]', true);\n      expectAttributeMatch(<img alt=\"\" src=\"foo-bar.jpg\" />, '[src^=\"foo-bar\"]', true);\n      expectAttributeMatch(<img alt=\"\" src=\"foo-bar.jpg\" />, '[src^=\"foo-bar.jpg\"]', true);\n      expectAttributeMatch(<img alt=\"\" src=\"foo-bar.jpg\" />, '[src^=\"bar\"]', false);\n      expectAttributeMatch(<img alt=\"\" src=\"foo-bar.jpg\" />, '[src^=\"\"]', false);\n      expectAttributeMatch(<img alt=\"\" src={1} />, '[src^=1]', false);\n      expectAttributeMatch(<img alt=\"\" src=\"1\" />, '[src^=1]', false);\n    });\n\n    it('suffix attribute operator', () => {\n      expectAttributeMatch(<img alt=\"\" src=\"foo-bar.jpg\" />, '[src$=\".jpg\"]', true);\n      expectAttributeMatch(<img alt=\"\" src=\"foo-bar.jpg\" />, '[src$=\"bar.jpg\"]', true);\n      expectAttributeMatch(<img alt=\"\" src=\"foo-bar.jpg\" />, '[src$=\"foo-bar.jpg\"]', true);\n      expectAttributeMatch(<img alt=\"\" src=\"foo-bar.jpg\" />, '[src$=\"foo\"]', false);\n      expectAttributeMatch(<img alt=\"\" src=\"foo-bar.jpg\" />, '[src$=\"\"]', false);\n      expectAttributeMatch(<img alt=\"\" src={1} />, '[src$=1]', false);\n      expectAttributeMatch(<img alt=\"\" src=\"1\" />, '[src$=1]', false);\n    });\n\n    it('substring attribute operator', () => {\n      expectAttributeMatch(<div id=\"foo bar baz\" />, '[id*=\"foo\"]', true);\n      expectAttributeMatch(<div id=\"foo bar baz\" />, '[id*=\"foo bar\"]', true);\n      expectAttributeMatch(<div id=\"foo bar baz\" />, '[id*=\"foo bar baz\"]', true);\n      expectAttributeMatch(<div id=\"foo bar baz\" />, '[id*=\"foo \"]', true);\n      expectAttributeMatch(<div id=\"foo bar baz\" />, '[id*=\"fo\"]', true);\n      expectAttributeMatch(<div id=\"foo bar baz\" />, '[id*=\"foz\"]', false);\n      expectAttributeMatch(<div id=\"foo bar baz\" />, '[id*=1]', false);\n      expectAttributeMatch(<div id={1} />, '[id*=1]', false);\n      expectAttributeMatch(<div id=\"1\" />, '[id*=1]', false);\n    });\n\n    itIf(name === 'mount', 'works with an element constructor', () => {\n      /* eslint-env browser */\n      const wrapper = renderMethod((\n        <div>\n          <span />\n          <button type=\"button\" />\n          <img alt=\"\" />\n        </div>\n      ));\n      expect(wrapper.find(HTMLButtonElement)).to.have.lengthOf(1);\n    });\n  });\n});\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/hooks/_hook.template",
    "content": "import React from 'react';\nimport PropTypes from 'prop-types';\nimport { expect } from 'chai';\nimport wrap from 'mocha-wrap';\nimport sinon from 'sinon-sandbox';\nimport { Portal } from 'react-is';\n\nimport { render } from 'enzyme';\nimport getAdapter from 'enzyme/build/getAdapter';\n\nimport {\n  describeIf,\n  itIf,\n} from '../../_helpers';\nimport {\n  is,\n  REACT16,\n} from '../../_helpers/version';\n\nimport {\n  useCallback,\n  useContext,\n  useEffect,\n  useLayoutEffect,\n  useMemo,\n  useReducer,\n  useState,\n  act,\n} from '../../_helpers/react-compat';\n\nexport default function describe$Hook({\n  hasHooks,\n  Wrap,\n  WrapRendered,\n  Wrapper,\n  WrapperName,\n  isShallow,\n  isMount,\n  makeDOMElement,\n}) {\n  describeIf(hasHooks, 'hooks: $Hook', () => {\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/hooks/custom.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\nimport sinon from 'sinon-sandbox';\n\nimport {\n  describeIf,\n} from '../../_helpers';\n\nimport {\n  useEffect,\n  useState,\n} from '../../_helpers/react-compat';\n\nexport default function describeCustomHooks({\n  hasHooks,\n  Wrap,\n  isShallow,\n}) {\n  describeIf(hasHooks, 'hooks: custom', () => {\n    describe('custom hook : useCounter', () => {\n      function useCounter({ initialCount = 0, step = 1 } = {}) {\n        const [count, setCount] = useState(initialCount);\n        const increment = () => setCount((c) => c + step);\n        const decrement = () => setCount((c) => c - step);\n        return { count, increment, decrement };\n      }\n      // testing custom hooks with renderProps\n      // may be we can think of adding in utils\n      // will be repeated\n      const Counter = ({ children, ...rest }) => children(useCounter(rest));\n\n      function setupTest(props) {\n        const returnVal = {};\n        Wrap(\n          <Counter {...props}>\n            {(val) => {\n              Object.assign(returnVal, val);\n              return null;\n            }}\n          </Counter>,\n        );\n        return returnVal;\n      }\n\n      it('useCounter', () => {\n        const counterData = setupTest();\n        counterData.increment();\n        expect(counterData).to.have.property('count', 1);\n        counterData.decrement();\n        expect(counterData).to.have.property('count', 0);\n      });\n\n      it('useCounter with initialCount', () => {\n        const counterData = setupTest({ initialCount: 2 });\n        counterData.increment();\n        expect(counterData).to.have.property('count', 3);\n        counterData.decrement();\n        expect(counterData).to.have.property('count', 2);\n      });\n\n      it('useCounter with step', () => {\n        const counterData = setupTest({ step: 2 });\n        counterData.increment();\n        expect(counterData).to.have.property('count', 2);\n        counterData.decrement();\n        expect(counterData).to.have.property('count', 0);\n      });\n\n      it('useCounter with step and initialCount', () => {\n        const counterData = setupTest({ step: 2, initialCount: 5 });\n        counterData.increment();\n        expect(counterData).to.have.property('count', 7);\n        counterData.decrement();\n        expect(counterData).to.have.property('count', 5);\n      });\n    });\n\n    // todo: enable shallow when useEffect works in the shallow renderer. see https://github.com/facebook/react/issues/15275\n    describeIf(!isShallow, 'custom hook: formInput invoke props', () => {\n      function useFormInput(initialValue = '') {\n        const [value, setValue] = useState(initialValue);\n\n        return {\n          value,\n          onChange(e) {\n            setValue(e.target.value);\n          },\n        };\n      }\n\n      function Input(props) {\n        return (\n          <div>\n            <input {...props} />\n          </div>\n        );\n      }\n\n      function ControlledInputWithEnhancedInput({ searchSomething }) {\n        const search = useFormInput();\n\n        useEffect(\n          () => {\n            searchSomething(search.value);\n          },\n          [search.value],\n        );\n\n        return <Input {...search} />;\n      }\n\n      function ControlledInputWithNativeInput({ searchSomething }) {\n        const search = useFormInput();\n\n        useEffect(\n          () => {\n            searchSomething(search.value);\n          },\n          [search.value],\n        );\n\n        return <input {...search} />;\n      }\n\n      it('work with native input', () => {\n        const spy = sinon.spy();\n        const wrapper = Wrap(<ControlledInputWithNativeInput searchSomething={spy} />);\n        wrapper.find('input').invoke('onChange')({ target: { value: 'foo' } });\n\n        expect(spy.withArgs('foo')).to.have.property('callCount', 1);\n      });\n\n      it('work with custom wrapped Input', () => {\n        const spy = sinon.spy();\n        const wrapper = Wrap(<ControlledInputWithEnhancedInput searchSomething={spy} />);\n        const input = wrapper.find('Input');\n        input.invoke('onChange')({ target: { value: 'foo' } });\n        expect(spy.withArgs('foo')).to.have.property('callCount', 1);\n      });\n\n      it('work with custom wrapped input', () => {\n        const spy = sinon.spy();\n        const wrapper = Wrap(<ControlledInputWithEnhancedInput searchSomething={spy} />);\n        const input = wrapper.find('input');\n        input.invoke('onChange')({ target: { value: 'foo' } });\n        expect(spy.withArgs('foo')).to.have.property('callCount', 1);\n      });\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/hooks/useCallback.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\n\nimport {\n  describeIf,\n  itIf,\n} from '../../_helpers';\n\nimport {\n  useCallback,\n} from '../../_helpers/react-compat';\n\nexport default function describeUseCallback({\n  hasHooks,\n  Wrap,\n  isShallow,\n}) {\n  describeIf(hasHooks, 'hooks: useCallback', () => {\n    function RendersNull() {\n      return null;\n    }\n\n    function ComponentUsingCallbackHook({ onChange }) {\n      const callback = useCallback((value) => onChange(value), [onChange]);\n      return (\n        <RendersNull callback={callback} />\n      );\n    }\n\n    function ComponentUsingCallbackHookWithRelatedProp({ onChange, relatedProp }) {\n      const callback = useCallback((value) => onChange(value), [onChange, relatedProp]);\n      return (\n        <RendersNull callback={callback} />\n      );\n    }\n\n    // TODO: fix pending https://github.com/facebook/react/issues/15774\n    itIf(!isShallow, 'get same callback when using `useCallback` and rerender with same prop in dependencies', () => {\n      const onChange = () => {};\n      const wrapper = Wrap(<ComponentUsingCallbackHook onChange={onChange} />);\n      const initialCallback = wrapper.find(RendersNull).prop('callback');\n\n      wrapper.setProps({ unRelatedProp: '123' });\n\n      const nextCallback = wrapper.find(RendersNull).prop('callback');\n      expect(initialCallback).to.equal(nextCallback);\n    });\n\n    it('get different callback when using `useCallback` and rerender with different prop in dependencies', () => {\n      const onChange = () => {};\n      const wrapper = Wrap(<ComponentUsingCallbackHookWithRelatedProp onChange={onChange} relatedProp=\"456\" />);\n      const initialCallback = wrapper.find(RendersNull).prop('callback');\n\n      wrapper.setProps({ relatedProp: '123' });\n\n      const nextCallback = wrapper.find(RendersNull).prop('callback');\n      expect(initialCallback).not.to.equal(nextCallback);\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/hooks/useContext.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\n\nimport {\n  describeIf,\n  itIf,\n} from '../../_helpers';\n\nimport {\n  useContext,\n  useState,\n  createContext,\n} from '../../_helpers/react-compat';\n\nexport default function describeUseContext({\n  hasHooks,\n  Wrap,\n  isShallow,\n}) {\n  describeIf(hasHooks, 'hooks: useContext', () => {\n    describe('simple example', () => {\n      const initialTitle = 'initialTitle';\n      const TitleContext = createContext && createContext(initialTitle);\n\n      function UiComponent() {\n        const title = useContext(TitleContext);\n        return (\n          <div>\n            {title}\n          </div>\n        );\n      }\n\n      const customTitle = 'CustomTitle';\n\n      function App() {\n        return (\n          <TitleContext.Provider value={customTitle}>\n            <UiComponent />\n          </TitleContext.Provider>\n        );\n      }\n\n      it('render ui component with initial context value', () => {\n        const wrapper = Wrap(<UiComponent />);\n        expect(wrapper.text()).to.equal(initialTitle);\n      });\n\n      // TODO: useContext: enable when shallow dive supports createContext\n      itIf(!isShallow, 'render ui component with value from outer provider', () => {\n        const wrapper = Wrap(<App />);\n        const subWrapper = isShallow ? wrapper.dive().dive() : wrapper;\n        expect(subWrapper.text()).to.equal(customTitle);\n      });\n    });\n\n    // TODO: useContext: enable when shallow dive supports createContext\n    describeIf(!isShallow, 'useContext: with Setting', () => {\n      const initialState = 10;\n      const context = createContext && createContext(null);\n\n      function MyGrandChild() {\n        const myContextVal = useContext(context);\n\n        const increment = () => {\n          myContextVal.setState(myContextVal.state + 1);\n        };\n\n        return (\n          <div>\n            <button type=\"button\" onClick={increment}>increment</button>\n            <span className=\"grandChildState\">\n              {myContextVal.state}\n            </span>\n          </div>\n        );\n      }\n\n      function MyChild() {\n        return (\n          <div>\n            <MyGrandChild />\n          </div>\n        );\n      }\n\n      function App() {\n        const [state, setState] = useState(initialState);\n\n        return (\n          <context.Provider value={{ state, setState }}>\n            <div>\n              <MyChild />\n            </div>\n          </context.Provider>\n        );\n      }\n\n      it('test render, get and set context value ', () => {\n        const wrapper = Wrap(<App />);\n\n        function getChild() {\n          const child = wrapper.find(MyChild);\n          return isShallow ? child.dive() : child;\n        }\n        function getGrandChild() {\n          const grandchild = getChild().find(MyGrandChild);\n          return isShallow ? grandchild.dive() : grandchild;\n        }\n        expect(getGrandChild().find('.grandChildState').debug()).to.equal(`<span className=\"grandChildState\">\n  ${String(initialState)}\n</span>`);\n\n        getGrandChild().find('button').props().onClick();\n        wrapper.update();\n        expect(getGrandChild().find('.grandChildState').debug()).to.equal(`<span className=\"grandChildState\">\n  ${String(initialState + 1)}\n</span>`);\n      });\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/hooks/useDebugValue.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\nimport sinon from 'sinon';\n\nimport {\n  describeIf,\n} from '../../_helpers';\n\nimport {\n  useDebugValue,\n} from '../../_helpers/react-compat';\n\nexport default function describeUseDebugValue({\n  hasHooks,\n  Wrap,\n}) {\n  // TODO: `useDebugValue`: test using react debug tools, verify it actually works, and try to add it to `.debug`\n  describeIf(hasHooks, 'hooks: useDebugValue', () => {\n    function ComponentUsingDebugValue({ value }) {\n      useDebugValue(`debug value: ${value}`);\n\n      return (<div>{value}</div>);\n    }\n\n    function ComponentUsingDebugValueAndCallback({ value, fn = (x) => `debug value: ${x}` }) {\n      useDebugValue(value, fn);\n\n      return (<div>{value}</div>);\n    }\n\n    it('can render component using useDebugValue', () => {\n      const value = 'foo';\n      const wrapper = Wrap(<ComponentUsingDebugValue value={value} />);\n      expect(wrapper.find('div').prop('children')).to.equal(value);\n    });\n\n    it('can render component using useDebugValue and callback', () => {\n      const value = 'foo';\n      const spy = sinon.spy();\n      const wrapper = Wrap(<ComponentUsingDebugValueAndCallback value={value} fn={spy} />);\n      expect(wrapper.find('div').prop('children')).to.equal(value);\n      expect(spy).to.have.property('callCount', 0);\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/hooks/useEffect.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\nimport sinon from 'sinon-sandbox';\n\nimport {\n  describeIf,\n  itIf,\n} from '../../_helpers';\nimport {\n  is,\n} from '../../_helpers/version';\nimport {\n  useEffect,\n  useState,\n  Fragment,\n} from '../../_helpers/react-compat';\n\nexport default function describeUseEffect({\n  hasHooks,\n  Wrap,\n  isShallow,\n}) {\n  // TODO: enable when the shallow renderer fixes its bug, see https://github.com/facebook/react/issues/15275.\n  describeIf(hasHooks && !isShallow, 'hooks: useEffect', () => {\n    const timeout = 100;\n    function ComponentUsingEffectHook() {\n      const [ctr, setCtr] = useState(0);\n      useEffect(() => {\n        setCtr(1);\n        setTimeout(() => {\n          setCtr(2);\n        }, timeout);\n      }, []);\n      return (\n        <div>\n          {ctr}\n        </div>\n      );\n    }\n\n    it('works', (done) => {\n      const wrapper = Wrap(<ComponentUsingEffectHook />);\n\n      expect(wrapper.debug()).to.equal(\n        isShallow\n          ? `<div>\n  1\n</div>`\n          : `<ComponentUsingEffectHook>\n  <div>\n    1\n  </div>\n</ComponentUsingEffectHook>`,\n      );\n\n      setTimeout(() => {\n        wrapper.update();\n        expect(wrapper.debug()).to.equal(\n          isShallow\n            ? `<div>\n  2\n</div>`\n            : `<ComponentUsingEffectHook>\n  <div>\n    2\n  </div>\n</ComponentUsingEffectHook>`,\n        );\n        done();\n      }, timeout + 1);\n    });\n\n    describe('with mount effect', () => {\n      const didMountCount = 9;\n\n      function FooCounterWithMountEffect({ initialCount = 0 }) {\n        const [count, setCount] = useState(+initialCount);\n\n        useEffect(() => {\n          setCount(didMountCount);\n        }, []);\n        return (\n          <Fragment>\n            <span className=\"counter\">\n              {count}\n            </span>\n          </Fragment>\n        );\n      }\n\n      it('initial render after did mount effect', () => {\n        const wrapper = Wrap(<FooCounterWithMountEffect />);\n        expect(wrapper.find('.counter').text()).to.equal(String(didMountCount));\n      });\n    });\n\n    describe('with async effect', () => {\n      it('works with `useEffect`', (done) => {\n        const wrapper = Wrap(<ComponentUsingEffectHook />);\n\n        expect(wrapper.debug()).to.equal(\n          isShallow\n            ? `<div>\n  1\n</div>`\n            : `<ComponentUsingEffectHook>\n  <div>\n    1\n  </div>\n</ComponentUsingEffectHook>`,\n        );\n\n        setTimeout(() => {\n          wrapper.update();\n          expect(wrapper.debug()).to.equal(\n            isShallow\n              ? `<div>\n  2\n</div>`\n              : `<ComponentUsingEffectHook>\n  <div>\n    2\n  </div>\n</ComponentUsingEffectHook>`,\n          );\n          done();\n        }, timeout + 1);\n      });\n    });\n\n    it('will receive Props', () => {\n      function Foo(props) {\n        const [fooVal, setFooVal] = useState('');\n        const { initialFooVal } = props;\n        useEffect(() => {\n          setFooVal(initialFooVal);\n        }, [initialFooVal]);\n\n        return (\n          <div>\n            <p>{fooVal}</p>\n          </div>\n        );\n      }\n\n      const wrapper = Wrap(<Foo />);\n      wrapper.setProps({ initialFooVal: 'hey' });\n      expect(wrapper.find('p').text()).to.equal('hey');\n    });\n\n    describe('on componentDidUpdate & componentDidMount', () => {\n      const expectedCountString = (x) => `You clicked ${x} times`;\n\n      let setDocumentTitle;\n      function ClickCounterPage() {\n        const [count, setCount] = useState(0);\n\n        useEffect(() => {\n          setDocumentTitle(expectedCountString(count));\n        }, [count]);\n\n        return (\n          <div>\n            <p>You clicked {count} times</p>\n            <button type=\"button\" onClick={() => setCount(count + 1)}>\n              Click me\n            </button>\n          </div>\n        );\n      }\n\n      beforeEach(() => {\n        setDocumentTitle = sinon.stub();\n      });\n\n      it('on mount initial render', () => {\n        const wrapper = Wrap(<ClickCounterPage />);\n\n        expect(wrapper.find('p').text()).to.eq(expectedCountString(0));\n        expect(setDocumentTitle).to.have.property('callCount', 1);\n        expect(setDocumentTitle.args).to.deep.equal([[expectedCountString(0)]]);\n      });\n\n      it('on didupdate', () => {\n        const wrapper = Wrap(<ClickCounterPage />);\n\n        expect(setDocumentTitle).to.have.property('callCount', 1);\n        const [firstCall] = setDocumentTitle.args;\n        expect(firstCall).to.deep.equal([expectedCountString(0)]);\n        expect(wrapper.find('p').text()).to.equal(expectedCountString(0));\n\n        wrapper.find('button').invoke('onClick')();\n\n        expect(setDocumentTitle).to.have.property('callCount', 2);\n        const [, secondCall] = setDocumentTitle.args;\n        expect(secondCall).to.deep.equal([expectedCountString(1)]);\n        expect(wrapper.find('p').text()).to.equal(expectedCountString(1));\n\n        wrapper.find('button').invoke('onClick')();\n        wrapper.find('button').invoke('onClick')();\n\n        expect(setDocumentTitle).to.have.property('callCount', 4);\n        const [,,, fourthCall] = setDocumentTitle.args;\n        expect(fourthCall).to.deep.equal([expectedCountString(3)]);\n        expect(wrapper.find('p').text()).to.equal(expectedCountString(3));\n      });\n    });\n\n    describe('with cleanup Effect', () => {\n      let ChatAPI;\n\n      beforeEach(() => {\n        ChatAPI = {\n          subscribeToFriendStatus: sinon.stub(),\n          unsubscribeFromFriendStatus: sinon.stub(),\n        };\n      });\n\n      function FriendStatus({ friend = {} }) {\n        const [isOnline, setIsOnline] = useState(null);\n\n        function handleStatusChange(status) {\n          setIsOnline(status.isOnline);\n        }\n\n        useEffect(() => {\n          ChatAPI.subscribeToFriendStatus(friend.id, handleStatusChange);\n          return function cleanup() {\n            ChatAPI.unsubscribeFromFriendStatus(friend.id, handleStatusChange);\n          };\n        }, [isOnline]);\n\n        if (isOnline === null) {\n          return 'Loading...';\n        }\n        return isOnline ? 'Online' : 'Offline';\n      }\n\n      const friend = { id: 'enzyme' };\n\n      it('on initial mount', () => {\n        const wrapper = Wrap(<FriendStatus friend={friend} />);\n        expect(wrapper.debug()).to.equal(\n          `<FriendStatus friend={{...}}>\n  Loading...\n</FriendStatus>`,\n        );\n        expect(wrapper.html()).to.eql('Loading...');\n        expect(ChatAPI.subscribeToFriendStatus.calledOnceWith(friend.id)).to.equal(true);\n      });\n\n      it('simulate status Change', () => {\n        const wrapper = Wrap(<FriendStatus friend={friend} />);\n        const [[, simulateChange]] = ChatAPI.subscribeToFriendStatus.args;\n\n        simulateChange({ isOnline: true });\n\n        wrapper.update();\n        expect(wrapper.html()).to.eql('Online');\n      });\n\n      // TODO: figure out why this test is flaky. Perhaps unmount of useEffect is async?\n      itIf.skip(is('> 16.8.3'), 'cleanup on unmount', () => {\n        const wrapper = Wrap(<FriendStatus friend={friend} />);\n\n        wrapper.unmount();\n\n        expect(ChatAPI.unsubscribeFromFriendStatus).to.have.property('callCount', 1);\n        const [[firstArg]] = ChatAPI.unsubscribeFromFriendStatus.args;\n        expect(firstArg).to.equal(friend.id);\n      });\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/hooks/useImperativeHandle.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\nimport sinon from 'sinon-sandbox';\n\nimport {\n  describeIf,\n} from '../../_helpers';\n\nimport {\n  useImperativeHandle,\n  useRef,\n  forwardRef,\n} from '../../_helpers/react-compat';\n\nexport default function describeUseImperativeHandle({\n  hasHooks,\n  Wrap,\n  isShallow,\n}) {\n  describeIf(hasHooks, 'hooks: useImperativeHandle', () => {\n    function Computer({ compute }, ref) {\n      const computerRef = useRef({ compute });\n      useImperativeHandle(ref, () => ({\n        compute: () => {\n          computerRef.current.compute();\n        },\n      }));\n      return <div />;\n    }\n\n    const FancyComputer = forwardRef && forwardRef(Computer);\n\n    class ParentComputer extends React.Component {\n      componentDidMount() {\n        if (this.ref) {\n          this.ref.compute();\n        }\n      }\n\n      render() {\n        return <FancyComputer ref={(ref) => { this.ref = ref; }} {...this.props} />;\n      }\n    }\n\n    it('able to call method with imperative handle', () => {\n      const compute = sinon.spy();\n      Wrap(<ParentComputer compute={compute} />);\n\n      expect(compute).to.have.property('callCount', isShallow ? 0 : 1);\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/hooks/useLayoutEffect.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\n\nimport {\n  describeIf,\n  itIf,\n} from '../../_helpers';\n\nimport {\n  useLayoutEffect,\n  useState,\n} from '../../_helpers/react-compat';\n\nexport default function describeUseLayoutEffect({\n  hasHooks,\n  Wrap,\n  isShallow,\n}) {\n  describeIf(hasHooks, 'hooks: useLayoutEffect', () => {\n    function ComponentUsingLayoutEffectHook() {\n      const [ctr, setCtr] = useState(0);\n      useLayoutEffect(() => {\n        setCtr(1);\n        setTimeout(() => {\n          setCtr(2);\n        }, 100);\n      }, []);\n      return (\n        <div>\n          {ctr}\n        </div>\n      );\n    }\n\n    // TODO: enable when https://github.com/facebook/react/issues/15275 is fixed\n    itIf(!isShallow, 'works with `useLayoutEffect`', (done) => {\n      const wrapper = Wrap(<ComponentUsingLayoutEffectHook />);\n\n      expect(wrapper.debug()).to.equal(isShallow\n        ? `<div>\n  1\n</div>`\n        : `<ComponentUsingLayoutEffectHook>\n  <div>\n    1\n  </div>\n</ComponentUsingLayoutEffectHook>`);\n\n      setTimeout(() => {\n        wrapper.update();\n        expect(wrapper.debug()).to.equal(isShallow\n          ? `<div>\n  2\n</div>`\n          : `<ComponentUsingLayoutEffectHook>\n  <div>\n    2\n  </div>\n</ComponentUsingLayoutEffectHook>`);\n        done();\n      }, 100);\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/hooks/useMemo.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\n\nimport {\n  describeIf,\n} from '../../_helpers';\n\nimport {\n  useMemo,\n} from '../../_helpers/react-compat';\n\nexport default function describeUseMemo({\n  hasHooks,\n  Wrap,\n}) {\n  describeIf(hasHooks, 'hooks: useMemo', () => {\n    function RendersNull() {\n      return null;\n    }\n\n    it('get same value when using `useMemo` and rerender with same prop in dependencies', () => {\n      function ComponentUsingMemoHook(props) {\n        const { count } = props;\n        const memoized = useMemo(() => ({ result: count * 2 }), [count]);\n        return (\n          <RendersNull memoized={memoized} />\n        );\n      }\n      const wrapper = Wrap(<ComponentUsingMemoHook count={1} />);\n      const initialValue = wrapper.find(RendersNull).prop('memoized');\n      wrapper.setProps({ unRelatedProp: '123' });\n      const nextValue = wrapper.find(RendersNull).prop('memoized');\n      expect(initialValue).to.equal(nextValue);\n    });\n\n    it('get different value when using `useMemo` and rerender with different prop in dependencies', () => {\n      function ComponentUsingMemoHook(props) {\n        const { count, relatedProp } = props;\n        const memoized = useMemo(() => ({ result: count * 2 }), [count, relatedProp]);\n        return (\n          <RendersNull memoized={memoized} relatedProp={relatedProp} />\n        );\n      }\n      const wrapper = Wrap(<ComponentUsingMemoHook relatedProp=\"456\" count={1} />);\n      const initialValue = wrapper.find(RendersNull).prop('memoized');\n      wrapper.setProps({ relatedProp: '123' });\n      const nextValue = wrapper.find(RendersNull).prop('memoized');\n      expect(initialValue).not.to.equal(nextValue);\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/hooks/useReducer.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\n\nimport { describeIf } from '../../_helpers';\n\nimport { useReducer } from '../../_helpers/react-compat';\n\nexport default function describeUseReducer({\n  hasHooks,\n  Wrap,\n}) {\n  describeIf(hasHooks, 'hooks: useReducer', () => {\n    describe('with custom dispatch', () => {\n      const initialState = [];\n\n      function Child({ dispatch, text }) {\n        function fire() {\n          dispatch({\n            type: 'ADD_TEXT',\n            payload: text,\n          });\n        }\n\n        return <button type=\"button\" onClick={fire}>Add {text}</button>;\n      }\n\n      function reducer(state, action) {\n        switch (action.type) {\n          case 'ADD_TEXT':\n            return [...state, action.payload];\n          default:\n            throw new Error();\n        }\n      }\n\n      function FooBarTextList() {\n        const [state, dispatch] = useReducer(reducer, initialState);\n\n        return (\n          <div className=\"FooBarTextList\">\n            <Child text=\"foo\" dispatch={dispatch} />\n            <Child text=\"bar\" dispatch={dispatch} />\n            {state.map((text) => (\n              <p key={text}>{text}</p>\n            ))}\n          </div>\n        );\n      }\n\n      it('render with initial state from useReducer', () => {\n        const wrapper = Wrap(<FooBarTextList />);\n        expect(wrapper.find('p')).to.have.lengthOf(0);\n      });\n\n      it('Test with Add Foo & Bar tex', () => {\n        const wrapper = Wrap(<FooBarTextList />);\n        expect(wrapper.find('p')).to.have.lengthOf(0);\n        wrapper.find('Child').at(0).props().dispatch({\n          type: 'ADD_TEXT',\n          payload: 'foo',\n        });\n        wrapper.update();\n\n        expect(wrapper.find('p')).to.have.lengthOf(1);\n        expect(wrapper.find('p').at(0).text()).to.equal('foo');\n\n        wrapper.find('Child').at(1).props().dispatch({\n          type: 'ADD_TEXT',\n          payload: 'bar',\n        });\n        wrapper.update();\n        expect(wrapper.find('p')).to.have.length(2);\n        expect(wrapper.find('p').at(0).text()).to.equal('foo');\n        expect(wrapper.find('p').at(1).text()).to.equal('bar');\n      });\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/hooks/useRef.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\n\nimport {\n  describeIf,\n} from '../../_helpers';\n\nimport {\n  useRef,\n} from '../../_helpers/react-compat';\n\nexport default function describeUseRef({\n  hasHooks,\n  Wrap,\n}) {\n  describeIf(hasHooks, 'hooks: useRef', () => {\n    function ComponentUsingRef() {\n      const id = useRef(Math.floor(100 * Math.random()));\n      return (\n        <div>{id.current}</div>\n      );\n    }\n\n    it('`current` should be the same between two renders', () => {\n      const wrapper = Wrap(<ComponentUsingRef />);\n\n      const childBefore = wrapper.find('div').prop('children');\n      wrapper.setProps({ foo: 'bar' });\n      const childAfter = wrapper.find('div').prop('children');\n\n      expect(childBefore).to.equal(childAfter);\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/hooks/useState.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\n\nimport {\n  describeIf,\n  itIf,\n} from '../../_helpers';\n\nimport {\n  useState,\n  useEffect,\n  Fragment,\n} from '../../_helpers/react-compat';\n\nexport default function describeUseState({\n  hasHooks,\n  Wrap,\n  isShallow,\n}) {\n  describeIf(hasHooks, 'hooks: useState', () => {\n    function FooCounter({ initialCount: initial = 0 }) {\n      const [count, setCount] = useState(+initial);\n\n      return (\n        <Fragment>\n          <button className=\"increment\" type=\"button\" onClick={() => setCount(count + 1)}>-</button>\n          <span className=\"counter\">\n            {count}\n          </span>\n          <button className=\"decrement\" type=\"button\" onClick={() => setCount(count - 1)}>+</button>\n        </Fragment>\n      );\n    }\n\n    const initialCount = 5;\n\n    it('initial render', () => {\n      const wrapper = Wrap(<FooCounter initialCount={initialCount} />);\n      expect(wrapper.find('.counter').text()).to.equal(String(initialCount));\n    });\n\n    it('lets increment', () => {\n      const wrapper = Wrap(<FooCounter initialCount={initialCount} />);\n\n      wrapper.find('.increment').props().onClick();\n\n      expect(wrapper.find('.counter').text()).to.equal(String(initialCount + 1));\n    });\n\n    it('now decrement', () => {\n      const wrapper = Wrap(<FooCounter initialCount={initialCount} />);\n\n      wrapper.find('.decrement').props().onClick();\n\n      expect(wrapper.find('.counter').text()).to.equal(String(initialCount - 1));\n    });\n\n    it('handles useState', () => {\n      function ComponentUsingStateHook() {\n        const [count] = useState(0);\n        return <div>{count}</div>;\n      }\n\n      const wrapper = Wrap(<ComponentUsingStateHook />);\n\n      expect(wrapper.find('div').length).to.equal(1);\n      expect(wrapper.find('div').text()).to.equal('0');\n    });\n\n    it('handles setState returned from useState', () => {\n      function ComponentUsingStateHook() {\n        const [count, setCount] = useState(0);\n        return <div onClick={() => setCount(count + 1)}>{count}</div>;\n      }\n\n      const wrapper = Wrap(<ComponentUsingStateHook />);\n      const div = wrapper.find('div');\n      const setCount = div.prop('onClick');\n      setCount();\n      wrapper.update();\n\n      expect(wrapper.find('div').text()).to.equal('1');\n    });\n\n    describe('useState with willReceive prop effect / simulate getDerivedStateFromProp', () => {\n      const newPropCount = 10;\n\n      function FooCounterWithEffect({ initialCount: initial = 0 }) {\n        const [count, setCount] = useState(+initial);\n\n        useEffect(() => {\n          setCount(initial);\n        }, [initial]);\n\n        return (\n          <Fragment>\n            <span className=\"counter\">\n              {count}\n            </span>\n          </Fragment>\n        );\n      }\n\n      // TODO: fixme when useEffect works in the shallow renderer, see https://github.com/facebook/react/issues/15275\n      itIf(!isShallow, 'initial render & new Props', () => {\n        const wrapper = Wrap(<FooCounterWithEffect initialCount={initialCount} />);\n        expect(wrapper.find('.counter').text()).to.equal(String(initialCount));\n\n        wrapper.setProps({ initialCount: newPropCount });\n        expect(wrapper.find('.counter').text()).to.equal(String(newPropCount));\n      });\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/lifecycles/componentDidCatch.jsx",
    "content": "import React from 'react';\nimport sinon from 'sinon-sandbox';\nimport { expect } from 'chai';\n\nimport { is } from '../../_helpers/version';\nimport {\n  describeIf,\n  itIf,\n} from '../../_helpers';\nimport {\n  Fragment,\n} from '../../_helpers/react-compat';\n\nexport default function describeCDC({\n  Wrap,\n  isShallow,\n}) {\n  describeIf(is('>= 16'), 'componentDidCatch', () => {\n    describe('errors inside an error boundary', () => {\n      const errorToThrow = new EvalError('threw an error!');\n      // in React 16.0 - 16.2 and 16.9+, and some older nodes, the actual error thrown isn't reported.\n      const reactError = new Error('An error was thrown inside one of your components, but React doesn\\'t know what it was. This is likely due to browser flakiness. React does its best to preserve the \"Pause on exceptions\" behavior of the DevTools, which requires some DEV-mode only tricks. It\\'s possible that these don\\'t work in your browser. Try triggering the error in production mode, or switching to a modern browser. If you suspect that this is actually an issue with React, please file an issue.');\n      const properErrorMessage = (error) => error instanceof Error && (\n        error.message === errorToThrow.message\n          || error.message === reactError.message\n      );\n\n      const hasFragments = is('>= 16.2');\n      const MaybeFragment = hasFragments ? Fragment : 'main';\n\n      function Thrower({ throws }) {\n        if (throws) {\n          throw errorToThrow;\n        }\n        return null;\n      }\n\n      class ErrorBoundary extends React.Component {\n        constructor(...args) {\n          super(...args);\n          this.state = {\n            throws: false,\n            didThrow: false,\n          };\n        }\n\n        componentDidCatch(error, info) {\n          const { spy } = this.props;\n          spy(error, info);\n          this.setState({\n            throws: false,\n            didThrow: true,\n          });\n        }\n\n        render() {\n          const { ThrowerComponent } = this.props;\n          const {\n            didThrow,\n            throws,\n          } = this.state;\n          return (\n            <div>\n              <MaybeFragment>\n                <span>\n                  {<ThrowerComponent throws={throws} />}\n                  <div>\n                    {didThrow ? 'HasThrown' : 'HasNotThrown'}\n                  </div>\n                </span>\n              </MaybeFragment>\n            </div>\n          );\n        }\n      }\n\n      ErrorBoundary.defaultProps = {\n        ThrowerComponent: Thrower,\n      };\n\n      function ErrorSFC(props) {\n        return <ErrorBoundary {...props} />;\n      }\n\n      describe('Thrower', () => {\n        it('does not throw when `throws` is `false`', () => {\n          expect(() => Wrap(<Thrower throws={false} />)).not.to.throw();\n        });\n\n        itIf(isShallow, 'throws when `throws` is `true`', () => {\n          expect(() => Wrap(<Thrower throws />)).to.throw(errorToThrow);\n        });\n\n        itIf(!isShallow, 'throws when `throws` is `true`', () => {\n          expect(() => Wrap(<Thrower throws />)).to.throw();\n          try {\n            Wrap(<Thrower throws />);\n            expect(true).to.equal(false, 'this line should not be reached');\n          } catch (e) {\n            expect(e).to.satisfy(properErrorMessage);\n          }\n        });\n      });\n\n      it('catches a simulated error', () => {\n        const spy = sinon.spy();\n        const wrapper = Wrap(<ErrorBoundary spy={spy} />);\n\n        expect(spy).to.have.property('callCount', 0);\n\n        expect(() => wrapper.find(Thrower).simulateError(errorToThrow)).not.to.throw();\n\n        expect(spy).to.have.property('callCount', 1);\n\n        expect(spy.args).to.be.an('array').and.have.lengthOf(1);\n        const [[actualError, info]] = spy.args;\n        expect(() => { throw actualError; }).to.throw(errorToThrow);\n        expect(info).to.deep.equal({\n          componentStack: `\n    in Thrower (created by ErrorBoundary)\n    in span (created by ErrorBoundary)${hasFragments ? '' : `\n    in main (created by ErrorBoundary)`}\n    in div (created by ErrorBoundary)\n    in ErrorBoundary (created by WrapperComponent)\n    in WrapperComponent`,\n        });\n      });\n\n      itIf(\n        is('>= 16.6'),\n        'catches a simulated error on memo() component',\n        () => {\n          const MemoThrower = React.memo(Thrower);\n          const spy = sinon.spy();\n          const wrapper = Wrap(\n            <ErrorBoundary spy={spy} ThrowerComponent={MemoThrower} />,\n          );\n\n          expect(spy).to.have.property('callCount', 0);\n\n          expect(() => wrapper.find(Thrower).simulateError(errorToThrow)).not.to.throw();\n\n          expect(spy).to.have.property('callCount', 1);\n\n          expect(spy.args).to.be.an('array').and.have.lengthOf(1);\n          const [[actualError, info]] = spy.args;\n          expect(() => {\n            throw actualError;\n          }).to.throw(errorToThrow);\n          expect(info).to.deep.equal({\n            componentStack: `\n    in Memo(Thrower) (created by ErrorBoundary)\n    in span (created by ErrorBoundary)${hasFragments ? '' : `\n    in main (created by ErrorBoundary)`}\n    in div (created by ErrorBoundary)\n    in ErrorBoundary (created by WrapperComponent)\n    in WrapperComponent`,\n          });\n        },\n      );\n\n      it('rerenders on a simulated error', () => {\n        const wrapper = Wrap(<ErrorBoundary spy={sinon.stub()} />);\n\n        expect(wrapper.find({ children: 'HasThrown' })).to.have.lengthOf(0);\n        expect(wrapper.find({ children: 'HasNotThrown' })).to.have.lengthOf(1);\n\n        expect(() => wrapper.find(Thrower).simulateError(errorToThrow)).not.to.throw();\n\n        expect(wrapper.find({ children: 'HasThrown' })).to.have.lengthOf(1);\n        expect(wrapper.find({ children: 'HasNotThrown' })).to.have.lengthOf(0);\n      });\n\n      itIf(isShallow, 'does not catch errors during Wrapper render', () => {\n        const spy = sinon.spy();\n        const wrapper = Wrap(<ErrorBoundary spy={spy} />);\n\n        expect(spy).to.have.property('callCount', 0);\n\n        wrapper.setState({ throws: true });\n\n        expect(spy).to.have.property('callCount', 0);\n\n        const thrower = wrapper.find(Thrower);\n        expect(thrower).to.have.lengthOf(1);\n        expect(thrower.props()).to.have.property('throws', true);\n\n        expect(() => thrower.dive()).to.throw(errorToThrow);\n\n        expect(spy).to.have.property('callCount', 0);\n\n        expect(wrapper.find({ children: 'HasThrown' })).to.have.lengthOf(0);\n        expect(wrapper.find({ children: 'HasNotThrown' })).to.have.lengthOf(1);\n      });\n\n      describeIf(!isShallow, 'descendant components', () => {\n        it('rerenders on a simulated error with an SFC root', () => {\n          const wrapper = Wrap(<ErrorSFC spy={sinon.stub()} />);\n\n          expect(wrapper.find({ children: 'HasThrown' })).to.have.lengthOf(0);\n          expect(wrapper.find({ children: 'HasNotThrown' })).to.have.lengthOf(1);\n\n          expect(() => wrapper.find(Thrower).simulateError(errorToThrow)).not.to.throw();\n\n          expect(wrapper.find({ children: 'HasThrown' })).to.have.lengthOf(1);\n          expect(wrapper.find({ children: 'HasNotThrown' })).to.have.lengthOf(0);\n        });\n\n        it('catches errors during render', () => {\n          const spy = sinon.spy();\n          const wrapper = Wrap(<ErrorBoundary spy={spy} />);\n\n          expect(spy).to.have.property('callCount', 0);\n\n          wrapper.setState({ throws: true });\n\n          expect(spy).to.have.property('callCount', 1);\n\n          expect(spy.args).to.be.an('array').and.have.lengthOf(1);\n          const [[actualError, info]] = spy.args;\n          expect(actualError).to.satisfy(properErrorMessage);\n          expect(info).to.deep.equal({\n            componentStack: `\n    in Thrower (created by ErrorBoundary)\n    in span (created by ErrorBoundary)${hasFragments ? '' : `\n    in main (created by ErrorBoundary)`}\n    in div (created by ErrorBoundary)\n    in ErrorBoundary (created by WrapperComponent)\n    in WrapperComponent`,\n          });\n        });\n\n        it('works when the root is an SFC', () => {\n          const spy = sinon.spy();\n          const wrapper = Wrap(<ErrorSFC spy={spy} />);\n\n          expect(spy).to.have.property('callCount', 0);\n\n          wrapper.find(ErrorBoundary).setState({ throws: true });\n\n          expect(spy).to.have.property('callCount', 1);\n\n          expect(spy.args).to.be.an('array').and.have.lengthOf(1);\n          const [[actualError, info]] = spy.args;\n          expect(actualError).to.satisfy(properErrorMessage);\n          expect(info).to.deep.equal({\n            componentStack: `\n    in Thrower (created by ErrorBoundary)\n    in span (created by ErrorBoundary)${hasFragments ? '' : `\n    in main (created by ErrorBoundary)`}\n    in div (created by ErrorBoundary)\n    in ErrorBoundary (created by ErrorSFC)\n    in ErrorSFC (created by WrapperComponent)\n    in WrapperComponent`,\n          });\n        });\n      });\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/lifecycles/componentDidMount.jsx",
    "content": "import React from 'react';\nimport sinon from 'sinon-sandbox';\nimport { expect } from 'chai';\n\nexport default function describeCDM({\n  Wrap,\n}) {\n  describe('componentDidUpdate()', () => {\n    it('does not call `componentDidMount` twice when a child component is created', () => {\n      const spy = sinon.spy();\n\n      class Foo extends React.Component {\n        constructor(props) {\n          super(props);\n          this.state = {\n            foo: 'init',\n          };\n        }\n\n        componentDidMount() {\n          spy('componentDidMount');\n        }\n\n        render() {\n          spy('render');\n\n          const { foo } = this.state;\n          return (\n            <div>\n              <button type=\"button\" onClick={() => this.setState({ foo: 'update2' })}>\n                click\n              </button>\n              {foo}\n            </div>\n          );\n        }\n      }\n\n      const wrapper = Wrap(<Foo />);\n      expect(spy.args).to.eql([\n        ['render'],\n        ['componentDidMount'],\n      ]);\n      spy.resetHistory();\n\n      wrapper.find('button').prop('onClick')();\n      expect(spy).to.have.property('callCount', 1);\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/lifecycles/componentDidUpdate.jsx",
    "content": "import React from 'react';\nimport sinon from 'sinon-sandbox';\nimport { expect } from 'chai';\nimport isEqual from 'lodash.isequal';\n\nimport {\n  PureComponent,\n} from '../../_helpers/react-compat';\nimport {\n  describeIf,\n  argSpy,\n  expectArgs,\n} from '../../_helpers';\nimport {\n  is,\n} from '../../_helpers/version';\n\nexport default function describeCDU({\n  Wrap,\n  isShallow,\n}) {\n  describe('componentDidUpdate()', () => {\n    it('calls `componentDidUpdate` when component’s `setState` is called', () => {\n      const spy = sinon.spy();\n\n      class Foo extends React.Component {\n        constructor(props) {\n          super(props);\n          this.state = {\n            foo: 'init',\n          };\n        }\n\n        componentDidUpdate() {\n          spy('componentDidUpdate');\n        }\n\n        onChange() {\n          // enzyme can't handle the update because `this` is a ReactComponent instance,\n          // not a ShallowWrapper instance.\n          this.setState({ foo: 'onChange update' });\n        }\n\n        render() {\n          spy('render');\n          const { foo } = this.state;\n          return <div>{foo}</div>;\n        }\n      }\n\n      const wrapper = Wrap(<Foo />);\n      spy.resetHistory();\n\n      wrapper.setState({ foo: 'wrapper setState update' });\n      expect(wrapper.state('foo')).to.equal('wrapper setState update');\n      expect(spy.args).to.eql([\n        ['render'],\n        ['componentDidUpdate'],\n      ]);\n      spy.resetHistory();\n\n      wrapper.instance().onChange();\n      expect(wrapper.state('foo')).to.equal('onChange update');\n      expect(spy.args).to.eql([\n        ['render'],\n        ['componentDidUpdate'],\n      ]);\n    });\n\n    it('calls `componentDidUpdate` when component’s `setState` is called through a bound method', () => {\n      const spy = sinon.spy();\n\n      class Foo extends React.Component {\n        constructor(props) {\n          super(props);\n          this.state = {\n            foo: 'init',\n          };\n          this.onChange = this.onChange.bind(this);\n        }\n\n        componentDidUpdate() {\n          spy('componentDidUpdate');\n        }\n\n        onChange() {\n          // enzyme can't handle the update because `this` is a ReactComponent instance,\n          // not a ShallowWrapper instance.\n          this.setState({ foo: 'onChange update' });\n        }\n\n        render() {\n          spy('render');\n          const { foo } = this.state;\n          return (\n            <div>\n              {foo}\n              <button type=\"button\" onClick={this.onChange}>click</button>\n            </div>\n          );\n        }\n      }\n\n      const wrapper = Wrap(<Foo />);\n      spy.resetHistory();\n\n      wrapper.find('button').prop('onClick')();\n      expect(wrapper.state('foo')).to.equal('onChange update');\n      expect(spy.args).to.eql([\n        ['render'],\n        ['componentDidUpdate'],\n      ]);\n    });\n\n    it('calls `componentDidUpdate` when component’s `setState` is called', () => {\n      const spy = sinon.spy();\n\n      class Foo extends React.Component {\n        constructor(props) {\n          super(props);\n          this.state = {\n            foo: 'init',\n          };\n          this.update = () => this.setState({ foo: 'update' });\n        }\n\n        componentDidMount() {\n          spy('componentDidMount');\n          this.update();\n        }\n\n        componentDidUpdate() {\n          spy('componentDidUpdate');\n        }\n\n        render() {\n          spy('render');\n          const { foo } = this.state;\n          return <div>{foo}</div>;\n        }\n      }\n\n      const wrapper = Wrap(<Foo />);\n      expect(wrapper.state('foo')).to.equal('update');\n\n      expect(spy.args).to.eql([\n        ['render'],\n        ['componentDidMount'],\n        ['render'],\n        ['componentDidUpdate'],\n      ]);\n    });\n\n    describeIf(is('>= 15.3'), 'PureComponent', () => {\n      let spy;\n      beforeEach(() => {\n        spy = argSpy();\n      });\n\n      it('does not update when state and props did not change', () => {\n        class Foo extends PureComponent {\n          constructor(props) {\n            super(props);\n            this.state = {\n              foo: 'init',\n            };\n          }\n\n          componentDidUpdate() {\n            spy('componentDidUpdate');\n          }\n\n          render() {\n            spy('render');\n            const { foo } = this.state;\n            return <div>{foo}</div>;\n          }\n        }\n\n        const wrapper = Wrap(<Foo id={1} />);\n        expectArgs(spy, 1, [\n          ['render'],\n        ]);\n\n        wrapper.setState({ foo: 'update' });\n        expectArgs(spy, 2, [\n          ['render'],\n          ['componentDidUpdate'],\n        ]);\n\n        wrapper.setState({ foo: 'update' });\n        expectArgs(spy, 3, []);\n\n        wrapper.setProps({ id: 2 });\n        expectArgs(spy, 4, [\n          ['render'],\n          ['componentDidUpdate'],\n        ]);\n\n        wrapper.setProps({ id: 2 });\n        expectArgs(spy, 5, []);\n      });\n\n      class Test extends PureComponent {\n        constructor(...args) {\n          super(...args);\n\n          this.state = { a: { b: { c: 1 } } };\n        }\n\n        componentDidUpdate() {\n          spy('componentDidUpdate');\n          const { onUpdate } = this.props;\n          onUpdate();\n        }\n\n        setDeepEqualState() {\n          this.setState({ a: { b: { c: 1 } } });\n        }\n\n        setDeepDifferentState() {\n          this.setState({ a: { b: { c: 2 } } });\n        }\n\n        render() {\n          spy('render');\n          const { a: { b: { c } } } = this.state;\n          return <div>{c}</div>;\n        }\n      }\n\n      it('rerenders on setState when new state is !==, but deeply equal to existing state', () => {\n        const updateSpy = sinon.spy();\n        const wrapper = Wrap(<Test onUpdate={updateSpy} />);\n        wrapper.instance().setDeepEqualState();\n        expect(updateSpy).to.have.property('callCount', 1);\n      });\n\n      it('rerenders when setState is called with an object that doesnt have deep equality', () => {\n        const updateSpy = sinon.spy();\n        const wrapper = Wrap(<Test onUpdate={updateSpy} />);\n        wrapper.instance().setDeepDifferentState();\n        expect(updateSpy).to.have.property('callCount', 1);\n      });\n\n      it('does not infinitely loop when a PureComponent fires a noop setState in cDU', () => {\n        class Example extends PureComponent {\n          constructor(props) {\n            super(props);\n\n            this.renders = 0;\n            this.state = {\n              a: false,\n              b: false,\n            };\n          }\n\n          componentDidMount() {\n            spy('componentDidMount');\n            this.setState({ b: false });\n          }\n\n          componentDidUpdate() {\n            spy('componentDidUpdate');\n            this.setState({ b: false }); // eslint-disable-line react/no-did-update-set-state\n          }\n\n          render() {\n            spy('render');\n            this.renders += 1;\n            const { a, b } = this.state;\n            return <div>{`${a} ${b} ${this.renders}`}</div>;\n          }\n        }\n\n        const wrapper = Wrap(<Example />);\n        expect(wrapper.debug()).to.equal(isShallow\n          ? `<div>\n  false false 1\n</div>`\n          : `<Example>\n  <div>\n    false false 1\n  </div>\n</Example>`);\n      });\n    });\n\n    describe('Own PureComponent implementation', () => {\n      it('does not update when state and props did not change', () => {\n        const spy = argSpy();\n\n        class Foo extends React.Component {\n          constructor(props) {\n            super(props);\n            this.state = {\n              foo: 'init',\n            };\n          }\n\n          shouldComponentUpdate(nextProps, nextState) {\n            spy('shouldComponentUpdate');\n            return !isEqual(this.props, nextProps) || !isEqual(this.state, nextState);\n          }\n\n          componentDidUpdate() {\n            spy('componentDidUpdate');\n          }\n\n          render() {\n            spy('render');\n            const { foo } = this.state;\n            return <div>{foo}</div>;\n          }\n        }\n\n        const wrapper = Wrap(<Foo id={1} />);\n        expectArgs(spy, 1, [\n          ['render'],\n        ]);\n\n        wrapper.setState({ foo: 'update' });\n        expectArgs(spy, 2, [\n          ['shouldComponentUpdate'],\n          ['render'],\n          ['componentDidUpdate'],\n        ]);\n\n        wrapper.setState({ foo: 'update' });\n        expectArgs(spy, 3, [\n          ['shouldComponentUpdate'],\n        ]);\n\n        wrapper.setProps({ id: 2 });\n        expectArgs(spy, 4, [\n          ['shouldComponentUpdate'],\n          ['render'],\n          ['componentDidUpdate'],\n        ]);\n\n        wrapper.setProps({ id: 2 });\n        expectArgs(spy, 5, [\n          ['shouldComponentUpdate'],\n        ]);\n      });\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/lifecycles/componentWillUnmount.jsx",
    "content": "import React from 'react';\nimport sinon from 'sinon-sandbox';\nimport { expect } from 'chai';\n\nexport default function describeCWU({\n  Wrap,\n}) {\n  describe('componentWillUnmount', () => {\n    it('calls componentWillUnmount', () => {\n      const spy = sinon.spy();\n      class Foo extends React.Component {\n        componentWillUnmount() {\n          spy('componentWillUnmount');\n        }\n\n        render() {\n          spy('render');\n          return <div>foo</div>;\n        }\n      }\n      const wrapper = Wrap(<Foo />);\n      wrapper.unmount();\n      expect(spy.args).to.deep.equal([\n        ['render'],\n        ['componentWillUnmount'],\n      ]);\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/lifecycles/getDerivedStateFromError.jsx",
    "content": "import React from 'react';\nimport sinon from 'sinon-sandbox';\nimport { expect } from 'chai';\n\nimport { is } from '../../_helpers/version';\nimport {\n  describeIf,\n  itIf,\n} from '../../_helpers';\nimport {\n  Fragment,\n} from '../../_helpers/react-compat';\n\nexport default function describeCDC({\n  Wrap,\n  isShallow,\n}) {\n  describeIf(is('>= 16.6'), 'getDerivedStateFromError', () => {\n    const errorToThrow = new EvalError('threw an error!');\n    // in React 16.0 - 16.2 and 16.9+, and some older nodes, the actual error thrown isn't reported.\n    const reactError = new Error('An error was thrown inside one of your components, but React doesn\\'t know what it was. This is likely due to browser flakiness. React does its best to preserve the \"Pause on exceptions\" behavior of the DevTools, which requires some DEV-mode only tricks. It\\'s possible that these don\\'t work in your browser. Try triggering the error in production mode, or switching to a modern browser. If you suspect that this is actually an issue with React, please file an issue.');\n    const properErrorMessage = (error) => error instanceof Error && (\n      error.message === errorToThrow.message\n      || error.message === reactError.message\n    );\n\n    describe('errors inside an error boundary', () => {\n      function Thrower({ throws }) {\n        if (throws) {\n          throw errorToThrow;\n        }\n        return null;\n      }\n\n      function getErrorBoundary() {\n        return class ErrorBoundary extends React.Component {\n          static getDerivedStateFromError() {\n            return {\n              throws: false,\n              didThrow: true,\n            };\n          }\n\n          constructor(props) {\n            super(props);\n            this.state = {\n              throws: false,\n              didThrow: false,\n            };\n          }\n\n          render() {\n            const {\n              didThrow,\n              throws,\n            } = this.state;\n\n            return (\n              <div>\n                <Fragment>\n                  <span>\n                    <Thrower throws={throws} />\n                    <div>\n                      {didThrow ? 'HasThrown' : 'HasNotThrown'}\n                    </div>\n                  </span>\n                </Fragment>\n              </div>\n            );\n          }\n        };\n      }\n\n      function ErrorSFC({ component }) {\n        return component();\n      }\n\n      describe('Thrower', () => {\n        it('does not throw when `throws` is `false`', () => {\n          expect(() => Wrap(<Thrower throws={false} />)).not.to.throw();\n        });\n\n        it('throws when `throws` is `true`', () => {\n          expect(() => Wrap(<Thrower throws />)).to.throw();\n          try {\n            Wrap(<Thrower throws />);\n            expect(true).to.equal(false, 'this line should not be reached');\n          } catch (error) {\n            expect(error).to.satisfy(properErrorMessage);\n          }\n        });\n      });\n\n      it('catches a simulated error', () => {\n        const ErrorBoundary = getErrorBoundary();\n\n        const spy = sinon.spy(ErrorBoundary, 'getDerivedStateFromError');\n        const wrapper = Wrap(<ErrorBoundary />);\n\n        expect(spy).to.have.property('callCount', 0);\n\n        expect(() => wrapper.find(Thrower).simulateError(errorToThrow)).not.to.throw();\n\n        expect(spy).to.have.property('callCount', 1);\n\n        expect(spy.args).to.be.an('array').and.have.lengthOf(1);\n        const [[actualError]] = spy.args;\n        expect(actualError).to.equal(errorToThrow);\n      });\n\n      it('rerenders on a simulated error', () => {\n        const ErrorBoundary = getErrorBoundary();\n\n        const wrapper = Wrap(<ErrorBoundary />);\n\n        expect(wrapper.find({ children: 'HasThrown' })).to.have.lengthOf(0);\n        expect(wrapper.find({ children: 'HasNotThrown' })).to.have.lengthOf(1);\n\n        expect(() => wrapper.find(Thrower).simulateError(errorToThrow)).not.to.throw();\n\n        expect(wrapper.find({ children: 'HasThrown' })).to.have.lengthOf(1);\n        expect(wrapper.find({ children: 'HasNotThrown' })).to.have.lengthOf(0);\n      });\n\n      itIf(isShallow, 'does not catch errors during Wrapper render', () => {\n        const ErrorBoundary = getErrorBoundary();\n\n        const spy = sinon.spy(ErrorBoundary, 'getDerivedStateFromError');\n        const wrapper = Wrap(<ErrorBoundary />);\n\n        expect(spy).to.have.property('callCount', 0);\n\n        wrapper.setState({ throws: true });\n\n        expect(spy).to.have.property('callCount', 0);\n\n        const thrower = wrapper.find(Thrower);\n        expect(thrower).to.have.lengthOf(1);\n        expect(thrower.props()).to.have.property('throws', true);\n\n        expect(() => thrower.dive()).to.throw(errorToThrow);\n\n        expect(spy).to.have.property('callCount', 0);\n\n        expect(wrapper.find({ children: 'HasThrown' })).to.have.lengthOf(0);\n        expect(wrapper.find({ children: 'HasNotThrown' })).to.have.lengthOf(1);\n      });\n\n      describeIf(!isShallow, 'descendant components', () => {\n        it('rerenders on a simulated error with an SFC root', () => {\n          const ErrorBoundary = getErrorBoundary();\n\n          const wrapper = Wrap(<ErrorSFC component={() => <ErrorBoundary />} />);\n\n          expect(wrapper.find({ children: 'HasThrown' })).to.have.lengthOf(0);\n          expect(wrapper.find({ children: 'HasNotThrown' })).to.have.lengthOf(1);\n\n          expect(() => wrapper.find(Thrower).simulateError(errorToThrow)).not.to.throw();\n\n          expect(wrapper.find({ children: 'HasThrown' })).to.have.lengthOf(1);\n          expect(wrapper.find({ children: 'HasNotThrown' })).to.have.lengthOf(0);\n        });\n\n        it('catches errors during render', () => {\n          const ErrorBoundary = getErrorBoundary();\n\n          const spy = sinon.spy(ErrorBoundary, 'getDerivedStateFromError');\n          const wrapper = Wrap(<ErrorBoundary />);\n\n          expect(spy).to.have.property('callCount', 0);\n\n          wrapper.setState({ throws: true });\n\n          expect(spy).to.have.property('callCount', 1);\n\n          expect(spy.args).to.be.an('array').and.have.lengthOf(1);\n          const [[actualError]] = spy.args;\n          expect(actualError).to.satisfy(properErrorMessage);\n        });\n\n        it('works when the root is an SFC', () => {\n          const ErrorBoundary = getErrorBoundary();\n\n          const spy = sinon.spy(ErrorBoundary, 'getDerivedStateFromError');\n          const wrapper = Wrap(<ErrorSFC component={() => <ErrorBoundary />} />);\n\n          expect(spy).to.have.property('callCount', 0);\n\n          wrapper.find(ErrorBoundary).setState({ throws: true });\n\n          expect(spy).to.have.property('callCount', 1);\n\n          expect(spy.args).to.be.an('array').and.have.lengthOf(1);\n          const [[actualError]] = spy.args;\n          expect(actualError).to.satisfy(properErrorMessage);\n        });\n      });\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/lifecycles/getDerivedStateFromProps.jsx",
    "content": "import React from 'react';\nimport sinon from 'sinon-sandbox';\nimport { expect } from 'chai';\n\nimport { is } from '../../_helpers/version';\nimport {\n  describeIf,\n} from '../../_helpers';\n\nexport default function describeGDSFP({\n  Wrap,\n}) {\n  describeIf(is('>= 16.3'), 'getDerivedStateFromProps()', () => {\n    let spy;\n\n    beforeEach(() => { // eslint-disable-line mocha/no-top-level-hooks\n      spy = sinon.spy();\n    });\n\n    class Spy extends React.Component {\n      constructor(...args) {\n        super(...args);\n        this.state = { state: true }; // eslint-disable-line react/no-unused-state\n        spy('constructor');\n      }\n\n      shouldComponentUpdate(nextProps, nextState, nextContext) {\n        spy('shouldComponentUpdate', {\n          prevProps: this.props,\n          nextProps,\n          prevState: this.state,\n          nextState,\n          prevContext: this.context,\n          nextContext,\n        });\n        return true;\n      }\n\n      componentWillUpdate(nextProps, nextState, nextContext) {\n        spy('componentWillUpdate', {\n          prevProps: this.props,\n          nextProps,\n          prevState: this.state,\n          nextState,\n          prevContext: this.context,\n          nextContext,\n        });\n      }\n\n      componentDidUpdate(prevProps, prevState, prevContext) {\n        spy('componentDidUpdate', {\n          prevProps,\n          nextProps: this.props,\n          prevState,\n          nextState: this.state,\n          prevContext,\n          nextContext: this.context,\n        });\n      }\n\n      render() {\n        spy('render');\n        return null;\n      }\n    }\n\n    class CWRP extends Spy {\n      componentWillReceiveProps(nextProps, nextContext) {\n        spy('componentWillReceiveProps', {\n          prevProps: this.props,\n          nextProps,\n          prevState: this.state,\n          nextState: this.state,\n          prevContext: this.context,\n          nextContext,\n        });\n      }\n    }\n\n    class U_CWRP extends Spy {\n      UNSAFE_componentWillReceiveProps(nextProps) { // eslint-disable-line camelcase\n        spy('UNSAFE_componentWillReceiveProps', {\n          prevProps: this.props,\n          nextProps,\n          prevState: this.state,\n          nextState: this.state,\n          prevContext: this.context,\n          nextContext: undefined,\n        });\n      }\n    }\n\n    class GDSFP extends Spy {\n      static getDerivedStateFromProps(props, state) {\n        spy('getDerivedStateFromProps', { props, state });\n        return {};\n      }\n    }\n\n    it('calls cWRP when expected', () => {\n      const prevProps = { a: 1 };\n      const wrapper = Wrap(<CWRP {...prevProps} />);\n      expect(spy.args).to.deep.equal([\n        ['constructor'],\n        ['render'],\n      ]);\n      spy.resetHistory();\n\n      const foo = {};\n      const props = { foo };\n      const {\n        context: prevContext,\n        context: nextContext,\n        state: prevState,\n        state: nextState,\n      } = wrapper.instance();\n\n      wrapper.setProps(props);\n      const nextProps = { ...prevProps, ...props };\n\n      const data = {\n        prevProps,\n        nextProps,\n        prevState,\n        nextState,\n        prevContext,\n        nextContext,\n      };\n      expect(spy.args).to.deep.equal([\n        ['componentWillReceiveProps', data],\n        ['shouldComponentUpdate', data],\n        ['componentWillUpdate', data],\n        ['render'],\n        ['componentDidUpdate', {\n          ...data,\n          prevContext: is('>= 16') ? undefined : prevContext,\n        }],\n      ]);\n    });\n\n    it('calls UNSAFE_cWRP when expected', () => {\n      const prevProps = { a: 1 };\n      // eslint-disable-next-line react/jsx-pascal-case\n      const wrapper = Wrap(<U_CWRP {...prevProps} />);\n      expect(spy.args).to.deep.equal([\n        ['constructor'],\n        ['render'],\n      ]);\n      spy.resetHistory();\n\n      const foo = {};\n      const props = { foo };\n      const {\n        context: prevContext,\n        context: nextContext,\n        state: prevState,\n        state: nextState,\n      } = wrapper.instance();\n\n      wrapper.setProps(props);\n      const nextProps = { ...prevProps, ...props };\n\n      const data = {\n        prevProps,\n        nextProps,\n        prevState,\n        nextState,\n        prevContext,\n        nextContext,\n      };\n      expect(spy.args).to.deep.equal([\n        ['UNSAFE_componentWillReceiveProps', {\n          ...data,\n          nextContext: is('>= 16') ? undefined : nextContext,\n        }],\n        ['shouldComponentUpdate', data],\n        ['componentWillUpdate', data],\n        ['render'],\n        ['componentDidUpdate', {\n          ...data,\n          prevContext: is('>= 16') ? undefined : prevContext,\n        }],\n      ]);\n    });\n\n    it('calls gDSFP when expected', () => {\n      const prevProps = { a: 1 };\n      const state = { state: true };\n      const wrapper = Wrap(<GDSFP {...prevProps} />);\n      expect(spy.args).to.deep.equal([\n        ['constructor'],\n        ['getDerivedStateFromProps', {\n          props: prevProps,\n          state,\n        }],\n        ['render'],\n      ]);\n      spy.resetHistory();\n\n      const foo = {};\n      const props = { foo };\n      const {\n        context: prevContext,\n        context: nextContext,\n        state: prevState,\n        state: nextState,\n      } = wrapper.instance();\n\n      wrapper.setProps(props);\n      const nextProps = { ...prevProps, ...props };\n\n      const data = {\n        prevProps,\n        nextProps,\n        prevState,\n        nextState,\n        prevContext,\n        nextContext,\n      };\n      expect(spy.args).to.deep.equal([\n        ['getDerivedStateFromProps', {\n          props: nextProps,\n          state: nextState,\n        }],\n        ['shouldComponentUpdate', data],\n        ['render'],\n        ['componentDidUpdate', {\n          ...data,\n          prevContext: is('>= 16') ? undefined : prevContext,\n        }],\n      ]);\n    });\n\n    it('cDU’s nextState differs from `this.state` when gDSFP returns new state', () => {\n      class SimpleComponent extends React.Component {\n        constructor(props) {\n          super(props);\n          this.state = { value: props.value };\n        }\n\n        static getDerivedStateFromProps(props, state) {\n          return props.value === state.value ? null : { value: props.value };\n        }\n\n        shouldComponentUpdate(nextProps, nextState) {\n          const { value } = this.state;\n          return nextState.value !== value;\n        }\n\n        render() {\n          const { value } = this.state;\n          return (<input value={value} />);\n        }\n      }\n      const wrapper = Wrap(<SimpleComponent value=\"initial\" />);\n\n      expect(wrapper.find('input').prop('value')).to.equal('initial');\n\n      wrapper.setProps({ value: 'updated' });\n\n      expect(wrapper.find('input').prop('value')).to.equal('updated');\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/lifecycles/getSnapshotBeforeUpdate.jsx",
    "content": "import React from 'react';\n\nimport {\n  describeIf,\n  argSpy,\n  expectArgs,\n} from '../../_helpers';\nimport {\n  is,\n} from '../../_helpers/version';\n\nexport default function describeGSBU({\n  Wrap,\n}) {\n  describeIf(is('>= 16.3'), 'getSnapshotBeforeUpdate()', () => {\n    it('calls getSnapshotBeforeUpdate and pass snapshot to componentDidUpdate', () => {\n      const spy = argSpy();\n\n      class Foo extends React.Component {\n        constructor(props) {\n          super(props);\n          this.state = {\n            foo: 'bar',\n          };\n        }\n\n        componentDidUpdate(prevProps, prevState, snapshot) {\n          spy('componentDidUpdate', prevProps, this.props, prevState, this.state, snapshot);\n        }\n\n        getSnapshotBeforeUpdate(prevProps, prevState) {\n          spy('getSnapshotBeforeUpdate', prevProps, this.props, prevState, this.state);\n          return { snapshot: 'ok' };\n        }\n\n        render() {\n          spy('render');\n          return <div>foo</div>;\n        }\n      }\n      const wrapper = Wrap(<Foo name=\"foo\" />);\n      expectArgs(spy, 1, [\n        ['render'],\n      ]);\n\n      wrapper.setProps({ name: 'bar' });\n      expectArgs(spy, 2, [\n        ['render'],\n        ['getSnapshotBeforeUpdate', { name: 'foo' }, { name: 'bar' }, { foo: 'bar' }, { foo: 'bar' }],\n        ['componentDidUpdate', { name: 'foo' }, { name: 'bar' }, { foo: 'bar' }, { foo: 'bar' }, { snapshot: 'ok' }],\n      ]);\n\n      wrapper.setState({ foo: 'baz' });\n      expectArgs(spy, 3, [\n        ['render'],\n        ['getSnapshotBeforeUpdate', { name: 'bar' }, { name: 'bar' }, { foo: 'bar' }, { foo: 'baz' }],\n        ['componentDidUpdate', { name: 'bar' }, { name: 'bar' }, { foo: 'bar' }, { foo: 'baz' }, { snapshot: 'ok' }],\n      ]);\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/lifecycles/misc.jsx",
    "content": "import React from 'react';\nimport sinon from 'sinon-sandbox';\nimport { expect } from 'chai';\nimport PropTypes from 'prop-types';\n\nimport {\n  describeIf,\n  itIf,\n  argSpy,\n  expectArgs,\n} from '../../_helpers';\nimport {\n  PureComponent,\n} from '../../_helpers/react-compat';\nimport {\n  is,\n  BATCHING,\n} from '../../_helpers/version';\n\nexport default function describeMisc({\n  Wrap,\n  isShallow,\n}) {\n  describe('miscellaneous lifecycle combos', () => {\n    let spy;\n\n    beforeEach(() => {\n      spy = argSpy();\n    });\n\n    describeIf(is('>= 16.3'), 'setProps calls `componentDidUpdate` when `getDerivedStateFromProps` is defined', () => {\n      class DummyComp extends PureComponent {\n        constructor(...args) {\n          super(...args);\n          this.state = { state: -1 };\n        }\n\n        static getDerivedStateFromProps(props, state) {\n          const { changeState, counter } = props;\n          spy('getDerivedStateFromProps', { props, state });\n          return changeState ? { state: counter * 10 } : null;\n        }\n\n        componentDidUpdate() {\n          spy('componentDidUpdate');\n        }\n\n        render() {\n          spy('render');\n          const { counter } = this.props;\n          const { state } = this.state;\n          return (\n            <p>\n              {counter}\n              {state}\n            </p>\n          );\n        }\n      }\n\n      it('with no state changes, calls both methods with a sync and async setProps', () => {\n        const wrapper = Wrap(<DummyComp changeState={false} counter={0} />);\n\n        expect(wrapper.state()).to.eql({ state: -1 });\n        expectArgs(spy, 1, [\n          [\n            'getDerivedStateFromProps',\n            {\n              props: {\n                changeState: false,\n                counter: 0,\n              },\n              state: {\n                state: -1,\n              },\n            },\n          ],\n          ['render'],\n        ]);\n\n        wrapper.setProps({ counter: 1 });\n\n        expect(wrapper.state()).to.eql({ state: -1 });\n        expectArgs(spy, 2, [\n          [\n            'getDerivedStateFromProps',\n            {\n              props: {\n                changeState: false,\n                counter: 1,\n              },\n              state: {\n                state: -1,\n              },\n            },\n          ],\n          ['render'],\n          ['componentDidUpdate'],\n        ]);\n\n        return new Promise((resolve) => {\n          wrapper.setProps({ counter: 2 }, resolve);\n        }).then(() => {\n          expectArgs(spy, 3, [\n            [\n              'getDerivedStateFromProps',\n              {\n                props: {\n                  changeState: false,\n                  counter: 2,\n                },\n                state: {\n                  state: -1,\n                },\n              },\n            ],\n            ['render'],\n            ['componentDidUpdate'],\n          ]);\n          expect(wrapper.state()).to.eql({ state: -1 });\n        });\n      });\n\n      it('with a state changes, calls both methods with a sync and async setProps', () => {\n        const wrapper = Wrap(<DummyComp changeState counter={0} />);\n\n        expectArgs(spy, 1, [\n          [\n            'getDerivedStateFromProps',\n            {\n              props: {\n                changeState: true,\n                counter: 0,\n              },\n              state: {\n                state: -1,\n              },\n            },\n          ],\n          ['render'],\n        ]);\n        expect(wrapper.state()).to.eql({ state: 0 });\n\n        wrapper.setProps({ counter: 1 });\n\n        expectArgs(spy, 2, [\n          [\n            'getDerivedStateFromProps',\n            {\n              props: {\n                changeState: true,\n                counter: 1,\n              },\n              state: {\n                state: 0,\n              },\n            },\n          ],\n          ['render'],\n          ['componentDidUpdate'],\n        ]);\n        expect(wrapper.state()).to.eql({ state: 10 });\n\n        return new Promise((resolve) => {\n          wrapper.setProps({ counter: 2 }, resolve);\n        }).then(() => {\n          expect(wrapper.state()).to.eql({ state: 20 });\n          expectArgs(spy, 3, [\n            [\n              'getDerivedStateFromProps',\n              {\n                props: {\n                  changeState: true,\n                  counter: 2,\n                },\n                state: {\n                  state: 10,\n                },\n              },\n            ],\n            ['render'],\n            ['componentDidUpdate'],\n          ]);\n        });\n      });\n    });\n\n    it('calls `componentDidUpdate` when component’s `setState` is called through a bound method', () => {\n      class Foo extends React.Component {\n        constructor(props) {\n          super(props);\n          this.state = {\n            foo: 'init',\n          };\n          this.onChange = this.onChange.bind(this);\n        }\n\n        componentDidUpdate() {\n          spy('componentDidUpdate');\n        }\n\n        onChange() {\n          this.setState({ foo: 'onChange update' });\n        }\n\n        render() {\n          spy('render');\n          const { foo } = this.state;\n          return (\n            <div>\n              {foo}\n              <button type=\"button\" onClick={this.onChange}>click</button>\n            </div>\n          );\n        }\n      }\n\n      const wrapper = Wrap(<Foo />);\n      wrapper.find('button').prop('onClick')();\n      expect(wrapper.state('foo')).to.equal('onChange update');\n      expectArgs(spy, 1, [\n        ['render'],\n        ['render'],\n        ['componentDidUpdate'],\n      ]);\n    });\n\n    it('calls `componentDidUpdate` when component’s `setState` is called by componentDidMount', () => {\n      class Foo extends React.Component {\n        constructor(props) {\n          super(props);\n          this.state = {\n            foo: 'init',\n          };\n          this.update = () => this.setState({ foo: 'update' });\n        }\n\n        componentDidMount() {\n          spy('componentDidMount');\n          this.update();\n        }\n\n        componentDidUpdate() {\n          spy('componentDidUpdate');\n        }\n\n        render() {\n          spy('render');\n          const { foo } = this.state;\n          return <div>{foo}</div>;\n        }\n      }\n\n      const wrapper = Wrap(<Foo />);\n      expect(wrapper.state('foo')).to.equal('update');\n      expectArgs(spy, 1, [\n        ['render'],\n        ['componentDidMount'],\n        ['render'],\n        ['componentDidUpdate'],\n      ]);\n    });\n\n    it('calls `componentDidUpdate` when component’s `setState` is called directly', () => {\n      class Foo extends React.Component {\n        constructor(props) {\n          super(props);\n          this.state = {\n            foo: 'init',\n          };\n        }\n\n        componentDidUpdate() {\n          spy('componentDidUpdate');\n        }\n\n        onChange() {\n          this.setState({ foo: 'onChange update' });\n        }\n\n        render() {\n          spy('render');\n          const { foo } = this.state;\n          return <div>{foo}</div>;\n        }\n      }\n\n      const wrapper = Wrap(<Foo />);\n      expectArgs(spy, 1, [\n        ['render'],\n      ]);\n\n      wrapper.setState({ foo: 'wrapper setState update' });\n      expect(wrapper.state('foo')).to.equal('wrapper setState update');\n      expectArgs(spy, 2, [\n        ['render'],\n        ['componentDidUpdate'],\n      ]);\n\n      wrapper.instance().onChange();\n      expect(wrapper.state('foo')).to.equal('onChange update');\n\n      expectArgs(spy, 3, [\n        ['render'],\n        ['componentDidUpdate'],\n      ]);\n    });\n\n    it('does not call `componentDidMount` twice when a child component is created', () => {\n      class Foo extends React.Component {\n        constructor(props) {\n          super(props);\n          this.state = {\n            foo: 'init',\n          };\n        }\n\n        componentDidMount() {\n          spy('componentDidMount');\n        }\n\n        render() {\n          spy('render');\n          const { foo } = this.state;\n          return (\n            <div>\n              <button type=\"button\" onClick={() => this.setState({ foo: 'update2' })}>\n                click\n              </button>\n              {foo}\n            </div>\n          );\n        }\n      }\n\n      const wrapper = Wrap(<Foo />);\n      expectArgs(spy, 1, [\n        ['render'],\n        ['componentDidMount'],\n      ]);\n\n      wrapper.find('button').prop('onClick')();\n      expectArgs(spy, 2, [\n        ['render'],\n      ]);\n    });\n\n    describeIf(is('>= 16.6'), 'getDerivedStateFromError and componentDidCatch combined', () => {\n      const errorToThrow = new EvalError('threw an error!');\n      // in React 16.0 - 16.2 and 16.9+, and some older nodes, the actual error thrown isn't reported.\n      const reactError = new Error('An error was thrown inside one of your components, but React doesn\\'t know what it was. This is likely due to browser flakiness. React does its best to preserve the \"Pause on exceptions\" behavior of the DevTools, which requires some DEV-mode only tricks. It\\'s possible that these don\\'t work in your browser. Try triggering the error in production mode, or switching to a modern browser. If you suspect that this is actually an issue with React, please file an issue.');\n      const properErrorMessage = (error) => error instanceof Error && (\n        error.message === errorToThrow.message\n        || error.message === reactError.message\n      );\n      const expectedInfo = {\n        componentStack: `\n    in Thrower (created by ErrorBoundary)\n    in div (created by ErrorBoundary)\n    in ErrorBoundary (created by WrapperComponent)\n    in WrapperComponent`,\n      };\n\n      function Thrower({ throws }) {\n        if (throws) {\n          throw errorToThrow;\n        }\n        return null;\n      }\n\n      describe('errors inside error boundary when getDerivedStateFromProps returns update', () => {\n        let lifecycleSpy;\n        let stateSpy;\n\n        beforeEach(() => {\n          lifecycleSpy = sinon.spy();\n          stateSpy = sinon.spy();\n        });\n\n        class ErrorBoundary extends React.Component {\n          static getDerivedStateFromError(error) {\n            lifecycleSpy('getDerivedStateFromError', error);\n            return {\n              didThrow: true,\n              throws: false,\n            };\n          }\n\n          constructor(props) {\n            super(props);\n            this.state = {\n              didThrow: false,\n              throws: false,\n            };\n\n            lifecycleSpy('constructor');\n          }\n\n          componentDidCatch(error, info) {\n            lifecycleSpy('componentDidCatch', error, info);\n            stateSpy({ ...this.state });\n          }\n\n          render() {\n            lifecycleSpy('render');\n\n            const {\n              throws,\n            } = this.state;\n\n            return (\n              <div>\n                <Thrower throws={throws} />\n              </div>\n            );\n          }\n        }\n\n        itIf(isShallow, 'does not catch errors during shallow render', () => {\n          const wrapper = Wrap(<ErrorBoundary />);\n\n          expect(lifecycleSpy.args).to.deep.equal([\n            ['constructor'],\n            ['render'],\n          ]);\n          lifecycleSpy.resetHistory();\n\n          expect(stateSpy.args).to.deep.equal([]);\n\n          wrapper.setState({ throws: true });\n\n          const thrower = wrapper.find(Thrower);\n          expect(thrower).to.have.lengthOf(1);\n          expect(thrower.props()).to.have.property('throws', true);\n\n          expect(() => thrower.dive()).to.throw(errorToThrow);\n\n          expect(lifecycleSpy.args).to.deep.equal([\n            ['render'],\n          ]);\n          expect(stateSpy.args).to.deep.equal([]);\n        });\n\n        it('calls getDerivedStateFromError first and then componentDidCatch for simulated error', () => {\n          const wrapper = Wrap(<ErrorBoundary />);\n\n          expect(lifecycleSpy.args).to.deep.equal([\n            ['constructor'],\n            ['render'],\n          ]);\n          lifecycleSpy.resetHistory();\n\n          expect(stateSpy.args).to.deep.equal([]);\n\n          expect(() => wrapper.find(Thrower).simulateError(errorToThrow)).not.to.throw();\n\n          expect(lifecycleSpy.args).to.deep.equal([\n            ['getDerivedStateFromError', errorToThrow],\n            ['render'],\n            ['componentDidCatch', errorToThrow, expectedInfo],\n          ]);\n\n          expect(stateSpy.args).to.deep.equal([\n            [{\n              throws: false,\n              didThrow: true,\n            }],\n          ]);\n        });\n\n        itIf(!isShallow, 'calls getDerivedStateFromError first and then componentDidCatch', () => {\n          const wrapper = Wrap(<ErrorBoundary />);\n\n          expect(lifecycleSpy.args).to.deep.equal([\n            ['constructor'],\n            ['render'],\n          ]);\n          lifecycleSpy.resetHistory();\n\n          expect(stateSpy.args).to.deep.equal([]);\n\n          wrapper.setState({ throws: true });\n\n          expect(lifecycleSpy).to.have.property('callCount', 4);\n          const [first, second, third, fourth] = lifecycleSpy.args;\n          expect(first).to.deep.equal(['render']);\n          expect(second).to.satisfy(([name, error, ...rest]) => name === 'getDerivedStateFromError'\n            && properErrorMessage(error)\n            && rest.length === 0);\n          expect(third).to.deep.equal(['render']);\n          const [name, error, info] = fourth;\n          expect(name).to.equal('componentDidCatch');\n          expect(error).to.satisfy(properErrorMessage);\n          expect(info).to.deep.equal(expectedInfo);\n\n          expect(stateSpy.args).to.deep.equal([\n            [{\n              throws: false,\n              didThrow: true,\n            }],\n          ]);\n        });\n      });\n\n      describe('errors inside error boundary when getDerivedStateFromError does not return update', () => {\n        class ErrorBoundary extends React.Component {\n          static getDerivedStateFromError(error) {\n            spy('getDerivedStateFromError', error);\n            return null;\n          }\n\n          constructor(props) {\n            super(props);\n            this.state = {\n              didThrow: false,\n              throws: false,\n            };\n\n            spy('constructor');\n          }\n\n          componentDidCatch(error, info) {\n            spy('componentDidCatch', error, info);\n\n            this.setState({\n              didThrow: true,\n              throws: false,\n            });\n          }\n\n          render() {\n            spy('render');\n\n            const {\n              didThrow,\n              throws,\n            } = this.state;\n\n            return (\n              <div>\n                <Thrower throws={throws} />\n                <div>\n                  {didThrow ? 'HasThrown' : 'HasNotThrown'}\n                </div>\n              </div>\n            );\n          }\n        }\n\n        itIf(isShallow, 'does not catch errors during shallow render', () => {\n          const wrapper = Wrap(<ErrorBoundary />);\n\n          expectArgs(spy, 1, [\n            ['constructor'],\n            ['render'],\n          ]);\n\n          wrapper.setState({ throws: true });\n\n          const thrower = wrapper.find(Thrower);\n          expect(thrower).to.have.lengthOf(1);\n          expect(thrower.props()).to.have.property('throws', true);\n\n          expect(() => thrower.dive()).to.throw(errorToThrow);\n\n          expectArgs(spy, 2, [\n            ['render'],\n          ]);\n        });\n\n        itIf(!isShallow, 'renders again without calling componentDidCatch and then fails', () => {\n          const wrapper = Wrap(<ErrorBoundary />);\n\n          expectArgs(spy, 1, [\n            ['constructor'],\n            ['render'],\n          ]);\n          spy.resetHistory();\n\n          try {\n            wrapper.setState({ throws: true });\n            expect('should never get here').to.equal(false);\n          } catch (e) {\n            expect(e).to.satisfy(properErrorMessage);\n          }\n\n          expect(spy).to.have.property('callCount', 3);\n          const [first, second, third] = spy.args;\n          expect(first).to.deep.equal(['render']);\n          expect(second).to.satisfy(([name, arg, ...rest]) => (\n            name === 'getDerivedStateFromError'\n            && properErrorMessage(arg)\n            && rest.length === 0\n          ));\n          expect(third).to.deep.equal(['render']);\n        });\n\n        it('rerenders on a simulated error', () => {\n          const wrapper = Wrap(<ErrorBoundary />);\n\n          expectArgs(spy, 1, [\n            ['constructor'],\n            ['render'],\n          ]);\n\n          const thrower = wrapper.find(Thrower);\n\n          expect(() => thrower.simulateError(errorToThrow)).not.to.throw(errorToThrow);\n\n          expectArgs(spy, 2, [\n            ['getDerivedStateFromError', errorToThrow],\n            ['componentDidCatch', errorToThrow, expectedInfo],\n            ['render'],\n          ]);\n        });\n\n        it('renders again on simulated error', () => {\n          const wrapper = Wrap(<ErrorBoundary />);\n\n          expectArgs(spy, 1, [\n            ['constructor'],\n            ['render'],\n          ]);\n\n          expect(() => wrapper.find(Thrower).simulateError(errorToThrow)).not.to.throw();\n\n          expectArgs(spy, 2, [\n            ['getDerivedStateFromError', errorToThrow],\n            ['componentDidCatch', errorToThrow, expectedInfo],\n            ['render'],\n          ]);\n        });\n      });\n    });\n\n    context('mounting phase', () => {\n      it('calls componentWillMount and componentDidMount', () => {\n        class Foo extends React.Component {\n          componentWillMount() {\n            spy('componentWillMount');\n          }\n\n          componentDidMount() {\n            spy('componentDidMount');\n          }\n\n          render() {\n            spy('render');\n            return <div>foo</div>;\n          }\n        }\n\n        Wrap(<Foo />);\n\n        expectArgs(spy, 1, [\n          ['componentWillMount'],\n          ['render'],\n          ['componentDidMount'],\n        ]);\n      });\n\n      itIf(!isShallow || BATCHING, 'is batching updates', () => {\n        class Foo extends React.Component {\n          constructor(props) {\n            super(props);\n            this.state = {\n              count: 0,\n            };\n          }\n\n          componentWillMount() {\n            spy('componentWillMount');\n            /* eslint-disable react/destructuring-assignment */\n            this.setState({ count: this.state.count + 1 });\n            this.setState({ count: this.state.count + 1 });\n            /* eslint-enable react/destructuring-assignment */\n          }\n\n          componentDidMount() {\n            spy('componentDidMount');\n            /* eslint-disable react/destructuring-assignment */\n            this.setState({ count: this.state.count + 1 });\n            this.setState({ count: this.state.count + 1 });\n            /* eslint-enable react/destructuring-assignment */\n          }\n\n          render() {\n            spy('render');\n            const { count } = this.state;\n            return <div>{count}</div>;\n          }\n        }\n        const result = Wrap(<Foo />);\n        expect(result.state('count')).to.equal(2);\n        expectArgs(spy, 1, [\n          ['componentWillMount'],\n          ['render'],\n          ['componentDidMount'],\n          ['render'],\n        ]);\n      });\n    });\n\n    context('updating props', () => {\n      it('calls shouldComponentUpdate, componentWillUpdate, and componentDidUpdate', () => {\n        class Foo extends React.Component {\n          constructor(...args) {\n            super(...args);\n            this.state = {\n              foo: 'state',\n            };\n          }\n\n          componentWillReceiveProps(nextProps, nextContext) {\n            spy('componentWillReceiveProps', this.props, nextProps, nextContext);\n          }\n\n          shouldComponentUpdate(nextProps, nextState, nextContext) {\n            spy('shouldComponentUpdate', this.props, nextProps, this.state, nextState, nextContext);\n            return true;\n          }\n\n          componentWillUpdate(nextProps, nextState, nextContext) {\n            spy('componentWillUpdate', this.props, nextProps, this.state, nextState, nextContext);\n          }\n\n          componentDidUpdate(prevProps, prevState, prevContext) {\n            spy('componentDidUpdate', prevProps, this.props, prevState, this.state, prevContext);\n          }\n\n          render() {\n            spy('render');\n            const { foo } = this.state;\n            return <div>{foo}</div>;\n          }\n        }\n        Foo.contextTypes = {\n          foo: PropTypes.string,\n        };\n\n        const wrapper = Wrap(\n          <Foo foo=\"bar\" />,\n          {\n            context: { foo: 'context' },\n          },\n        );\n        expectArgs(spy, 1, [\n          ['render'],\n        ]);\n\n        wrapper.setProps({ foo: 'baz' });\n        wrapper.setProps({ foo: 'bax' });\n        expectArgs(spy, 2, [\n          [\n            'componentWillReceiveProps',\n            { foo: 'bar' }, { foo: 'baz' },\n            { foo: 'context' }, // this will be fixed\n          ],\n          [\n            'shouldComponentUpdate',\n            { foo: 'bar' }, { foo: 'baz' },\n            { foo: 'state' }, { foo: 'state' },\n            { foo: 'context' },\n          ],\n          [\n            'componentWillUpdate',\n            { foo: 'bar' }, { foo: 'baz' },\n            { foo: 'state' }, { foo: 'state' },\n            { foo: 'context' },\n          ],\n          ['render'],\n          [\n            'componentDidUpdate',\n            { foo: 'bar' }, { foo: 'baz' },\n            { foo: 'state' }, { foo: 'state' },\n            is('>= 16') ? undefined : { foo: 'context' },\n          ],\n          [\n            'componentWillReceiveProps',\n            { foo: 'baz' }, { foo: 'bax' },\n            { foo: 'context' },\n          ],\n          [\n            'shouldComponentUpdate',\n            { foo: 'baz' }, { foo: 'bax' },\n            { foo: 'state' }, { foo: 'state' },\n            { foo: 'context' },\n          ],\n          [\n            'componentWillUpdate',\n            { foo: 'baz' }, { foo: 'bax' },\n            { foo: 'state' }, { foo: 'state' },\n            { foo: 'context' },\n          ],\n          ['render'],\n          [\n            'componentDidUpdate',\n            { foo: 'baz' }, { foo: 'bax' },\n            { foo: 'state' }, { foo: 'state' },\n            is('>= 16') ? undefined : { foo: 'context' },\n          ],\n        ]);\n      });\n\n      it('calls componentWillReceiveProps, shouldComponentUpdate, componentWillUpdate and componentDidUpdate with merged props', () => {\n        class Foo extends React.Component {\n          componentWillReceiveProps(nextProps) {\n            spy('componentWillReceiveProps', this.props, nextProps);\n          }\n\n          shouldComponentUpdate(nextProps) {\n            spy('shouldComponentUpdate', this.props, nextProps);\n            return true;\n          }\n\n          componentWillUpdate(nextProps) {\n            spy('componentWillUpdate', this.props, nextProps);\n          }\n\n          componentDidUpdate(prevProps) {\n            spy('componentDidUpdate', prevProps, this.props);\n          }\n\n          render() {\n            spy('render');\n            return (<div />);\n          }\n        }\n\n        const wrapper = Wrap(<Foo a=\"a\" b=\"b\" />);\n        expectArgs(spy, 1, [\n          ['render'],\n        ]);\n\n        wrapper.setProps({ b: 'c', d: 'e' });\n        expectArgs(spy, 2, [\n          [\n            'componentWillReceiveProps',\n            { a: 'a', b: 'b' },\n            { a: 'a', b: 'c', d: 'e' },\n          ],\n          [\n            'shouldComponentUpdate',\n            { a: 'a', b: 'b' },\n            { a: 'a', b: 'c', d: 'e' },\n          ],\n          [\n            'componentWillUpdate',\n            { a: 'a', b: 'b' },\n            { a: 'a', b: 'c', d: 'e' },\n          ],\n          ['render'],\n          [\n            'componentDidUpdate',\n            { a: 'a', b: 'b' },\n            { a: 'a', b: 'c', d: 'e' },\n          ],\n        ]);\n      });\n\n      it('cancels rendering when Component returns false in shouldComponentUpdate', () => {\n        class Foo extends React.Component {\n          componentWillReceiveProps() {\n            spy('componentWillReceiveProps');\n          }\n\n          shouldComponentUpdate() {\n            spy('shouldComponentUpdate');\n            return false;\n          }\n\n          componentWillUpdate() {\n            spy('componentWillUpdate');\n          }\n\n          componentDidUpdate() {\n            spy('componentDidUpdate');\n          }\n\n          render() {\n            spy('render');\n            return <div>foo</div>;\n          }\n        }\n\n        const wrapper = Wrap(<Foo foo=\"bar\" />);\n        expect(wrapper.instance().props.foo).to.equal('bar');\n        expectArgs(spy, 1, [\n          ['render'],\n        ]);\n\n        wrapper.setProps({ foo: 'baz' });\n        expect(wrapper.instance().props.foo).to.equal('baz');\n        expectArgs(spy, 2, [\n          ['componentWillReceiveProps'],\n          ['shouldComponentUpdate'],\n        ]);\n\n        wrapper.setProps({ foo: 'bax' });\n        expect(wrapper.instance().props.foo).to.equal('bax');\n        expectArgs(spy, 3, [\n          ['componentWillReceiveProps'],\n          ['shouldComponentUpdate'],\n        ]);\n      });\n\n      itIf(!isShallow || BATCHING, 'does not provoke another renders to call setState in componentWillReceiveProps', () => {\n        class Foo extends React.Component {\n          constructor(props) {\n            super(props);\n            this.state = {\n              count: 0,\n            };\n          }\n\n          componentWillReceiveProps() {\n            spy('componentWillReceiveProps');\n            /* eslint-disable react/destructuring-assignment */\n            this.setState({ count: this.state.count + 1 });\n            this.setState({ count: this.state.count + 1 });\n            /* eslint-enable react/destructuring-assignment */\n          }\n\n          render() {\n            spy('render');\n            const { foo } = this.props;\n            return <div>{foo}</div>;\n          }\n        }\n        const result = Wrap(<Foo />);\n        expectArgs(spy, 1, [\n          ['render'],\n        ]);\n\n        result.setProps({ name: 'bar' });\n\n        expect(result.state('count')).to.equal(1);\n        expectArgs(spy, 2, [\n          ['componentWillReceiveProps'],\n          ['render'],\n        ]);\n      });\n\n      itIf(!isShallow || BATCHING, 'provokes another render to call setState twice in componentWillUpdate', () => {\n        class Foo extends React.Component {\n          constructor(props) {\n            super(props);\n            this.updated = false;\n            this.state = {\n              count: 0,\n            };\n          }\n\n          componentWillUpdate() {\n            spy('componentWillUpdate');\n            if (!this.updated) {\n              this.updated = true;\n              /* eslint-disable react/destructuring-assignment */\n              this.setState({ count: this.state.count + 1 });\n              this.setState({ count: this.state.count + 1 });\n              /* eslint-enable react/destructuring-assignment */\n            }\n          }\n\n          render() {\n            spy('render');\n            const { foo } = this.props;\n            return <div>{foo}</div>;\n          }\n        }\n        const result = Wrap(<Foo />);\n        expectArgs(spy, 1, [\n          ['render'],\n        ]);\n\n        result.setProps({ name: 'bar' });\n\n        expect(result.state('count')).to.equal(1);\n        expectArgs(spy, 2, [\n          ['componentWillUpdate'],\n          ['render'],\n          ['componentWillUpdate'],\n          ['render'],\n        ]);\n      });\n\n      itIf(!isShallow || BATCHING, 'provokes another render to call setState twice in componentDidUpdate', () => {\n        class Foo extends React.Component {\n          constructor(props) {\n            super(props);\n            this.updated = false;\n            this.state = {\n              count: 0,\n            };\n          }\n\n          componentDidUpdate() {\n            spy('componentDidUpdate');\n            if (!this.updated) {\n              this.updated = true;\n              /* eslint-disable react/no-did-update-set-state, react/destructuring-assignment */\n              this.setState({ count: this.state.count + 1 });\n              this.setState({ count: this.state.count + 1 });\n              /* eslint-enable react/no-did-update-set-state, react/destructuring-assignment */\n            }\n          }\n\n          render() {\n            spy('render');\n            const { foo } = this.props;\n            return <div>{foo}</div>;\n          }\n        }\n        const result = Wrap(<Foo />);\n        expectArgs(spy, 1, [\n          ['render'],\n        ]);\n\n        result.setProps({ name: 'bar' });\n\n        expect(result.state('count')).to.equal(1);\n        expectArgs(spy, 2, [\n          ['render'],\n          ['componentDidUpdate'],\n          ['render'],\n          ['componentDidUpdate'],\n        ]);\n      });\n    });\n\n    context('updating state', () => {\n      it('calls shouldComponentUpdate, componentWillUpdate, and componentDidUpdate', () => {\n        class Foo extends React.Component {\n          constructor(...args) {\n            super(...args);\n            this.state = {\n              foo: 'bar',\n            };\n          }\n\n          shouldComponentUpdate(nextProps, nextState, nextContext) {\n            spy('shouldComponentUpdate', this.props, nextProps, this.state, nextState, nextContext);\n            return true;\n          }\n\n          componentWillUpdate(nextProps, nextState, nextContext) {\n            spy('componentWillUpdate', this.props, nextProps, this.state, nextState, nextContext);\n          }\n\n          componentDidUpdate(prevProps, prevState, prevContext) {\n            spy('componentDidUpdate', prevProps, this.props, prevState, this.state, prevContext);\n          }\n\n          render() {\n            spy('render');\n            const { foo } = this.state;\n            return <div>{foo}</div>;\n          }\n        }\n        Foo.contextTypes = {\n          foo: PropTypes.string,\n        };\n\n        const wrapper = Wrap(\n          <Foo foo=\"props\" />,\n          {\n            context: { foo: 'context' },\n          },\n        );\n        expectArgs(spy, 1, [\n          ['render'],\n        ]);\n\n        wrapper.setState({ foo: 'baz' });\n        expectArgs(spy, 2, [\n          [\n            'shouldComponentUpdate',\n            { foo: 'props' }, { foo: 'props' },\n            { foo: 'bar' }, { foo: 'baz' },\n            { foo: 'context' },\n          ],\n          [\n            'componentWillUpdate',\n            { foo: 'props' }, { foo: 'props' },\n            { foo: 'bar' }, { foo: 'baz' },\n            { foo: 'context' },\n          ],\n          ['render'],\n          [\n            'componentDidUpdate',\n            { foo: 'props' }, { foo: 'props' },\n            { foo: 'bar' }, { foo: 'baz' },\n            is('>= 16') ? undefined : { foo: 'context' },\n          ],\n        ]);\n      });\n\n      it('cancels rendering when Component returns false in shouldComponentUpdate', () => {\n        class Foo extends React.Component {\n          constructor(props) {\n            super(props);\n            this.state = {\n              foo: 'bar',\n            };\n          }\n\n          shouldComponentUpdate() {\n            spy('shouldComponentUpdate');\n            return false;\n          }\n\n          componentWillUpdate() {\n            spy('componentWillUpdate');\n          }\n\n          componentDidUpdate() {\n            spy('componentDidUpdate');\n          }\n\n          render() {\n            spy('render');\n            const { foo } = this.state;\n            return <div>{foo}</div>;\n          }\n        }\n        const wrapper = Wrap(<Foo />);\n        expect(wrapper.instance().state.foo).to.equal('bar');\n        expectArgs(spy, 1, [\n          ['render'],\n        ]);\n\n        wrapper.setState({ foo: 'baz' });\n        expect(wrapper.instance().state.foo).to.equal('baz');\n        expectArgs(spy, 2, [\n          ['shouldComponentUpdate'],\n        ]);\n      });\n\n      itIf(!isShallow || BATCHING, 'provokes another render to call setState twice in componentWillUpdate', () => {\n        class Foo extends React.Component {\n          constructor(props) {\n            super(props);\n            this.updated = false;\n            this.state = {\n              name: 'foo',\n              count: 0,\n            };\n          }\n\n          componentWillUpdate() {\n            spy('componentWillUpdate');\n            if (!this.updated) {\n              this.updated = true;\n              /* eslint-disable react/destructuring-assignment */\n              this.setState({ count: this.state.count + 1 });\n              this.setState({ count: this.state.count + 1 });\n              /* eslint-enable react/destructuring-assignment */\n            }\n          }\n\n          render() {\n            spy('render');\n            const { name } = this.state;\n            return <div>{name}</div>;\n          }\n        }\n        const result = Wrap(<Foo />);\n        expectArgs(spy, 1, [\n          ['render'],\n        ]);\n\n        result.setState({ name: 'bar' });\n        expect(result.state('count')).to.equal(1);\n        expectArgs(spy, 2, [\n          ['componentWillUpdate'],\n          ['render'],\n          ['componentWillUpdate'],\n          ['render'],\n        ]);\n      });\n\n      itIf(!isShallow || BATCHING, 'provokes another render to call setState twice in componentDidUpdate', () => {\n        class Foo extends React.Component {\n          constructor(props) {\n            super(props);\n            this.updated = false;\n            this.state = {\n              name: 'foo',\n              count: 0,\n            };\n          }\n\n          componentDidUpdate() {\n            spy('componentDidUpdate');\n            if (!this.updated) {\n              this.updated = true;\n              /* eslint-disable react/no-did-update-set-state, react/destructuring-assignment */\n              this.setState({ count: this.state.count + 1 });\n              this.setState({ count: this.state.count + 1 });\n              /* eslint-enable react/no-did-update-set-state, react/destructuring-assignment */\n            }\n          }\n\n          render() {\n            spy('render');\n            const { name } = this.state;\n            return <div>{name}</div>;\n          }\n        }\n        const result = Wrap(<Foo />);\n        expectArgs(spy, 1, [\n          ['render'],\n        ]);\n\n        result.setState({ name: 'bar' });\n        expect(result.state('count')).to.equal(1);\n        expectArgs(spy, 2, [\n          ['render'],\n          ['componentDidUpdate'],\n          ['render'],\n          ['componentDidUpdate'],\n        ]);\n      });\n    });\n\n    context('updating context', () => {\n      it('calls shouldComponentUpdate, componentWillUpdate and componentDidUpdate', () => {\n        class Foo extends React.Component {\n          constructor(...args) {\n            super(...args);\n            this.state = {\n              foo: 'state',\n            };\n          }\n\n          shouldComponentUpdate(nextProps, nextState, nextContext) {\n            spy('shouldComponentUpdate', this.props, nextProps, this.state, nextState, nextContext);\n            return true;\n          }\n\n          componentWillUpdate(nextProps, nextState, nextContext) {\n            spy('componentWillUpdate', this.props, nextProps, this.state, nextState, nextContext);\n          }\n\n          componentDidUpdate(prevProps, prevState, prevContext) {\n            spy('componentDidUpdate', prevProps, this.props, prevState, this.state, prevContext);\n          }\n\n          render() {\n            spy('render');\n            const { foo } = this.state;\n            return <div>{foo}</div>;\n          }\n        }\n        Foo.contextTypes = {\n          foo: PropTypes.string,\n        };\n        const wrapper = Wrap(\n          <Foo foo=\"props\" />,\n          {\n            context: { foo: 'bar' },\n          },\n        );\n        expect(wrapper.instance().context.foo).to.equal('bar');\n        expectArgs(spy, 1, [\n          ['render'],\n        ]);\n\n        wrapper.setContext({ foo: 'baz' });\n        expect(wrapper.instance().context.foo).to.equal('baz');\n        expectArgs(spy, 2, [\n          [\n            'shouldComponentUpdate',\n            { foo: 'props' }, { foo: 'props' },\n            { foo: 'state' }, { foo: 'state' },\n            { foo: 'baz' },\n          ],\n          [\n            'componentWillUpdate',\n            { foo: 'props' }, { foo: 'props' },\n            { foo: 'state' }, { foo: 'state' },\n            { foo: 'baz' },\n          ],\n          ['render'],\n          [\n            'componentDidUpdate',\n            { foo: 'props' }, { foo: 'props' },\n            { foo: 'state' }, { foo: 'state' },\n            is('>= 16') ? undefined : { foo: 'bar' },\n          ],\n        ]);\n      });\n\n      it('cancels rendering when Component returns false in shouldComponentUpdate', () => {\n        class Foo extends React.Component {\n          shouldComponentUpdate() {\n            spy('shouldComponentUpdate');\n            return false;\n          }\n\n          componentWillUpdate() {\n            spy('componentWillUpdate');\n          }\n\n          componentDidUpdate() {\n            spy('componentDidUpdate');\n          }\n\n          render() {\n            spy('render');\n            return <div>foo</div>;\n          }\n        }\n        Foo.contextTypes = {\n          foo: PropTypes.string,\n        };\n        const wrapper = Wrap(\n          <Foo />,\n          {\n            context: { foo: 'bar' },\n          },\n        );\n        expectArgs(spy, 1, [\n          ['render'],\n        ]);\n\n        wrapper.setContext({ foo: 'baz' });\n\n        expectArgs(spy, 2, [\n          ['shouldComponentUpdate'],\n        ]);\n      });\n\n      itIf(!isShallow || BATCHING, 'provokes another render to call setState twice in componentWillUpdate', () => {\n        class Foo extends React.Component {\n          constructor(props) {\n            super(props);\n            this.updated = false;\n            this.state = {\n              count: 0,\n            };\n          }\n\n          componentWillUpdate() {\n            spy('componentWillUpdate');\n            if (!this.updated) {\n              this.updated = true;\n              /* eslint-disable react/destructuring-assignment */\n              this.setState({ count: this.state.count + 1 });\n              this.setState({ count: this.state.count + 1 });\n              /* eslint-enable react/destructuring-assignment */\n            }\n          }\n\n          render() {\n            spy('render');\n            const { name } = this.state;\n            return <div>{name}</div>;\n          }\n        }\n        const result = Wrap(\n          <Foo />,\n          {\n            context: { foo: 'bar' },\n          },\n        );\n        expectArgs(spy, 1, [\n          ['render'],\n        ]);\n\n        result.setContext({ foo: 'baz' });\n        expect(result.state('count')).to.equal(1);\n        expectArgs(spy, 2, [\n          ['componentWillUpdate'],\n          ['render'],\n          ['componentWillUpdate'],\n          ['render'],\n        ]);\n      });\n\n      itIf(!isShallow || BATCHING, 'provokes an another render to call setState twice in componentDidUpdate', () => {\n        class Foo extends React.Component {\n          constructor(props) {\n            super(props);\n            this.updated = false;\n            this.state = {\n              count: 0,\n            };\n          }\n\n          componentDidUpdate() {\n            spy('componentDidUpdate');\n            if (!this.updated) {\n              this.updated = true;\n              /* eslint-disable react/no-did-update-set-state, react/destructuring-assignment */\n              this.setState({ count: this.state.count + 1 });\n              this.setState({ count: this.state.count + 1 });\n              /* eslint-enable react/no-did-update-set-state, react/destructuring-assignment */\n            }\n          }\n\n          render() {\n            spy('render');\n            const { name } = this.state;\n            return <div>{name}</div>;\n          }\n        }\n        const result = Wrap(\n          <Foo />,\n          {\n            context: { foo: 'bar' },\n          },\n        );\n        expectArgs(spy, 1, [\n          ['render'],\n        ]);\n\n        result.setContext({ foo: 'baz' });\n        expect(result.state('count')).to.equal(1);\n        expectArgs(spy, 2, [\n          ['render'],\n          ['componentDidUpdate'],\n          ['render'],\n          ['componentDidUpdate'],\n        ]);\n      });\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/@@iterator.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\n\nimport {\n  ITERATOR_SYMBOL,\n} from 'enzyme/build/Utils';\n\nimport {\n  describeIf,\n} from '../../_helpers';\n\nexport default function describeIterator({\n  Wrap,\n}) {\n  describeIf(!!ITERATOR_SYMBOL, '@@iterator', () => {\n    it('is iterable', () => {\n      class Foo extends React.Component {\n        render() {\n          return (\n            <div>\n              <a href=\"#1\">Hello</a>\n              <a href=\"#2\">Hello</a>\n              <a href=\"#3\">Hello</a>\n              <a href=\"#4\">Hello</a>\n            </div>\n          );\n        }\n      }\n      const wrapper = Wrap(<Foo />);\n      const [a, b, c, d, ...e] = wrapper.find('a');\n      const a1 = wrapper.find('a').get(0);\n      const b1 = wrapper.find('a').get(1);\n      const c1 = wrapper.find('a').get(2);\n      const d1 = wrapper.find('a').get(3);\n      expect(a1).to.deep.equal(a);\n      expect(b1).to.deep.equal(b);\n      expect(c1).to.deep.equal(c);\n      expect(d1).to.deep.equal(d);\n      expect(e).to.eql([]);\n    });\n\n    it('returns an iterable iterator', () => {\n      class Foo extends React.Component {\n        render() {\n          return (\n            <div>\n              <a href=\"#1\">Hello</a>\n              <a href=\"#2\">Hello</a>\n              <a href=\"#3\">Hello</a>\n              <a href=\"#4\">Hello</a>\n            </div>\n          );\n        }\n      }\n      const wrapper = Wrap(<Foo />);\n\n      const iter = wrapper[ITERATOR_SYMBOL]();\n      expect(iter).to.have.property(ITERATOR_SYMBOL).and.be.a('function');\n      expect(iter[ITERATOR_SYMBOL]()).to.equal(iter);\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/_method.template",
    "content": "import React from 'react';\nimport PropTypes from 'prop-types';\nimport { expect } from 'chai';\nimport wrap from 'mocha-wrap';\nimport sinon from 'sinon-sandbox';\nimport { Portal } from 'react-is';\n\nimport { render } from 'enzyme';\nimport getAdapter from 'enzyme/build/getAdapter';\nimport {\n  ITERATOR_SYMBOL,\n  sym,\n} from 'enzyme/build/Utils';\n\nimport {\n  describeIf,\n  itIf,\n} from '../../_helpers';\nimport realArrowFunction from '../../_helpers/realArrowFunction';\nimport { getElementPropSelector, getWrapperPropSelector } from '../../_helpers/selectors';\nimport {\n  is,\n  REACT16,\n} from '../../_helpers/version';\n\nimport {\n  createClass,\n  createPortal,\n  createRef,\n  Fragment,\n} from '../../_helpers/react-compat';\n\nexport default function describe$Method({\n  Wrap,\n  WrapRendered,\n  Wrapper,\n  WrapperName,\n  isShallow,\n  isMount,\n  makeDOMElement,\n}) {\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/at.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\n\nexport default function describeAt({\n  Wrap,\n}) {\n  describe('.at(index)', () => {\n    it('gets a wrapper of the node at the specified index', () => {\n      const wrapper = Wrap((\n        <div>\n          <div className=\"bar foo\" />\n          <div className=\"bar bax\" />\n          <div className=\"bar bux\" />\n          <div className=\"bar baz\" />\n        </div>\n      ));\n      const bar = wrapper.find('.bar');\n      expect(bar.at(0).hasClass('foo')).to.equal(true);\n      expect(bar.at(1).hasClass('bax')).to.equal(true);\n      expect(bar.at(2).hasClass('bux')).to.equal(true);\n      expect(bar.at(3).hasClass('baz')).to.equal(true);\n    });\n\n    it('`.at()` does not affect the results of `.exists()`', () => {\n      const wrapper = Wrap((\n        <div>\n          <div className=\"foo\" />\n        </div>\n      ));\n      const bar = wrapper.find('.bar');\n      expect(bar.exists()).to.equal(false);\n      expect(bar.at(0).exists()).to.equal(false);\n\n      const foo = wrapper.find('.foo');\n      expect(foo.exists()).to.equal(true);\n      expect(foo.at(0).exists()).to.equal(true);\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/childAt.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\n\nexport default function describeChildAt({\n  Wrap,\n}) {\n  describe('.childAt(index)', () => {\n    it('gets a wrapped node at the specified index', () => {\n      const wrapper = Wrap((\n        <div>\n          <div className=\"bar\" />\n          <div className=\"baz\" />\n        </div>\n      ));\n\n      expect(wrapper.childAt(0).hasClass('bar')).to.equal(true);\n      expect(wrapper.childAt(1).hasClass('baz')).to.equal(true);\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/children.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\n\nimport {\n  describeIf,\n} from '../../_helpers';\nimport { is } from '../../_helpers/version';\n\nexport default function describeChildren({\n  Wrap,\n  WrapRendered,\n  isShallow,\n}) {\n  describe('.children([selector])', () => {\n    it('returns empty wrapper for node with no children', () => {\n      const wrapper = Wrap(<div />);\n      expect(wrapper.children()).to.have.lengthOf(0);\n    });\n\n    it('includes text nodes', () => {\n      const wrapper = Wrap(<div>B<span />C</div>).children();\n      expect(wrapper).to.have.lengthOf(3);\n    });\n\n    it('does not attempt to get an instance for text nodes', () => {\n      const wrapper = WrapRendered(<div>B<span />C</div>);\n      expect(wrapper).to.have.lengthOf(isShallow ? 1 : 3);\n    });\n\n    it('skips the falsy children', () => {\n      const wrapper = Wrap((\n        <div>\n          <div>\n            {false}\n            {[false, false]}\n            <p>foo</p>\n          </div>\n          <div>\n            {undefined}\n            {[undefined, undefined]}\n            <p>bar</p>\n          </div>\n          <div>\n            {null}\n            {[null, null]}\n            <p>baz</p>\n          </div>\n        </div>\n      ));\n      expect(wrapper.childAt(0).children()).to.have.lengthOf(1);\n      expect(wrapper.childAt(1).children()).to.have.lengthOf(1);\n      expect(wrapper.childAt(2).children()).to.have.lengthOf(1);\n    });\n\n    it('returns the children nodes of the root', () => {\n      const wrapper = Wrap((\n        <div>\n          <div className=\"foo\" />\n          <div className=\"bar\" />\n          <div className=\"baz\" />\n        </div>\n      ));\n      expect(wrapper.children()).to.have.lengthOf(3);\n      expect(wrapper.children().at(0).hasClass('foo')).to.equal(true);\n      expect(wrapper.children().at(1).hasClass('bar')).to.equal(true);\n      expect(wrapper.children().at(2).hasClass('baz')).to.equal(true);\n    });\n\n    it('does not return any of the children of children', () => {\n      const wrapper = Wrap((\n        <div>\n          <div className=\"foo\">\n            <div className=\"bar\" />\n          </div>\n          <div className=\"baz\" />\n        </div>\n      ));\n      expect(wrapper.children()).to.have.lengthOf(2);\n      expect(wrapper.children().at(0).hasClass('foo')).to.equal(true);\n      expect(wrapper.children().at(1).hasClass('baz')).to.equal(true);\n    });\n\n    it('handles mixed children with and without arrays', () => {\n      class Foo extends React.Component {\n        render() {\n          const { items } = this.props;\n          return (\n            <div>\n              <span className=\"foo\" />\n              {items.map((x) => x)}\n            </div>\n          );\n        }\n      }\n      const wrapper = WrapRendered((\n        <Foo\n          items={[\n            <i key={1} className=\"bar\">abc</i>,\n            <i key={2} className=\"baz\">def</i>,\n          ]}\n        />\n      ));\n      expect(wrapper.children()).to.have.lengthOf(3);\n      expect(wrapper.children().at(0).hasClass('foo')).to.equal(true);\n      expect(wrapper.children().at(1).hasClass('bar')).to.equal(true);\n      expect(wrapper.children().at(2).hasClass('baz')).to.equal(true);\n    });\n\n    it('optionally allows a selector to filter by', () => {\n      const wrapper = Wrap((\n        <div>\n          <div className=\"foo\" />\n          <div className=\"bar bip\" />\n          <div className=\"baz bip\" />\n        </div>\n      ));\n      const children = wrapper.children('.bip');\n      expect(children).to.have.lengthOf(2);\n      expect(children.at(0).hasClass('bar')).to.equal(true);\n      expect(children.at(1).hasClass('baz')).to.equal(true);\n    });\n\n    describeIf(is('> 0.13'), 'stateless function components (SFCs)', () => {\n      it('handles mixed children with and without arrays', () => {\n        const Foo = ({ items }) => (\n          <div>\n            <span className=\"foo\" />\n            {items.map((x) => x)}\n          </div>\n        );\n\n        const wrapper = WrapRendered((\n          <Foo\n            items={[\n              <i key={1} className=\"bar\">abc</i>,\n              <i key={2} className=\"baz\">def</i>,\n            ]}\n          />\n        ));\n        expect(wrapper.children()).to.have.lengthOf(3);\n        expect(wrapper.children().at(0).hasClass('foo')).to.equal(true);\n        expect(wrapper.children().at(1).hasClass('bar')).to.equal(true);\n        expect(wrapper.children().at(2).hasClass('baz')).to.equal(true);\n      });\n    });\n\n    it('returns duplicates untouched', () => {\n      class Foo extends React.Component {\n        render() {\n          const foo = 'Foo';\n          return (\n            <div>\n              {foo} Bar {foo} Bar {foo}\n            </div>\n          );\n        }\n      }\n\n      const wrapper = Wrap(<Foo />);\n      const children = wrapper.children();\n      const textNodes = children.map((x) => x.text());\n      const expectedShallowNodes = ['Foo', ' Bar ', 'Foo', ' Bar ', 'Foo'];\n      const expectedTextNodes = isShallow ? expectedShallowNodes : [expectedShallowNodes.join('')];\n      expect(textNodes).to.eql(expectedTextNodes);\n    });\n\n    it('renders children separated by spaces', () => {\n      class JustificationRow extends React.Component {\n        render() {\n          const { children } = this.props;\n          const wrappedChildren = React.Children.map(\n            children,\n            (child) => child && <span>{child}</span>,\n          );\n\n          const justifiedChildren = [];\n          React.Children.forEach(wrappedChildren, (child) => {\n            if (child) {\n              justifiedChildren.push(child, ' ');\n            }\n          });\n          justifiedChildren.pop();\n\n          return <div>{justifiedChildren}</div>;\n        }\n      }\n\n      const wrapper = WrapRendered((\n        <JustificationRow>\n          <div>foo</div>\n          <div>bar</div>\n          <div>baz</div>\n        </JustificationRow>\n      ));\n\n      expect(wrapper.children().map((x) => x.debug())).to.eql([\n        `<span>\n  <div>\n    foo\n  </div>\n</span>`,\n        ' ',\n        `<span>\n  <div>\n    bar\n  </div>\n</span>`,\n        ' ',\n        `<span>\n  <div>\n    baz\n  </div>\n</span>`,\n      ]);\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/closest.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\n\nexport default function describeClosest({\n  Wrap,\n}) {\n  describe('.closest(selector)', () => {\n    it('returns the closest ancestor for a given selector', () => {\n      const wrapper = Wrap((\n        <div className=\"foo\">\n          <div className=\"foo baz\">\n            <div className=\"bax\">\n              <div className=\"bar\" />\n            </div>\n          </div>\n        </div>\n      ));\n\n      const closestFoo = wrapper.find('.bar').closest('.foo');\n      expect(closestFoo).to.have.lengthOf(1);\n      expect(closestFoo.hasClass('baz')).to.equal(true);\n    });\n\n    it('only ever returns a wrapper of a single node', () => {\n      const wrapper = Wrap((\n        <div className=\"bax\">\n          <div className=\"foo\">\n            <div className=\"bar\">\n              <div className=\"baz\" />\n            </div>\n          </div>\n        </div>\n      ));\n\n      expect(wrapper.find('.baz').parent().hasClass('bar')).to.equal(true);\n    });\n\n    it('returns itself if matching', () => {\n      const wrapper = Wrap((\n        <div className=\"bax\">\n          <div className=\"foo\">\n            <div className=\"baz\">\n              <div className=\"bux baz\" />\n            </div>\n          </div>\n        </div>\n      ));\n\n      expect(wrapper.find('.bux').closest('.baz').hasClass('bux')).to.equal(true);\n    });\n\n    it('does not find a nonexistent match', () => {\n      const wrapper = Wrap((\n        <div className=\"foo\">\n          <div className=\"bar\" />\n        </div>\n      ));\n\n      expect(wrapper.find('.fooooo')).to.have.lengthOf(0);\n\n      const bar = wrapper.find('.bar');\n      expect(bar).to.have.lengthOf(1);\n\n      expect(bar.closest('.fooooo')).to.have.lengthOf(0);\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/contains.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\n\nimport {\n  describeIf,\n  itIf,\n} from '../../_helpers';\nimport { is } from '../../_helpers/version';\n\nexport default function describeContains({\n  Wrap,\n  WrapperName,\n  isMount,\n}) {\n  describe('.contains(node)', () => {\n    it('allows matches on the root node', () => {\n      const a = <div className=\"foo\" />;\n      const b = <div className=\"foo\" />;\n      const c = <div className=\"bar\" />;\n      const wrapper = Wrap(a);\n      expect(wrapper.contains(b)).to.equal(true);\n      expect(wrapper.contains(c)).to.equal(false);\n    });\n\n    it('allows matches on a nested node', () => {\n      const wrapper = Wrap((\n        <div>\n          <div className=\"foo\" />\n        </div>\n      ));\n      const b = <div className=\"foo\" />;\n      expect(wrapper.contains(b)).to.equal(true);\n    });\n\n    it('matches composite components', () => {\n      class Foo extends React.Component {\n        render() { return <div />; }\n      }\n      const wrapper = Wrap((\n        <div>\n          <Foo />\n        </div>\n      ));\n      const b = <Foo />;\n      expect(wrapper.contains(b)).to.equal(true);\n    });\n\n    it('works with strings', () => {\n      const wrapper = Wrap(<div>foo</div>);\n\n      expect(wrapper.contains('foo')).to.equal(true);\n      expect(wrapper.contains('bar')).to.equal(false);\n    });\n\n    it('works with numbers', () => {\n      const wrapper = Wrap(<div>{1}</div>);\n\n      expect(wrapper.contains(1)).to.equal(true);\n      expect(wrapper.contains(2)).to.equal(false);\n      expect(wrapper.contains('1')).to.equal(false);\n    });\n\n    it('works with nested strings & numbers', () => {\n      const wrapper = Wrap((\n        <div>\n          <div>\n            <div>{5}</div>\n          </div>\n          <div>foo</div>\n        </div>\n      ));\n\n      expect(wrapper.contains('foo')).to.equal(true);\n      expect(wrapper.contains(<div>foo</div>)).to.equal(true);\n\n      expect(wrapper.contains(5)).to.equal(true);\n      expect(wrapper.contains(<div>{5}</div>)).to.equal(true);\n    });\n\n    it('does something with arrays of nodes', () => {\n      const wrapper = Wrap((\n        <div>\n          <span>Hello</span>\n          <div>Goodbye</div>\n          <span>More</span>\n        </div>\n      ));\n      const fails = [\n        <span>wrong</span>,\n        <div>Goodbye</div>,\n      ];\n\n      const passes1 = [\n        <span>Hello</span>,\n        <div>Goodbye</div>,\n      ];\n      const passes2 = [\n        <div>Goodbye</div>,\n        <span>More</span>,\n      ];\n\n      expect(wrapper.contains(fails)).to.equal(false);\n      expect(wrapper.contains(passes1)).to.equal(true);\n      expect(wrapper.contains(passes2)).to.equal(true);\n    });\n\n    // FIXME: fix on mount\n    itIf(!isMount, 'throws on invalid argument', () => {\n      const wrapper = Wrap(<div />);\n\n      expect(() => wrapper.contains({})).to.throw(\n        Error,\n        `${WrapperName}::contains() can only be called with a ReactElement (or an array of them), a string, or a number as an argument.`,\n      );\n      expect(() => wrapper.contains(() => ({}))).to.throw(\n        Error,\n        `${WrapperName}::contains() can only be called with a ReactElement (or an array of them), a string, or a number as an argument.`,\n      );\n    });\n\n    describeIf(is('> 0.13'), 'stateless function components (SFCs)', () => {\n      it('matches composite components', () => {\n        function Foo() {\n          return <div />;\n        }\n\n        const wrapper = Wrap((\n          <div>\n            <Foo />\n          </div>\n        ));\n        const b = <Foo />;\n        expect(wrapper.contains(b)).to.equal(true);\n      });\n\n      it('matches composite components if rendered by function', () => {\n        function Foo() {\n          return <div />;\n        }\n        const renderStatelessComponent = () => <Foo />;\n        const wrapper = Wrap((\n          <div>\n            {renderStatelessComponent()}\n          </div>\n        ));\n        const b = <Foo />;\n        expect(wrapper.contains(b)).to.equal(true);\n      });\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/containsAllMatchingElements.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\nimport sinon from 'sinon-sandbox';\n\nexport default function describeContainsAllMatchingElements({\n  Wrap,\n}) {\n  describe('.containsAllMatchingElements(nodes)', () => {\n    it('throws TypeError if non-array passed in', () => {\n      const wrapper = Wrap((\n        <div>\n          Hello\n        </div>\n      ));\n\n      expect(() => wrapper.containsAllMatchingElements((\n        <div>\n          Hello\n        </div>\n      ))).to.throw(TypeError, 'nodes should be an Array');\n    });\n\n    it('matches on array of nodes that each look like rendered nodes, with nested elements', () => {\n      const wrapper = Wrap((\n        <div>\n          <div>\n            <p>Hello</p>\n          </div>\n          <div>\n            <p>Goodbye</p>\n          </div>\n        </div>\n      ));\n\n      expect(wrapper.containsAllMatchingElements([\n        <p>Hello</p>,\n        <p>Goodbye</p>,\n      ])).to.equal(true);\n    });\n\n    it('matches on an array of nodes that all look like one of the rendered nodes', () => {\n      const spy1 = sinon.spy();\n      const spy2 = sinon.spy();\n      const wrapper = Wrap((\n        <div>\n          <div onClick={spy1} style={{ fontSize: 12, color: 'red' }}>Hello World</div>\n          <div onClick={spy2} style={{ fontSize: 13, color: 'blue' }}>Goodbye World</div>\n        </div>\n      ));\n      expect(wrapper.containsAllMatchingElements([\n        <div>Hello World</div>,\n        <div>Goodbye World</div>,\n      ])).to.equal(true);\n      expect(wrapper.containsAllMatchingElements([\n        <div onClick={spy1} style={{ fontSize: 12, color: 'red' }}>Hello World</div>,\n        <div>Goodbye World</div>,\n      ])).to.equal(true);\n      expect(wrapper.containsAllMatchingElements([\n        <div>Hello World</div>,\n        <div onClick={spy2} style={{ fontSize: 13, color: 'blue' }}>Goodbye World</div>,\n      ])).to.equal(true);\n      expect(wrapper.containsAllMatchingElements([\n        <div onClick={spy1} style={{ fontSize: 12, color: 'red' }}>Hello World</div>,\n        <div onClick={spy2} style={{ fontSize: 13, color: 'blue' }}>Goodbye World</div>,\n      ])).to.equal(true);\n      expect(wrapper.containsAllMatchingElements([\n        <div onClick={spy1}>Hello World</div>,\n        <div onClick={spy2} style={{ fontSize: 13, color: 'blue' }}>Goodbye World</div>,\n      ])).to.equal(true);\n      expect(wrapper.containsAllMatchingElements([\n        <div style={{ fontSize: 12, color: 'red' }}>Hello World</div>,\n        <div onClick={spy2} style={{ fontSize: 13, color: 'blue' }}>Goodbye World</div>,\n      ])).to.equal(true);\n      expect(wrapper.containsAllMatchingElements([\n        <div onClick={spy1} style={{ fontSize: 12, color: 'red' }}>Hello World</div>,\n        <div style={{ fontSize: 13, color: 'blue' }}>Goodbye World</div>,\n      ])).to.equal(true);\n      expect(wrapper.containsAllMatchingElements([\n        <div onClick={spy1} style={{ fontSize: 12, color: 'red' }}>Hello World</div>,\n        <div onClick={spy2}>Goodbye World</div>,\n      ])).to.equal(true);\n      expect(spy1).to.have.property('callCount', 0);\n      expect(spy2).to.have.property('callCount', 0);\n    });\n\n    it('does not match on nodes that do not all look like one of the rendered nodes', () => {\n      const spy1 = sinon.spy();\n      const spy2 = sinon.spy();\n      const wrapper = Wrap((\n        <div>\n          <div onClick={spy1} style={{ fontSize: 12, color: 'red' }}>Hello World</div>\n          <div onClick={spy2} style={{ fontSize: 13, color: 'blue' }}>Goodbye World</div>\n        </div>\n      ));\n      expect(wrapper.containsAllMatchingElements([\n        <div onClick={spy1} style={{ fontSize: 12, color: 'red' }}>Hello World</div>,\n        <div onClick={spy1} style={{ fontSize: 12, color: 'red' }}>Bonjour le monde</div>,\n        <div onClick={spy2}>Goodbye World</div>,\n      ])).to.equal(false);\n      expect(spy1).to.have.property('callCount', 0);\n      expect(spy2).to.have.property('callCount', 0);\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/containsAnyMatchingElements.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\nimport sinon from 'sinon-sandbox';\n\nexport default function describeContainsAnyMatchingElements({\n  Wrap,\n}) {\n  describe('.containsAnyMatchingElements(nodes)', () => {\n    it('matches on an array with at least one node that looks like a rendered node', () => {\n      const spy1 = sinon.spy();\n      const spy2 = sinon.spy();\n      const wrapper = Wrap((\n        <div>\n          <div onClick={spy1} style={{ fontSize: 12, color: 'red' }}>Hello World</div>\n          <div onClick={spy2} style={{ fontSize: 13, color: 'blue' }}>Goodbye World</div>\n        </div>\n      ));\n      expect(wrapper.containsAnyMatchingElements([\n        <div>Bonjour le monde</div>,\n        <div>Goodbye World</div>,\n      ])).to.equal(true);\n      expect(wrapper.containsAnyMatchingElements([\n        <div onClick={spy1} style={{ fontSize: 12, color: 'red' }}>Bonjour le monde</div>,\n        <div>Goodbye World</div>,\n      ])).to.equal(true);\n      expect(wrapper.containsAnyMatchingElements([\n        <div>Bonjour le monde</div>,\n        <div onClick={spy2} style={{ fontSize: 13, color: 'blue' }}>Goodbye World</div>,\n      ])).to.equal(true);\n      expect(wrapper.containsAnyMatchingElements([\n        <div onClick={spy1} style={{ fontSize: 12, color: 'red' }}>Bonjour le monde</div>,\n        <div onClick={spy2} style={{ fontSize: 13, color: 'blue' }}>Goodbye World</div>,\n      ])).to.equal(true);\n      expect(wrapper.containsAnyMatchingElements([\n        <div onClick={spy1}>Bonjour le monde</div>,\n        <div onClick={spy2} style={{ fontSize: 13, color: 'blue' }}>Goodbye World</div>,\n      ])).to.equal(true);\n      expect(wrapper.containsAnyMatchingElements([\n        <div style={{ fontSize: 12, color: 'red' }}>Bonjour le monde</div>,\n        <div onClick={spy2} style={{ fontSize: 13, color: 'blue' }}>Goodbye World</div>,\n      ])).to.equal(true);\n      expect(wrapper.containsAnyMatchingElements([\n        <div onClick={spy1} style={{ fontSize: 12, color: 'red' }}>Bonjour le monde</div>,\n        <div style={{ fontSize: 13, color: 'blue' }}>Goodbye World</div>,\n      ])).to.equal(true);\n      expect(wrapper.containsAnyMatchingElements([\n        <div onClick={spy1} style={{ fontSize: 12, color: 'red' }}>Bonjour le monde</div>,\n        <div onClick={spy2}>Goodbye World</div>,\n      ])).to.equal(true);\n      expect(spy1).to.have.property('callCount', 0);\n      expect(spy2).to.have.property('callCount', 0);\n    });\n\n    it('does not match on an array with no nodes that look like a rendered node', () => {\n      const spy1 = sinon.spy();\n      const spy2 = sinon.spy();\n      const wrapper = Wrap((\n        <div>\n          <div onClick={spy1} style={{ fontSize: 12, color: 'red' }}>Hello World</div>\n          <div onClick={spy2} style={{ fontSize: 13, color: 'blue' }}>Goodbye World</div>\n        </div>\n      ));\n      expect(wrapper.containsAnyMatchingElements([\n        <div onClick={spy1} style={{ fontSize: 12, color: 'red' }}>Bonjour le monde</div>,\n        <div onClick={spy2}>Au revoir le monde</div>,\n      ])).to.equal(false);\n      expect(spy1).to.have.property('callCount', 0);\n      expect(spy2).to.have.property('callCount', 0);\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/containsMatchingElement.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\nimport sinon from 'sinon-sandbox';\n\nexport default function describeContainsMatchingElement({\n  Wrap,\n}) {\n  describe('.containsMatchingElement(node)', () => {\n    it('matches a root node that looks like the rendered one', () => {\n      const spy1 = sinon.spy();\n      const spy2 = sinon.spy();\n      const wrapper = Wrap((\n        <div>\n          <div onClick={spy1} style={{ fontSize: 12, color: 'red' }}>Hello World</div>\n          <div onClick={spy2} style={{ fontSize: 13, color: 'blue' }}>Goodbye World</div>\n        </div>\n      ));\n      expect(wrapper.containsMatchingElement((\n        <div>\n          <div>Hello World</div>\n          <div>Goodbye World</div>\n        </div>\n      ))).to.equal(true);\n      expect(wrapper.containsMatchingElement((\n        <div>\n          <div onClick={spy1} style={{ fontSize: 12, color: 'red' }}>Hello World</div>\n          <div onClick={spy2} style={{ fontSize: 13, color: 'blue' }}>Goodbye World</div>\n        </div>\n      ))).to.equal(true);\n      expect(wrapper.containsMatchingElement((\n        <div>\n          <div onClick={spy1}>Hello World</div>\n          <div style={{ fontSize: 13, color: 'blue' }}>Goodbye World</div>\n        </div>\n      ))).to.equal(true);\n      expect(wrapper.containsMatchingElement((\n        <div>\n          <div style={{ fontSize: 12, color: 'red' }}>Hello World</div>\n          <div onClick={spy2}>Goodbye World</div>\n        </div>\n      ))).to.equal(true);\n      expect(wrapper.containsMatchingElement((\n        <div>\n          <div>Hello World</div>\n          <div onClick={spy2} style={{ fontSize: 13, color: 'blue' }}>Goodbye World</div>\n        </div>\n      ))).to.equal(true);\n      expect(wrapper.containsMatchingElement((\n        <div>\n          <div>Hello World</div>\n          <div style={{ fontSize: 13, color: 'blue' }}>Goodbye World</div>\n        </div>\n      ))).to.equal(true);\n      expect(spy1).to.have.property('callCount', 0);\n      expect(spy2).to.have.property('callCount', 0);\n    });\n\n    it('matches on a single node that looks like a rendered one', () => {\n      const spy1 = sinon.spy();\n      const spy2 = sinon.spy();\n      const wrapper = Wrap((\n        <div>\n          <div onClick={spy1} style={{ fontSize: 12, color: 'red' }}>Hello World</div>\n          <div onClick={spy2} style={{ fontSize: 13, color: 'blue' }}>Goodbye World</div>\n        </div>\n      ));\n      expect(wrapper.containsMatchingElement(<div>Hello World</div>)).to.equal(true);\n      expect(wrapper.containsMatchingElement(<div>Goodbye World</div>)).to.equal(true);\n      expect(wrapper.containsMatchingElement((\n        <div onClick={spy1} style={{ fontSize: 12, color: 'red' }}>Hello World</div>\n      ))).to.equal(true);\n      expect(wrapper.containsMatchingElement((\n        <div style={{ fontSize: 12, color: 'red' }}>Hello World</div>\n      ))).to.equal(true);\n      expect(wrapper.containsMatchingElement((\n        <div onClick={spy2} style={{ fontSize: 13, color: 'blue' }}>Goodbye World</div>\n      ))).to.equal(true);\n      expect(wrapper.containsMatchingElement((\n        <div onClick={spy2}>Goodbye World</div>\n      ))).to.equal(true);\n      expect(spy1).to.have.property('callCount', 0);\n      expect(spy2).to.have.property('callCount', 0);\n    });\n\n    it('does not match on a single node that doesn‘t looks like a rendered one', () => {\n      const spy1 = sinon.spy();\n      const spy2 = sinon.spy();\n      const wrapper = Wrap((\n        <div>\n          <div onClick={spy1} style={{ fontSize: 12, color: 'red' }}>Hello World</div>\n          <div onClick={spy2} style={{ fontSize: 13, color: 'blue' }}>Goodbye World</div>\n        </div>\n      ));\n      expect(wrapper.containsMatchingElement(<div>Bonjour le monde</div>)).to.equal(false);\n      expect(wrapper.containsMatchingElement((\n        <div onClick={spy2}>Au revoir le monde</div>\n      ))).to.equal(false);\n    });\n\n    it('does not differentiate between absence, null, or undefined', () => {\n      const wrapper = Wrap((\n        <div>\n          <div className=\"a\" id={null} />\n          <div className=\"b\" id={undefined} />\n          <div className=\"c\" />\n        </div>\n      ));\n\n      expect(wrapper.containsMatchingElement(<div />)).to.equal(true);\n\n      expect(wrapper.containsMatchingElement(<div className=\"a\" />)).to.equal(true);\n      expect(wrapper.containsMatchingElement(<div className=\"a\" id={null} />)).to.equal(true);\n      expect(wrapper.containsMatchingElement(<div className=\"a\" id={undefined} />)).to.equal(true);\n\n      expect(wrapper.containsMatchingElement(<div className=\"b\" />)).to.equal(true);\n      expect(wrapper.containsMatchingElement(<div className=\"b\" id={null} />)).to.equal(true);\n      expect(wrapper.containsMatchingElement(<div className=\"b\" id={undefined} />)).to.equal(true);\n\n      expect(wrapper.containsMatchingElement(<div className=\"c\" />)).to.equal(true);\n      expect(wrapper.containsMatchingElement(<div className=\"c\" id={null} />)).to.equal(true);\n      expect(wrapper.containsMatchingElement(<div className=\"c\" id={undefined} />)).to.equal(true);\n    });\n\n    it('works with leading and trailing spaces', () => {\n      const wrapper = Wrap((\n        <li>\n          <a> All Operations </a>\n        </li>\n      ));\n\n      expect(wrapper.containsMatchingElement(<a> All Operations </a>)).to.equal(true);\n    });\n\n    it('works with leading and trailing newlines', () => {\n      const wrapper = Wrap((\n        <li>\n          <a>\n            All Operations\n          </a>\n        </li>\n      ));\n\n      expect(wrapper.containsMatchingElement(<a> All Operations </a>)).to.equal(true);\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/context.jsx",
    "content": "import React from 'react';\nimport PropTypes from 'prop-types';\nimport { expect } from 'chai';\n\nimport {\n  itIf,\n} from '../../_helpers';\nimport {\n  is,\n} from '../../_helpers/version';\n\nimport {\n  createClass,\n} from '../../_helpers/react-compat';\n\nexport default function describeContext({\n  Wrap,\n  WrapperName,\n  isShallow,\n}) {\n  describe('.context()', () => {\n    const contextTypes = {\n      name: PropTypes.string,\n    };\n    const SimpleComponent = createClass({\n      contextTypes,\n      render() {\n        const { name } = this.context;\n        return <div>{name}</div>;\n      },\n    });\n\n    function SimpleComponentSFC(props, { name }) {\n      return <div>{name}</div>;\n    }\n    SimpleComponentSFC.contextTypes = contextTypes;\n\n    it('throws when not called on the root', () => {\n      const context = { name: <main /> };\n      const wrapper = Wrap(<SimpleComponent />, { context });\n      const main = wrapper.find('main');\n      expect(main).to.have.lengthOf(1);\n      expect(() => main.context()).to.throw(\n        Error,\n        `${WrapperName}::context() can only be called on the root`,\n      );\n    });\n\n    itIf(isShallow, 'throws if it is called when wrapper didn’t include context', () => {\n      const wrapper = Wrap(<SimpleComponent />, { context: false });\n      expect(() => wrapper.context()).to.throw(\n        Error,\n        `${WrapperName}::context() can only be called on a wrapper that was originally passed a context option`,\n      );\n    });\n\n    itIf(is('>= 16'), 'throws on SFCs that lack an instance', () => {\n      const context = { name: 'bob' };\n      const wrapper = Wrap(<SimpleComponentSFC />, { context });\n      expect(() => wrapper.context()).to.throw(\n        Error,\n        `${WrapperName}::context() can only be called on wrapped nodes that have a non-null instance`,\n      );\n    });\n\n    it('works with no arguments', () => {\n      const context = { name: 'foo' };\n      const wrapper = Wrap(<SimpleComponent />, { context });\n      expect(wrapper.context()).to.eql(context);\n    });\n\n    it('works with a key name', () => {\n      const context = { name: 'foo' };\n      const wrapper = Wrap(<SimpleComponent />, { context });\n      expect(wrapper.context('name')).to.equal(context.name);\n    });\n\n    class RendersHTML extends React.Component {\n      render() {\n        return <div><span>hi</span></div>;\n      }\n    }\n\n    it('throws on non-instance', () => {\n      const wrapper = Wrap(<RendersHTML />);\n      const span = wrapper.find('span');\n      expect(span).to.have.lengthOf(1);\n      expect(() => span.context()).to.throw(Error);\n    });\n\n    class RendersChildren extends React.Component {\n      render() {\n        const { children } = this.props;\n        return <div>{children}</div>;\n      }\n    }\n\n    it('throws on non-root', () => {\n\n      const wrapper = Wrap(<RendersChildren><RendersHTML /></RendersChildren>);\n      const child = wrapper.find(RendersHTML);\n      expect(child).to.have.lengthOf(1);\n      expect(() => child.context()).to.throw(Error);\n    });\n\n    itIf(is('>= 16'), 'throws on an SFC without an instance', () => {\n      function Bar() {\n        return <RendersHTML />;\n      }\n\n      const wrapper = Wrap(<RendersChildren><Bar /></RendersChildren>);\n      const child = wrapper.find(Bar);\n      expect(child).to.have.lengthOf(1);\n      expect(() => child.context()).to.throw(Error);\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/debug.jsx",
    "content": "import React from 'react';\nimport PropTypes from 'prop-types';\nimport { expect } from 'chai';\nimport inspect from 'object-inspect';\n\nimport { debugNodes } from 'enzyme/build/Debug';\n\nimport {\n  describeIf,\n  itIf,\n} from '../../_helpers';\nimport { is } from '../../_helpers/version';\n\nimport {\n  createClass,\n  memo,\n  useCallback,\n} from '../../_helpers/react-compat';\n\nexport default function describeDebug({\n  Wrap,\n  WrapRendered,\n  isShallow,\n}) {\n  describe('.debug()', () => {\n    context('passes through to the debugNodes function', () => {\n      it('with wrapping an HTML element', () => {\n        const wrapper = Wrap(<div />);\n\n        expect(wrapper.debug()).to.equal('<div />');\n        expect(wrapper.debug()).to.equal(debugNodes(wrapper.getNodesInternal()));\n      });\n\n      it('with wrapping a createClass component', () => {\n        const Foo = createClass({\n          displayName: 'Bar',\n          render() { return <div />; },\n        });\n        const wrapper = Wrap(<Foo />);\n\n        const expectedDebug = isShallow\n          ? '<div />'\n          : `<Bar>\n  <div />\n</Bar>`;\n        expect(wrapper.debug()).to.equal(expectedDebug);\n        expect(wrapper.debug()).to.equal(debugNodes(wrapper.getNodesInternal()));\n      });\n\n      it('with wrapping a class component', () => {\n        class Foo extends React.Component {\n          render() {\n            return <div />;\n          }\n        }\n        const wrapper = Wrap(<Foo />);\n\n        const expectedDebug = isShallow\n          ? '<div />'\n          : `<Foo>\n  <div />\n</Foo>`;\n        expect(wrapper.debug()).to.equal(expectedDebug);\n        expect(wrapper.debug()).to.equal(debugNodes(wrapper.getNodesInternal()));\n      });\n\n      itIf(is('> 0.13'), 'with wrapping a stateless function component (SFC)', () => {\n        const wrapper = Wrap(<div />);\n\n        expect(wrapper.debug()).to.equal('<div />');\n        expect(wrapper.debug()).to.equal(debugNodes(wrapper.getNodesInternal()));\n      });\n    });\n\n    describeIf(is('>= 16.6'), 'React.memo', () => {\n      describe('display names', () => {\n        function SFC() { return null; }\n        function SFCwithDisplayName() { return null; }\n        SFCwithDisplayName.displayName = 'SFC!';\n\n        const SFCMemo = memo && memo(SFC);\n        const SFCwithDisplayNameMemo = memo && memo(SFCwithDisplayName);\n\n        const SFCMemoWithDisplayName = memo && Object.assign(memo(SFC), {\n          displayName: 'SFCMemoWithDisplayName!',\n        });\n        const SFCMemoWitDoubleDisplayName = memo && Object.assign(memo(SFCwithDisplayName), {\n          displayName: 'SFCMemoWitDoubleDisplayName!',\n        });\n\n        it('displays the expected display names', () => {\n          expect(SFCMemoWithDisplayName).to.have.property('displayName');\n          const wrapper = Wrap((\n            <div>\n              <SFC />\n              <SFCwithDisplayName />\n              <SFCMemo />\n              <SFCwithDisplayNameMemo />\n              <SFCMemoWithDisplayName />\n              <SFCMemoWitDoubleDisplayName />\n            </div>\n          ));\n          expect(wrapper.debug()).to.equal(`<div>\n  <SFC />\n  <SFC! />\n  <Memo(SFC) />\n  <Memo(SFC!) />\n  <SFCMemoWithDisplayName! />\n  <SFCMemoWitDoubleDisplayName! />\n</div>`);\n        });\n      });\n\n      describe('defaultProps', () => {\n        function Add({ a, b, c }) {\n          return <div>{String(a)}|{String(b)}|{String(c)}</div>;\n        }\n        Add.defaultProps = {\n          b: 2,\n          c: 3,\n        };\n        const MemoAdd = memo && memo(Add);\n\n        it('applies defaultProps to the component', () => {\n          const wrapper = WrapRendered(<Add />);\n          expect(wrapper.debug()).to.equal(`<div>\n  undefined\n  |\n  2\n  |\n  3\n</div>`);\n        });\n\n        it('applies defaultProps to the memoized component', () => {\n          const wrapper = WrapRendered(<MemoAdd />);\n          expect(wrapper.debug()).to.equal(`<div>\n  undefined\n  |\n  2\n  |\n  3\n</div>`);\n        });\n\n        it('applies defaultProps to the memoized component and does not override real props', () => {\n          const wrapper = WrapRendered(<MemoAdd a={10} b={20} />);\n          expect(wrapper.debug()).to.equal(`<div>\n  10\n  |\n  20\n  |\n  3\n</div>`);\n        });\n\n        describeIf(is('>= 16.8'), 'full tree', () => {\n          function TransitionGroup({ children }) { return children; }\n          function CSSTransition({ children }) { return children; }\n          function Body({ imageToShow, switchImage }) {\n            const handlerClick = useCallback(\n              () => {\n                if (imageToShow === 1) {\n                  return switchImage(2);\n                }\n\n                return switchImage(1);\n              },\n              [imageToShow, switchImage],\n            );\n\n            return (\n              <div className=\"styles.body\">\n                <button type=\"button\" onClick={handlerClick} className=\"buttonsStyles.button\">\n                  <TransitionGroup className=\"body.animWrap\">\n                    <CSSTransition classNames=\"mainImage\" timeout={500} key={imageToShow}>\n                      <img className=\"bodyImg\" src={`../assets/${imageToShow}.png`} alt=\"main_img\" />\n                    </CSSTransition>\n                  </TransitionGroup>\n                </button>\n              </div>\n            );\n          }\n          const BodyMemo = memo && memo(Body);\n\n          it('shows everything when not memoized', () => {\n            const wrapper = WrapRendered(<Body imageToShow={1} switchImage={() => {}} />);\n            expect(wrapper.debug()).to.equal(`<div className=\"styles.body\">\n  <button type=\"button\" onClick={${inspect(() => {})}} className=\"buttonsStyles.button\">\n    <TransitionGroup className=\"body.animWrap\">\n      <CSSTransition classNames=\"mainImage\" timeout={500}>\n        <img className=\"bodyImg\" src=\"../assets/1.png\" alt=\"main_img\" />\n      </CSSTransition>\n    </TransitionGroup>\n  </button>\n</div>`);\n          });\n\n          it('shows everything when memoized', () => {\n            const wrapper = WrapRendered(<BodyMemo imageToShow={1} switchImage={() => {}} />);\n            expect(wrapper.debug()).to.equal(`<div className=\"styles.body\">\n  <button type=\"button\" onClick={${inspect(() => {})}} className=\"buttonsStyles.button\">\n    <TransitionGroup className=\"body.animWrap\">\n      <CSSTransition classNames=\"mainImage\" timeout={500}>\n        <img className=\"bodyImg\" src=\"../assets/1.png\" alt=\"main_img\" />\n      </CSSTransition>\n    </TransitionGroup>\n  </button>\n</div>`);\n          });\n        });\n      });\n\n      describe('defaultProps vs no defaultProps', () => {\n        function Child({ children }) {\n          return <main>{children}</main>;\n        }\n\n        function LazyC({ type }) {\n          return (\n            <Child>\n              <div>{type}</div>\n            </Child>\n          );\n        }\n\n        const ComponentWithDefaultProps = React.memo && Object.assign(\n          React.memo(LazyC),\n          {\n            defaultProps: {\n              type: 'block',\n            },\n            propTypes: {\n              type: PropTypes.oneOf(['block', 'inline']),\n            },\n          },\n        );\n\n        const ComponentWithoutDefaultProps = React.memo && Object.assign(\n          React.memo(LazyC),\n          {\n            propTypes: {\n              type: PropTypes.oneOf(['block', 'inline']),\n            },\n          },\n        );\n\n        [ComponentWithDefaultProps, ComponentWithoutDefaultProps].forEach((C) => {\n          const isWithout = C === ComponentWithoutDefaultProps;\n\n          // TODO: remove this ternary, pick either variant\n          // see https://github.com/enzymejs/enzyme/issues/2471 for details\n          const Name = isWithout || is('~16.6') ? 'Memo(LazyC)' : 'LazyC';\n\n          it(`produces the expected tree ${isWithout ? 'without' : 'with'} defaultProps, no prop provided`, () => {\n            const wrapper = Wrap(<C />);\n\n            expect(wrapper.debug()).to.equal(isShallow\n              ? `<Child>\n  ${isWithout\n    ? '<div />'\n    : `<div>\n    block\n  </div>`}\n</Child>`\n              : `<${Name}${isWithout ? '' : ' type=\"block\"'}>\n  <Child>\n    <main>\n      ${isWithout\n    ? '<div />'\n    : `<div>\n        block\n      </div>`}\n    </main>\n  </Child>\n</${Name}>`);\n          });\n\n          it(`produces the expected tree ${isWithout ? 'without' : 'with'} defaultProps, prop provided`, () => {\n            const wrapper = Wrap(<C type=\"inline\" />);\n\n            expect(wrapper.debug()).to.equal(isShallow\n              ? `<Child>\n  <div>\n    inline\n  </div>\n</Child>`\n              : `<${Name} type=\"inline\">\n  <Child>\n    <main>\n      <div>\n        inline\n      </div>\n    </main>\n  </Child>\n</${Name}>`);\n          });\n        });\n      });\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/deprecatedInstanceProperties.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\n\nexport default function describeDeprecatedInstanceProperties({\n  Wrap,\n  isShallow,\n}) {\n  class Foo extends React.Component {\n    render() {\n      return (\n        <div>\n          <span>\n            <button type=\"button\" />\n          </span>\n        </div>\n      );\n    }\n  }\n\n  describe('deprecated instance properties', () => {\n    let wrapper;\n    beforeEach(() => {\n      wrapper = Wrap(<Foo />);\n    });\n\n    const tuples = [\n      ['node', 'Consider using the getElement() method instead.'],\n      ['nodes', 'Consider using the getElements() method instead.'],\n      ['renderer', ''],\n      ['options', ''],\n      ['complexSelector', ''],\n    ];\n\n    tuples.forEach(([prop, extra]) => {\n      it(`warns on \\`${prop}\\``, () => {\n        expect(() => wrapper[prop]).to.throw(\n          Error,\n          new RegExp(`^Attempted to access ${isShallow ? 'Shallow' : 'React'}Wrapper::${prop}`),\n        );\n        expect(() => wrapper[prop]).to.throw(\n          Error,\n          new RegExp(`${extra.replace(/([(){}.\\\\])/g, '\\\\$1')}$`),\n        );\n      });\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/equals.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\n\nimport {\n  describeIf,\n} from '../../_helpers';\nimport { is } from '../../_helpers/version';\n\nexport default function describeEquals({\n  Wrap,\n  WrapRendered,\n}) {\n  describe('.equals(node)', () => {\n    it('allows matches on the root node', () => {\n      const a = <div className=\"foo\" />;\n      const b = <div className=\"foo\" />;\n      const c = <div className=\"bar\" />;\n\n      expect(Wrap(a).equals(b)).to.equal(true);\n      expect(Wrap(a).equals(c)).to.equal(false);\n    });\n\n    it('does NOT allow matches on a nested node', () => {\n      const wrapper = Wrap((\n        <div>\n          <div className=\"foo\" />\n        </div>\n      ));\n      const b = <div className=\"foo\" />;\n      expect(wrapper.equals(b)).to.equal(false);\n    });\n\n    it('matches composite components', () => {\n      class Foo extends React.Component {\n        render() { return <div />; }\n      }\n      const wrapper = Wrap((\n        <div>\n          <Foo />\n        </div>\n      ));\n      const b = <div><Foo /></div>;\n      expect(wrapper.equals(b)).to.equal(true);\n    });\n\n    it('does not expand `node` content', () => {\n      class Bar extends React.Component {\n        render() { return <div />; }\n      }\n\n      class Foo extends React.Component {\n        render() { return <Bar />; }\n      }\n\n      const wrapper = WrapRendered(<Foo />);\n      expect(wrapper.equals(<Bar />)).to.equal(true);\n      expect(wrapper.equals(<Foo />)).to.equal(false);\n    });\n\n    describeIf(is('> 0.13'), 'stateless function components (SFCs)', () => {\n      it('matches composite SFCs', () => {\n        const Foo = () => (\n          <div />\n        );\n\n        const wrapper = Wrap((\n          <div>\n            <Foo />\n          </div>\n        ));\n        const b = <div><Foo /></div>;\n        expect(wrapper.equals(b)).to.equal(true);\n      });\n\n      it('does not expand `node` content', () => {\n        const Bar = () => (\n          <div />\n        );\n\n        const Foo = () => (\n          <Bar />\n        );\n\n        const wrapper = WrapRendered(<Foo />);\n        expect(wrapper.equals(<Bar />)).to.equal(true);\n        expect(wrapper.equals(<Foo />)).to.equal(false);\n      });\n    });\n\n    it('flattens arrays of children to compare', () => {\n      class TwoChildren extends React.Component {\n        render() {\n          return (\n            <div className=\"parent-component-class\">\n              <div key=\"a\" className=\"asd\" />\n              <div key=\"b\" className=\"fgh\" />\n            </div>\n          );\n        }\n      }\n\n      class TwoChildrenOneArrayed extends React.Component {\n        render() {\n          return (\n            <div className=\"parent-component-class\">\n              <div key=\"a\" className=\"asd\" />\n              {[<div key=\"b\" className=\"fgh\" />]}\n            </div>\n          );\n        }\n      }\n      const twoChildren = WrapRendered(<TwoChildren />);\n      const twoChildrenOneArrayed = WrapRendered(<TwoChildrenOneArrayed />);\n\n      expect(twoChildren.equals(twoChildrenOneArrayed.getElement())).to.equal(true);\n      expect(twoChildrenOneArrayed.equals(twoChildren.getElement())).to.equal(true);\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/every.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\n\nexport default function describeEvery({\n  Wrap,\n}) {\n  describe('.every(selector)', () => {\n    it('returns if every node matches a selector', () => {\n      const wrapper = Wrap((\n        <div>\n          <div className=\"foo qoo\" />\n          <div className=\"foo boo\" />\n          <div className=\"foo hoo\" />\n        </div>\n      ));\n      expect(wrapper.find('.foo').every('.foo')).to.equal(true);\n      expect(wrapper.find('.foo').every('.qoo')).to.equal(false);\n      expect(wrapper.find('.foo').every('.bar')).to.equal(false);\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/everyWhere.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\n\nexport default function describeEveryWhere({\n  Wrap,\n}) {\n  describe('.everyWhere(predicate)', () => {\n    it('returns if every node matches a predicate', () => {\n      const wrapper = Wrap((\n        <div>\n          <div className=\"foo qoo\" />\n          <div className=\"foo boo\" />\n          <div className=\"foo hoo\" />\n        </div>\n      ));\n      const foo = wrapper.find('.foo');\n      expect(foo.everyWhere((n) => n.hasClass('foo'))).to.equal(true);\n      expect(foo.everyWhere((n) => n.hasClass('qoo'))).to.equal(false);\n      expect(foo.everyWhere((n) => n.hasClass('bar'))).to.equal(false);\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/exists.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\nimport sinon from 'sinon-sandbox';\n\nexport default function describeExists({\n  Wrap,\n  Wrapper,\n}) {\n  describe('.exists()', () => {\n    it('has no required arguments', () => {\n      expect(Wrapper.prototype.exists).to.have.lengthOf(0);\n    });\n\n    describe('without argument', () => {\n      it('returns true if node exists in wrapper', () => {\n        const wrapper = Wrap(<div className=\"foo\" />);\n        expect(wrapper.find('.bar').exists()).to.equal(false);\n        expect(wrapper.find('.foo').exists()).to.equal(true);\n      });\n    });\n    describe('with argument', () => {\n      it('throws on invalid EnzymeSelector', () => {\n        const wrapper = Wrap(<div />);\n\n        expect(() => wrapper.exists(null)).to.throw(TypeError);\n        expect(() => wrapper.exists(undefined)).to.throw(TypeError);\n        expect(() => wrapper.exists(45)).to.throw(TypeError);\n        expect(() => wrapper.exists({})).to.throw(TypeError);\n      });\n\n      it('returns .find(arg).exists() instead', () => {\n        const wrapper = Wrap(<div />);\n        const fakeFindExistsReturnVal = { toString() { return 'fake .find(arg).exists() return value'; } };\n        const fakeSelector = '.someClass';\n        wrapper.find = sinon.stub().returns({ exists() { return fakeFindExistsReturnVal; } });\n        const existsResult = wrapper.exists(fakeSelector);\n        expect(wrapper.find).to.have.property('callCount', 1);\n        expect(wrapper.find.firstCall.args[0]).to.equal(fakeSelector);\n        expect(existsResult).to.equal(fakeFindExistsReturnVal);\n      });\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/filter.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\n\nexport default function describeFilter({\n  Wrap,\n}) {\n  describe('.filter(selector)', () => {\n    it('returns a new wrapper of just the nodes that matched the selector', () => {\n      const wrapper = Wrap((\n        <div>\n          <div className=\"foo bar baz\" />\n          <div className=\"foo\" />\n          <div className=\"bar baz\">\n            <div className=\"foo bar baz\" />\n            <div className=\"foo\" />\n          </div>\n          <div className=\"baz\" />\n          <div className=\"foo bar\" />\n        </div>\n      ));\n\n      expect(wrapper.find('.foo').filter('.bar')).to.have.lengthOf(3);\n      expect(wrapper.find('.bar').filter('.foo')).to.have.lengthOf(3);\n      expect(wrapper.find('.bar').filter('.bax')).to.have.lengthOf(0);\n      expect(wrapper.find('.foo').filter('.baz.bar')).to.have.lengthOf(2);\n    });\n\n    it('only looks in the current wrappers nodes, not their children', () => {\n      const wrapper = Wrap((\n        <div>\n          <div className=\"foo\">\n            <div className=\"bar\" />\n          </div>\n          <div className=\"foo bar\" />\n        </div>\n      ));\n\n      expect(wrapper.find('.foo').filter('.bar')).to.have.lengthOf(1);\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/filterWhere.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\nimport sinon from 'sinon-sandbox';\n\nexport default function describeFilterWhere({\n  Wrap,\n  Wrapper,\n}) {\n  describe('.filterWhere(predicate)', () => {\n    it('filters only the nodes of the wrapper', () => {\n      const wrapper = Wrap((\n        <div>\n          <div className=\"foo bar\" />\n          <div className=\"foo baz\" />\n          <div className=\"foo bux\" />\n        </div>\n      ));\n\n      const stub = sinon.stub();\n      stub.onCall(0).returns(false);\n      stub.onCall(1).returns(true);\n      stub.onCall(2).returns(false);\n\n      const baz = wrapper.find('.foo').filterWhere(stub);\n      expect(baz).to.have.lengthOf(1);\n      expect(baz.hasClass('baz')).to.equal(true);\n    });\n\n    it('calls the predicate with the wrapped node as the first argument', () => {\n      const wrapper = Wrap((\n        <div>\n          <div className=\"foo bar\" />\n          <div className=\"foo baz\" />\n          <div className=\"foo bux\" />\n        </div>\n      ));\n\n      const stub = sinon.stub();\n      stub.returns(true);\n      const spy = sinon.spy(stub);\n      wrapper.find('.foo').filterWhere(spy);\n      expect(spy).to.have.property('callCount', 3);\n      expect(spy.args[0][0]).to.be.instanceOf(Wrapper);\n      expect(spy.args[1][0]).to.be.instanceOf(Wrapper);\n      expect(spy.args[2][0]).to.be.instanceOf(Wrapper);\n      expect(spy.args[0][0].hasClass('bar')).to.equal(true);\n      expect(spy.args[1][0].hasClass('baz')).to.equal(true);\n      expect(spy.args[2][0].hasClass('bux')).to.equal(true);\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/find.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\nimport wrap from 'mocha-wrap';\nimport getData from 'html-element-map/getData';\n\nimport getAdapter from 'enzyme/build/getAdapter';\n\nimport {\n  describeIf,\n  describeWithDOM,\n  itIf,\n} from '../../_helpers';\nimport { is } from '../../_helpers/version';\n\nimport {\n  createPortal,\n  Fragment,\n  forwardRef,\n  memo,\n  useState,\n} from '../../_helpers/react-compat';\n\nexport default function describeFind({\n  Wrap,\n  WrapRendered,\n  isShallow,\n  isMount,\n  hasDOM,\n  makeDOMElement,\n}) {\n  describe('.find(selector)', () => {\n    it('matches the root DOM element', () => {\n      const wrapper = Wrap(<div id=\"ttt\" className=\"ttt\">hello</div>);\n      expect(wrapper.find('#ttt')).to.have.lengthOf(1);\n      expect(wrapper.find('.ttt')).to.have.lengthOf(1);\n    });\n\n    it('finds an element based on a class name', () => {\n      const wrapper = Wrap((\n        <div>\n          <input className=\"foo\" />\n        </div>\n      ));\n      expect(wrapper.find('.foo').type()).to.equal('input');\n    });\n\n    it('finds an SVG element based on a class name', () => {\n      const wrapper = Wrap((\n        <div>\n          <svg className=\"foo\" />\n        </div>\n      ));\n      expect(wrapper.find('.foo').type()).to.equal('svg');\n    });\n\n    it('finds an element that has dot in attribute', () => {\n      const wrapper = Wrap((\n        <div>\n          <div data-baz=\"foo.bar\" />\n        </div>\n      ));\n\n      const elements = wrapper.find('[data-baz=\"foo.bar\"]');\n      expect(elements).to.have.lengthOf(1);\n    });\n\n    it('finds an element based on a tag name', () => {\n      const wrapper = Wrap((\n        <div>\n          <input className=\"foo\" />\n          <button type=\"button\" className=\"bar\">Button</button>\n          <textarea className=\"magic\" />\n          <select className=\"reality\" />\n        </div>\n      ));\n      expect(wrapper.find('input').props()).to.eql({ className: 'foo' });\n      expect(wrapper.find('button').props()).to.eql({\n        className: 'bar',\n        children: 'Button',\n        type: 'button',\n      });\n      expect(wrapper.find('textarea').props()).to.eql({ className: 'magic' });\n      expect(wrapper.find('select').props()).to.eql({ className: 'reality' });\n    });\n\n    it('finds an element based on a tag name and class name', () => {\n      const wrapper = Wrap((\n        <div>\n          <input className=\"foo\" />\n          <div className=\"foo\" />\n        </div>\n      ));\n      expect(wrapper.find('input.foo')).to.have.lengthOf(1);\n    });\n\n    it('finds an element based on a tag name and id', () => {\n      const wrapper = Wrap((\n        <div>\n          <input id=\"foo\" />\n        </div>\n      ));\n      expect(wrapper.find('input#foo')).to.have.lengthOf(1);\n    });\n\n    it('finds an element based on a tag name, id, and class name', () => {\n      const wrapper = Wrap((\n        <div>\n          <input id=\"foo\" className=\"bar\" />\n        </div>\n      ));\n      expect(wrapper.find('input#foo.bar')).to.have.lengthOf(1);\n    });\n\n    it('finds an element that with class and attribute', () => {\n      const wrapper = Wrap((\n        <div>\n          <div data-baz=\"bar\" className=\"classBar\" />\n        </div>\n      ));\n\n      const elements = wrapper.find('.classBar[data-baz=\"bar\"]');\n      expect(elements).to.have.lengthOf(1);\n    });\n\n    it('finds an element that with multiple classes and one attribute', () => {\n      const wrapper = Wrap((\n        <div>\n          <div data-baz=\"bar\" className=\"classBar classFoo\" />\n        </div>\n      ));\n\n      const elements = wrapper.find('.classBar.classFoo[data-baz=\"bar\"]');\n      expect(elements).to.have.lengthOf(1);\n    });\n\n    it('finds an element that with class and class with hyphen', () => {\n      const wrapper = Wrap((\n        <div>\n          <div data-baz=\"bar\" className=\"classBar class-Foo\" />\n        </div>\n      ));\n\n      const elements = wrapper.find('.classBar.class-Foo');\n      expect(elements).to.have.lengthOf(1);\n    });\n\n    it('finds a component based on a constructor', () => {\n      class Foo extends React.Component {\n        render() { return <div />; }\n      }\n      const wrapper = Wrap((\n        <div>\n          <Foo className=\"foo\" />\n        </div>\n      ));\n      expect(wrapper.find(Foo).type()).to.equal(Foo);\n    });\n\n    wrap()\n      .withOverride(() => getAdapter(), 'isValidElementType', () => () => false)\n      .it('throws when an adapter’s `isValidElementType` lies', () => {\n        class Foo extends React.Component {\n          render() { return <div />; }\n        }\n        const wrapper = Wrap((\n          <div>\n            <Foo className=\"foo\" />\n          </div>\n        ));\n\n        expect(() => wrapper.find(Foo)).to.throw(\n          TypeError,\n          'Enzyme::Selector expects a string, object, or valid element type (Component Constructor)',\n        );\n      });\n\n    wrap()\n      .withOverride(() => getAdapter(), 'isValidElementType', () => {})\n      .it('works when an adapter’s `isValidElementType` does not exist', () => {\n        class Foo extends React.Component {\n          render() { return <div />; }\n        }\n        const wrapper = Wrap((\n          <div>\n            <Foo className=\"foo\" />\n          </div>\n        ));\n\n        expect(wrapper.find(Foo)).to.have.lengthOf(1);\n      });\n\n    it('finds a component based on a component function name', () => {\n      class Foo extends React.Component {\n        render() { return <div />; }\n      }\n      const wrapper = Wrap((\n        <div>\n          <Foo className=\"foo\" />\n        </div>\n      ));\n      expect(wrapper.find('Foo').type()).to.equal(Foo);\n    });\n\n    it('finds a component based on a component displayName', () => {\n      class Foo extends React.Component {\n        render() { return <div />; }\n      }\n      Foo.displayName = 'Bar';\n\n      const wrapper = Wrap((\n        <div>\n          <Foo className=\"foo\" />\n        </div>\n      ));\n      expect(wrapper.find('Bar').type()).to.equal(Foo);\n    });\n\n    it('finds multiple elements based on a class name', () => {\n      const wrapper = Wrap((\n        <div>\n          <input className=\"foo\" />\n          <button type=\"button\" className=\"foo\" />\n        </div>\n      ));\n      expect(wrapper.find('.foo')).to.have.lengthOf(2);\n    });\n\n    it('finds multiple elements based on a tag name', () => {\n      const wrapper = Wrap((\n        <div>\n          <input className=\"foo\" />\n          <input />\n          <button type=\"button\" />\n        </div>\n      ));\n      expect(wrapper.find('input')).to.have.lengthOf(2);\n      expect(wrapper.find('button')).to.have.lengthOf(1);\n    });\n\n    it('finds multiple elements based on a constructor', () => {\n      class Foo extends React.Component {\n        render() {\n          return <div />;\n        }\n      }\n      class Bar extends React.Component {\n        render() {\n          return <div />;\n        }\n      }\n\n      const wrapper = Wrap((\n        <div>\n          <Foo className=\"foo\" />\n          <Foo />\n          <Bar />\n        </div>\n      ));\n      expect(wrapper.find(Foo)).to.have.lengthOf(2);\n      expect(wrapper.find(Bar)).to.have.lengthOf(1);\n    });\n\n    it('finds multiple elements based on a string prop', () => {\n      const wrapper = Wrap((\n        <div>\n          <span title=\"foo\" />\n          <span htmlFor=\"foo\" />\n          <div htmlFor=\"bar\" />\n        </div>\n      ));\n\n      expect(wrapper.find('[htmlFor=\"foo\"]')).to.have.lengthOf(1);\n      expect(wrapper.find('[htmlFor]')).to.have.lengthOf(2);\n      expect(wrapper.find('[title=\"foo\"]')).to.have.lengthOf(1);\n      expect(wrapper.find('[title]')).to.have.lengthOf(1);\n    });\n\n    it('finds multiple elements with multiple matching react props', () => {\n      function noop() {}\n      const wrapper = Wrap((\n        <div>\n          <span htmlFor=\"foo\" onChange={noop} preserveAspectRatio=\"xMaxYMax\" />\n        </div>\n      ));\n\n      expect(wrapper.find('span[htmlFor=\"foo\"][onChange]')).to.have.lengthOf(1);\n      expect(wrapper.find('span[htmlFor=\"foo\"][preserveAspectRatio=\"xMaxYMax\"]')).to.have.lengthOf(1);\n      expect(wrapper.find('[htmlFor][preserveAspectRatio]')).to.have.lengthOf(1);\n    });\n\n    it('works on non-single nodes', () => {\n      const wrapper = Wrap((\n        <div className=\"a\">\n          <div className=\"b\">\n            <div className=\"c\">Text</div>\n            <div className=\"c\">Text</div>\n            <div className=\"c\">Text</div>\n          </div>\n          <div className=\"b\">\n            <div className=\"c\">Text</div>\n            <div className=\"c\">Text</div>\n            <div className=\"c\">Text</div>\n          </div>\n        </div>\n      ));\n      expect(wrapper.find('.a')).to.have.lengthOf(1);\n      expect(wrapper.find('.b')).to.have.lengthOf(2);\n      expect(wrapper.find('.b').find('.c')).to.have.lengthOf(6);\n    });\n\n    it('works with an adjacent sibling selector', () => {\n      const a = 'some';\n      const b = 'text';\n      const wrapper = Wrap((\n        <div>\n          <div className=\"row\">\n            {a}\n            {b}\n          </div>\n          <div className=\"row\">\n            {a}\n            {b}\n          </div>\n        </div>\n      ));\n      expect(wrapper.find('.row')).to.have.lengthOf(2);\n      expect(wrapper.find('.row + .row')).to.have.lengthOf(1);\n    });\n\n    it('throws for non-numeric attribute values without quotes', () => {\n      const wrapper = Wrap((\n        <div>\n          <input type=\"text\" />\n          <input type=\"hidden\" />\n          <input type=\"text\" />\n        </div>\n      ));\n      expect(() => wrapper.find('[type=text]')).to.throw(\n        Error,\n        'Failed to parse selector: [type=text]',\n      );\n      expect(() => wrapper.find('[type=hidden]')).to.throw(\n        Error,\n        'Failed to parse selector: [type=hidden]',\n      );\n      expect(() => wrapper.find('[type=\"text\"]')).to.not.throw(\n        Error,\n        'Failed to parse selector: [type=\"text\"]',\n      );\n    });\n\n    it('errors sensibly if any of the search props are undefined', () => {\n      const wrapper = Wrap((\n        <div>\n          <input type={undefined} />\n        </div>\n      ));\n\n      expect(() => wrapper.find({ type: undefined })).to.throw(\n        TypeError,\n        'Enzyme::Props can’t have `undefined` values. Try using ‘findWhere()’ instead.',\n      );\n    });\n\n    it('does not find property when undefined', () => {\n      const wrapper = Wrap((\n        <div>\n          <span data-foo={undefined} />\n        </div>\n      ));\n\n      expect(wrapper.find('[data-foo]')).to.have.lengthOf(0);\n    });\n\n    it('compounds tag and prop selector', () => {\n      const wrapper = Wrap((\n        <div>\n          <span preserveAspectRatio=\"xMaxYMax\" />\n          <span htmlFor=\"foo\" />\n        </div>\n      ));\n\n      expect(wrapper.find('span[preserveAspectRatio=\"xMaxYMax\"]')).to.have.lengthOf(1);\n      expect(wrapper.find('span[preserveAspectRatio]')).to.have.lengthOf(1);\n\n      expect(wrapper.find('span[htmlFor=\"foo\"]')).to.have.lengthOf(1);\n      expect(wrapper.find('span[htmlFor]')).to.have.lengthOf(1);\n    });\n\n    it('supports data prop selectors', () => {\n      const wrapper = Wrap((\n        <div>\n          <span data-foo=\"bar\" />\n          <span data-foo-123=\"bar2\" />\n          <span data-123-foo=\"bar3\" />\n          <span data-foo_bar=\"bar4\" />\n        </div>\n      ));\n\n      expect(wrapper.find('[data-foo=\"bar\"]')).to.have.lengthOf(1);\n      expect(wrapper.find('[data-foo]')).to.have.lengthOf(1);\n\n      expect(wrapper.find('[data-foo-123]')).to.have.lengthOf(1);\n      expect(wrapper.find('[data-foo-123=\"bar2\"]')).to.have.lengthOf(1);\n\n      expect(wrapper.find('[data-123-foo]')).to.have.lengthOf(1);\n      expect(wrapper.find('[data-123-foo=\"bar3\"]')).to.have.lengthOf(1);\n\n      expect(wrapper.find('[data-foo_bar]')).to.have.lengthOf(1);\n      expect(wrapper.find('[data-foo_bar=\"bar4\"]')).to.have.lengthOf(1);\n    });\n\n    it('supports boolean and numeric values for matching props', () => {\n      const wrapper = Wrap((\n        <div>\n          <span value={1} />\n          <a value={false} />\n          <a value=\"false\" />\n          <span value=\"true\" />\n          <a value=\"1\" />\n          <a value=\"2\" />\n        </div>\n      ));\n\n      expect(wrapper.find('span[value=1]')).to.have.lengthOf(1);\n      expect(wrapper.find('span[value=2]')).to.have.lengthOf(0);\n      expect(wrapper.find('a[value=false]')).to.have.lengthOf(1);\n      expect(wrapper.find('a[value=true]')).to.have.lengthOf(0);\n    });\n\n    it('does not find key or ref via property selector', () => {\n      const arrayOfComponents = [<div key=\"1\" />, <div key=\"2\" />];\n\n      class Foo extends React.Component {\n        render() {\n          return (\n            <div>\n              <div ref=\"foo\" />\n              {arrayOfComponents}\n            </div>\n          );\n        }\n      }\n      const wrapper = Wrap(<Foo />);\n\n      expect(wrapper.find('div[ref=\"foo\"]')).to.have.lengthOf(0);\n      expect(wrapper.find('div[key=\"1\"]')).to.have.lengthOf(0);\n      expect(wrapper.find('[ref]')).to.have.lengthOf(0);\n      expect(wrapper.find('[key]')).to.have.lengthOf(0);\n    });\n\n    it('supports object property selectors', () => {\n      const wrapper = Wrap((\n        <div>\n          <input type=\"text\" data-test=\"ref\" className=\"foo\" />\n          <input type=\"text\" data-test=\"ref\" />\n          <button type=\"button\" data-test=\"ref\" data-prop={undefined} />\n          <span data-test=\"ref\" data-prop={null} />\n          <div data-test=\"ref\" data-prop={123} />\n          <input type=\"text\" data-test=\"ref\" data-prop={false} />\n          <a data-test=\"ref\" data-prop />\n        </div>\n      ));\n      expect(wrapper.find({ a: 1 })).to.have.lengthOf(0);\n      expect(wrapper.find({ 'data-test': 'ref' })).to.have.lengthOf(7);\n      expect(wrapper.find({ className: 'foo' })).to.have.lengthOf(1);\n      expect(wrapper.find({ 'data-prop': null })).to.have.lengthOf(1);\n      expect(wrapper.find({ 'data-prop': 123 })).to.have.lengthOf(1);\n      expect(wrapper.find({ 'data-prop': false })).to.have.lengthOf(1);\n      expect(wrapper.find({ 'data-prop': true })).to.have.lengthOf(1);\n    });\n\n    it('supports complex and nested object property selectors', () => {\n      const testFunction = () => ({});\n      const wrapper = Wrap((\n        <div>\n          <span data-more={[{ id: 1 }]} data-test=\"ref\" data-prop onChange={testFunction} />\n          <a data-more={[{ id: 1 }]} data-test=\"ref\" />\n          <div data-more={{ item: { id: 1 } }} data-test=\"ref\" />\n          <input data-more={{ height: 20 }} data-test=\"ref\" />\n        </div>\n      ));\n      expect(wrapper.find({ 'data-test': 'ref' })).to.have.lengthOf(4);\n      expect(wrapper.find({ 'data-more': { a: 1 } })).to.have.lengthOf(0);\n      expect(wrapper.find({ 'data-more': [{ id: 1 }] })).to.have.lengthOf(2);\n      expect(wrapper.find({ 'data-more': { item: { id: 1 } } })).to.have.lengthOf(1);\n      expect(wrapper.find({ 'data-more': { height: 20 } })).to.have.lengthOf(1);\n      expect(wrapper.find({\n        'data-more': [{ id: 1 }],\n        'data-test': 'ref',\n        'data-prop': true,\n        onChange: testFunction,\n      })).to.have.lengthOf(1);\n    });\n\n    it('throws when given empty object, null, or an array', () => {\n      const wrapper = Wrap((\n        <div>\n          <input className=\"foo\" type=\"text\" />\n        </div>\n      ));\n      expect(() => wrapper.find({})).to.throw(\n        TypeError,\n        'Enzyme::Selector does not support an array, null, or empty object as a selector',\n      );\n      expect(() => wrapper.find([])).to.throw(\n        TypeError,\n        'Enzyme::Selector does not support an array, null, or empty object as a selector',\n      );\n      expect(() => wrapper.find(null)).to.throw(\n        TypeError,\n        'Enzyme::Selector does not support an array, null, or empty object as a selector',\n      );\n    });\n\n    it('queries attributes with spaces in their values', () => {\n      const wrapper = Wrap((\n        <div>\n          <h1 data-foo=\"foo bar\">Hello</h1>\n          <h1 data-foo=\"bar baz quz\">World</h1>\n        </div>\n      ));\n      expect(wrapper.find('[data-foo]')).to.have.lengthOf(2);\n      expect(wrapper.find('[data-foo=\"foo bar\"]')).to.have.lengthOf(1);\n      expect(wrapper.find('[data-foo=\"bar baz quz\"]')).to.have.lengthOf(1);\n      expect(wrapper.find('[data-foo=\"bar baz\"]')).to.have.lengthOf(0);\n      expect(wrapper.find('[data-foo=\"foo  bar\"]')).to.have.lengthOf(0);\n      expect(wrapper.find('[data-foo=\"bar  baz quz\"]')).to.have.lengthOf(0);\n    });\n\n    describeIf(is('> 0.13'), 'stateless function components (SFCs)', () => {\n      it('finds a component based on a constructor', () => {\n        const Foo = () => (<div />);\n\n        const wrapper = Wrap((\n          <div>\n            <Foo className=\"foo\" />\n          </div>\n        ));\n        expect(wrapper.find(Foo).type()).to.equal(Foo);\n      });\n\n      it('finds a component based on a function name', () => {\n        const Foo = () => (<div />);\n\n        const wrapper = Wrap((\n          <div>\n            <Foo className=\"foo\" />\n          </div>\n        ));\n        expect(wrapper.find('Foo').type()).to.equal(Foo);\n      });\n\n      it('finds a component based on a displayName', () => {\n        const Foo = () => (<div />);\n        Foo.displayName = 'Bar';\n\n        const wrapper = Wrap((\n          <div>\n            <Foo className=\"foo\" />\n          </div>\n        ));\n        expect(wrapper.find('Bar').type()).to.equal(Foo);\n      });\n\n      itIf(!isShallow, 'finds a stateless component based on a component displayName if rendered by function', () => {\n        const Foo = () => <div />;\n        const renderStatelessComponent = () => <Foo className=\"foo\" />;\n        const wrapper = Wrap((\n          <div>\n            {renderStatelessComponent()}\n          </div>\n        ));\n        expect(wrapper.find('Foo').type()).to.equal(Foo);\n      });\n\n      it('does not find key via property selector', () => {\n        const arrayOfComponents = [<div key=\"1\" />, <div key=\"2\" />];\n\n        const Foo = () => (\n          <div>\n            {arrayOfComponents}\n          </div>\n        );\n\n        const wrapper = WrapRendered(<Foo />);\n\n        expect(wrapper.find('div[key=\"1\"]')).to.have.lengthOf(0);\n        expect(wrapper.find('[key]')).to.have.lengthOf(0);\n      });\n    });\n\n    describe('works with attribute selectors containing #', () => {\n      let wrapper;\n      beforeEach(() => {\n        wrapper = Wrap((\n          <div>\n            <a id=\"test\" href=\"/page\">Hello</a>\n            <a href=\"/page#anchor\">World</a>\n          </div>\n        ));\n      });\n\n      it('works with an ID', () => {\n        expect(wrapper.find('a#test')).to.have.lengthOf(1);\n      });\n\n      it('works with a normal attribute', () => {\n        expect(wrapper.find('a[href=\"/page\"]')).to.have.lengthOf(1);\n      });\n\n      it('works with an attribute with a #', () => {\n        expect(wrapper.find('a[href=\"/page#anchor\"]')).to.have.lengthOf(1);\n      });\n    });\n\n    describe('works with data- attributes', () => {\n      class Foo extends React.Component {\n        render() {\n          return (\n            <div>\n              <i className=\"ficon ficon-12 some-icon\" />\n              <span className=\"custom class\">\n                <i className=\"ficon ficon-book ficon-24\" data-custom-tag=\"bookIcon\" />\n                <i className=\"ficon ficon-book ficon-24\" data-custom-tag=\"bookIcon\" />\n              </span>\n            </div>\n          );\n        }\n      }\n\n      it('finds elements by data attribute', () => {\n        const wrapper = WrapRendered(<Foo />);\n        expect(wrapper.html()).to.contain('data-custom-tag=\"bookIcon\"'); // sanity check\n        const elements = wrapper.find('[data-custom-tag=\"bookIcon\"]');\n        expect(elements).to.have.lengthOf(2);\n        expect(elements.filter('i')).to.have.lengthOf(2);\n      });\n    });\n\n    describeIf(is('>= 16.2'), 'works with Fragments', () => {\n      const NestedFragmentComponent = () => (\n        <div className=\"container\">\n          <Fragment>\n            <span>A span</span>\n            <span>B span</span>\n            <div>A div</div>\n            <Fragment>\n              <span>C span</span>\n            </Fragment>\n          </Fragment>\n          <span>D span</span>\n        </div>\n      );\n\n      it('finds descendant span inside React.Fragment', () => {\n        const wrapper = Wrap(<NestedFragmentComponent />);\n        expect(wrapper.find('.container span')).to.have.lengthOf(4);\n      });\n\n      it('does not find nonexistent p inside React.Fragment', () => {\n        const wrapper = Wrap(<NestedFragmentComponent />);\n        expect(wrapper.find('.container p')).to.have.lengthOf(0);\n      });\n\n      it('finds direct child span inside React.Fragment', () => {\n        const wrapper = Wrap(<NestedFragmentComponent />);\n        expect(wrapper.find('.container > span')).to.have.lengthOf(4);\n      });\n\n      it('handles adjacent sibling selector inside React.Fragment', () => {\n        const wrapper = Wrap(<NestedFragmentComponent />);\n        expect(wrapper.find('.container span + div')).to.have.lengthOf(1);\n      });\n\n      it('handles general sibling selector inside React.Fragment', () => {\n        const wrapper = Wrap(<NestedFragmentComponent />);\n        expect(wrapper.find('.container div ~ span')).to.have.lengthOf(2);\n      });\n\n      // FIXME: investigate if/why mount requires the version range\n      itIf(!isMount || is('>= 16.4.1'), 'handles fragments with no content', () => {\n        const EmptyFragmentComponent = () => (\n          <div className=\"container\">\n            <Fragment>\n              <Fragment />\n            </Fragment>\n          </div>\n        );\n        const wrapper = WrapRendered(<EmptyFragmentComponent />);\n\n        expect(wrapper.find('.container > span')).to.have.lengthOf(0);\n        expect(wrapper.find('.container span')).to.have.lengthOf(0);\n        expect(wrapper).to.have.lengthOf(1);\n        expect(wrapper.children()).to.have.lengthOf(0);\n      });\n    });\n\n    describeIf(is('>= 16'), 'works with Portals', () => {\n      it('finds portals by name', () => {\n        const containerDiv = makeDOMElement();\n        const Foo = () => (\n          <div>\n            {createPortal(\n              <div className=\"in-portal\">InPortal</div>,\n              containerDiv,\n            )}\n          </div>\n        );\n\n        const wrapper = Wrap(<Foo />);\n\n        expect(wrapper.find('Portal')).to.have.lengthOf(1);\n      });\n\n      context('finding through portals', () => {\n        let containerDiv;\n        let FooPortal;\n        let wrapper;\n        beforeEach(() => {\n          containerDiv = makeDOMElement();\n          FooPortal = class FooPortalContainer extends React.Component {\n            render() {\n              const { children } = this.props;\n              return createPortal(children, containerDiv);\n            }\n          };\n          wrapper = Wrap((\n            <FooPortal>\n              <h1>Successful Portal!</h1>\n              <span />\n            </FooPortal>\n          ));\n        });\n\n        it('finds elements', () => {\n          expect(wrapper.find('h1')).to.have.lengthOf(1);\n          expect(wrapper.find('span')).to.have.lengthOf(1);\n        });\n\n        itIf(hasDOM, 'finds elements with qSA', () => {\n          expect(containerDiv.querySelectorAll('h1')).to.have.lengthOf(1);\n        });\n      });\n    });\n\n    describeIf(is('>= 16.3'), 'forwardRef', () => {\n      it('finds forwardRefs', () => {\n        const Component = forwardRef(() => <div />);\n        class Foo extends React.Component {\n          render() {\n            return (\n              <div>\n                <Component />\n                <Component />\n              </div>\n            );\n          }\n        }\n\n        const wrapper = Wrap(<Foo />);\n        expect(wrapper.find(Component)).to.have.lengthOf(2);\n        expect(wrapper.find('ForwardRef')).to.have.lengthOf(2);\n      });\n\n      it('finds forwardRef by custom display name', () => {\n        const Component = forwardRef(() => <div />);\n        Component.displayName = 'CustomForwardRef';\n        class Foo extends React.Component {\n          render() {\n            return (\n              <div>\n                <Component />\n                <Component />\n              </div>\n            );\n          }\n        }\n\n        const wrapper = Wrap(<Foo />);\n        expect(wrapper.find(Component)).to.have.lengthOf(2);\n        expect(wrapper.find(Component.displayName)).to.have.lengthOf(2);\n      });\n    });\n\n    describeIf(is('>= 16.8'), 'hooks', () => {\n      it('handles useState', () => {\n        const ComponentUsingStateHook = () => {\n          const [count] = useState(0);\n          return <div>{count}</div>;\n        };\n\n        const wrapper = Wrap(<ComponentUsingStateHook />);\n\n        expect(wrapper.find('div')).to.have.lengthOf(1);\n        expect(wrapper.find('div').text()).to.equal('0');\n      });\n\n      it('handles setState returned from useState', () => {\n        const ComponentUsingStateHook = () => {\n          const [count, setCount] = useState(0);\n          return <div onClick={() => setCount(count + 1)}>{count}</div>;\n        };\n\n        const wrapper = Wrap(<ComponentUsingStateHook />);\n        wrapper.simulate('click'); // FIXME: avoid simulate\n\n        expect(wrapper.find('div').text()).to.equal('1');\n      });\n\n      it('handles keep hook state for same component type', () => {\n        const ComponentUsingStateHook = () => {\n          const [count, setCount] = useState(0);\n          return <div onClick={() => setCount(count + 1)}>{count}</div>;\n        };\n\n        const wrapper = Wrap(<ComponentUsingStateHook />);\n        wrapper.simulate('click'); // FIXME: avoid simulate\n        expect(wrapper.find('div').text()).to.equal('1');\n\n        wrapper.setProps({ newProp: 1 });\n        expect(wrapper.find('div').text()).to.equal('1');\n\n        wrapper.simulate('click'); // FIXME: avoid simulate\n        expect(wrapper.find('div').text()).to.equal('2');\n      });\n    });\n\n    describeWithDOM('find DOM elements by constructor', () => {\n      // in React 0.13 and 0.14, these HTML tags get moved around by the DOM, and React fails\n      // they're tested in `shallow`, and in React 15+, so we can skip them here.\n      const tagsWithRenderError = new Set([\n        'body',\n        'frame',\n        'frameset',\n        'head',\n        'html',\n        'caption',\n        'td',\n        'th',\n        'tr',\n        'col',\n        'colgroup',\n        'tbody',\n        'thead',\n        'tfoot',\n      ]);\n      function hasRenderError(Tag) {\n        return isMount && is('< 15') && tagsWithRenderError.has(Tag);\n      }\n\n      const { elements, all } = getData();\n\n      elements.filter(({ constructor: C }) => C && C !== all).forEach(({\n        tag: Tag,\n        constructorName: name,\n      }) => {\n        class Foo extends React.Component {\n          render() {\n            return <Tag />;\n          }\n        }\n\n        itIf(!hasRenderError(Tag), `${Tag}: found with \\`${name}\\``, () => {\n          const wrapper = WrapRendered(<Foo />);\n\n          expect(wrapper.type()).to.equal(Tag);\n          expect(wrapper.is(Tag)).to.equal(true);\n          expect(wrapper.filter(Tag)).to.have.lengthOf(1);\n        });\n      });\n    });\n\n    describeIf(is('>= 16.6'), 'React.memo', () => {\n      it('works with an SFC', () => {\n        function InnerComp({ message }) {\n          return <div><span>{message}</span></div>;\n        }\n        const InnerMemo = memo(InnerComp);\n        const InnerFoo = ({ foo }) => (\n          <div>\n            <InnerComp message=\"Hello\" />\n            <InnerMemo message=\"find me?\" />\n            <div className=\"bar\">bar</div>\n            <div className=\"qoo\">{foo}</div>\n          </div>\n        );\n        const Foo = memo(InnerFoo);\n\n        const wrapper = Wrap(<Foo foo=\"qux\" />);\n        const expectedDebug = isShallow\n          ? `<div>\n  <InnerComp message=\"Hello\" />\n  <Memo(InnerComp) message=\"find me?\" />\n  <div className=\"bar\">\n    bar\n  </div>\n  <div className=\"qoo\">\n    qux\n  </div>\n</div>`\n          : `<Memo(InnerFoo) foo=\"qux\">\n  <div>\n    <InnerComp message=\"Hello\">\n      <div>\n        <span>\n          Hello\n        </span>\n      </div>\n    </InnerComp>\n    <Memo(InnerComp) message=\"find me?\">\n      <div>\n        <span>\n          find me?\n        </span>\n      </div>\n    </Memo(InnerComp)>\n    <div className=\"bar\">\n      bar\n    </div>\n    <div className=\"qoo\">\n      qux\n    </div>\n  </div>\n</Memo(InnerFoo)>`;\n        expect(wrapper.debug()).to.equal(expectedDebug);\n        const inner = wrapper.find('InnerComp');\n        expect(inner).to.have.lengthOf(1);\n        const memoInner = wrapper.find('Memo(InnerComp)');\n        expect(memoInner).to.have.lengthOf(1);\n        expect(wrapper.find('.bar')).to.have.lengthOf(1);\n        expect(wrapper.find('.qoo').text()).to.equal('qux');\n        expect(wrapper.find(InnerMemo)).to.have.lengthOf(inner.length + memoInner.length); // 2\n      });\n\n      it('works with a class component', () => {\n        class InnerComp extends React.Component {\n          render() {\n            return <div><span>Hello</span></div>;\n          }\n        }\n\n        class Foo extends React.Component {\n          render() {\n            const { foo } = this.props;\n            return (\n              <div>\n                <InnerComp />\n                <div className=\"bar\">bar</div>\n                <div className=\"qoo\">{foo}</div>\n              </div>\n            );\n          }\n        }\n        const FooMemo = memo(Foo);\n\n        const wrapper = Wrap(<FooMemo foo=\"qux\" />);\n        const expectedDebug = isShallow\n          ? `<div>\n  <InnerComp />\n  <div className=\"bar\">\n    bar\n  </div>\n  <div className=\"qoo\">\n    qux\n  </div>\n</div>`\n          : `<Foo foo=\"qux\">\n  <div>\n    <InnerComp>\n      <div>\n        <span>\n          Hello\n        </span>\n      </div>\n    </InnerComp>\n    <div className=\"bar\">\n      bar\n    </div>\n    <div className=\"qoo\">\n      qux\n    </div>\n  </div>\n</Foo>`;\n        expect(wrapper.debug()).to.equal(expectedDebug);\n        expect(wrapper.find('InnerComp')).to.have.lengthOf(1);\n        expect(wrapper.find('.bar')).to.have.lengthOf(1);\n        expect(wrapper.find('.qoo').text()).to.equal('qux');\n      });\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/findWhere.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\nimport sinon from 'sinon-sandbox';\nimport { Portal } from 'react-is';\n\nimport {\n  describeIf,\n  itIf,\n} from '../../_helpers';\nimport realArrowFunction from '../../_helpers/realArrowFunction';\nimport { is } from '../../_helpers/version';\n\nimport {\n  createPortal,\n  Fragment,\n} from '../../_helpers/react-compat';\n\nexport default function describeFindWhere({\n  Wrap,\n  WrapRendered,\n  Wrapper,\n  isShallow,\n  makeDOMElement,\n}) {\n  describe('.findWhere(predicate)', () => {\n    it('returns all elements for a truthy test', () => {\n      const wrapper = Wrap((\n        <div>\n          <input className=\"foo\" />\n          <input />\n        </div>\n      ));\n      expect(wrapper.findWhere(() => true)).to.have.lengthOf(3);\n    });\n\n    it('returns no elements for a falsy test', () => {\n      const wrapper = Wrap((\n        <div>\n          <input className=\"foo\" />\n          <input />\n        </div>\n      ));\n      expect(wrapper.findWhere(() => false)).to.have.lengthOf(0);\n    });\n\n    it('does not pass empty wrappers', () => {\n      class EditableText extends React.Component {\n        render() {\n          return <div>{''}</div>;\n        }\n      }\n\n      const wrapper = WrapRendered(<EditableText />);\n\n      const stub = sinon.stub();\n      wrapper.findWhere(stub);\n      const passedNodeLengths = stub.getCalls().map(({ args: [firstArg] }) => firstArg.length);\n      expect(passedNodeLengths).to.eql([1]);\n    });\n\n    it('calls the predicate with the wrapped node as the first argument', () => {\n      const wrapper = Wrap((\n        <div>\n          <div className=\"foo bar\" />\n          <div className=\"foo baz\" />\n          <div className=\"foo bux\" />\n        </div>\n      ));\n\n      const stub = sinon.stub();\n      stub.returns(true);\n      const spy = sinon.spy(stub);\n      wrapper.findWhere(spy);\n      expect(spy).to.have.property('callCount', 4);\n      expect(spy.args[0][0]).to.be.instanceOf(Wrapper);\n      expect(spy.args[1][0]).to.be.instanceOf(Wrapper);\n      expect(spy.args[2][0]).to.be.instanceOf(Wrapper);\n      expect(spy.args[3][0]).to.be.instanceOf(Wrapper);\n      expect(spy.args[1][0].hasClass('bar')).to.equal(true);\n      expect(spy.args[2][0].hasClass('baz')).to.equal(true);\n      expect(spy.args[3][0].hasClass('bux')).to.equal(true);\n    });\n\n    it('finds nodes', () => {\n      class Foo extends React.Component {\n        render() {\n          const { selector } = this.props;\n          return (\n            <div>\n              <span data-foo={selector} />\n              <i data-foo={selector} />\n            </div>\n          );\n        }\n      }\n\n      const selector = 'blah';\n      const wrapper = Wrap(<Foo selector={selector} />);\n      const foundSpan = wrapper.findWhere((n) => (\n        n.type() === 'span' && n.props()['data-foo'] === selector\n      ));\n      expect(foundSpan.type()).to.equal('span');\n\n      const foundNotSpan = wrapper.findWhere((n) => (\n        n.type() !== 'span' && n.props()['data-foo'] === selector\n      ));\n      expect(foundNotSpan.type()).to.equal('i');\n    });\n\n    describeIf(is('>= 16.2'), 'with fragments', () => {\n      it('finds nodes', () => {\n        class FragmentFoo extends React.Component {\n          render() {\n            const { selector } = this.props;\n            return (\n              <div>\n                <Fragment>\n                  <span data-foo={selector} />\n                  <i data-foo={selector} />\n                  <Fragment>\n                    <i data-foo={selector} />\n                  </Fragment>\n                </Fragment>\n                <span data-foo={selector} />\n              </div>\n            );\n          }\n        }\n\n        const selector = 'blah';\n        const wrapper = Wrap(<FragmentFoo selector={selector} />);\n        const foundSpans = wrapper.findWhere((n) => (\n          n.type() === 'span' && n.props()['data-foo'] === selector\n        ));\n        expect(foundSpans).to.have.lengthOf(2);\n        expect(foundSpans.get(0).type).to.equal('span');\n        expect(foundSpans.get(1).type).to.equal('span');\n\n        const foundNotSpans = wrapper.findWhere((n) => (\n          n.type() !== 'span' && n.props()['data-foo'] === selector\n        ));\n        expect(foundNotSpans).to.have.lengthOf(2);\n        expect(foundNotSpans.get(0).type).to.equal('i');\n        expect(foundNotSpans.get(1).type).to.equal('i');\n      });\n    });\n\n    it('finds nodes when conditionally rendered', () => {\n      class Foo extends React.Component {\n        render() {\n          const { selector } = this.props;\n          return (\n            <div>\n              <span data-foo={selector} />\n              {selector === 'baz' ? <i data-foo={selector} /> : null}\n            </div>\n          );\n        }\n      }\n\n      const selector = 'blah';\n      const wrapper = Wrap(<Foo selector={selector} />);\n      const foundSpan = wrapper.findWhere((n) => (\n        n.type() === 'span' && n.props()['data-foo'] === selector\n      ));\n      expect(foundSpan.type()).to.equal('span');\n\n      const foundNotSpan = wrapper.findWhere((n) => (\n        n.type() !== 'span' && n.props()['data-foo'] === selector\n      ));\n      expect(foundNotSpan).to.have.lengthOf(0);\n    });\n\n    it('does not get trapped when conditionally rendering using an empty string variable as the condition', () => {\n      const emptyString = '';\n\n      class Foo extends React.Component {\n        render() {\n          const { selector } = this.props;\n          return (\n            <div>\n              <header>\n                <span />\n                {emptyString && <i />}\n              </header>\n              <div>\n                <span data-foo={selector}>Test</span>\n              </div>\n            </div>\n          );\n        }\n      }\n\n      const selector = 'blah';\n      const wrapper = Wrap(<Foo selector={selector} />);\n      const foundSpan = wrapper.findWhere((n) => (\n        n.type() === 'span'\n        && n.props()['data-foo'] === selector\n      ));\n\n      expect(foundSpan.debug()).to.equal((\n        `<span data-foo=\"${selector}\">\n  Test\n</span>`\n      ));\n    });\n\n    class HasDataFoo extends React.Component {\n      render() {\n        const { data } = this.props;\n        return (\n          <div data-foo={data}>Test Component</div>\n        );\n      }\n    }\n\n    it('returns props object when props() is called', () => {\n      const content = 'blah';\n      const wrapper = WrapRendered(<HasDataFoo data={content} />);\n      expect(wrapper.props()).to.deep.equal({ 'data-foo': content, children: 'Test Component' });\n    });\n\n    it('returns shallow rendered string when debug() is called', () => {\n      const content = 'blah';\n      const wrapper = Wrap(<HasDataFoo data={content} />);\n      const expectedDebug = isShallow\n        ? `<div data-foo=\"${content}\">\n  Test Component\n</div>`\n        : `<HasDataFoo data=\"${content}\">\n  <div data-foo=\"${content}\">\n    Test Component\n  </div>\n</HasDataFoo>`;\n      expect(wrapper.debug()).to.equal(expectedDebug);\n    });\n\n    describeIf(is('> 0.13'), 'stateless function components (SFCs)', () => {\n      it('finds nodes', () => {\n        const SFC = function SFC({ selector }) {\n          return (\n            <div>\n              <span data-foo={selector} />\n              <i data-foo={selector} />\n            </div>\n          );\n        };\n\n        const selector = 'blah';\n        const wrapper = Wrap(<SFC selector={selector} />);\n        const foundSpan = wrapper.findWhere((n) => (\n          n.type() === 'span' && n.props()['data-foo'] === selector\n        ));\n        expect(foundSpan.type()).to.equal('span');\n\n        const foundNotSpan = wrapper.findWhere((n) => (\n          n.type() !== 'span' && n.props()['data-foo'] === selector\n        ));\n        expect(foundNotSpan.type()).to.equal('i');\n      });\n\n      it('finds nodes when conditionally rendered', () => {\n        const SFC = function SFC({ selector }) {\n          return (\n            <div>\n              <span data-foo={selector} />\n              {selector === 'baz' ? <i data-foo={selector} /> : null}\n            </div>\n          );\n        };\n\n        const selector = 'blah';\n        const wrapper = Wrap(<SFC selector={selector} />);\n        const foundSpan = wrapper.findWhere((n) => (\n          n.type() === 'span' && n.props()['data-foo'] === selector\n        ));\n        expect(foundSpan.type()).to.equal('span');\n\n        const foundNotSpan = wrapper.findWhere((n) => (\n          n.type() !== 'span' && n.props()['data-foo'] === selector\n        ));\n        expect(foundNotSpan).to.have.lengthOf(0);\n      });\n\n      it('returns props object when props() is called', () => {\n        const SFC = function SFC({ data }) {\n          return (\n            <div data-foo={data}>Test SFC</div>\n          );\n        };\n\n        const content = 'blah';\n        const wrapper = WrapRendered(<SFC data={content} />);\n        expect(wrapper.props()).to.deep.equal({ 'data-foo': content, children: 'Test SFC' });\n      });\n\n      it('returns shallow rendered string when debug() is called', () => {\n        const SFC = function SFC({ data }) {\n          return (\n            <div data-foo={data}>Test SFC</div>\n          );\n        };\n\n        const content = 'blah';\n        const wrapper = Wrap(<SFC data={content} />);\n        const expectedDebug = isShallow\n          ? `<div data-foo=\"${content}\">\n  Test SFC\n</div>`\n          : `<SFC data=\"${content}\">\n  <div data-foo=\"${content}\">\n    Test SFC\n  </div>\n</SFC>`;\n        expect(wrapper.debug()).to.equal(expectedDebug);\n      });\n\n      context('works with a nested SFC', () => {\n        const Bar = realArrowFunction(<div>Hello</div>);\n        class Foo extends React.Component {\n          render() { return <Bar />; }\n        }\n\n        itIf(isShallow, 'works in shallow', () => {\n          const wrapper = Wrap(<Foo />);\n          expect(wrapper.is(Bar)).to.equal(true);\n          expect(wrapper.dive().text()).to.equal('Hello');\n        });\n\n        itIf(!isShallow, 'works in non-shallow', () => {\n          const wrapper = Wrap(<Foo />);\n          expect(wrapper.text()).to.equal('Hello');\n        });\n      });\n    });\n\n    it('allows `.text()` to be called on text nodes', () => {\n      const wrapper = Wrap((\n        <section>\n          <div className=\"foo bar\" />\n          <div>foo bar</div>\n          {null}\n          {false}\n        </section>\n      ));\n\n      const stub = sinon.stub();\n      wrapper.findWhere(stub);\n\n      const passedNodes = stub.getCalls().map(({ args: [firstArg] }) => firstArg);\n\n      const textContents = passedNodes.map((n) => [n.debug(), n.text()]);\n      const expected = [\n        [wrapper.debug(), 'foo bar'], // root\n        ['<div className=\"foo bar\" />', ''], // first div\n        ['<div>\\n  foo bar\\n</div>', 'foo bar'], // second div\n        ['foo bar', 'foo bar'], // second div's contents\n      ];\n      expect(textContents).to.eql(expected);\n    });\n\n    // FIXME: figure out why this fails on 15.0, 15.1 and 15.4\n    itIf(!is('~15.0 || ~15.1 || ~15.2 || ~15.3 || ~15.4'), 'does not pass in null or false nodes', () => {\n      const wrapper = Wrap((\n        <section>\n          <div className=\"foo bar\" />\n          <div>foo bar</div>\n          {null}\n          {false}\n        </section>\n      ));\n      const stub = sinon.stub();\n      wrapper.findWhere(stub);\n\n      const passedNodes = stub.getCalls().map(({ args: [firstArg] }) => firstArg);\n      const getElement = (n) => (isShallow ? n.getElement() : n.getDOMNode());\n      const hasElements = passedNodes.map((n) => [n.debug(), getElement(n) && true]);\n      const expected = [\n        [wrapper.debug(), true], // root\n        ['<div className=\"foo bar\" />', true], // first div\n        ['<div>\\n  foo bar\\n</div>', true], // second div\n        ['foo bar', null], // second div's contents\n      ];\n      expect(hasElements).to.eql(expected);\n\n      // the root, plus the 2 renderable children, plus the grandchild text\n      expect(stub).to.have.property('callCount', 4);\n    });\n\n    it('does not pass in null or false nodes', () => {\n      const wrapper = Wrap((\n        <div>\n          <div className=\"foo bar\" />\n          {null}\n          {false}\n        </div>\n      ));\n      const stub = sinon.stub();\n      stub.returns(true);\n      const spy = sinon.spy(stub);\n      wrapper.findWhere(spy);\n      expect(spy).to.have.property('callCount', 2);\n    });\n\n    itIf(is('>= 16'), 'finds portals by react-is Portal type', () => {\n      const containerDiv = makeDOMElement();\n      const Foo = () => (\n        <div>\n          {createPortal(\n            <div className=\"in-portal\">InPortal</div>,\n            containerDiv,\n          )}\n        </div>\n      );\n\n      const wrapper = Wrap(<Foo />);\n\n      expect(wrapper.findWhere((node) => node.type() === Portal)).to.have.lengthOf(1);\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/first.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\n\nexport default function describeFirst({\n  Wrap,\n}) {\n  describe('.first()', () => {\n    it('returns the first node in the current set', () => {\n      const wrapper = Wrap((\n        <div>\n          <div className=\"bar baz\" />\n          <div className=\"bar\" />\n          <div className=\"bar\" />\n          <div className=\"bar\" />\n        </div>\n      ));\n      expect(wrapper.find('.bar').first().hasClass('baz')).to.equal(true);\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/flatMap.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\n\nexport default function describeFlatMap({\n  Wrap,\n}) {\n  describe('.flatMap(fn)', () => {\n    it('returns a wrapper with the mapped and flattened nodes', () => {\n      const wrapper = Wrap((\n        <div>\n          <div className=\"foo\">\n            <div className=\"bar\" />\n            <div className=\"bar\" />\n          </div>\n          <div className=\"foo\">\n            <div className=\"baz\" />\n            <div className=\"baz\" />\n          </div>\n          <div className=\"foo\">\n            <div className=\"bax\" />\n            <div className=\"bax\" />\n          </div>\n        </div>\n      ));\n\n      const nodes = wrapper.find('.foo').flatMap((w) => w.children().getElements());\n\n      expect(nodes).to.have.lengthOf(6);\n      expect(nodes.at(0).hasClass('bar')).to.equal(true);\n      expect(nodes.at(1).hasClass('bar')).to.equal(true);\n      expect(nodes.at(2).hasClass('baz')).to.equal(true);\n      expect(nodes.at(3).hasClass('baz')).to.equal(true);\n      expect(nodes.at(4).hasClass('bax')).to.equal(true);\n      expect(nodes.at(5).hasClass('bax')).to.equal(true);\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/forEach.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\nimport sinon from 'sinon-sandbox';\n\nexport default function describeForEach({\n  Wrap,\n  Wrapper,\n}) {\n  describe('.forEach(fn)', () => {\n    it('calls a function for each node in the wrapper', () => {\n      const wrapper = Wrap((\n        <div>\n          <div className=\"foo bax\" />\n          <div className=\"foo bar\" />\n          <div className=\"foo baz\" />\n        </div>\n      ));\n      const spy = sinon.spy();\n\n      wrapper.find('.foo').forEach(spy);\n\n      expect(spy).to.have.property('callCount', 3);\n      expect(spy.args[0][0]).to.be.instanceOf(Wrapper);\n      expect(spy.args[0][0].hasClass('bax')).to.equal(true);\n      expect(spy.args[0][1]).to.equal(0);\n      expect(spy.args[1][0]).to.be.instanceOf(Wrapper);\n      expect(spy.args[1][0].hasClass('bar')).to.equal(true);\n      expect(spy.args[1][1]).to.equal(1);\n      expect(spy.args[2][0]).to.be.instanceOf(Wrapper);\n      expect(spy.args[2][0].hasClass('baz')).to.equal(true);\n      expect(spy.args[2][1]).to.equal(2);\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/get.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\nimport { itIf } from '../../_helpers';\nimport { is } from '../../_helpers/version';\n\nexport default function describeGet({\n  Wrap,\n}) {\n  describe('.get(index)', () => {\n    it('gets the node at the specified index', () => {\n      const wrapper = Wrap((\n        <div>\n          <div className=\"bar foo\" />\n          <div className=\"bar bax\" />\n          <div className=\"bar bux\" />\n          <div className=\"bar baz\" />\n        </div>\n      ));\n      const bar = wrapper.find('.bar');\n      expect(bar.get(0)).to.deep.equal(wrapper.find('.foo').getElement());\n      expect(bar.get(1)).to.deep.equal(wrapper.find('.bax').getElement());\n      expect(bar.get(2)).to.deep.equal(wrapper.find('.bux').getElement());\n      expect(bar.get(3)).to.deep.equal(wrapper.find('.baz').getElement());\n    });\n\n    // FIXME: figure out why this fails on 15.0 and 15.1\n    itIf(!is('~15.0 || ~15.1'), 'does not add a \"null\" key to elements with a ref and no key', () => {\n      class Foo extends React.Component {\n        constructor(props) {\n          super(props);\n          this.setRef = this.setRef.bind(this);\n        }\n\n        setRef(node) {\n          this.node = node;\n        }\n\n        render() {\n          return (\n            <div ref={this.setRef} className=\"foo\" />\n          );\n        }\n      }\n      const wrapper = Wrap(<Foo />);\n      expect(wrapper.get(0)).to.have.property('key', null);\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/getElement.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\n\nimport {\n  itIf,\n} from '../../_helpers';\nimport { is } from '../../_helpers/version';\nimport {\n  createRef,\n} from '../../_helpers/react-compat';\n\nexport default function describeGetElement({\n  Wrap,\n  isShallow,\n}) {\n  describe('.getElement()', () => {\n    it('returns nodes with refs as well', () => {\n      class Foo extends React.Component {\n        constructor(props) {\n          super(props);\n          this.setRef = this.setRef.bind(this);\n          this.node = null;\n        }\n\n        setRef(node) {\n          this.node = node;\n        }\n\n        render() {\n          return (\n            <div>\n              <div ref={this.setRef} className=\"foo\" />\n            </div>\n          );\n        }\n      }\n      const wrapper = Wrap(<Foo />);\n      const mockNode = { mock: true };\n      wrapper.find('.foo').getElement().ref(mockNode);\n      expect(wrapper.instance().node).to.equal(mockNode);\n    });\n\n    itIf(is('>= 16.3'), 'returns nodes with createRefs as well', () => {\n      class Foo extends React.Component {\n        constructor(props) {\n          super(props);\n          this.setRef = createRef();\n        }\n\n        render() {\n          return (\n            <div>\n              <div ref={this.setRef} className=\"foo\" />\n            </div>\n          );\n        }\n      }\n      const wrapper = Wrap(<Foo />);\n      // shallow rendering does not invoke refs\n      if (isShallow) {\n        expect(wrapper.instance().setRef).to.have.property('current', null);\n      } else {\n        const element = wrapper.find('.foo').instance();\n        expect(wrapper.instance().setRef).to.have.property('current', element);\n      }\n    });\n\n    // FIXME: figure out why this fails on 15.0 and 15.1\n    itIf(!is('~15.0 || ~15.1'), 'does not add a \"null\" key to elements with a ref and no key', () => {\n      class Foo extends React.Component {\n        constructor(props) {\n          super(props);\n          this.setRef = this.setRef.bind(this);\n        }\n\n        setRef(node) {\n          this.node = node;\n        }\n\n        render() {\n          return (\n            <div ref={this.setRef} className=\"foo\" />\n          );\n        }\n      }\n      const wrapper = Wrap(<Foo />);\n      expect(wrapper.getElement()).to.have.property('key', null);\n    });\n\n    itIf(is('>= 16.3'), 'does not add a \"null\" key to elements with a createRef and no key', () => {\n      class Foo extends React.Component {\n        constructor(props) {\n          super(props);\n          this.setRef = createRef();\n        }\n\n        render() {\n          return (\n            <div ref={this.setRef} className=\"foo\" />\n          );\n        }\n      }\n      const wrapper = Wrap(<Foo />);\n      expect(wrapper.getElement()).to.have.property('key', null);\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/getElements.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\nimport { itIf } from '../../_helpers';\nimport { is } from '../../_helpers/version';\n\nexport default function describeGetElements({\n  Wrap,\n}) {\n  describe('.getElements()', () => {\n    // FIXME: figure out why this fails on 15.0, 15.1, 15.2 and 15.3\n    itIf(!is('~15.0 || ~15.1 || ~15.2 || ~15.3'), 'returns the wrapped elements', () => {\n      const one = <span />;\n      const two = <span />;\n\n      class Test extends React.Component {\n        render() {\n          return (\n            <div>\n              {one}\n              {two}\n            </div>\n          );\n        }\n      }\n\n      const wrapper = Wrap(<Test />);\n      expect(wrapper.find('span').getElements()).to.deep.equal([one, two]);\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/getNode.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\n\nexport default function describeGetNode({\n  Wrap,\n  WrapperName,\n  isShallow,\n}) {\n  describe('.getNode()', () => {\n    it('throws', () => {\n      const wrapper = Wrap(<div />);\n      expect(() => wrapper.getNode()).to.throw(\n        `${WrapperName}::getNode() is no longer supported. Use ${WrapperName}::${isShallow ? 'getElement' : 'instance'}() instead`,\n      );\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/getNodes.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\n\nexport default function describeGetNodes({\n  Wrap,\n  WrapperName,\n}) {\n  describe('.getNodes()', () => {\n    it('throws', () => {\n      const wrapper = Wrap(<div />);\n      expect(() => wrapper.getNodes()).to.throw(\n        `${WrapperName}::getNodes() is no longer supported.`,\n      );\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/getWrappingComponent.jsx",
    "content": "import React from 'react';\nimport PropTypes from 'prop-types';\nimport { expect } from 'chai';\n\nimport {\n  describeIf,\n  itIf,\n} from '../../_helpers';\nimport {\n  is,\n} from '../../_helpers/version';\n\nexport default function describeGetWrappingComponent({\n  Wrap,\n  WrapperName,\n  isShallow,\n}) {\n  class RendersNull extends React.Component {\n    render() {\n      return null;\n    }\n  }\n  class StateTester extends React.Component {\n    render() {\n      return null;\n    }\n  }\n  class RendersChildren extends React.Component {\n    render() {\n      const { children } = this.props;\n      return children;\n    }\n  }\n\n  describeIf(is('<= 0.13'), '<= 0.13: .getWrappingComponent()', () => {\n    it('throws', () => {\n      expect(() => Wrap(<div />, {\n        wrappingComponent: RendersChildren,\n      })).to.throw(TypeError, 'your adapter does not support `wrappingComponent`. Try upgrading it!');\n    });\n  });\n\n  describeIf(is('> 0.13'), '> 0.13: .getWrappingComponent()', () => {\n    class TestProvider extends React.Component {\n      getChildContext() {\n        const { value, renderMore, renderStateTester } = this.props;\n\n        return {\n          testContext: value || 'Hello world!',\n          renderMore: !!renderMore,\n          renderStateTester: !!renderStateTester,\n        };\n      }\n\n      render() {\n        const { children } = this.props;\n        return children;\n      }\n    }\n    TestProvider.childContextTypes = {\n      testContext: PropTypes.string,\n      renderMore: PropTypes.bool,\n      renderStateTester: PropTypes.bool,\n    };\n\n    class MyWrappingComponent extends React.Component {\n      constructor() {\n        super();\n        this.state = { renderStateTester: false };\n      }\n\n      render() {\n        const { children, contextValue, renderMore } = this.props;\n        const { renderStateTester } = this.state;\n\n        return (\n          <main>\n            <TestProvider\n              value={contextValue}\n              renderMore={renderMore}\n              renderStateTester={renderStateTester}\n            >\n              {children}\n            </TestProvider>\n          </main>\n        );\n      }\n    }\n\n    class MyComponent extends React.Component {\n      render() {\n        const {\n          testContext,\n          renderMore,\n          renderStateTester,\n          explicitContext,\n        } = this.context;\n\n        return (\n          <div>\n            <div>Context says: {testContext}{explicitContext}</div>\n            {renderMore && <RendersNull />}\n            {renderStateTester && <StateTester />}\n          </div>\n        );\n      }\n    }\n    MyComponent.contextTypes = {\n      ...TestProvider.childContextTypes,\n      explicitContext: PropTypes.string,\n    };\n\n    const context = {\n      explicitContext: ' stop!',\n    };\n\n    it('gets a Wrapper for the wrappingComponent', () => {\n      const wrapper = Wrap(<MyComponent />, {\n        wrappingComponent: MyWrappingComponent,\n        context,\n      });\n      const wrappingComponent = wrapper.getWrappingComponent();\n      expect(wrappingComponent.type()).to.equal(isShallow ? 'main' : MyWrappingComponent);\n      expect(wrappingComponent.parent().exists()).to.equal(false);\n\n      wrappingComponent.setProps({ contextValue: 'this is a test.' });\n      expect(wrapper.text()).to.equal('Context says: this is a test. stop!');\n    });\n\n    it('updates the wrapper when the wrappingComponent is updated', () => {\n      const wrapper = Wrap(<MyComponent />, {\n        wrappingComponent: MyWrappingComponent,\n        context,\n      });\n      const wrappingComponent = wrapper.getWrappingComponent();\n      wrappingComponent.setProps({ renderMore: true });\n      expect(wrapper.find(RendersNull).exists()).to.equal(true);\n      expect(wrapper.text()).to.equal(`Context says: Hello world! stop!${isShallow ? '<RendersNull />' : ''}`);\n    });\n\n    it('updates the primary wrapper after a state update', () => {\n      const wrapper = Wrap(<MyComponent />, {\n        wrappingComponent: MyWrappingComponent,\n        context: {\n          explicitContext: ' stop!',\n        },\n      });\n      const wrappingComponent = wrapper.getWrappingComponent();\n      wrappingComponent.setState({ renderStateTester: true });\n      expect(wrapper.find(StateTester).exists()).to.equal(true);\n      expect(wrapper.text()).to.equal(`Context says: Hello world! stop!${isShallow ? '<StateTester />' : ''}`);\n    });\n\n    it('updates the wrappingComponent when the root is updated', () => {\n      const wrapper = Wrap(<MyComponent />, {\n        wrappingComponent: MyWrappingComponent,\n        context,\n      });\n      const wrappingComponent = wrapper.getWrappingComponent();\n      wrapper.unmount();\n      expect(wrappingComponent.children()).to.have.lengthOf(0);\n      if (!isShallow) {\n        expect(wrappingComponent.exists()).to.equal(false);\n      }\n    });\n\n    // FIXME: figure out why this fails on 15.0 and 15.1\n    itIf(!is('~15.0 || ~15.1 || ~15.2'), 'handles the wrapper being unmounted', () => {\n      const wrapper = Wrap(<MyComponent />, {\n        wrappingComponent: MyWrappingComponent,\n        context,\n      });\n      const wrappingComponent = wrapper.getWrappingComponent();\n      wrapper.unmount();\n      wrappingComponent.update();\n      expect(wrappingComponent.children()).to.have.lengthOf(0);\n      if (isShallow) {\n        expect(wrappingComponent.debug()).to.equal('');\n      } else {\n        expect(wrappingComponent.exists()).to.equal(false);\n        expect(() => wrappingComponent.setProps({})).to.throw(\n          'The wrapping component may not be updated if the root is unmounted.',\n        );\n      }\n    });\n\n    itIf(is('>= 16.3'), 'updates a <Provider /> if it is rendered as root', () => {\n      const Context = React.createContext();\n      function WrappingComponent(props) {\n        const { value, children } = props;\n        return (\n          <Context.Provider value={value}>\n            {children}\n          </Context.Provider>\n        );\n      }\n      const wrapper = Wrap((\n        <Context.Consumer>\n          {(value) => <div>{value}</div>}\n        </Context.Consumer>\n      ), {\n        wrappingComponent: WrappingComponent,\n        wrappingComponentProps: { value: 'hello!' },\n      });\n      const wrappingComponent = wrapper.getWrappingComponent();\n      expect(wrapper.text()).to.equal('hello!');\n\n      wrappingComponent.setProps({ value: 'goodbye!' });\n      expect(wrapper.text()).to.equal('goodbye!');\n    });\n\n    itIf(!isShallow, 'handles a partial prop update', () => {\n      const wrapper = Wrap(<MyComponent />, {\n        wrappingComponent: MyWrappingComponent,\n        context,\n      });\n      const wrappingComponent = wrapper.getWrappingComponent();\n      wrappingComponent.setProps({ contextValue: 'hello' });\n      wrappingComponent.setProps({ foo: 'bar' });\n      expect(wrappingComponent.prop('foo')).to.equal('bar');\n      expect(wrappingComponent.prop('contextValue')).to.equal('hello');\n    });\n\n    it('cannot be called on the non-root', () => {\n      const wrapper = Wrap(<MyComponent />, {\n        wrappingComponent: MyWrappingComponent,\n        context,\n      });\n      expect(() => wrapper.find('div').getWrappingComponent()).to.throw(\n        `${WrapperName}::getWrappingComponent() can only be called on the root`,\n      );\n    });\n\n    it('cannot be called on itself', () => {\n      const wrapper = Wrap(<MyComponent />, {\n        wrappingComponent: MyWrappingComponent,\n        context,\n      });\n      const wrappingComponent = wrapper.getWrappingComponent();\n      expect(() => wrappingComponent.getWrappingComponent()).to.throw(\n        `${WrapperName}::getWrappingComponent() can only be called on the root`,\n      );\n    });\n\n    it('throws an error if `wrappingComponent` was not provided', () => {\n      const wrapper = Wrap(<MyComponent />);\n      expect(() => wrapper.getWrappingComponent()).to.throw(\n        `${WrapperName}::getWrappingComponent() can only be called on a wrapper that was originally passed a \\`wrappingComponent\\` option`,\n      );\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/hasClass.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\nimport sinon from 'sinon-sandbox';\n\nimport {\n  describeIf,\n  itIf,\n} from '../../_helpers';\nimport { is } from '../../_helpers/version';\n\nexport default function describeHasClass({\n  Wrap,\n  WrapRendered,\n  WrapperName,\n  isShallow,\n  isMount,\n}) {\n  describe('.hasClass(className)', () => {\n    function FooSFC() {\n      return <div className=\"foo bar baz some-long-string FoOo\" />;\n    }\n    class Foo extends React.Component {\n      render() {\n        return FooSFC();\n      }\n    }\n    class Bar extends React.Component {\n      render() {\n        return <Foo className=\"isFoo\" />;\n      }\n    }\n    class RendersNull extends React.Component {\n      render() {\n        return null;\n      }\n    }\n\n    it('warns when passing a CSS selector', () => {\n      const stub = sinon.stub(console, 'warn');\n      const wrapper = Wrap(<div className=\"foo bar baz some-long-string FoOo\" />);\n\n      expect(wrapper.hasClass('oops.classname')).to.equal(false);\n\n      expect(stub).to.have.property('callCount', 1);\n      const [args] = stub.args;\n      expect(args).to.eql([`It looks like you're calling \\`${WrapperName}::hasClass()\\` with a CSS selector. hasClass() expects a class name, not a CSS selector.`]);\n    });\n\n    context('when using a DOM component', () => {\n      it('returns whether or not node has a certain class', () => {\n        const wrapper = Wrap(<div className=\"foo bar baz some-long-string FoOo\" />);\n\n        expect(wrapper.hasClass('foo')).to.equal(true);\n        expect(wrapper.hasClass('bar')).to.equal(true);\n        expect(wrapper.hasClass('baz')).to.equal(true);\n        expect(wrapper.hasClass('some-long-string')).to.equal(true);\n        expect(wrapper.hasClass('FoOo')).to.equal(true);\n        expect(wrapper.hasClass('doesnt-exist')).to.equal(false);\n      });\n    });\n\n    describeIf(is('> 0.13'), 'with stateless function components (SFCs)', () => {\n      it('returns whether or not rendered node has a certain class', () => {\n        const wrapper = WrapRendered(<FooSFC className=\"root\" />);\n\n        expect(wrapper.hasClass('root')).to.equal(false);\n        expect(wrapper.hasClass('foo')).to.equal(true);\n        expect(wrapper.hasClass('bar')).to.equal(true);\n        expect(wrapper.hasClass('baz')).to.equal(true);\n        expect(wrapper.hasClass('some-long-string')).to.equal(true);\n        expect(wrapper.hasClass('FoOo')).to.equal(true);\n        expect(wrapper.hasClass('doesnt-exist')).to.equal(false);\n      });\n\n      itIf(isMount, 'returns whether or not root node has a certain class', () => {\n        const wrapper = Wrap(<FooSFC className=\"root\" />);\n\n        expect(wrapper.hasClass('root')).to.equal(true);\n        expect(wrapper.hasClass('foo')).to.equal(false);\n        expect(wrapper.hasClass('bar')).to.equal(false);\n        expect(wrapper.hasClass('baz')).to.equal(false);\n        expect(wrapper.hasClass('some-long-string')).to.equal(false);\n        expect(wrapper.hasClass('FoOo')).to.equal(false);\n        expect(wrapper.hasClass('doesnt-exist')).to.equal(false);\n      });\n    });\n\n    context('when using a Composite class component', () => {\n      it('returns whether or not rendered node has a certain class', () => {\n        const wrapper = WrapRendered(<Foo className=\"root\" />);\n\n        expect(wrapper.hasClass('root')).to.equal(false);\n        expect(wrapper.hasClass('foo')).to.equal(true);\n        expect(wrapper.hasClass('bar')).to.equal(true);\n        expect(wrapper.hasClass('baz')).to.equal(true);\n        expect(wrapper.hasClass('some-long-string')).to.equal(true);\n        expect(wrapper.hasClass('FoOo')).to.equal(true);\n        expect(wrapper.hasClass('doesnt-exist')).to.equal(false);\n      });\n\n      itIf(isMount, 'returns whether or not root node has a certain class', () => {\n        const wrapper = Wrap(<Foo className=\"root\" />);\n\n        expect(wrapper.hasClass('root')).to.equal(true);\n        expect(wrapper.hasClass('foo')).to.equal(false);\n        expect(wrapper.hasClass('bar')).to.equal(false);\n        expect(wrapper.hasClass('baz')).to.equal(false);\n        expect(wrapper.hasClass('some-long-string')).to.equal(false);\n        expect(wrapper.hasClass('FoOo')).to.equal(false);\n        expect(wrapper.hasClass('doesnt-exist')).to.equal(false);\n      });\n    });\n\n    context('when using nested composite components', () => {\n      it('returns whether or not node has a certain class', () => {\n        const wrapper = WrapRendered(<Bar className=\"root\" />);\n\n        expect(wrapper.hasClass('root')).to.equal(false);\n        expect(wrapper.hasClass('isFoo')).to.equal(true);\n      });\n\n      itIf(!isShallow, 'returns whether or not nested node has a certain class', () => {\n        const wrapper = WrapRendered(<Bar className=\"root\" />);\n\n        expect(wrapper.hasClass('root')).to.equal(false);\n        expect(wrapper.hasClass('isFoo')).to.equal(true);\n\n        expect(wrapper.children().hasClass('foo')).to.equal(true);\n        expect(wrapper.children().hasClass('bar')).to.equal(true);\n        expect(wrapper.children().hasClass('baz')).to.equal(true);\n        expect(wrapper.children().hasClass('some-long-string')).to.equal(true);\n        expect(wrapper.children().hasClass('FoOo')).to.equal(true);\n        expect(wrapper.children().hasClass('doesnt-exist')).to.equal(false);\n      });\n\n      itIf(isMount, 'returns whether or not root node has a certain class', () => {\n        const wrapper = Wrap(<Bar className=\"root\" />);\n\n        expect(wrapper.hasClass('root')).to.equal(true);\n        expect(wrapper.hasClass('foo')).to.equal(false);\n        expect(wrapper.hasClass('bar')).to.equal(false);\n        expect(wrapper.hasClass('baz')).to.equal(false);\n        expect(wrapper.hasClass('some-long-string')).to.equal(false);\n        expect(wrapper.hasClass('FoOo')).to.equal(false);\n        expect(wrapper.hasClass('doesnt-exist')).to.equal(false);\n      });\n    });\n\n    context('when using a Composite component that renders null', () => {\n      it('returns whether or not node has a certain class', () => {\n        const wrapper = Wrap(<RendersNull />);\n\n        expect(wrapper.hasClass('foo')).to.equal(false);\n      });\n    });\n\n    it('works with a non-string `className` prop', () => {\n      class SpreadsProps extends React.Component {\n        render() {\n          return <div {...this.props} />;\n        }\n      }\n      const obj = { classA: true, classB: false };\n      const wrapper = Wrap(<SpreadsProps className={obj} />);\n      expect(wrapper.hasClass('foo')).to.equal(false);\n      expect(wrapper.hasClass('classA')).to.equal(false);\n      expect(wrapper.hasClass('classB')).to.equal(false);\n      expect(wrapper.hasClass(String(obj))).to.equal(true);\n    });\n\n    it('allows hyphens', () => {\n      const wrapper = Wrap(<div className=\"foo-bar\" />);\n      expect(wrapper.hasClass('foo-bar')).to.equal(true);\n    });\n\n    it('works if className has a function in toString property', () => {\n      function classes() {}\n      classes.toString = () => 'foo-bar';\n      const wrapper = Wrap(<div className={classes} />);\n      expect(wrapper.hasClass('foo-bar')).to.equal(true);\n    });\n\n    it('works if searching with a RegExp', () => {\n      const wrapper = Wrap(<div className=\"ComponentName-classname-123\" />);\n      expect(wrapper.hasClass(/(ComponentName)-(classname)-(\\d+)/)).to.equal(true);\n      expect(wrapper.hasClass(/(ComponentName)-(other)-(\\d+)/)).to.equal(false);\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/hostNodes.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\n\nimport {\n  describeIf,\n} from '../../_helpers';\nimport { is } from '../../_helpers/version';\n\nexport default function describeHostNodes({\n  Wrap,\n  WrapRendered,\n}) {\n  describe('.hostNodes()', () => {\n    it('strips out any non-hostNode', () => {\n      class Foo extends React.Component {\n        render() {\n          return <div {...this.props} />;\n        }\n      }\n      const wrapper = Wrap((\n        <main>\n          <Foo className=\"foo\" />\n          <div className=\"foo\" />\n        </main>\n      ));\n\n      const foos = wrapper.find('main > .foo');\n      expect(foos).to.have.lengthOf(2);\n\n      const hostNodes = foos.hostNodes();\n      expect(hostNodes).to.have.lengthOf(1);\n\n      expect(hostNodes.is('div')).to.equal(true);\n      expect(hostNodes.hasClass('foo')).to.equal(true);\n    });\n\n    it('does NOT allow matches on a nested node', () => {\n      const wrapper = Wrap((\n        <div>\n          <div className=\"foo\" />\n        </div>\n      ));\n      const b = <div className=\"foo\" />;\n      expect(wrapper.equals(b)).to.equal(false);\n    });\n\n    it('matches composite components', () => {\n      class Foo extends React.Component {\n        render() { return <div />; }\n      }\n\n      const wrapper = Wrap((\n        <div>\n          <Foo />\n        </div>\n      ));\n      const b = <div><Foo /></div>;\n      expect(wrapper.equals(b)).to.equal(true);\n    });\n\n    it('does not expand `node` content', () => {\n      class Bar extends React.Component {\n        render() { return <div />; }\n      }\n\n      class Foo extends React.Component {\n        render() { return <Bar />; }\n      }\n\n      expect(WrapRendered(<Foo />).equals(<Bar />)).to.equal(true);\n      expect(WrapRendered(<Foo />).equals(<Foo />)).to.equal(false);\n    });\n\n    describeIf(is('> 0.13'), 'stateless function components (SFCs)', () => {\n      it('matches composite SFCs', () => {\n        const Foo = () => (\n          <div />\n        );\n\n        const wrapper = Wrap((\n          <div>\n            <Foo />\n          </div>\n        ));\n        const b = <div><Foo /></div>;\n        expect(wrapper.equals(b)).to.equal(true);\n      });\n\n      it('does not expand `node` content', () => {\n        const Bar = () => (\n          <div />\n        );\n\n        const Foo = () => (\n          <Bar />\n        );\n\n        expect(WrapRendered(<Foo />).equals(<Bar />)).to.equal(true);\n        expect(WrapRendered(<Foo />).equals(<Foo />)).to.equal(false);\n      });\n    });\n\n    it('flattens arrays of children to compare', () => {\n      class TwoChildren extends React.Component {\n        render() {\n          return (\n            <div className=\"parent-component-class\">\n              <div key=\"a\" className=\"asd\" />\n              <div key=\"b\" className=\"fgh\" />\n            </div>\n          );\n        }\n      }\n\n      class TwoChildrenOneArrayed extends React.Component {\n        render() {\n          return (\n            <div className=\"parent-component-class\">\n              <div key=\"a\" className=\"asd\" />\n              {[<div key=\"b\" className=\"fgh\" />]}\n            </div>\n          );\n        }\n      }\n      const twoChildren = WrapRendered(<TwoChildren />);\n      const twoChildrenOneArrayed = WrapRendered(<TwoChildrenOneArrayed />);\n\n      expect(twoChildren.equals(twoChildrenOneArrayed.getElement())).to.equal(true);\n      expect(twoChildrenOneArrayed.equals(twoChildren.getElement())).to.equal(true);\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/html.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\n\nimport {\n  describeIf, itIf,\n} from '../../_helpers';\nimport { is } from '../../_helpers/version';\n\nimport {\n  Fragment,\n} from '../../_helpers/react-compat';\n\nexport default function describeHTML({\n  Wrap,\n}) {\n  describe('.html()', () => {\n    it('returns html of straight DOM elements', () => {\n      const wrapper = Wrap((\n        <div className=\"test\">\n          <span>Hello World!</span>\n        </div>\n      ));\n      expect(wrapper.html()).to.equal('<div class=\"test\"><span>Hello World!</span></div>');\n    });\n\n    // FIXME: figure out why this fails on 15.0 and 15.1\n    itIf(!is('~15.0 || ~15.1'), 'renders out nested composite components', () => {\n      class Foo extends React.Component {\n        render() {\n          return (<div className=\"in-foo\" />);\n        }\n      }\n      class Bar extends React.Component {\n        render() {\n          return (\n            <div className=\"in-bar\">\n              <Foo />\n            </div>\n          );\n        }\n      }\n      const wrapper = Wrap(<Bar />);\n      expect(wrapper.html()).to.equal('<div class=\"in-bar\"><div class=\"in-foo\"></div></div>');\n      expect(wrapper.find(Foo).html()).to.equal('<div class=\"in-foo\"></div>');\n    });\n\n    describeIf(is('> 0.13'), 'stateless function components (SFCs)', () => {\n      // FIXME: figure out why this fails on 15.0 and 15.1\n      itIf(!is('~15.0 || ~15.1'), 'renders out nested composite components', () => {\n        const Foo = () => <div className=\"in-foo\" />;\n        const Bar = () => (\n          <div className=\"in-bar\">\n            <Foo />\n          </div>\n        );\n\n        const wrapper = Wrap(<Bar />);\n        expect(wrapper.html()).to.equal('<div class=\"in-bar\"><div class=\"in-foo\"></div></div>');\n        expect(wrapper.find(Foo).html()).to.equal('<div class=\"in-foo\"></div>');\n      });\n    });\n\n    describeIf(is('>16.2'), 'Fragments', () => {\n      class FragmentClassExample extends React.Component {\n        render() {\n          return (\n            <Fragment>\n              <div><span>Foo</span></div>\n              <div><span>Bar</span></div>\n            </Fragment>\n          );\n        }\n      }\n\n      const FragmentConstExample = () => (\n        <Fragment>\n          <div><span>Foo</span></div>\n          <div><span>Bar</span></div>\n        </Fragment>\n      );\n\n      class ClassChild extends React.Component {\n        render() {\n          return <div>Class child</div>;\n        }\n      }\n\n      function SFCChild() {\n        return <div>SFC child</div>;\n      }\n\n      class FragmentWithCustomChildClass extends React.Component {\n        render() {\n          return (\n            <Fragment>\n              <ClassChild />\n              <SFCChild />\n            </Fragment>\n          );\n        }\n      }\n\n      it('correctly renders html for both children for class', () => {\n        const classWrapper = Wrap(<FragmentClassExample />);\n        expect(classWrapper.html()).to.equal('<div><span>Foo</span></div><div><span>Bar</span></div>');\n      });\n\n      it('correctly renders html for both children for const', () => {\n        const constWrapper = Wrap(<FragmentConstExample />);\n        expect(constWrapper.html()).to.equal('<div><span>Foo</span></div><div><span>Bar</span></div>');\n      });\n\n      it('correctly renders html for custom component children', () => {\n        const withChildrenWrapper = Wrap(<FragmentWithCustomChildClass />);\n        expect(withChildrenWrapper.html()).to.equal('<div>Class child</div><div>SFC child</div>');\n      });\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/instance.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\n\nimport {\n  describeIf,\n  itIf,\n} from '../../_helpers';\nimport { is } from '../../_helpers/version';\n\nexport default function describeInstance({\n  Wrap,\n  WrapperName,\n  isShallow,\n}) {\n  describe('.instance()', () => {\n    it('returns the component instance', () => {\n      class Foo extends React.Component {\n        render() { return <div />; }\n      }\n\n      const wrapper = Wrap(<Foo />);\n      expect(wrapper.instance()).to.be.instanceof(Foo);\n      expect(wrapper.instance().render).to.equal(Foo.prototype.render);\n    });\n\n    describeIf(is('> 0.13'), 'stateless function components (SFCs)', () => {\n      function SFC() {\n        return <div />;\n      }\n\n      itIf(is('>= 16'), 'has no instance', () => {\n        const wrapper = Wrap(<SFC />);\n        expect(wrapper.instance()).to.equal(null);\n      });\n\n      itIf(is('< 16'), 'has an instance', () => {\n        const wrapper = Wrap(<SFC />);\n        expect(wrapper.instance()).not.to.equal(null);\n      });\n    });\n\n    itIf(!isShallow, 'throws when wrapping multiple elements', () => {\n      class Test extends React.Component {\n        render() {\n          return (\n            <div>\n              <span />\n              <span />\n            </div>\n          );\n        }\n      }\n\n      const wrapper = Wrap(<Test />).find('span');\n      expect(() => wrapper.instance()).to.throw(\n        Error,\n        'Method “instance” is meant to be run on 1 node. 2 found instead.',\n      );\n    });\n\n    itIf(isShallow, 'throws if called on something other than the root node', () => {\n      class Foo extends React.Component {\n        render() { return <div><a /></div>; }\n      }\n\n      const wrapper = Wrap(<Foo />);\n      const div = wrapper.find('div');\n\n      expect(() => div.instance()).to.throw(\n        Error,\n        `${WrapperName}::instance() can only be called on the root`,\n      );\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/invoke.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\nimport sinon from 'sinon-sandbox';\nimport {\n  itIf,\n} from '../../_helpers';\nimport {\n  is,\n} from '../../_helpers/version';\n\nimport {\n  useEffect,\n  useState,\n} from '../../_helpers/react-compat';\n\nexport default function describeInvoke({\n  Wrap,\n  WrapperName,\n  isShallow,\n}) {\n  describe('.invoke(propName)(..args)', () => {\n    class CounterButton extends React.Component {\n      constructor(props) {\n        super(props);\n        this.state = { count: 0 };\n      }\n\n      render() {\n        const { count } = this.state;\n        return (\n          <div>\n            <button\n              type=\"button\"\n              onClick={() => this.setState(({ count: oldCount }) => ({ count: oldCount + 1 }))}\n            >\n              {count}\n            </button>\n          </div>\n        );\n      }\n    }\n\n    class ClickableLink extends React.Component {\n      render() {\n        const { onClick } = this.props;\n        return (\n          <div>\n            <a onClick={onClick}>foo</a>\n          </div>\n        );\n      }\n    }\n\n    it('throws when pointing to a non-function prop', () => {\n      const wrapper = Wrap(<div data-a={{}} />);\n\n      expect(() => wrapper.invoke('data-a')).to.throw(\n        TypeError,\n        `${WrapperName}::invoke() requires the name of a prop whose value is a function`,\n      );\n\n      expect(() => wrapper.invoke('does not exist')).to.throw(\n        TypeError,\n        `${WrapperName}::invoke() requires the name of a prop whose value is a function`,\n      );\n    });\n\n    it('can update the state value', () => {\n      const wrapper = Wrap(<CounterButton />);\n      expect(wrapper.state('count')).to.equal(0);\n      wrapper.find('button').invoke('onClick')();\n      expect(wrapper.state('count')).to.equal(1);\n    });\n\n    it('can return the handlers’ return value', () => {\n      const sentinel = {};\n      const spy = sinon.stub().returns(sentinel);\n\n      const wrapper = Wrap(<ClickableLink onClick={spy} />);\n\n      const value = wrapper.find('a').invoke('onClick')();\n      expect(value).to.equal(sentinel);\n      expect(spy).to.have.property('callCount', 1);\n    });\n\n    it('can pass in arguments', () => {\n      const spy = sinon.spy();\n\n      const wrapper = Wrap(<ClickableLink onClick={spy} />);\n\n      const a = {};\n      const b = {};\n      wrapper.find('a').invoke('onClick')(a, b);\n      expect(spy).to.have.property('callCount', 1);\n      const [[arg1, arg2]] = spy.args;\n      expect(arg1).to.equal(a);\n      expect(arg2).to.equal(b);\n    });\n\n    // TODO: enable when the shallow renderer fixes its bug\n    itIf(!isShallow && is('>= 16.8'), 'works without explicit `act` wrapper', () => {\n      function App() {\n        const [counter, setCounter] = useState(0);\n        const [result, setResult] = useState(0);\n        useEffect(\n          () => setResult(counter * 2),\n          [counter],\n        );\n        return (\n          <button type=\"button\" onClick={() => setCounter((input) => input + 1)}>{result}</button>\n        );\n      }\n      const wrapper = Wrap(<App />);\n\n      const expected = ['0', '2', '4', '6'];\n\n      const actual = [wrapper.find('button').text()]\n        .concat(Array.from({ length: 3 }, () => {\n          wrapper.find('button').invoke('onClick')();\n          wrapper.update();\n\n          return wrapper.find('button').text();\n        }));\n      expect(actual).to.eql(expected);\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/is.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\n\nimport {\n  describeIf,\n} from '../../_helpers';\nimport { is } from '../../_helpers/version';\n\nimport {\n  memo,\n  forwardRef,\n} from '../../_helpers/react-compat';\n\nexport default function describeIs({\n  Wrap,\n  WrapRendered,\n}) {\n  describe('.is(selector)', () => {\n    it('returns true when selector matches current element', () => {\n      const wrapper = Wrap(<div className=\"foo bar baz\" />);\n      expect(wrapper.is('.foo')).to.equal(true);\n    });\n\n    it('allows for compound selectors', () => {\n      const wrapper = Wrap(<div className=\"foo bar baz\" />);\n      expect(wrapper.is('.foo.bar')).to.equal(true);\n    });\n\n    it('ignores insignificant whitespace', () => {\n      const className = `\n      foo\n      `;\n      const wrapper = Wrap(<div className={className} />);\n      expect(wrapper.is('.foo')).to.equal(true);\n    });\n\n    it('handles all significant whitespace', () => {\n      const className = `foo\n\n      bar\n      baz`;\n      const wrapper = Wrap(<div className={className} />);\n      expect(wrapper.is('.foo.bar.baz')).to.equal(true);\n    });\n\n    it('returns false when selector does not match', () => {\n      const wrapper = Wrap(<div className=\"bar baz\" />);\n      expect(wrapper.is('.foo')).to.equal(false);\n    });\n\n    class RendersDiv extends React.Component {\n      render() {\n        return <div />;\n      }\n    }\n    const Memoized = memo && memo(RendersDiv);\n    const ForwardRef = forwardRef && forwardRef(() => <RendersDiv />);\n    const MemoForwardRef = memo && memo(() => <ForwardRef />);\n\n    class RendersChildren extends React.Component {\n      render() {\n        const { children } = this.props;\n        return children;\n      }\n    }\n\n    it('recognizes nonmemoized', () => {\n      const wrapper = WrapRendered(<RendersChildren><RendersDiv /></RendersChildren>);\n      expect(wrapper.is(RendersDiv)).to.equal(true);\n    });\n\n    describeIf(is('>= 16.3'), 'forwardRef', () => {\n      it('recognizes forwardRef', () => {\n        const wrapper = WrapRendered(<RendersChildren><ForwardRef /></RendersChildren>);\n        expect(wrapper.is(ForwardRef)).to.equal(true);\n      });\n    });\n\n    describeIf(is('>= 16.6'), 'React.memo', () => {\n      it('recognizes memoized and inner', () => {\n        const wrapper = WrapRendered(<RendersChildren><Memoized /></RendersChildren>);\n        expect(wrapper.is(Memoized)).to.equal(true);\n        // expect(wrapper.is(RendersDiv)).to.equal(true);\n      });\n\n      it('recognizes memoized forwardRef and inner', () => {\n        const wrapper = WrapRendered(<RendersChildren><MemoForwardRef /></RendersChildren>);\n        expect(wrapper.is(MemoForwardRef)).to.equal(true);\n      });\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/isEmpty.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\nimport sinon from 'sinon-sandbox';\n\nexport default function describeLast({\n  Wrap,\n}) {\n  describe('.isEmpty()', () => {\n    let warningStub;\n    let fooNode;\n    let missingNode;\n\n    beforeEach(() => {\n      warningStub = sinon.stub(console, 'warn');\n      const wrapper = Wrap(<div className=\"foo\" />);\n      fooNode = wrapper.find('.foo');\n      missingNode = wrapper.find('.missing');\n    });\n    afterEach(() => {\n      warningStub.restore();\n    });\n\n    it('displays a deprecation warning', () => {\n      fooNode.isEmpty();\n      expect(warningStub.calledWith('Enzyme::Deprecated method isEmpty() called, use exists() instead.')).to.equal(true);\n    });\n\n    it('calls exists() instead', () => {\n      const existsSpy = sinon.spy();\n      fooNode.exists = existsSpy;\n      expect(fooNode.isEmpty()).to.equal(true);\n      expect(existsSpy).to.have.property('called', true);\n    });\n\n    it('returns true if wrapper is empty', () => {\n      expect(fooNode.isEmpty()).to.equal(false);\n      expect(missingNode.isEmpty()).to.equal(true);\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/isEmptyRender.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\n\nimport {\n  describeIf,\n  itIf,\n  itWithData,\n  generateEmptyRenderData,\n} from '../../_helpers';\nimport { is } from '../../_helpers/version';\n\nimport {\n  createClass,\n  memo,\n} from '../../_helpers/react-compat';\n\nexport default function describeIsEmptyRender({\n  Wrap,\n  WrapRendered,\n  isShallow,\n}) {\n  describe('.isEmptyRender()', () => {\n    class RenderChildren extends React.Component {\n      render() {\n        const { children } = this.props;\n        return children;\n      }\n    }\n\n    class RenderNull extends React.Component {\n      render() {\n        return null;\n      }\n    }\n\n    const emptyRenderValues = generateEmptyRenderData();\n\n    itWithData(emptyRenderValues, 'when a React createClass component returns: ', (data) => {\n      const Foo = createClass({\n        render() {\n          return data.value;\n        },\n      });\n      const wrapper = Wrap(<Foo />);\n      expect(wrapper.isEmptyRender()).to.equal(data.expectResponse);\n    });\n\n    itWithData(emptyRenderValues, 'when an ES2015 class component returns: ', (data) => {\n      class Foo extends React.Component {\n        render() {\n          return data.value;\n        }\n      }\n      const wrapper = Wrap(<Foo />);\n      expect(wrapper.isEmptyRender()).to.equal(data.expectResponse);\n    });\n\n    describe('nested nodes', () => {\n      it(`returns ${!isShallow} for nested elements that return null`, () => {\n        const wrapper = Wrap((\n          <RenderChildren>\n            <RenderNull />\n          </RenderChildren>\n        ));\n\n        expect(wrapper.isEmptyRender()).to.equal(!isShallow);\n      });\n\n      it('returns false for multiple nested elements that all return null', () => {\n        const wrapper = Wrap((\n          <RenderChildren>\n            <div />\n          </RenderChildren>\n        ));\n\n        expect(wrapper.isEmptyRender()).to.equal(false);\n      });\n\n      it('returns false for multiple nested elements where one fringe returns a non null value', () => {\n        const wrapper = Wrap((\n          <RenderChildren>\n            <div>Hello</div>\n          </RenderChildren>\n        ));\n\n        expect(wrapper.isEmptyRender()).to.equal(false);\n      });\n\n      itIf(is('>= 16'), 'returns false for multiple nested elements that all return null', () => {\n        const wrapper = Wrap((\n          <RenderChildren>\n            <RenderNull />\n            <RenderChildren>\n              <RenderNull />\n              <div />\n            </RenderChildren>\n          </RenderChildren>\n        ));\n\n        expect(wrapper.isEmptyRender()).to.equal(false);\n      });\n\n      itIf(is('>= 16'), 'returns false for multiple nested elements where one fringe returns a non null value', () => {\n        const wrapper = Wrap((\n          <RenderChildren>\n            <RenderNull />\n            <RenderChildren>\n              <RenderNull />\n              <RenderNull />\n            </RenderChildren>\n            <RenderChildren>\n              <RenderNull />\n              <RenderChildren>\n                <RenderNull />\n                <RenderNull />\n                <RenderNull />\n                <div>Hello</div>\n              </RenderChildren>\n            </RenderChildren>\n          </RenderChildren>\n        ));\n\n        expect(wrapper.isEmptyRender()).to.equal(false);\n      });\n\n      itIf(is('>= 16'), `returns ${!isShallow} for multiple nested elements where all values are null`, () => {\n        const wrapper = Wrap((\n          <RenderChildren>\n            <RenderNull />\n            <RenderChildren>\n              <RenderNull />\n              <RenderNull />\n            </RenderChildren>\n            <RenderChildren>\n              <RenderNull />\n              <RenderChildren>\n                <RenderNull />\n                <RenderNull />\n                <RenderNull />\n              </RenderChildren>\n            </RenderChildren>\n          </RenderChildren>\n        ));\n\n        expect(wrapper.isEmptyRender()).to.equal(!isShallow);\n      });\n    });\n\n    it('does not return true for HTML elements', () => {\n      const wrapper = Wrap(<div className=\"bar baz\" />);\n      expect(wrapper.isEmptyRender()).to.equal(false);\n    });\n\n    describeIf(is('>=15 || ^16.0.0-alpha'), 'stateless function components (SFCs)', () => {\n      itWithData(emptyRenderValues, 'when a component returns: ', (data) => {\n        function Foo() {\n          return data.value;\n        }\n        const wrapper = Wrap(<Foo />);\n        expect(wrapper.isEmptyRender()).to.equal(data.expectResponse);\n      });\n    });\n\n    it(`returns ${!isShallow} for > 1 elements`, () => {\n      class RendersThree extends React.Component {\n        render() {\n          return (\n            <div>\n              <RenderNull />\n              <RenderNull />\n              <RenderNull />\n            </div>\n          );\n        }\n      }\n\n      const wrapper = WrapRendered(<RendersThree />);\n      const elements = wrapper.find(RenderNull);\n      expect(elements).to.have.lengthOf(3);\n      expect(elements.isEmptyRender()).to.equal(!isShallow);\n    });\n\n    itIf(!!memo, 'works on a memoized functional component', () => {\n      const Component = memo(() => null);\n      const wrapper = Wrap(<Component />);\n      expect(wrapper.debug()).to.equal(isShallow ? '' : '<Memo() />');\n      expect(wrapper.isEmptyRender()).to.equal(true);\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/key.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\n\nexport default function describeKey({\n  Wrap,\n}) {\n  describe('.key()', () => {\n    it('returns the key of the node', () => {\n      const wrapper = Wrap((\n        <ul>\n          {['foo', 'bar', ''].map((s) => <li key={s}>{s}</li>)}\n        </ul>\n      )).find('li');\n      expect(wrapper.at(0).key()).to.equal('foo');\n      expect(wrapper.at(1).key()).to.equal('bar');\n      expect(wrapper.at(2).key()).to.equal('');\n    });\n\n    it('returns null when no key is specified', () => {\n      const wrapper = Wrap((\n        <ul>\n          <li>foo</li>\n        </ul>\n      )).find('li');\n      expect(wrapper.key()).to.equal(null);\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/last.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\n\nexport default function describeLast({\n  Wrap,\n}) {\n  describe('.last()', () => {\n    it('returns the last node in the current set', () => {\n      const wrapper = Wrap((\n        <div>\n          <div className=\"bar\" />\n          <div className=\"bar\" />\n          <div className=\"bar\" />\n          <div className=\"bar baz\" />\n        </div>\n      ));\n      expect(wrapper.find('.bar').last().hasClass('baz')).to.equal(true);\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/map.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\nimport sinon from 'sinon-sandbox';\n\nexport default function describeMap({\n  Wrap,\n  Wrapper,\n}) {\n  describe('.map(fn)', () => {\n    it('calls a function with a wrapper for each node in the wrapper', () => {\n      const wrapper = Wrap((\n        <div>\n          <div className=\"foo bax\" />\n          <div className=\"foo bar\" />\n          <div className=\"foo baz\" />\n        </div>\n      ));\n      const spy = sinon.spy();\n\n      wrapper.find('.foo').map(spy);\n\n      expect(spy).to.have.property('callCount', 3);\n      expect(spy.args[0][0]).to.be.instanceOf(Wrapper);\n      expect(spy.args[0][0].hasClass('bax')).to.equal(true);\n      expect(spy.args[0][1]).to.equal(0);\n      expect(spy.args[1][0]).to.be.instanceOf(Wrapper);\n      expect(spy.args[1][0].hasClass('bar')).to.equal(true);\n      expect(spy.args[1][1]).to.equal(1);\n      expect(spy.args[2][0]).to.be.instanceOf(Wrapper);\n      expect(spy.args[2][0].hasClass('baz')).to.equal(true);\n      expect(spy.args[2][1]).to.equal(2);\n    });\n\n    it('returns an array with the mapped values', () => {\n      const wrapper = Wrap((\n        <div>\n          <div className=\"foo bax\" />\n          <div className=\"foo bar\" />\n          <div className=\"foo baz\" />\n        </div>\n      ));\n      const result = wrapper.find('.foo').map((w) => w.props().className);\n\n      expect(result).to.eql([\n        'foo bax',\n        'foo bar',\n        'foo baz',\n      ]);\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/matchesElement.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\nimport sinon from 'sinon-sandbox';\n\nexport default function describeMatchesElement({\n  Wrap,\n  WrapRendered,\n}) {\n  describe('.matchesElement(node)', () => {\n    it('matches on a root node that looks like the rendered one', () => {\n      const spy = sinon.spy();\n      const wrapper = Wrap((\n        <div>\n          <div onClick={spy} style={{ fontSize: 12, color: 'red' }}>Hello World</div>\n        </div>\n      )).first();\n      expect(wrapper.matchesElement(<div><div>Hello World</div></div>)).to.equal(true);\n      expect(wrapper.matchesElement((\n        <div>\n          <div onClick={spy} style={{ fontSize: 12, color: 'red' }}>Hello World</div>\n        </div>\n      ))).to.equal(true);\n      expect(wrapper.matchesElement((\n        <div>\n          <div onClick={spy}>Hello World</div>\n        </div>\n      ))).to.equal(true);\n      expect(wrapper.matchesElement((\n        <div>\n          <div style={{ fontSize: 12, color: 'red' }}>Hello World</div>\n        </div>\n      ))).to.equal(true);\n      expect(spy).to.have.property('callCount', 0);\n    });\n\n    it('does not match on a root node that doesn’t looks like the rendered one', () => {\n      const spy = sinon.spy();\n      const spy2 = sinon.spy();\n      const wrapper = Wrap((\n        <div>\n          <div onClick={spy} style={{ fontSize: 12, color: 'red' }}>Hello World</div>\n        </div>\n      )).first();\n      expect(wrapper.matchesElement(<div><div>Bonjour le monde</div></div>)).to.equal(false);\n      expect(wrapper.matchesElement((\n        <div>\n          <div onClick={spy} style={{ fontSize: 12, color: 'blue' }}>Hello World</div>\n        </div>\n      ))).to.equal(false);\n      expect(wrapper.matchesElement((\n        <div>\n          <div onClick={spy2}>Hello World</div>\n        </div>\n      ))).to.equal(false);\n      expect(wrapper.matchesElement((\n        <div>\n          <div style={{ fontSize: 13, color: 'red' }}>Hello World</div>\n        </div>\n      ))).to.equal(false);\n      expect(spy).to.have.property('callCount', 0);\n      expect(spy2).to.have.property('callCount', 0);\n    });\n\n    it('matches a simple node', () => {\n      class Test extends React.Component {\n        render() {\n          return <h1>test</h1>;\n        }\n      }\n      const wrapper = WrapRendered(<Test />);\n      expect(wrapper.matchesElement(<h1>test</h1>)).to.equal(true);\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/name.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\nimport wrap from 'mocha-wrap';\nimport sinon from 'sinon-sandbox';\n\nimport getAdapter from 'enzyme/build/getAdapter';\n\nimport {\n  describeIf,\n} from '../../_helpers';\nimport { is } from '../../_helpers/version';\n\nimport {\n  createClass,\n} from '../../_helpers/react-compat';\n\nexport default function describeName({\n  Wrap,\n  WrapRendered,\n}) {\n  wrap()\n    .withOverride(() => getAdapter(), 'displayNameOfNode', () => undefined)\n    .describe('.name()', () => {\n      describe('node with displayName', () => {\n        it('returns the displayName of the node', () => {\n          class Foo extends React.Component {\n            render() { return <div />; }\n          }\n\n          class FooWrapper extends React.Component {\n            render() { return <Foo />; }\n          }\n\n          Foo.displayName = 'CustomWrapper';\n\n          const wrapper = WrapRendered(<FooWrapper />);\n          expect(wrapper.name()).to.equal('CustomWrapper');\n        });\n\n        describeIf(is('> 0.13'), 'stateless function components (SFCs)', () => {\n          it('returns the name of the node', () => {\n            function SFC() {\n              return <div />;\n            }\n            const SFCWrapper = () => <SFC />;\n\n            SFC.displayName = 'CustomWrapper';\n\n            const wrapper = WrapRendered(<SFCWrapper />);\n            expect(wrapper.name()).to.equal('CustomWrapper');\n          });\n        });\n\n        describe('createClass', () => {\n          it('returns the name of the node', () => {\n            const Foo = createClass({\n              displayName: 'CustomWrapper',\n              render() {\n                return <div />;\n              },\n            });\n            const FooWrapper = createClass({\n              render() {\n                return <Foo />;\n              },\n            });\n\n            const wrapper = WrapRendered(<FooWrapper />);\n            expect(wrapper.name()).to.equal('CustomWrapper');\n          });\n        });\n\n        wrap()\n          .withOverride(() => getAdapter(), 'displayNameOfNode', () => sinon.stub())\n          .describe('adapter has `displayNameOfNode`', () => {\n            it('delegates to the adapter’s `displayNameOfNode`', () => {\n              class Foo extends React.Component {\n                render() { return <div />; }\n              }\n              const stub = getAdapter().displayNameOfNode;\n              const sentinel = {};\n              stub.returns(sentinel);\n\n              const wrapper = Wrap(<Foo />);\n\n              expect(wrapper.name()).to.equal(sentinel);\n\n              expect(stub).to.have.property('callCount', 1);\n              const { args } = stub.firstCall;\n              expect(args).to.eql([wrapper.getNodeInternal()]);\n            });\n          });\n      });\n\n      describe('node without displayName', () => {\n        it('returns the name of the node', () => {\n          class Foo extends React.Component {\n            render() { return <div />; }\n          }\n\n          class FooWrapper extends React.Component {\n            render() { return <Foo />; }\n          }\n\n          const wrapper = WrapRendered(<FooWrapper />);\n          expect(wrapper.name()).to.equal('Foo');\n        });\n\n        describeIf(is('> 0.13'), 'stateless function components (SFCs)', () => {\n          it('returns the name of the node', () => {\n            function SFC() {\n              return <div />;\n            }\n            const SFCWrapper = () => <SFC />;\n\n            const wrapper = WrapRendered(<SFCWrapper />);\n            expect(wrapper.name()).to.equal('SFC');\n          });\n        });\n      });\n\n      describe('DOM node', () => {\n        it('returns the name of the node', () => {\n          const wrapper = Wrap(<div />);\n          expect(wrapper.name()).to.equal('div');\n        });\n      });\n    });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/not.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\n\nexport default function describeNot({\n  Wrap,\n}) {\n  describe('.not(selector)', () => {\n    it('filters to things not matching a selector', () => {\n      const wrapper = Wrap((\n        <div>\n          <div className=\"foo bar baz\" />\n          <div className=\"foo\" />\n          <div className=\"bar baz\" />\n          <div className=\"baz\" />\n          <div className=\"foo bar\" />\n        </div>\n      ));\n\n      expect(wrapper.find('.foo').not('.bar')).to.have.lengthOf(1);\n      expect(wrapper.find('.baz').not('.foo')).to.have.lengthOf(2);\n      expect(wrapper.find('.foo').not('div')).to.have.lengthOf(0);\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/parent.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\n\nimport {\n  itIf,\n} from '../../_helpers';\n\nimport {\n  createClass,\n} from '../../_helpers/react-compat';\n\nexport default function describeParent({\n  Wrap,\n  isShallow,\n}) {\n  describe('.parent()', () => {\n    it('returns only the immediate parent of the node', () => {\n      const wrapper = Wrap((\n        <div className=\"bax\">\n          <div className=\"foo\">\n            <div className=\"bar\">\n              <div className=\"baz\" />\n            </div>\n          </div>\n        </div>\n      ));\n      expect(wrapper.find('.baz').parent().hasClass('bar')).to.equal(true);\n    });\n\n    it('works when the sibling node has children', () => {\n      const wrapper = Wrap((\n        <div className=\"bax\">\n          <div className=\"foo\">\n            <div className=\"bar\">\n              <div className=\"baz\" />\n              <div>\n                <div />\n              </div>\n            </div>\n          </div>\n        </div>\n      ));\n\n      expect(wrapper.find('.baz').parent().hasClass('bar')).to.equal(true);\n    });\n\n    it('works for multiple nodes', () => {\n      const wrapper = Wrap((\n        <div>\n          <div className=\"foo\">\n            <div className=\"baz\" />\n          </div>\n          <div className=\"bar\">\n            <div className=\"baz\" />\n          </div>\n          <div className=\"bax\">\n            <div className=\"baz\" />\n          </div>\n        </div>\n      ));\n\n      const parents = wrapper.find('.baz').parent();\n      expect(parents).to.have.lengthOf(3);\n      expect(parents.at(0).hasClass('foo')).to.equal(true);\n      expect(parents.at(1).hasClass('bar')).to.equal(true);\n      expect(parents.at(2).hasClass('bax')).to.equal(true);\n    });\n\n    itIf(isShallow, 'works with component', () => {\n      const Foo = createClass({\n        render() {\n          return <div className=\"bar\" />;\n        },\n      });\n      const wrapper = Wrap(<Foo />);\n      expect(wrapper.find('.bar')).to.have.lengthOf(1);\n      expect(wrapper.find('.bar').parent()).to.have.lengthOf(0);\n      expect(wrapper.parent()).to.have.lengthOf(0);\n    });\n\n    itIf(!isShallow, 'works with component', () => {\n      const Foo = createClass({\n        render() {\n          return <div className=\"bar\" />;\n        },\n      });\n      const wrapper = Wrap(<Foo />);\n      expect(wrapper.find('.bar')).to.have.lengthOf(1);\n      expect(wrapper.find('.bar').parent()).to.have.lengthOf(1);\n      expect(wrapper.parent()).to.have.lengthOf(0);\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/parents.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\n\nimport {\n  itIf,\n} from '../../_helpers';\n\nimport {\n  createClass,\n} from '../../_helpers/react-compat';\n\nexport default function describeParents({\n  Wrap,\n  isShallow,\n}) {\n  describe('.parents([selector])', () => {\n    it('returns an array of current node’s ancestors', () => {\n      const wrapper = Wrap((\n        <div className=\"bax\">\n          <div className=\"foo\">\n            <div className=\"bar\">\n              <div className=\"baz\" />\n            </div>\n          </div>\n          <div className=\"qux\">\n            <div className=\"qoo\" />\n          </div>\n        </div>\n      ));\n\n      const parents = wrapper.find('.baz').parents();\n\n      expect(parents).to.have.lengthOf(3);\n      expect(parents.at(0).hasClass('bar')).to.equal(true);\n      expect(parents.at(1).hasClass('foo')).to.equal(true);\n      expect(parents.at(2).hasClass('bax')).to.equal(true);\n    });\n\n    it('works for non-leaf nodes as well', () => {\n      const wrapper = Wrap((\n        <div className=\"bax\">\n          <div className=\"foo\">\n            <div className=\"bar\">\n              <div className=\"baz\" />\n            </div>\n          </div>\n        </div>\n      ));\n\n      const parents = wrapper.find('.bar').parents();\n\n      expect(parents).to.have.lengthOf(2);\n      expect(parents.at(0).hasClass('foo')).to.equal(true);\n      expect(parents.at(1).hasClass('bax')).to.equal(true);\n    });\n\n    it('optionally allows a selector', () => {\n      const wrapper = Wrap((\n        <div className=\"bax foo\">\n          <div className=\"foo\">\n            <div className=\"bar\">\n              <div className=\"baz\" />\n            </div>\n          </div>\n        </div>\n      ));\n\n      const parents = wrapper.find('.baz').parents('.foo');\n\n      expect(parents).to.have.lengthOf(2);\n      expect(parents.at(0).hasClass('foo')).to.equal(true);\n      expect(parents.at(1).hasClass('bax')).to.equal(true);\n    });\n\n    it('works when called sequentially on two sibling nodes', () => {\n      class Test extends React.Component {\n        render() {\n          return (\n            <div>\n              <div className=\"a\">\n                <div>A child</div>\n              </div>\n              <div className=\"b\">\n                <div>B child</div>\n              </div>\n            </div>\n          );\n        }\n      }\n\n      const wrapper = Wrap(<Test />);\n\n      const aChild = wrapper.find({ children: 'A child' });\n      expect(aChild.debug()).to.equal(`<div>\n  A child\n</div>`);\n      expect(aChild).to.have.lengthOf(1);\n\n      const bChild = wrapper.find({ children: 'B child' });\n      expect(bChild.debug()).to.equal(`<div>\n  B child\n</div>`);\n      expect(bChild).to.have.lengthOf(1);\n\n      const bChildParents = bChild.parents('.b');\n      expect(bChildParents.debug()).to.equal(`<div className=\"b\">\n  <div>\n    B child\n  </div>\n</div>`);\n      expect(bChildParents).to.have.lengthOf(1);\n\n      const aChildParents = aChild.parents('.a');\n      expect(aChildParents.debug()).to.equal(`<div className=\"a\">\n  <div>\n    A child\n  </div>\n</div>`);\n      expect(aChildParents).to.have.lengthOf(1);\n    });\n\n    itIf(!isShallow, 'works with components in the tree', () => {\n      const Foo = createClass({\n        render() {\n          return <div className=\"bar\" />;\n        },\n      });\n      const wrapper = Wrap((\n        <div className=\"root\">\n          <Foo />\n        </div>\n      ));\n      const rootDiv = wrapper.find('.root');\n      expect(rootDiv).to.have.lengthOf(1);\n      expect(rootDiv.hasClass('root')).to.equal(true);\n      expect(rootDiv.hasClass('bar')).to.equal(false);\n\n      const bar = rootDiv.find('.bar');\n      expect(bar).to.have.lengthOf(1);\n      expect(bar.parents('.root')).to.have.lengthOf(1);\n    });\n\n    itIf(!isShallow, 'finds parents up a tree through a custom component boundary', () => {\n      class CustomForm extends React.Component {\n        render() {\n          const { children } = this.props;\n          return (\n            <form>\n              {children}\n            </form>\n          );\n        }\n      }\n\n      const wrapper = Wrap((\n        <div>\n          <CustomForm>\n            <input />\n          </CustomForm>\n        </div>\n      ));\n\n      const formDown = wrapper.find('form');\n      expect(formDown).to.have.lengthOf(1);\n\n      const input = wrapper.find('input');\n      expect(input).to.have.lengthOf(1);\n      const formUp = input.parents('form');\n      expect(formUp).to.have.lengthOf(1);\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/prop.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\n\nimport {\n  describeIf,\n  itIf,\n} from '../../_helpers';\nimport { is } from '../../_helpers/version';\n\nexport default function describeProp({\n  Wrap,\n  WrapRendered,\n  isMount,\n}) {\n  describe('.prop(name)', () => {\n    it('returns the prop value for [name]', () => {\n      const fn = () => {};\n      const wrapper = Wrap((\n        <div id=\"fooId\" className=\"bax\" onClick={fn}>\n          <div className=\"baz\" />\n          <div className=\"foo\" />\n        </div>\n      ));\n\n      expect(wrapper.prop('className')).to.equal('bax');\n      expect(wrapper.prop('onClick')).to.equal(fn);\n      expect(wrapper.prop('id')).to.equal('fooId');\n    });\n\n    it('is allowed to be used on an inner node', () => {\n      const fn = () => {};\n      const wrapper = Wrap((\n        <div className=\"bax\">\n          <div className=\"baz\" onClick={fn} />\n          <div className=\"foo\" id=\"fooId\" />\n        </div>\n      ));\n\n      expect(wrapper.find('.baz').prop('onClick')).to.equal(fn);\n      expect(wrapper.find('.foo').prop('id')).to.equal('fooId');\n    });\n\n    class Foo extends React.Component {\n      render() {\n        const { bar, foo } = this.props;\n        return (\n          <div className={bar} id={foo} />\n        );\n      }\n    }\n\n    itIf(isMount, 'called on root should return props of root node', () => {\n      const wrapper = Wrap(<Foo foo=\"hi\" bar=\"bye\" />);\n\n      expect(wrapper.prop('foo')).to.equal('hi');\n      expect(wrapper.prop('bar')).to.equal('bye');\n      expect(wrapper.prop('className')).to.equal(undefined);\n      expect(wrapper.prop('id')).to.equal(undefined);\n    });\n\n    it('returns prop value of root rendered node', () => {\n      const wrapper = WrapRendered(<Foo foo=\"hi\" bar=\"bye\" />);\n\n      expect(wrapper.prop('className')).to.equal('bye');\n      expect(wrapper.prop('id')).to.equal('hi');\n      expect(wrapper.prop('foo')).to.equal(undefined);\n      expect(wrapper.prop('bar')).to.equal(undefined);\n    });\n\n    describeIf(is('> 0.13'), 'stateless function components (SFCs)', () => {\n      const FooSFC = ({ bar, foo }) => (\n        <div className={bar} id={foo} />\n      );\n\n      itIf(isMount, 'called on root should return props of root node', () => {\n        const wrapper = Wrap(<FooSFC foo=\"hi\" bar=\"bye\" />);\n\n        expect(wrapper.prop('foo')).to.equal('hi');\n        expect(wrapper.prop('bar')).to.equal('bye');\n        expect(wrapper.prop('className')).to.equal(undefined);\n        expect(wrapper.prop('id')).to.equal(undefined);\n      });\n\n      it('returns props of root rendered node', () => {\n        const wrapper = WrapRendered(<FooSFC foo=\"hi\" bar=\"bye\" />);\n\n        expect(wrapper.prop('className')).to.equal('bye');\n        expect(wrapper.prop('id')).to.equal('hi');\n        expect(wrapper.prop('foo')).to.equal(undefined);\n        expect(wrapper.prop('bar')).to.equal(undefined);\n      });\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/props.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\n\nimport {\n  delay,\n  describeIf,\n  itIf,\n} from '../../_helpers';\nimport sloppyReturnThis from '../../_helpers/untranspiledSloppyReturnThis';\nimport { is } from '../../_helpers/version';\n\nexport default function describeProps({\n  Wrap,\n  WrapRendered,\n  isMount,\n}) {\n  describe('.props()', () => {\n    it('returns the props object', () => {\n      const fn = () => ({});\n      const wrapper = Wrap((\n        <div id=\"fooId\" className=\"bax\" onClick={fn}>\n          <div className=\"baz\" />\n          <div className=\"foo\" />\n        </div>\n      ));\n\n      expect(wrapper.props().className).to.equal('bax');\n      expect(wrapper.props().onClick).to.equal(fn);\n      expect(wrapper.props().id).to.equal('fooId');\n    });\n\n    it('is allowed to be used on an inner node', () => {\n      const fn = () => ({});\n      const wrapper = Wrap((\n        <div className=\"bax\">\n          <div className=\"baz\" onClick={fn} />\n          <div className=\"foo\" id=\"fooId\" />\n        </div>\n      ));\n\n      expect(wrapper.find('.baz').props().onClick).to.equal(fn);\n      expect(wrapper.find('.foo').props().id).to.equal('fooId');\n    });\n\n    class Foo extends React.Component {\n      render() {\n        const { bar, foo } = this.props;\n        return (\n          <div className={bar} id={foo} />\n        );\n      }\n    }\n\n    itIf(isMount, 'called on root should return props of root node', () => {\n      const wrapper = Wrap(<Foo foo=\"hi\" bar=\"bye\" />);\n\n      expect(wrapper.props()).to.eql({ bar: 'bye', foo: 'hi' });\n    });\n\n    it('returns props of root rendered node', () => {\n      const wrapper = WrapRendered(<Foo foo=\"hi\" bar=\"bye\" />);\n\n      expect(wrapper.props()).to.eql({ className: 'bye', id: 'hi' });\n    });\n\n    describeIf(is('> 0.13'), 'stateless function components (SFCs)', () => {\n      const FooSFC = ({ bar, foo }) => (\n        <div className={bar} id={foo} />\n      );\n\n      itIf(isMount, 'called on root should return props of root node', () => {\n        const wrapper = Wrap(<FooSFC foo=\"hi\" bar=\"bye\" />);\n\n        expect(wrapper.props()).to.eql({ bar: 'bye', foo: 'hi' });\n      });\n\n      it('returns props of root rendered node', () => {\n        const wrapper = WrapRendered(<FooSFC foo=\"hi\" bar=\"bye\" />);\n\n        expect(wrapper.props()).to.eql({ className: 'bye', id: 'hi' });\n      });\n\n      const SloppyReceiver = sloppyReturnThis((\n        receiver,\n        props = { NO_PROPS: true },\n        context,\n      ) => (\n        <div\n          data-is-global={receiver === global}\n          data-is-undefined={typeof receiver === 'undefined'}\n          {...props}\n          {...context}\n        />\n      ));\n\n      const StrictReceiver = function SFC(\n        props = { NO_PROPS: true },\n        context,\n      ) {\n        return (\n          <div\n            data-is-global={this === global}\n            data-is-undefined={typeof this === 'undefined'}\n            {...props}\n            {...context}\n          />\n        );\n      };\n\n      it('does not provide a `this` to a sloppy-mode SFC', () => {\n        const wrapper = WrapRendered(<SloppyReceiver />);\n        expect(wrapper.props()).to.be.an('object').that.has.all.keys({\n          'data-is-global': true,\n          'data-is-undefined': false,\n        });\n      });\n\n      it('does not provide a `this` to a strict-mode SFC', () => {\n        const wrapper = WrapRendered(<StrictReceiver />);\n        expect(wrapper.props()).to.be.an('object').that.has.all.keys({\n          'data-is-global': false,\n          'data-is-undefined': true,\n        });\n      });\n    });\n\n    describe('props in async handler', () => {\n      class TestComponent extends React.Component {\n        constructor(props) {\n          super(props);\n          this.state = { counter: 1 };\n          this.handleClick = this.handleClick.bind(this);\n        }\n\n        handleClick() {\n          return delay(100).then(() => new Promise((resolve) => {\n            this.setState({ counter: 2 }, () => {\n              resolve();\n            });\n          }));\n        }\n\n        render() {\n          const { counter } = this.state;\n          return (\n            <div id=\"parentDiv\" onClick={this.handleClick}>\n              <TestSubComponent id=\"childDiv\" counter={counter} />\n            </div>\n          );\n        }\n      }\n\n      class TestSubComponent extends React.Component {\n        render() {\n          const { counter } = this.props;\n          return <div>{counter}</div>;\n        }\n      }\n\n      it('child component props should update after call to setState in async handler', () => {\n        const wrapper = Wrap(<TestComponent />);\n        expect(wrapper.find(TestSubComponent).props()).to.eql({ id: 'childDiv', counter: 1 });\n        const promise = wrapper.find('#parentDiv').props().onClick();\n        expect(wrapper.find(TestSubComponent).props()).to.eql({ id: 'childDiv', counter: 1 });\n        return promise.then(() => {\n          wrapper.update();\n          expect(wrapper.find(TestSubComponent).props()).to.eql({ id: 'childDiv', counter: 2 });\n        });\n      });\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/reduce.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\nimport sinon from 'sinon-sandbox';\n\nimport { getElementPropSelector, getWrapperPropSelector } from '../../_helpers/selectors';\n\nexport default function describeReduce({\n  Wrap,\n  Wrapper,\n}) {\n  describe('.reduce(fn[, initialValue])', () => {\n    it('has the right length', () => {\n      expect(Wrapper.prototype.reduce).to.have.lengthOf(1);\n    });\n\n    it('calls a function with a wrapper for each node in the wrapper', () => {\n      const wrapper = Wrap((\n        <div>\n          <div className=\"foo bax\" />\n          <div className=\"foo bar\" />\n          <div className=\"foo baz\" />\n        </div>\n      ));\n      const spy = sinon.spy((n) => n + 1);\n\n      wrapper.find('.foo').reduce(spy, 0);\n\n      expect(spy).to.have.property('callCount', 3);\n      expect(spy.args[0][1]).to.be.instanceOf(Wrapper);\n      expect(spy.args[0][1].hasClass('bax')).to.equal(true);\n      expect(spy.args[1][1]).to.be.instanceOf(Wrapper);\n      expect(spy.args[1][1].hasClass('bar')).to.equal(true);\n      expect(spy.args[2][1]).to.be.instanceOf(Wrapper);\n      expect(spy.args[2][1].hasClass('baz')).to.equal(true);\n    });\n\n    it('accumulates a value', () => {\n      const wrapper = Wrap((\n        <div>\n          <div id=\"bax\" className=\"foo qoo\" />\n          <div id=\"bar\" className=\"foo boo\" />\n          <div id=\"baz\" className=\"foo hoo\" />\n        </div>\n      ));\n      const result = wrapper.find('.foo').reduce((obj, n) => {\n        obj[n.prop('id')] = n.prop('className');\n        return obj;\n      }, {});\n\n      expect(result).to.eql({\n        bax: 'foo qoo',\n        bar: 'foo boo',\n        baz: 'foo hoo',\n      });\n    });\n\n    it('allows the initialValue to be omitted', () => {\n      const one = (<div id=\"bax\" className=\"foo qoo\" />);\n      const two = (<div id=\"bar\" className=\"foo boo\" />);\n      const three = (<div id=\"baz\" className=\"foo hoo\" />);\n      const wrapper = Wrap((\n        <div>\n          {one}\n          {two}\n          {three}\n        </div>\n      ));\n      const counter = (<noscript id=\"counter\" />);\n      const result = wrapper\n        .find('.foo')\n        .reduce((acc, n) => [].concat(acc, n, new Wrapper(counter)))\n        .map(getWrapperPropSelector('id'));\n\n      expect(result).to.eql([one, two, counter, three, counter].map(getElementPropSelector('id')));\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/reduceRight.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\nimport sinon from 'sinon-sandbox';\n\nimport { getElementPropSelector, getWrapperPropSelector } from '../../_helpers/selectors';\n\nexport default function describeReduceRight({\n  Wrap,\n  Wrapper,\n}) {\n  describe('.reduceRight(fn[, initialValue])', () => {\n    it('has the right length', () => {\n      expect(Wrapper.prototype.reduceRight).to.have.lengthOf(1);\n    });\n\n    it('calls a function with a wrapper for each node in the wrapper in reverse', () => {\n      const wrapper = Wrap((\n        <div>\n          <div className=\"foo bax\" />\n          <div className=\"foo bar\" />\n          <div className=\"foo baz\" />\n        </div>\n      ));\n      const spy = sinon.spy((n) => n + 1);\n\n      wrapper.find('.foo').reduceRight(spy, 0);\n\n      expect(spy).to.have.property('callCount', 3);\n      expect(spy.args[0][1]).to.be.instanceOf(Wrapper);\n      expect(spy.args[0][1].hasClass('baz')).to.equal(true);\n      expect(spy.args[1][1]).to.be.instanceOf(Wrapper);\n      expect(spy.args[1][1].hasClass('bar')).to.equal(true);\n      expect(spy.args[2][1]).to.be.instanceOf(Wrapper);\n      expect(spy.args[2][1].hasClass('bax')).to.equal(true);\n    });\n\n    it('accumulates a value', () => {\n      const wrapper = Wrap((\n        <div>\n          <div id=\"bax\" className=\"foo qoo\" />\n          <div id=\"bar\" className=\"foo boo\" />\n          <div id=\"baz\" className=\"foo hoo\" />\n        </div>\n      ));\n      const result = wrapper.find('.foo').reduceRight((obj, n) => {\n        obj[n.prop('id')] = n.prop('className');\n        return obj;\n      }, {});\n\n      expect(result).to.eql({\n        bax: 'foo qoo',\n        bar: 'foo boo',\n        baz: 'foo hoo',\n      });\n    });\n\n    it('allows the initialValue to be omitted', () => {\n      const one = (<div id=\"bax\" className=\"foo qoo\" />);\n      const two = (<div id=\"bar\" className=\"foo boo\" />);\n      const three = (<div id=\"baz\" className=\"foo hoo\" />);\n      const wrapper = Wrap((\n        <div>\n          {one}\n          {two}\n          {three}\n        </div>\n      ));\n      const counter = (<noscript id=\"counter\" />);\n      const result = wrapper\n        .find('.foo')\n        .reduceRight((acc, n) => [].concat(acc, n, new Wrapper(counter)))\n        .map(getWrapperPropSelector('id'));\n\n      expect(result).to.eql([three, two, counter, one, counter].map(getElementPropSelector('id')));\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/render.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\n\nimport {\n  describeIf, itIf,\n} from '../../_helpers';\nimport { is } from '../../_helpers/version';\n\nexport default function describeRender({\n  Wrap,\n}) {\n  describe('.render()', () => {\n    // FIXME: figure out why this fails on 15.0 and 15.1\n    itIf(!is('~15.0 || ~15.1'), 'returns a cheerio wrapper around the current node', () => {\n      class Foo extends React.Component {\n        render() {\n          return (<div className=\"in-foo\" />);\n        }\n      }\n\n      class Bar extends React.Component {\n        render() {\n          return (\n            <div className=\"in-bar\">\n              <Foo />\n            </div>\n          );\n        }\n      }\n\n      const wrapper = Wrap(<Bar />);\n\n      expect(wrapper.render().find('.in-foo')).to.have.lengthOf(1);\n\n      const rendered = wrapper.render();\n      expect(rendered.is('.in-bar')).to.equal(true);\n      expect(rendered).to.have.lengthOf(1);\n\n      const renderedFoo = wrapper.find(Foo).render();\n      expect(renderedFoo.is('.in-foo')).to.equal(true);\n      expect(renderedFoo.is('.in-bar')).to.equal(false);\n      expect(renderedFoo.find('.in-bar')).to.have.lengthOf(0);\n    });\n\n    describeIf(is('> 0.13'), 'stateless function components (SFCs)', () => {\n      // FIXME: figure out why this fails on 15.0 and 15.1\n      itIf(!is('~15.0 || ~15.1'), 'returns a cheerio wrapper around the current node', () => {\n        const Foo = () => (\n          <div className=\"in-foo\" />\n        );\n\n        const Bar = () => (\n          <div className=\"in-bar\">\n            <Foo />\n          </div>\n        );\n\n        const wrapper = Wrap(<Bar />);\n\n        expect(wrapper.render().find('.in-foo')).to.have.lengthOf(1);\n        expect(wrapper.render().is('.in-bar')).to.equal(true);\n\n        const renderedFoo = wrapper.find(Foo).render();\n        expect(renderedFoo.is('.in-foo')).to.equal(true);\n        expect(renderedFoo.is('.in-bar')).to.equal(false);\n        expect(renderedFoo.find('.in-bar')).to.have.lengthOf(0);\n      });\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/renderProp.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\nimport wrap from 'mocha-wrap';\nimport sinon from 'sinon-sandbox';\n\nimport getAdapter from 'enzyme/build/getAdapter';\n\nimport {\n  describeIf,\n} from '../../_helpers';\nimport { is } from '../../_helpers/version';\n\nexport default function describeRenderProp({\n  Wrap,\n  WrapRendered,\n  WrapperName,\n}) {\n  wrap()\n    .withConsoleThrows()\n    .describe('.renderProp()', () => {\n      class Foo extends React.Component {\n        render() {\n          return <div className=\"in-foo\" />;\n        }\n      }\n      class Bar extends React.Component {\n        render() {\n          const { render: r } = this.props;\n          return <div className=\"in-bar\">{typeof r === 'function' && r()}</div>;\n        }\n      }\n      class RendersBar extends React.Component {\n        render() {\n          return <Bar {...this.props} />;\n        }\n      }\n\n      it('returns a wrapper around the node returned from the render prop', () => {\n        const wrapperA = Wrap(<div><Bar render={() => <div><Foo /></div>} /></div>);\n        const renderPropWrapperA = wrapperA.find(Bar).renderProp('render')();\n        expect(renderPropWrapperA.find(Foo)).to.have.lengthOf(1);\n\n        const wrapperB = Wrap(<div><Bar render={() => <Foo />} /></div>);\n        const renderPropWrapperB = wrapperB.find(Bar).renderProp('render')();\n        expect(renderPropWrapperB.find(Foo)).to.have.lengthOf(1);\n\n        const stub = sinon.stub().returns(<div />);\n        const wrapperC = Wrap(<div><Bar render={stub} /></div>);\n        stub.resetHistory();\n        wrapperC.find(Bar).renderProp('render')('one', 'two');\n        expect(stub.args).to.deep.equal([['one', 'two']]);\n      });\n\n      it('throws on a non-string prop name', () => {\n        const wrapper = Wrap(<RendersBar render={() => {}} />);\n        expect(() => wrapper.renderProp()).to.throw(\n          TypeError,\n          `${WrapperName}::renderProp(): \\`propName\\` must be a string`,\n        );\n      });\n\n      it('throws on a missing prop', () => {\n        const wrapper = Wrap(<RendersBar render={() => {}} />);\n        expect(() => wrapper.renderProp('nope')).to.throw(\n          Error,\n          `${WrapperName}::renderProp(): no prop called “nope“ found`,\n        );\n      });\n\n      it('throws on a non-function render prop value', () => {\n        const wrapper = Wrap(<RendersBar render={{}} />);\n        expect(() => wrapper.renderProp('render')).to.throw(\n          TypeError,\n          `${WrapperName}::renderProp(): expected prop “render“ to contain a function, but it holds “object“`,\n        );\n      });\n\n      it('throws on host elements', () => {\n        class Div extends React.Component {\n          render() {\n            const { children } = this.props;\n            return <div>{children}</div>;\n          }\n        }\n\n        const wrapper = WrapRendered(<Div />);\n        expect(wrapper.is('div')).to.equal(true);\n        expect(() => wrapper.renderProp('foo')).to.throw();\n      });\n\n      wrap()\n        .withOverride(() => getAdapter(), 'wrap', () => undefined)\n        .it('throws with a react adapter that lacks a `.wrap`', () => {\n          const wrapper = Wrap(<div><Bar render={() => <div><Foo /></div>} /></div>);\n          expect(() => wrapper.find(Bar).renderProp('render')).to.throw(RangeError);\n        });\n\n      describeIf(is('>= 16'), 'allows non-nodes', () => {\n        function MyComponent({ val }) {\n          return <ComponentWithRenderProp val={val} r={(x) => x} />;\n        }\n\n        function ComponentWithRenderProp({ val, r }) {\n          return r(val);\n        }\n\n        it('works with strings', () => {\n          const wrapper = Wrap(<MyComponent val=\"foo\" />);\n\n          wrapper.find(ComponentWithRenderProp).renderProp('r')('foo');\n\n          wrapper.find(ComponentWithRenderProp).renderProp('r')('');\n        });\n\n        it('works with numbers', () => {\n          const wrapper = Wrap(<MyComponent val={42} />);\n\n          wrapper.find(ComponentWithRenderProp).renderProp('r')(42);\n\n          wrapper.find(ComponentWithRenderProp).renderProp('r')(0);\n\n          wrapper.find(ComponentWithRenderProp).renderProp('r')(NaN);\n        });\n\n        it('works with null', () => {\n          const wrapper = Wrap(<MyComponent val={null} />);\n\n          wrapper.find(ComponentWithRenderProp).renderProp('r')(null);\n        });\n\n        // FIXME: figure out how to test this reliably\n        it.skip('throws with undefined', () => {\n          const wrapper = Wrap(<MyComponent val=\"\" />);\n\n          expect(() => wrapper.find(ComponentWithRenderProp).renderProp('r')(undefined)).to.throw();\n        });\n\n        it('works with arrays', () => {\n          const wrapper = Wrap(<MyComponent val={[]} />);\n\n          wrapper.find(ComponentWithRenderProp).renderProp('r')([]);\n\n          wrapper.find(ComponentWithRenderProp).renderProp('r')(['a']);\n\n          wrapper.find(ComponentWithRenderProp).renderProp('r')([Infinity]);\n        });\n\n        it('works with false', () => {\n          const wrapper = Wrap(<MyComponent val={false} />);\n\n          wrapper.find(ComponentWithRenderProp).renderProp('r')(false);\n        });\n\n        it('throws with true', () => {\n          const wrapper = Wrap(<MyComponent val={false} />);\n\n          expect(() => wrapper.find(ComponentWithRenderProp).renderProp('r')(true).Wrap()).to.throw();\n        });\n      });\n    });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/root.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\n\nimport {\n  itIf,\n} from '../../_helpers';\n\nexport default function describeRoot({\n  Wrap,\n  isMount,\n}) {\n  describe('.root()', () => {\n    class Fixture extends React.Component {\n      render() {\n        return <div><span /><span /></div>;\n      }\n    }\n\n    itIf(isMount, 'returns the root component instance', () => {\n      const wrapper = Wrap(<Fixture />);\n      const root = wrapper.root();\n      expect(root.is(Fixture)).to.equal(true);\n      expect(root.childAt(0).children().debug()).to.equal('<span />\\n\\n\\n<span />');\n\n      expect(wrapper.find('span').root()).to.equal(root);\n    });\n\n    itIf(!isMount, 'returns the root rendered node', () => {\n      const wrapper = Wrap(<Fixture />);\n      const root = wrapper.root();\n      expect(root.is('div')).to.equal(true);\n      expect(root.children().debug()).to.equal('<span />\\n\\n\\n<span />');\n\n      expect(wrapper.find('span').root()).to.equal(root);\n    });\n\n    it('returns the root wrapper from a child', () => {\n      const wrapper = Wrap(<Fixture />);\n      const root = wrapper.root();\n      expect(wrapper.find('span').root()).to.equal(root);\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/setContext.jsx",
    "content": "import React from 'react';\nimport PropTypes from 'prop-types';\nimport { expect } from 'chai';\nimport sinon from 'sinon-sandbox';\n\nimport {\n  describeIf,\n  itIf,\n} from '../../_helpers';\nimport { is } from '../../_helpers/version';\n\nimport {\n  createClass,\n} from '../../_helpers/react-compat';\n\nexport default function describeSetContext({\n  Wrap,\n  WrapperName,\n  isShallow,\n}) {\n  describe('.setContext(newContext)', () => {\n    const SimpleComponent = createClass({\n      contextTypes: {\n        name: PropTypes.string,\n      },\n      render() {\n        const { name } = this.context;\n        return <div>{name}</div>;\n      },\n    });\n\n    it('sets context for a component multiple times', () => {\n      const context = { name: 'foo' };\n      const wrapper = Wrap(<SimpleComponent />, { context });\n      expect(wrapper.text()).to.equal('foo');\n      wrapper.setContext({ name: 'bar' });\n      expect(wrapper.text()).to.equal('bar');\n      wrapper.setContext({ name: 'baz' });\n      expect(wrapper.text()).to.equal('baz');\n    });\n\n    it('throws if it is called when wrapper didn’t include context', () => {\n      const wrapper = Wrap(<SimpleComponent />);\n      expect(() => wrapper.setContext({ name: 'bar' })).to.throw(\n        Error,\n        `${WrapperName}::setContext() can only be called on a wrapper that was originally passed a context option`,\n      );\n    });\n\n    it('throws when not called on the root', () => {\n      const context = { name: <main /> };\n      const wrapper = Wrap(<SimpleComponent />, { context });\n      const main = wrapper.find('main');\n      expect(main).to.have.lengthOf(1);\n      expect(() => main.setContext()).to.throw(\n        Error,\n        `${WrapperName}::setContext() can only be called on the root`,\n      );\n    });\n\n    describeIf(is('> 0.13'), 'stateless functional components', () => {\n      const SFC = (props, { name }) => (\n        <div>{name}</div>\n      );\n      SFC.contextTypes = { name: PropTypes.string };\n\n      it('sets context for a component multiple times', () => {\n        const context = { name: 'foo' };\n        const wrapper = Wrap(<SFC />, { context });\n        expect(wrapper.text()).to.equal('foo');\n        wrapper.setContext({ name: 'bar' });\n        expect(wrapper.text()).to.equal('bar');\n        wrapper.setContext({ name: 'baz' });\n        expect(wrapper.text()).to.equal('baz');\n      });\n\n      it('throws if it is called when shallow didn’t include context', () => {\n        const wrapper = Wrap(<SFC />);\n        expect(() => wrapper.setContext({ name: 'bar' })).to.throw(\n          Error,\n          `${WrapperName}::setContext() can only be called on a wrapper that was originally passed a context option`,\n        );\n      });\n    });\n\n    it('calls componentWillReceiveProps when context is updated', () => {\n      const spy = sinon.spy();\n      const updatedProps = { foo: 'baz' };\n      class Foo extends React.Component {\n        componentWillReceiveProps() {\n          spy('componentWillReceiveProps');\n        }\n\n        render() {\n          spy('render');\n          const { foo } = this.context;\n          return <div>{foo}</div>;\n        }\n      }\n      Foo.contextTypes = {\n        foo: PropTypes.string,\n      };\n\n      const wrapper = Wrap(\n        <Foo />,\n        {\n          context: { foo: 'bar' },\n        },\n      );\n\n      wrapper.setContext(updatedProps);\n\n      expect(spy.args).to.deep.equal([\n        ['render'],\n        ['componentWillReceiveProps'],\n        ['render'],\n      ]);\n      expect(wrapper.context('foo')).to.equal(updatedProps.foo);\n\n      expect(wrapper.debug()).to.equal(isShallow\n        ? `<div>\n  baz\n</div>`\n        : `<Foo>\n  <div>\n    baz\n  </div>\n</Foo>`);\n    });\n\n    itIf(is('>= 16.3'), 'calls componentWillReceiveProps and UNSAFE_componentWillReceiveProps when context is updated', () => {\n      const spy = sinon.spy();\n      const updatedProps = { foo: 'baz' };\n      class Foo extends React.Component {\n        componentWillReceiveProps() {\n          spy('componentWillReceiveProps');\n        }\n\n        UNSAFE_componentWillReceiveProps() { // eslint-disable-line camelcase\n          spy('UNSAFE_componentWillReceiveProps');\n        }\n\n        render() {\n          spy('render');\n          const { foo } = this.context;\n          return <div>{foo}</div>;\n        }\n      }\n      Foo.contextTypes = {\n        foo: PropTypes.string,\n      };\n\n      const wrapper = Wrap(\n        <Foo />,\n        {\n          context: { foo: 'bar' },\n        },\n      );\n\n      wrapper.setContext(updatedProps);\n\n      expect(spy.args).to.deep.equal([\n        ['render'],\n        ['componentWillReceiveProps'],\n        ['UNSAFE_componentWillReceiveProps'],\n        ['render'],\n      ]);\n      expect(wrapper.context('foo')).to.equal(updatedProps.foo);\n\n      expect(wrapper.debug()).to.equal(isShallow\n        ? `<div>\n  baz\n</div>`\n        : `<Foo>\n  <div>\n    baz\n  </div>\n</Foo>`);\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/setProps.jsx",
    "content": "import React from 'react';\nimport PropTypes from 'prop-types';\nimport { expect } from 'chai';\nimport sinon from 'sinon-sandbox';\n\nimport {\n  sym,\n} from 'enzyme/build/Utils';\n\nimport {\n  describeIf,\n  itIf,\n} from '../../_helpers';\nimport { is } from '../../_helpers/version';\n\nexport default function describeSetProps({\n  Wrap,\n  WrapperName,\n  isShallow,\n  isMount,\n}) {\n  describe('.setProps(newProps[, callback)', () => {\n    class RendersNull extends React.Component {\n      render() {\n        return null;\n      }\n    }\n\n    class Foo extends React.Component {\n      render() {\n        const { id, foo } = this.props;\n        return (\n          <div className={id}>\n            {foo}\n          </div>\n        );\n      }\n    }\n\n    function FooSFC({ id, foo }) {\n      return (\n        <div className={id}>\n          {foo}\n        </div>\n      );\n    }\n\n    class RendersFoo extends React.Component {\n      render() {\n        return (\n          <main>\n            <Foo {...this.props} />\n          </main>\n        );\n      }\n    }\n\n    it('throws on a non-function callback', () => {\n      const wrapper = Wrap(<RendersNull />);\n\n      expect(() => wrapper.setProps({}, undefined)).to.throw();\n      expect(() => wrapper.setProps({}, null)).to.throw();\n      expect(() => wrapper.setProps({}, false)).to.throw();\n      expect(() => wrapper.setProps({}, true)).to.throw();\n      expect(() => wrapper.setProps({}, [])).to.throw();\n      expect(() => wrapper.setProps({}, {})).to.throw();\n    });\n\n    it('throws when not called on the root', () => {\n      const wrapper = Wrap(<RendersFoo id=\"a\" foo=\"b\" />);\n      const child = wrapper.find(Foo);\n      expect(child).to.have.lengthOf(1);\n      expect(() => child.setProps({})).to.throw(\n        Error,\n        `${WrapperName}::setProps() can only be called on the root`,\n      );\n    });\n\n    it('sets props for a component multiple times', () => {\n      const wrapper = Wrap(<Foo id=\"foo\" />);\n      expect(wrapper.find('.foo')).to.have.lengthOf(1);\n      wrapper.setProps({ id: 'bar', foo: 'bla' });\n      expect(wrapper.find('.bar')).to.have.lengthOf(1);\n    });\n\n    // TODO: figure out why these tests are racy in React v15.2, but only in node 4 and for `mount`\n    describeIf(!isMount && !is('^15.2'), 'merging props', () => {\n      it('merges, not replaces, props when rerendering', () => {\n        const wrapper = Wrap(<Foo id=\"foo\" foo=\"bar\" />);\n        const rendered = () => (isShallow ? wrapper : wrapper.children());\n\n        const expectedPreDebug = isShallow\n          ? `\n<div className=\"foo\">\n  bar\n</div>\n        `.trim()\n          : `\n<Foo id=\"foo\" foo=\"bar\">\n  <div className=\"foo\">\n    bar\n  </div>\n</Foo>\n        `.trim();\n        expect(wrapper.debug()).to.equal(expectedPreDebug);\n        expect(rendered().props()).to.eql({\n          className: 'foo',\n          children: 'bar',\n        });\n        expect(wrapper.instance().props).to.eql({\n          id: 'foo',\n          foo: 'bar',\n        });\n\n        wrapper.setProps({ id: 'bar' });\n\n        const expectedPostDebug = isShallow\n          ? `\n<div className=\"bar\">\n  bar\n</div>\n        `.trim()\n          : `\n<Foo id=\"bar\" foo=\"bar\">\n  <div className=\"bar\">\n    bar\n  </div>\n</Foo>\n        `.trim();\n        expect(wrapper.debug()).to.equal(expectedPostDebug);\n        expect(rendered().props()).to.eql({\n          className: 'bar',\n          children: 'bar',\n        });\n        expect(wrapper.instance().props).to.eql({\n          id: 'bar',\n          foo: 'bar',\n        });\n      });\n\n      itIf(is('> 0.13'), 'merges, not replaces, props on SFCs', () => {\n        const wrapper = Wrap(<FooSFC id=\"foo\" foo=\"bar\" />);\n        const rendered = () => (isShallow ? wrapper : wrapper.children());\n\n        const expectedPreDebug = isShallow\n          ? `\n<div className=\"foo\">\n  bar\n</div>\n        `.trim()\n          : `\n<FooSFC id=\"foo\" foo=\"bar\">\n  <div className=\"foo\">\n    bar\n  </div>\n</FooSFC>\n        `.trim();\n        expect(wrapper.debug()).to.equal(expectedPreDebug);\n        expect(rendered().props()).to.eql({\n          className: 'foo',\n          children: 'bar',\n        });\n        if (is('< 16')) {\n          expect(wrapper.instance().props).to.eql({\n            id: 'foo',\n            foo: 'bar',\n          });\n        }\n\n        wrapper.setProps({ id: 'bar' });\n\n        const expectedPostDebug = isShallow\n          ? `\n<div className=\"bar\">\n  bar\n</div>\n        `.trim()\n          : `\n<FooSFC id=\"bar\" foo=\"bar\">\n  <div className=\"bar\">\n    bar\n  </div>\n</FooSFC>\n        `.trim();\n        expect(wrapper.debug()).to.equal(expectedPostDebug);\n        expect(rendered().props()).to.eql({\n          className: 'bar',\n          children: 'bar',\n        });\n        if (is('< 16')) {\n          expect(wrapper.instance().props).to.eql({\n            id: 'bar',\n            foo: 'bar',\n          });\n        }\n      });\n\n      it('merges, not replaces, props when no rerender is needed', () => {\n        class FooNoUpdate extends React.Component {\n          shouldComponentUpdate() {\n            return false;\n          }\n\n          render() {\n            const { id, foo } = this.props;\n            return (\n              <div className={id}>\n                {foo}\n              </div>\n            );\n          }\n        }\n        const wrapper = Wrap(<FooNoUpdate id=\"foo\" foo=\"bar\" />);\n        const rendered = () => (isShallow ? wrapper : wrapper.children());\n\n        const expectedPreDebug = isShallow\n          ? `\n<div className=\"foo\">\n  bar\n</div>\n          `.trim()\n          : `\n<FooNoUpdate id=\"foo\" foo=\"bar\">\n  <div className=\"foo\">\n    bar\n  </div>\n</FooNoUpdate>\n          `.trim();\n        expect(wrapper.debug()).to.equal(expectedPreDebug);\n        expect(rendered().props()).to.eql({\n          className: 'foo',\n          children: 'bar',\n        });\n        expect(wrapper.instance().props).to.eql({\n          id: 'foo',\n          foo: 'bar',\n        });\n\n        wrapper.setProps({ id: 'foo' });\n\n        expect(wrapper.debug()).to.equal(expectedPreDebug);\n        expect(rendered().props()).to.eql({\n          className: 'foo',\n          children: 'bar',\n        });\n        expect(wrapper.instance().props).to.eql({\n          id: 'foo',\n          foo: 'bar',\n        });\n      });\n    });\n\n    it('calls componentWillReceiveProps for new renders', () => {\n      const stateValue = {};\n\n      class FooWithLifecycles extends React.Component {\n        constructor(props) {\n          super(props);\n          this.state = { stateValue };\n        }\n\n        componentWillReceiveProps() {}\n\n        UNSAFE_componentWillReceiveProps() {} // eslint-disable-line camelcase\n\n        render() {\n          const { id } = this.props;\n          const { stateValue: val } = this.state;\n          return (\n            <div className={id}>\n              {String(val)}\n            </div>\n          );\n        }\n      }\n      FooWithLifecycles.contextTypes = {\n        foo() { return null; },\n      };\n      const cWRP = sinon.stub(FooWithLifecycles.prototype, 'componentWillReceiveProps');\n      // eslint-disable-next-line camelcase\n      const U_cWRP = sinon.stub(FooWithLifecycles.prototype, 'UNSAFE_componentWillReceiveProps');\n\n      const nextProps = { id: 'bar', foo: 'bla' };\n      const context = { foo: 'bar' };\n      const wrapper = Wrap(<FooWithLifecycles id=\"foo\" />, { context });\n\n      expect(cWRP).to.have.property('callCount', 0);\n      expect(U_cWRP).to.have.property('callCount', 0);\n\n      wrapper.setProps(nextProps);\n\n      expect(cWRP).to.have.property('callCount', 1);\n      expect(cWRP.calledWith(nextProps, context)).to.equal(true);\n\n      if (is('>= 16.3')) {\n        expect(U_cWRP).to.have.property('callCount', 1);\n        expect(U_cWRP.calledWith(nextProps, context)).to.equal(true);\n      }\n    });\n\n    it('merges newProps with oldProps', () => {\n      class RendersBar extends React.Component {\n        render() {\n          return (\n            <Bar {...this.props} />\n          );\n        }\n      }\n      class Bar extends React.Component {\n        render() {\n          return (\n            <div />\n          );\n        }\n      }\n\n      const wrapper = Wrap(<RendersBar a=\"a\" b=\"b\" />);\n      expect(wrapper.props()).to.eql({\n        a: 'a',\n        b: 'b',\n      });\n\n      wrapper.setProps({ b: 'c', d: 'e' });\n\n      expect(wrapper.props()).to.eql({\n        a: 'a',\n        b: 'c',\n        d: 'e',\n      });\n    });\n\n    it('passes in old context', () => {\n      class HasContextX extends React.Component {\n        render() {\n          const { x } = this.context;\n          return (\n            <div>{x}</div>\n          );\n        }\n      }\n      HasContextX.contextTypes = { x: PropTypes.string };\n\n      const context = { x: 'yolo' };\n      const wrapper = Wrap(<HasContextX x={5} />, { context });\n      expect(wrapper.first('div').text()).to.equal('yolo');\n\n      wrapper.setProps({ x: 5 }); // Just force a re-render\n      expect(wrapper.first('div').text()).to.equal('yolo');\n    });\n\n    it('uses defaultProps if new props includes undefined values', () => {\n      const initialState = { a: 42 };\n      const context = { b: 7 };\n      class HasInitialState extends React.Component {\n        constructor(...args) {\n          super(...args);\n          this.state = initialState;\n        }\n\n        componentWillReceiveProps() {}\n\n        render() {\n          const { className } = this.props;\n          return <div className={className} />;\n        }\n      }\n\n      const cWRP = sinon.stub(HasInitialState.prototype, 'componentWillReceiveProps');\n\n      HasInitialState.defaultProps = {\n        className: 'default-class',\n      };\n      HasInitialState.contextTypes = {\n        b: PropTypes.number,\n      };\n\n      const wrapper = Wrap(<HasInitialState className=\"original\" />, { context });\n\n      // Set undefined in order to use defaultProps if any\n      wrapper.setProps({ className: undefined });\n\n      expect(cWRP).to.have.property('callCount', 1);\n      const [args] = cWRP.args;\n      expect(args).to.eql([\n        { className: HasInitialState.defaultProps.className },\n        context,\n      ]);\n    });\n\n    it('throws if an exception occurs during render', () => {\n      let error;\n      class Trainwreck extends React.Component {\n        render() {\n          const { user } = this.props;\n          try {\n            return (\n              <div>\n                {user.name.givenName}\n              </div>\n            );\n          } catch (e) {\n            error = e;\n            throw e;\n          }\n        }\n      }\n\n      const validUser = {\n        name: {\n          givenName: 'Brian',\n        },\n      };\n\n      const wrapper = Wrap(<Trainwreck user={validUser} />);\n\n      expect(() => wrapper.setProps({ user: { name: {} } })).not.to.throw();\n      expect(() => wrapper.setProps({ user: {} })).to.throw(error);\n    });\n\n    it('calls the callback when setProps has completed', () => {\n      const wrapper = Wrap(<Foo id=\"foo\" />);\n      expect(wrapper.find('.foo')).to.have.lengthOf(1);\n\n      wrapper[sym('__renderer__')].batchedUpdates(() => {\n        wrapper.setProps({ id: 'bar', foo: 'bla' }, () => {\n          expect(wrapper.find('.bar')).to.have.lengthOf(1);\n        });\n      });\n      expect(wrapper.find('.foo')).to.have.lengthOf(0);\n    });\n\n    it('calls componentWillReceiveProps, shouldComponentUpdate, componentWillUpdate, and componentDidUpdate with merged newProps', () => {\n      const spy = sinon.spy();\n\n      class HasLifecycleSpies extends React.Component {\n        componentWillReceiveProps(nextProps) {\n          spy('componentWillReceiveProps', this.props, nextProps);\n        }\n\n        shouldComponentUpdate(nextProps) {\n          spy('shouldComponentUpdate', this.props, nextProps);\n          return true;\n        }\n\n        componentWillUpdate(nextProps) {\n          spy('componentWillUpdate', this.props, nextProps);\n        }\n\n        componentDidUpdate(prevProps) {\n          spy('componentDidUpdate', prevProps, this.props);\n        }\n\n        render() {\n          return (<div />);\n        }\n      }\n\n      const wrapper = Wrap(<HasLifecycleSpies a=\"a\" b=\"b\" />);\n\n      wrapper.setProps({ b: 'c', d: 'e' });\n\n      expect(spy.args).to.deep.equal([\n        [\n          'componentWillReceiveProps',\n          { a: 'a', b: 'b' },\n          { a: 'a', b: 'c', d: 'e' },\n        ],\n        [\n          'shouldComponentUpdate',\n          { a: 'a', b: 'b' },\n          { a: 'a', b: 'c', d: 'e' },\n        ],\n        [\n          'componentWillUpdate',\n          { a: 'a', b: 'b' },\n          { a: 'a', b: 'c', d: 'e' },\n        ],\n        [\n          'componentDidUpdate',\n          { a: 'a', b: 'b' },\n          { a: 'a', b: 'c', d: 'e' },\n        ],\n      ]);\n    });\n\n    describe('setProps does not call componentDidUpdate twice', () => {\n      it('when setState is called in cWRP', () => {\n        class Dummy extends React.Component {\n          constructor(...args) {\n            super(...args);\n\n            this.state = {\n              someState: '',\n            };\n          }\n\n          componentWillReceiveProps({ myProp: someState }) {\n            this.setState({ someState });\n          }\n\n          componentDidUpdate() {}\n\n          render() {\n            const { myProp } = this.props;\n            const { someState } = this.state;\n            return (\n              <div>\n                myProp: {myProp}\n                someState: {someState}\n              </div>\n            );\n          }\n        }\n\n        const spy = sinon.spy(Dummy.prototype, 'componentDidUpdate');\n        const wrapper = Wrap(<Dummy />);\n        expect(spy).to.have.property('callCount', 0);\n        return new Promise((resolve) => {\n          wrapper.setProps({ myProp: 'Prop Value' }, resolve);\n        }).then(() => {\n          expect(spy).to.have.property('callCount', 1);\n        });\n      });\n    });\n\n    describeIf(is('> 0.13'), 'stateless function components (SFCs)', () => {\n      it('sets props for a component multiple times', () => {\n        const wrapper = Wrap(<FooSFC id=\"foo\" />);\n        expect(wrapper.find('.foo')).to.have.lengthOf(1);\n        wrapper.setProps({ id: 'bar', foo: 'bla' });\n        expect(wrapper.find('.bar')).to.have.lengthOf(1);\n      });\n\n      it('merges newProps with oldProps', () => {\n        const RendersBarSFC = (props) => (\n          <BarSFC {...props} />\n        );\n        const BarSFC = () => (\n          <div />\n        );\n\n        const wrapper = Wrap(<RendersBarSFC a=\"a\" b=\"b\" />);\n        expect(wrapper.props()).to.eql({\n          a: 'a',\n          b: 'b',\n        });\n\n        wrapper.setProps({ b: 'c', d: 'e' });\n\n        expect(wrapper.props()).to.eql({\n          a: 'a',\n          b: 'c',\n          d: 'e',\n        });\n      });\n\n      it('passes in old context', () => {\n        const HasContextXSFC = (props, { x }) => (\n          <div>{x}</div>\n        );\n        HasContextXSFC.contextTypes = { x: PropTypes.string };\n\n        const context = { x: 'yolo' };\n        const wrapper = Wrap(<HasContextXSFC x={5} />, { context });\n        expect(wrapper.first('div').text()).to.equal('yolo');\n\n        wrapper.setProps({ x: 5 }); // Just force a re-render\n        expect(wrapper.first('div').text()).to.equal('yolo');\n      });\n\n      it('throws if an exception occurs during render', () => {\n        let error;\n        const Trainwreck = ({ user }) => {\n          try {\n            return (\n              <div>\n                {user.name.givenName}\n              </div>\n            );\n          } catch (e) {\n            error = e;\n            throw e;\n          }\n        };\n\n        const validUser = {\n          name: {\n            givenName: 'Brian',\n          },\n        };\n\n        const wrapper = Wrap(<Trainwreck user={validUser} />);\n\n        expect(() => wrapper.setProps({ user: { name: {} } })).not.to.throw();\n        expect(() => wrapper.setProps({ user: {} })).to.throw(error);\n      });\n    });\n  });\n\n  describe('componentDidUpdate and componentWillReceiveProps with setState', () => {\n    let spy;\n    beforeEach(() => {\n      spy = sinon.spy();\n    });\n\n    class WithoutSetStateInCWRP extends React.Component {\n      constructor(props) {\n        super(props);\n        this.state = { count: 0 };\n      }\n\n      componentWillReceiveProps(nextProps) {\n        spy('componentWillReceiveProps', this.props, nextProps);\n      }\n\n      componentDidUpdate(prevProps, prevState) {\n        spy('componentDidUpdate', prevProps, this.props, prevState, this.state);\n      }\n\n      render() {\n        spy('render', this.props, this.state);\n        const { count } = this.state;\n        return (<div>{count}</div>);\n      }\n    }\n\n    class WithSetStateInCWRP extends React.Component {\n      constructor(props) {\n        super(props);\n        this.state = { count: 0 };\n      }\n\n      componentWillReceiveProps(nextProps) {\n        spy('componentWillReceiveProps', this.props, nextProps);\n        this.setState(({ count }) => ({ count: count + 1 }));\n      }\n\n      componentDidUpdate(prevProps, prevState) {\n        spy('componentDidUpdate', prevProps, this.props, prevState, this.state);\n      }\n\n      render() {\n        spy('render', this.props, this.state);\n        const { count } = this.state;\n        return (<div>{count}</div>);\n      }\n    }\n\n    const oldProps = { a: 'old a', b: 'old b' };\n    const newProps = { a: 'old a', b: 'new b', d: 'new d' };\n    const oldState = { count: 0 };\n    const newState = { count: 1 };\n\n    it('calls componentDidUpdate when componentWillReceiveProps without setting state', () => {\n      const wrapper = Wrap(<WithoutSetStateInCWRP a=\"old a\" b=\"old b\" />);\n      wrapper.setProps({ b: 'new b', d: 'new d' });\n      expect(spy.args).to.deep.equal([\n        ['render', oldProps, oldState],\n        ['componentWillReceiveProps', oldProps, newProps],\n        ['render', newProps, oldState],\n        ['componentDidUpdate', oldProps, newProps, oldState, oldState],\n      ]);\n    });\n\n    // TODO: assertion output is incorrect after calling setState inside of componentWillReceiveProps\n    itIf(!isShallow, 'calls componentDidUpdate when componentWillReceiveProps sets state', () => {\n      const wrapper = Wrap(<WithSetStateInCWRP a=\"old a\" b=\"old b\" />);\n      wrapper.setProps({ b: 'new b', d: 'new d' });\n\n      expect(spy.args).to.deep.equal([\n        ['render', oldProps, oldState],\n        ['componentWillReceiveProps', oldProps, newProps],\n        ['render', newProps, newState],\n        ['componentDidUpdate', oldProps, newProps, oldState, newState],\n      ]);\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/setState.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\nimport sinon from 'sinon-sandbox';\nimport wrap from 'mocha-wrap';\n\nimport getAdapter from 'enzyme/build/getAdapter';\n\nimport {\n  describeIf,\n  itIf,\n} from '../../_helpers';\nimport { is } from '../../_helpers/version';\n\n// some React versions pass undefined as an argument of setState callback.\nconst CALLING_SETSTATE_CALLBACK_WITH_UNDEFINED = is('^15.5');\n\nexport default function describeSetState({\n  Wrap,\n  WrapperName,\n  isShallow,\n}) {\n  describe('.setState(newState[, callback])', () => {\n    class HasIDState extends React.Component {\n      constructor(props) {\n        super(props);\n        this.state = { id: 'foo' };\n      }\n\n      componentDidUpdate() {}\n\n      setBadState() {\n        this.setState({}, 1);\n      }\n\n      render() {\n        const { id } = this.state;\n        return (\n          <div className={id} />\n        );\n      }\n    }\n\n    class HasMountedState extends React.Component {\n      constructor(props) {\n        super(props);\n        this.state = { mounted: false };\n      }\n\n      componentDidMount() {\n        this.setState({ mounted: true });\n      }\n\n      render() {\n        const { mounted } = this.state;\n        return <div>{mounted ? 'a' : 'b'}</div>;\n      }\n    }\n\n    class RendersNull extends React.Component {\n      render() {\n        return null;\n      }\n    }\n\n    it('throws on a non-function callback', () => {\n      const wrapper = Wrap(<RendersNull />);\n\n      expect(() => wrapper.setState({}, undefined)).to.throw();\n      expect(() => wrapper.setState({}, null)).to.throw();\n      expect(() => wrapper.setState({}, false)).to.throw();\n      expect(() => wrapper.setState({}, true)).to.throw();\n      expect(() => wrapper.setState({}, [])).to.throw();\n      expect(() => wrapper.setState({}, {})).to.throw();\n    });\n\n    it('sets the state of the root node', () => {\n      const wrapper = Wrap(<HasIDState />);\n      expect(wrapper.find('.foo')).to.have.lengthOf(1);\n      wrapper.setState({ id: 'bar' });\n      expect(wrapper.find('.bar')).to.have.lengthOf(1);\n    });\n\n    it('allows setState inside of componentDidMount', () => {\n      const wrapper = Wrap(<HasMountedState />);\n      expect(wrapper.find('div').text()).to.equal('a');\n    });\n\n    it('calls the callback when setState has completed', () => {\n      const wrapper = Wrap(<HasIDState />);\n      expect(wrapper.state()).to.eql({ id: 'foo' });\n      return new Promise((resolve) => {\n        wrapper.setState({ id: 'bar' }, function callback(...args) {\n          expect(wrapper.state()).to.eql({ id: 'bar' });\n          expect(this).to.equal(wrapper.instance());\n          expect(this.state).to.eql({ id: 'bar' });\n          expect(wrapper.find('div').prop('className')).to.equal('bar');\n          expect(args).to.eql(CALLING_SETSTATE_CALLBACK_WITH_UNDEFINED ? [undefined] : []);\n          resolve();\n        });\n      });\n    });\n\n    wrap()\n      .withOverride(() => getAdapter(), 'invokeSetStateCallback', () => {})\n      .describe('adapter lacks `invokeSetStateCallback`', () => {\n        it('calls the callback when setState has completed', () => {\n          const wrapper = Wrap(<HasIDState />);\n          expect(wrapper.state()).to.eql({ id: 'foo' });\n          return new Promise((resolve) => {\n            wrapper.setState({ id: 'bar' }, function callback(...args) {\n              expect(wrapper.state()).to.eql({ id: 'bar' });\n              expect(this).to.equal(wrapper.instance());\n              expect(this.state).to.eql({ id: 'bar' });\n              expect(wrapper.find('div').prop('className')).to.equal('bar');\n              expect(args).to.eql([]);\n              resolve();\n            });\n          });\n        });\n      });\n\n    it('prevents the update if nextState is null or undefined', () => {\n      const wrapper = Wrap(<HasIDState />);\n      const spy = sinon.spy(wrapper.instance(), 'componentDidUpdate');\n      const callback = sinon.spy();\n      wrapper.setState(() => ({ id: 'bar' }), callback);\n      expect(spy).to.have.property('callCount', 1);\n      expect(callback).to.have.property('callCount', 1);\n\n      wrapper.setState(() => null, callback);\n      expect(spy).to.have.property('callCount', is('>= 16') ? 1 : 2);\n      expect(callback).to.have.property('callCount', 2);\n\n      wrapper.setState(() => undefined, callback);\n      expect(spy).to.have.property('callCount', is('>= 16') ? 1 : 3);\n      expect(callback).to.have.property('callCount', 3);\n    });\n\n    itIf(is('>= 16'), 'prevents an infinite loop if nextState is null or undefined from setState in CDU', () => {\n      let payload;\n      const stub = sinon.stub(HasIDState.prototype, 'componentDidUpdate')\n        .callsFake(function componentDidUpdate() { this.setState(() => payload); });\n\n      const wrapper = Wrap(<HasIDState />);\n\n      wrapper.setState(() => ({ id: 'bar' }));\n      expect(stub).to.have.property('callCount', 1);\n\n      payload = null;\n      wrapper.setState(() => ({ id: 'bar' }));\n      expect(stub).to.have.property('callCount', 2);\n    });\n\n    describe('does not call componentWillReceiveProps after setState is called', () => {\n      it('does not call componentWillReceiveProps upon rerender', () => {\n        class A extends React.Component {\n          constructor(props) {\n            super(props);\n\n            this.state = { a: 0 };\n          }\n\n          componentWillReceiveProps() {\n            this.setState({ a: 1 });\n          }\n\n          render() {\n            const { a } = this.state;\n            return (<div>{a}</div>);\n          }\n        }\n        const spy = sinon.spy(A.prototype, 'componentWillReceiveProps');\n\n        const wrapper = Wrap(<A />, { disableLifecycleMethods: true });\n\n        wrapper.setState({ a: 2 });\n        expect(wrapper.state('a')).to.equal(2);\n\n        expect(spy).to.have.property('callCount', 0);\n        wrapper.setProps({});\n        expect(spy).to.have.property('callCount', 1);\n        expect(wrapper.state('a')).to.equal(1);\n\n        return new Promise((resolve) => {\n          wrapper.setState({ a: 3 }, resolve);\n        }).then(() => {\n          expect(spy).to.have.property('callCount', 1);\n          expect(wrapper.state('a')).to.equal(3);\n        });\n      });\n\n      it('does not call componentWillReceiveProps with multiple keys in props', () => {\n        class B extends React.Component {\n          constructor(props) {\n            super(props);\n            this.state = { a: 0, b: 1 };\n          }\n\n          componentWillReceiveProps() {\n            this.setState({ b: 0, a: 1 });\n          }\n\n          render() {\n            const { a, b } = this.state;\n            return (\n              <div>\n                {a + b}\n              </div>\n            );\n          }\n        }\n        const spy = sinon.spy(B.prototype, 'componentWillReceiveProps');\n\n        const wrapper = Wrap(<B />, { disableLifecycleMethods: true });\n\n        wrapper.setState({ a: 2 });\n        expect(wrapper.state('a')).to.equal(2);\n        expect(wrapper.state('b')).to.equal(1);\n\n        expect(spy).to.have.property('callCount', 0);\n        wrapper.setProps({});\n        expect(spy).to.have.property('callCount', 1);\n        expect(wrapper.state('a')).to.equal(1);\n\n        return Promise.all([\n          new Promise((resolve) => { wrapper.setState({ b: 5 }, resolve); }),\n          new Promise((resolve) => { wrapper.setState({ a: 10 }, resolve); }),\n        ]).then(() => {\n          expect(spy).to.have.property('callCount', 1);\n          expect(wrapper.state('b')).to.equal(5);\n          expect(wrapper.state('a')).to.equal(10);\n        });\n      });\n    });\n\n    describeIf(is('> 0.13'), 'stateless function components (SFCs)', () => {\n      it('throws when trying to access state', () => {\n        const Foo = () => (\n          <div>abc</div>\n        );\n\n        const wrapper = Wrap(<Foo />);\n\n        expect(() => wrapper.state()).to.throw(\n          Error,\n          `${WrapperName}::state() can only be called on class components`,\n        );\n      });\n\n      it('throws when trying to set state', () => {\n        const Foo = () => (\n          <div>abc</div>\n        );\n\n        const wrapper = Wrap(<Foo />);\n\n        expect(() => wrapper.setState({ a: 1 })).to.throw(\n          Error,\n          `${WrapperName}::setState() can only be called on class components`,\n        );\n      });\n    });\n\n    it('throws an error when cb is not a function', () => {\n      const wrapper = Wrap(<HasIDState />);\n      expect(wrapper.state()).to.eql({ id: 'foo' });\n      expect(() => wrapper.setState({ id: 'bar' }, 1)).to.throw(Error);\n      expect(() => wrapper.instance().setBadState()).to.throw(Error);\n    });\n\n    it('does not throw with a null/undefined callback', () => {\n      class Foo extends React.Component {\n        constructor() {\n          super();\n\n          this.state = {};\n        }\n\n        setStateWithNullishCallback() {\n          this.setState({}, null);\n          this.setState({}, undefined);\n        }\n\n        render() {\n          return null;\n        }\n      }\n\n      const wrapper = Wrap(<Foo />);\n      expect(() => wrapper.instance().setStateWithNullishCallback()).not.to.throw();\n    });\n\n    it('preserves the receiver', () => {\n      class Comp extends React.Component {\n        constructor(...args) {\n          super(...args);\n\n          this.state = {\n            key: '',\n          };\n\n          this.instanceFunction = () => this.setState(() => ({ key: 'value' }));\n        }\n\n        componentDidMount() {\n          this.instanceFunction();\n        }\n\n        render() {\n          const { key } = this.state;\n          // FIXME: is this right?\n          return key ? null : null;\n        }\n      }\n\n      expect(Wrap(<Comp />).debug()).to.equal(isShallow ? '' : '<Comp />');\n    });\n\n    describe('child components', () => {\n      class Child extends React.Component {\n        constructor(...args) {\n          super(...args);\n          this.state = { state: 'a' };\n        }\n\n        render() {\n          const { prop } = this.props;\n          const { state } = this.state;\n          return (\n            <div>\n              {prop} - {state}\n            </div>\n          );\n        }\n      }\n\n      class Parent extends React.Component {\n        constructor(...args) {\n          super(...args);\n          this.state = { childProp: 1 };\n        }\n\n        render() {\n          const { childProp } = this.state;\n          return <Child prop={childProp} />;\n        }\n      }\n\n      it('sets the state of a stateful root', () => {\n        const wrapper = Wrap(<Parent />);\n\n        const expectedDebug = isShallow\n          ? '<Child prop={1} />'\n          : `<Parent>\n  <Child prop={1}>\n    <div>\n      1\n       -${' '}\n      a\n    </div>\n  </Child>\n</Parent>`;\n        expect(wrapper.debug()).to.equal(expectedDebug);\n\n        return new Promise((resolve) => {\n          wrapper.setState({ childProp: 2 }, () => {\n            const expectedPostDebug = isShallow\n              ? '<Child prop={2} />'\n              : `<Parent>\n  <Child prop={2}>\n    <div>\n      2\n       -${' '}\n      a\n    </div>\n  </Child>\n</Parent>`;\n            expect(wrapper.debug()).to.equal(expectedPostDebug);\n            resolve();\n          });\n        });\n      });\n\n      itIf(isShallow, 'can not set the state of the stateful child of a stateful root', () => {\n        const wrapper = Wrap(<Parent />);\n\n        expect(wrapper.debug()).to.equal('<Child prop={1} />');\n\n        const child = wrapper.find(Child);\n        expect(() => child.setState({ state: 'b' })).to.throw(\n          Error,\n          `${WrapperName}::setState() can only be called on the root`,\n        );\n      });\n\n      itIf(!isShallow, 'sets the state of the stateful child of a stateful root', () => {\n        const wrapper = Wrap(<Parent />);\n\n        expect(wrapper.text().trim()).to.equal('1 - a');\n\n        const child = wrapper.find(Child);\n        return new Promise((resolve) => {\n          child.setState({ state: 'b' }, () => {\n            expect(wrapper.text().trim()).to.equal('1 - b');\n            resolve();\n          });\n        });\n      });\n\n      describeIf(is('> 0.13'), 'stateless function components (SFCs)', () => {\n        function SFC(props) {\n          return <Parent {...props} />;\n        }\n\n        itIf(isShallow, 'can not set the state of the stateful child of a stateless root', () => {\n          const wrapper = Wrap(<SFC />);\n\n          expect(wrapper.text().trim()).to.equal('<Parent />');\n\n          const child = wrapper.find(Child);\n          expect(() => child.setState({ state: 'b' })).to.throw(\n            Error,\n            `${WrapperName}::setState() can only be called on the root`,\n          );\n        });\n\n        itIf(!isShallow, 'sets the state of the stateful child of a stateless root', () => {\n          const wrapper = Wrap(<SFC />);\n\n          expect(wrapper.text().trim()).to.equal('1 - a');\n\n          const child = wrapper.find(Child);\n          return new Promise((resolve) => {\n            child.setState({ state: 'b' }, () => {\n              expect(wrapper.text().trim()).to.equal('1 - b');\n              resolve();\n            });\n          });\n        });\n      });\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/simulate.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\nimport sinon from 'sinon-sandbox';\n\nimport {\n  describeIf,\n  itIf,\n} from '../../_helpers';\nimport {\n  is,\n  REACT16,\n} from '../../_helpers/version';\n\nimport {\n  memo,\n  useEffect,\n  useState,\n} from '../../_helpers/react-compat';\n\nexport default function describeSimulate({\n  Wrap,\n  WrapperName,\n  isShallow,\n  isMount,\n}) {\n  // The shallow renderer in react 16 does not yet support batched updates. When it does,\n  // we should be able to go un-skip all of the tests that are skipped with this flag.\n  // FIXME: fix this\n  const BATCHING = !isShallow || !REACT16;\n\n  describe('.simulate(eventName, data)', () => {\n    it('simulates events', () => {\n      class ClickCounter extends React.Component {\n        constructor(props) {\n          super(props);\n          this.state = { count: 0 };\n          this.incrementCount = this.incrementCount.bind(this);\n        }\n\n        incrementCount() {\n          this.setState(({ count }) => ({ count: count + 1 }));\n        }\n\n        render() {\n          const { count } = this.state;\n          return (\n            <a\n              data-count={count}\n              onClick={this.incrementCount}\n            >\n              foo\n            </a>\n          );\n        }\n      }\n\n      const wrapper = Wrap(<ClickCounter />);\n\n      expect(wrapper.find('a').prop('data-count')).to.have.equal(0);\n      wrapper.simulate('click');\n      expect(wrapper.find('a').prop('data-count')).to.have.equal(1);\n    });\n\n    itIf(!isShallow, 'throws a descriptive error for invalid events', () => {\n      const wrapper = Wrap(<div>foo</div>);\n      expect(() => wrapper.simulate('invalidEvent')).to.throw(\n        TypeError,\n        `${WrapperName}::simulate() event 'invalidEvent' does not exist`,\n      );\n    });\n\n    // FIXME: figure out why this hangs forever\n    itIf(!isMount, 'passes in event data', () => {\n      const spy = sinon.spy();\n      class Clicker extends React.Component {\n        render() {\n          return (<a onClick={spy}>foo</a>);\n        }\n      }\n\n      const wrapper = Wrap(<Clicker />);\n      const a = {};\n      const b = {};\n\n      wrapper.simulate('click', a, b);\n      expect(spy).to.have.property('callCount', 1);\n      expect(spy.args[0][0]).to.equal(a);\n      if (!isMount) {\n        expect(spy.args[0][1]).to.equal(b);\n      }\n    });\n\n    describeIf(is('> 0.13'), 'stateless function components (SFCs)', () => {\n      const ClickerSFC = ({ onClick }) => (<a onClick={onClick}>foo</a>);\n\n      // FIXME: figure out why this fails on 15.0 and 15.1\n      itIf(!is('~15.0 || ~15.1'), 'simulates events', () => {\n        const spy = sinon.spy();\n        const wrapper = Wrap(<ClickerSFC onClick={spy} />);\n\n        expect(spy).to.have.property('callCount', 0);\n        wrapper.find('a').simulate('click');\n        expect(spy).to.have.property('callCount', 1);\n      });\n\n      // FIXME: figure out why this hangs forever\n      itIf(!isMount, 'passes in event data', () => {\n        const spy = sinon.spy();\n        const wrapper = Wrap(<ClickerSFC onClick={spy} />);\n        const a = {};\n        const b = {};\n\n        wrapper.simulate('click', a, b);\n        expect(spy).to.have.property('callCount', 1);\n        expect(spy.args[0][0]).to.equal(a);\n        if (!isMount) {\n          expect(spy.args[0][1]).to.equal(b);\n        }\n      });\n    });\n\n    describe('Normalizing JS event names', () => {\n      it('converts lowercase events to React camelcase', () => {\n        const spy = sinon.spy();\n        const clickSpy = sinon.spy();\n        class Clicks extends React.Component {\n          render() {\n            return (<a onClick={clickSpy} onDoubleClick={spy}>foo</a>);\n          }\n        }\n\n        const wrapper = Wrap(<Clicks />);\n\n        wrapper.simulate('dblclick');\n        expect(spy).to.have.property('callCount', 1);\n\n        wrapper.simulate('click');\n        expect(clickSpy).to.have.property('callCount', 1);\n      });\n\n      describeIf(is('> 0.13'), 'normalizing mouseenter', () => {\n        it('converts lowercase events to React camelcase', () => {\n          const spy = sinon.spy();\n          class Mousetrap extends React.Component {\n            render() {\n              return (\n                <a onMouseEnter={spy}>foo</a>\n              );\n            }\n          }\n\n          const wrapper = Wrap(<Mousetrap />);\n\n          wrapper.simulate('mouseenter');\n          expect(spy).to.have.property('callCount', 1);\n        });\n\n        it('converts lowercase events to React camelcase in SFCs', () => {\n          const spy = sinon.spy();\n          const MousetrapSFC = () => (\n            <a onMouseEnter={spy}>foo</a>\n          );\n\n          const wrapper = Wrap(<MousetrapSFC />);\n\n          wrapper.simulate('mouseenter');\n          expect(spy).to.have.property('callCount', 1);\n        });\n      });\n\n      describeIf(is('>= 15'), 'animation events', () => {\n        it('converts lowercase events to React camelcase', () => {\n          const spy = sinon.spy();\n          class Animator extends React.Component {\n            render() {\n              return (\n                <a onAnimationIteration={spy}>foo</a>\n              );\n            }\n          }\n\n          const wrapper = Wrap(<Animator />);\n\n          wrapper.simulate('animationiteration');\n          expect(spy).to.have.property('callCount', 1);\n        });\n\n        it('converts lowercase events to React camelcase in stateless components', () => {\n          const spy = sinon.spy();\n          const AnimatorSFC = () => (<a onAnimationIteration={spy}>foo</a>);\n\n          const wrapper = Wrap(<AnimatorSFC />);\n\n          wrapper.simulate('animationiteration');\n          expect(spy).to.have.property('callCount', 1);\n        });\n      });\n\n      describeIf(is('>= 16.4'), 'pointer events', () => {\n        it('converts lowercase events to React camelcase', () => {\n          const spy = sinon.spy();\n          class Fingertrap extends React.Component {\n            render() {\n              return (<a onGotPointerCapture={spy}>foo</a>);\n            }\n          }\n\n          const wrapper = Wrap(<Fingertrap />);\n\n          wrapper.simulate('gotpointercapture');\n          expect(spy).to.have.property('callCount', 1);\n        });\n\n        it('converts lowercase events to React camelcase in stateless components', () => {\n          const spy = sinon.spy();\n          const FingertrapSFC = () => (<a onGotPointerCapture={spy}>foo</a>);\n\n          const wrapper = Wrap(<FingertrapSFC />);\n\n          wrapper.simulate('gotpointercapture');\n          expect(spy).to.have.property('callCount', 1);\n        });\n      });\n    });\n\n    itIf(BATCHING, 'has batched updates', () => {\n      let renderCount = 0;\n      class Multistate extends React.Component {\n        constructor(props) {\n          super(props);\n          this.state = { count: 0 };\n          this.onClick = this.onClick.bind(this);\n        }\n\n        onClick() {\n          // eslint-disable-next-line react/destructuring-assignment, react/no-access-state-in-setstate\n          this.setState({ count: this.state.count + 1 });\n          // eslint-disable-next-line react/destructuring-assignment, react/no-access-state-in-setstate\n          this.setState({ count: this.state.count + 1 });\n        }\n\n        render() {\n          renderCount += 1;\n          const { count } = this.state;\n          return (\n            <a onClick={this.onClick}>{count}</a>\n          );\n        }\n      }\n\n      const wrapper = Wrap(<Multistate />);\n      wrapper.simulate('click');\n      expect(wrapper.text()).to.equal('1');\n      expect(renderCount).to.equal(2);\n    });\n\n    // FIXME: figure out why this fails on 15.0 and 15.1\n    itIf(!is('~15.0 || ~15.1'), 'chains', () => {\n      const wrapper = Wrap(<div />);\n      expect(wrapper.simulate('click')).to.equal(wrapper);\n    });\n\n    describe('works with .parent()/.parents()/.closest()', () => {\n      let onClick;\n      let wrapper;\n      beforeEach(() => {\n        onClick = sinon.stub();\n        wrapper = Wrap((\n          <div className=\"div-elem\">\n            <span className=\"parent-elem\" onClick={onClick}>\n              <span className=\"child-elem\">click me</span>\n            </span>\n          </div>\n        ));\n      });\n\n      // FIXME: figure out why this fails on 15.0 and 15.1\n      itIf(!isShallow && !is('~15.0 || ~15.1'), 'child should fire onClick', () => {\n        wrapper.find('.child-elem').simulate('click');\n        expect(onClick).to.have.property('callCount', 1);\n      });\n\n      // FIXME: figure out why this fails on 15.0 and 15.1\n      itIf(!is('~15.0 || ~15.1'), 'parents should fire onClick', () => {\n        wrapper.find('.child-elem').parents('.parent-elem').simulate('click');\n        expect(onClick).to.have.property('callCount', 1);\n      });\n\n      // FIXME: figure out why this fails on 15.0 and 15.1\n      itIf(!is('~15.0 || ~15.1'), 'closest should fire onClick', () => {\n        wrapper.find('.child-elem').closest('.parent-elem').simulate('click');\n        expect(onClick).to.have.property('callCount', 1);\n      });\n\n      // FIXME: figure out why this breaks in `mount` with \"Cannot read property '__reactInternalInstance$ukkwkcm5yvc' of null\"\n      itIf(!isMount, 'parent should fire onClick', () => {\n        wrapper.find('.child-elem').parent().simulate('click');\n        expect(onClick).to.have.property('callCount', 1);\n      });\n    });\n\n    describeIf(is('>= 16.6'), 'React.memo', () => {\n      itIf(isMount, 'can simulate events', () => {\n        function Child({ onClick }) {\n          return <button onClick={onClick} type=\"button\" />;\n        }\n        const MemoizedChild = memo(Child);\n\n        function Parent(props) {\n          const { onClick } = props;\n\n          return <MemoizedChild onClick={onClick} />;\n        }\n\n        const handleClick = sinon.spy();\n        const wrapper = Wrap(<Parent onClick={handleClick} />);\n\n        wrapper.find(MemoizedChild).props().onClick();\n        expect(handleClick).to.have.property('callCount', 1);\n        wrapper.find(MemoizedChild).simulate('click');\n        expect(handleClick).to.have.property('callCount', 2);\n        wrapper.find(MemoizedChild).props().onClick();\n        expect(handleClick).to.have.property('callCount', 3);\n      });\n    });\n\n    describeIf(is('>= 16.8'), 'hooks', () => {\n      // TODO: fix for shallow when useEffect works for shallow\n      itIf(!isShallow, 'works with `useEffect` simulated events', () => {\n        const effectSpy = sinon.spy();\n        function ComponentUsingEffectHook() {\n          useEffect(effectSpy);\n          const [counter, setCounter] = useState(0);\n\n          return (\n            <button type=\"button\" onClick={() => setCounter(counter + 1)}>{counter}</button>\n          );\n        }\n        const wrapper = Wrap(<ComponentUsingEffectHook />);\n\n        const button = wrapper.find('button');\n        expect(button.text()).to.equal('0');\n        expect(effectSpy).to.have.property('callCount', 1);\n\n        button.simulate('click');\n\n        expect(button.text()).to.equal('1');\n        expect(effectSpy).to.have.property('callCount', 2);\n      });\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/simulateError.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\nimport sinon from 'sinon-sandbox';\nimport wrap from 'mocha-wrap';\n\nimport getAdapter from 'enzyme/build/getAdapter';\n\nimport {\n  sym,\n} from 'enzyme/build/Utils';\n\nimport {\n  itIf,\n} from '../../_helpers';\n\nexport default function describeSimulateError({\n  Wrap,\n  WrapRendered,\n  isShallow,\n}) {\n  describe('.simulateError(error)', () => {\n    class Div extends React.Component {\n      render() {\n        const { children } = this.props;\n        return <div>{children}</div>;\n      }\n    }\n\n    class Spans extends React.Component {\n      render() {\n        return <div><span /><span /></div>;\n      }\n    }\n\n    class Nested extends React.Component {\n      render() {\n        return <Div><Spans /></Div>;\n      }\n    }\n\n    it('throws on host elements', () => {\n      const wrapper = WrapRendered(<Div />);\n      expect(wrapper.is('div')).to.equal(true);\n      expect(() => wrapper.simulateError()).to.throw();\n    });\n\n    it('throws on \"not one\" node', () => {\n      const wrapper = Wrap(<Spans />);\n\n      const spans = wrapper.find('span');\n      expect(spans).to.have.lengthOf(2);\n      expect(() => spans.simulateError()).to.throw();\n\n      const navs = wrapper.find('nav');\n      expect(navs).to.have.lengthOf(0);\n      expect(() => navs.simulateError()).to.throw();\n    });\n\n    it('throws when the renderer lacks `simulateError`', () => {\n      const wrapper = Wrap(<Nested />);\n      delete wrapper[sym('__renderer__')].simulateError;\n      expect(() => wrapper.simulateError()).to.throw();\n      try {\n        wrapper.simulateError();\n      } catch (e) {\n        expect(e).not.to.equal(undefined);\n      }\n    });\n\n    wrap()\n      .withOverride(() => getAdapter(), 'createRenderer', () => {\n        const adapter = getAdapter();\n        const original = adapter.createRenderer;\n        return function () {\n          // eslint-disable-next-line prefer-rest-params\n          const renderer = original.apply(this, arguments);\n          delete renderer.simulateError;\n          return renderer;\n        };\n      })\n      .it('throws when the adapter does not support simulateError', () => {\n        const wrapper = WrapRendered(<Nested />);\n        expect(() => wrapper.simulateError()).to.throw(\n          TypeError,\n          'your adapter does not support `simulateError`. Try upgrading it!',\n        );\n      });\n\n    context('calls through to renderer’s `simulateError`', () => {\n      let hierarchy;\n      beforeEach(() => {\n        const wrapper = WrapRendered(<Nested />);\n        const stub = sinon.stub().callsFake((_, __, e) => { throw e; });\n        wrapper[sym('__renderer__')].simulateError = stub;\n        const error = new Error('hi');\n        expect(() => wrapper.simulateError(error)).to.throw(error);\n        expect(stub).to.have.property('callCount', 1);\n\n        const [args] = stub.args;\n        expect(args).to.have.lengthOf(3);\n        const [h, rootNode, actualError] = args;\n        expect(actualError).to.equal(error);\n        expect(rootNode).to.eql(wrapper[sym('__root__')].getNodeInternal());\n\n        hierarchy = h;\n        expect(hierarchy).not.to.have.lengthOf(0);\n\n        const [divNode] = hierarchy;\n        expect(divNode).to.contain.keys({\n          type: Div,\n          nodeType: 'class',\n          rendered: {\n            type: Spans,\n            nodeType: 'class',\n            rendered: null,\n          },\n        });\n      });\n\n      itIf(isShallow, 'calls through to renderer’s `simulateError`', () => {\n        expect(hierarchy).to.have.lengthOf(1);\n      });\n\n      itIf(!isShallow, 'calls through to renderer’s `simulateError`', () => {\n        expect(hierarchy).to.have.lengthOf(2);\n        const [, spanNode] = hierarchy;\n        expect(spanNode).to.contain.keys({\n          type: Spans,\n          nodeType: 'class',\n          rendered: null,\n        });\n      });\n    });\n\n    it('returns the wrapper', () => {\n      const wrapper = WrapRendered(<Nested />);\n      wrapper[sym('__renderer__')].simulateError = sinon.stub();\n      expect(wrapper.simulateError()).to.equal(wrapper);\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/single.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\n\nimport {\n  sym,\n} from 'enzyme/build/Utils';\n\nexport default function describeSingle({\n  Wrap,\n}) {\n  describe('#single()', () => {\n    it('throws if run on multiple nodes', () => {\n      const wrapper = Wrap(<div><i /><i /></div>).children();\n      expect(wrapper).to.have.lengthOf(2);\n      expect(() => wrapper.single('name!')).to.throw(\n        Error,\n        'Method “name!” is meant to be run on 1 node. 2 found instead.',\n      );\n    });\n\n    it('throws if run on zero nodes', () => {\n      const wrapper = Wrap(<div />).children();\n      expect(wrapper).to.have.lengthOf(0);\n      expect(() => wrapper.single('name!')).to.throw(\n        Error,\n        'Method “name!” is meant to be run on 1 node. 0 found instead.',\n      );\n    });\n\n    it('works with a name', () => {\n      const wrapper = Wrap(<div />);\n      wrapper.single('foo', (node) => {\n        expect(node).to.equal(wrapper[sym('__node__')]);\n      });\n    });\n\n    it('works without a name', () => {\n      const wrapper = Wrap(<div />);\n      wrapper.single((node) => {\n        expect(node).to.equal(wrapper[sym('__node__')]);\n      });\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/slice.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\n\nexport default function describeSlice({\n  Wrap,\n}) {\n  describe('.slice([begin[, end]])', () => {\n    it('returns an identical wrapper if no params are set', () => {\n      const wrapper = Wrap((\n        <div>\n          <div className=\"foo bax\" />\n          <div className=\"foo bar\" />\n          <div className=\"foo baz\" />\n        </div>\n      ));\n      const slice = wrapper.find('.foo').slice();\n      expect(slice).to.have.lengthOf(3);\n      expect(slice.at(0).hasClass('bax')).to.equal(true);\n      expect(slice.at(1).hasClass('bar')).to.equal(true);\n      expect(slice.at(2).hasClass('baz')).to.equal(true);\n    });\n\n    it('returns a new wrapper if begin is set', () => {\n      const wrapper = Wrap((\n        <div>\n          <div className=\"foo bax\" />\n          <div className=\"foo bar\" />\n          <div className=\"foo baz\" />\n        </div>\n      ));\n      const slice = wrapper.find('.foo').slice(1);\n      expect(slice).to.have.lengthOf(2);\n      expect(slice.at(0).hasClass('bar')).to.equal(true);\n      expect(slice.at(1).hasClass('baz')).to.equal(true);\n    });\n\n    it('returns a new wrapper if begin and end are set', () => {\n      const wrapper = Wrap((\n        <div>\n          <div className=\"foo bax\" />\n          <div className=\"foo bar\" />\n          <div className=\"foo baz\" />\n        </div>\n      ));\n      const slice = wrapper.find('.foo').slice(1, 2);\n      expect(slice).to.have.lengthOf(1);\n      expect(slice.at(0).hasClass('bar')).to.equal(true);\n    });\n\n    it('returns a new wrapper if begin and end are set (negative)', () => {\n      const wrapper = Wrap((\n        <div>\n          <div className=\"foo bax\" />\n          <div className=\"foo bar\" />\n          <div className=\"foo baz\" />\n        </div>\n      ));\n      const slice = wrapper.find('.foo').slice(-2, -1);\n      expect(slice).to.have.lengthOf(1);\n      expect(slice.at(0).hasClass('bar')).to.equal(true);\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/some.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\n\nexport default function describeSome({\n  Wrap,\n  WrapperName,\n}) {\n  describe('.some(selector)', () => {\n    it('returns if a node matches a selector', () => {\n      const wrapper = Wrap((\n        <div>\n          <div className=\"foo qoo\" />\n          <div className=\"foo boo\" />\n          <div className=\"foo hoo\" />\n        </div>\n      ));\n      const foo = wrapper.find('.foo');\n      expect(foo.some('.qoo')).to.equal(true);\n      expect(foo.some('.foo')).to.equal(true);\n      expect(foo.some('.bar')).to.equal(false);\n    });\n\n    it('throws if called on root', () => {\n      const wrapper = Wrap((\n        <div>\n          <div className=\"foo\" />\n        </div>\n      ));\n      expect(() => wrapper.some('.foo')).to.throw(\n        Error,\n        `${WrapperName}::some() can not be called on the root`,\n      );\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/someWhere.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\n\nexport default function describeSomeWhere({\n  Wrap,\n}) {\n  describe('.someWhere(predicate)', () => {\n    it('returns if a node matches a predicate', () => {\n      const wrapper = Wrap((\n        <div>\n          <div className=\"foo qoo\" />\n          <div className=\"foo boo\" />\n          <div className=\"foo hoo\" />\n        </div>\n      ));\n      const foo = wrapper.find('.foo');\n      expect(foo.someWhere((n) => n.hasClass('qoo'))).to.equal(true);\n      expect(foo.someWhere((n) => n.hasClass('foo'))).to.equal(true);\n      expect(foo.someWhere((n) => n.hasClass('bar'))).to.equal(false);\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/state.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\n\nimport {\n  describeIf,\n  itIf,\n} from '../../_helpers';\nimport { is } from '../../_helpers/version';\n\nimport {\n  createPortal,\n} from '../../_helpers/react-compat';\n\nexport default function describeState({\n  Wrap,\n  WrapperName,\n  isShallow,\n  makeDOMElement,\n}) {\n  describe('.state([name])', () => {\n    class HasFooState extends React.Component {\n      constructor(props) {\n        super(props);\n        this.state = { foo: 'foo' };\n      }\n\n      render() {\n        const { foo } = this.state;\n        return <div>{foo}</div>;\n      }\n    }\n\n    it('returns the state object', () => {\n      const wrapper = Wrap(<HasFooState />);\n      expect(wrapper.state()).to.eql({ foo: 'foo' });\n    });\n\n    it('returns the current state after state transitions', () => {\n      const wrapper = Wrap(<HasFooState />);\n      wrapper.setState({ foo: 'bar' });\n      expect(wrapper.state()).to.eql({ foo: 'bar' });\n    });\n\n    it('allows a state property name be passed in as an argument', () => {\n      const wrapper = Wrap(<HasFooState />);\n      expect(wrapper.state('foo')).to.equal('foo');\n    });\n\n    it('throws on host nodes', () => {\n      const wrapper = Wrap(<div><span /></div>);\n\n      expect(() => wrapper.state()).to.throw(Error, `${WrapperName}::state() can only be called on class components`);\n    });\n\n    itIf(is('>= 16'), 'throws on Portals', () => {\n      const containerDiv = makeDOMElement();\n      const portal = createPortal(\n        <div />,\n        containerDiv,\n      );\n\n      const wrapper = Wrap(<div>{portal}</div>);\n      expect(() => wrapper.state()).to.throw(Error, `${WrapperName}::state() can only be called on class components`);\n    });\n\n    describeIf(is('> 0.13'), 'stateless function components (SFCs)', () => {\n      it('throws on SFCs', () => {\n        function FooSFC() {\n          return <div />;\n        }\n\n        const wrapper = Wrap(<FooSFC />);\n        expect(() => wrapper.state()).to.throw(Error, `${WrapperName}::state() can only be called on class components`);\n      });\n    });\n\n    describe('child components', () => {\n      class Child extends React.Component {\n        constructor(...args) {\n          super(...args);\n          this.state = { state: 'a' };\n        }\n\n        render() {\n          const { prop } = this.props;\n          const { state } = this.state;\n          return (\n            <div>\n              {prop} - {state}\n            </div>\n          );\n        }\n      }\n\n      class Parent extends React.Component {\n        constructor(...args) {\n          super(...args);\n          this.state = { childProp: 1 };\n        }\n\n        render() {\n          const { childProp } = this.state;\n          return <Child prop={childProp} />;\n        }\n      }\n\n      it('gets the state of a stateful parent', () => {\n        const wrapper = Wrap(<Parent />);\n\n        expect(wrapper.state()).to.eql({ childProp: 1 });\n      });\n\n      itIf(isShallow, 'can not get the state of the stateful child of a stateful root', () => {\n        const wrapper = Wrap(<Parent />);\n\n        const child = wrapper.find(Child);\n        expect(() => child.state()).to.throw(Error, `${WrapperName}::state() can only be called on the root`);\n      });\n\n      itIf(!isShallow, 'gets the state of the stateful child of a stateful root', () => {\n        const wrapper = Wrap(<Parent />);\n\n        const child = wrapper.find(Child);\n        expect(child.state()).to.eql({ state: 'a' });\n      });\n\n      describeIf(is('> 0.13'), 'stateless function components (SFCs)', () => {\n        function StatelessParent(props) {\n          return <Child {...props} />;\n        }\n\n        itIf(isShallow, 'can not get the state of the stateful child of a stateless root', () => {\n          const wrapper = Wrap(<StatelessParent />);\n\n          const child = wrapper.find(Child);\n          expect(() => child.state()).to.throw(Error, `${WrapperName}::state() can only be called on the root`);\n        });\n\n        itIf(!isShallow, 'gets the state of the stateful child of a stateless root', () => {\n          const wrapper = Wrap(<StatelessParent />);\n\n          const child = wrapper.find(Child);\n          expect(child.state()).to.eql({ state: 'a' });\n        });\n      });\n    });\n\n    it('throws when called on a wrapper of multiple nodes', () => {\n      const wrapper = Wrap((\n        <div>\n          <span />\n          <span />\n          <span />\n        </div>\n      ));\n      const spans = wrapper.find('span');\n      expect(spans).to.have.lengthOf(3);\n      expect(() => spans.state()).to.throw(\n        Error,\n        isShallow\n          ? 'ShallowWrapper::state() can only be called on the root'\n          : `${WrapperName}::getNode() can only be called when wrapping one node`,\n      );\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/tap.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\nimport sinon from 'sinon-sandbox';\n\nexport default function describeTap({\n  Wrap,\n}) {\n  describe('.tap()', () => {\n    it('calls the passed function with current Wrapper and returns itself', () => {\n      const spy = sinon.spy();\n      const wrapper = Wrap((\n        <ul>\n          <li>xxx</li>\n          <li>yyy</li>\n          <li>zzz</li>\n        </ul>\n      )).find('li');\n      const result = wrapper.tap(spy);\n      expect(spy.calledWith(wrapper)).to.equal(true);\n      expect(result).to.equal(wrapper);\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/text.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\n\nimport { render } from 'enzyme';\n\nimport {\n  describeIf,\n  itIf,\n} from '../../_helpers';\nimport { is } from '../../_helpers/version';\n\nimport {\n  Fragment,\n  memo,\n} from '../../_helpers/react-compat';\n\nexport default function describeText({\n  Wrap,\n  isShallow,\n}) {\n  describe('.text()', () => {\n    const matchesRender = function matchesRender(node) {\n      const actual = Wrap(node).text();\n      const expected = render(node).text();\n      expect(expected).to.equal(actual);\n    };\n\n    it('handles simple text nodes', () => {\n      const wrapper = Wrap((\n        <div>some text</div>\n      ));\n      expect(wrapper.text()).to.equal('some text');\n    });\n\n    it('handles nodes with mapped children', () => {\n      class Foo extends React.Component {\n        render() {\n          const { items } = this.props;\n          return (\n            <div>\n              {items.map((x) => x)}\n            </div>\n          );\n        }\n      }\n      matchesRender(<Foo items={['abc', 'def', 'hij']} />);\n      matchesRender((\n        <Foo\n          items={[\n            <i key={1}>abc</i>,\n            <i key={2}>def</i>,\n            <i key={3}>hij</i>,\n          ]}\n        />\n      ));\n    });\n\n    context('composite components', () => {\n      class Foo extends React.Component {\n        render() { return <div>foo</div>; }\n      }\n\n      itIf(isShallow, 'renders dumbly', () => {\n        const wrapper = Wrap((\n          <div>\n            <Foo />\n            <div>test</div>\n          </div>\n        ));\n        expect(wrapper.text()).to.equal('<Foo />test');\n      });\n\n      // FIXME: figure out why this fails on 15.0 and 15.1\n      itIf(!isShallow && !is('~15.0 || ~15.1'), 'renders smartly', () => {\n        const wrapper = Wrap((\n          <div>\n            <Foo />\n            <div>test</div>\n          </div>\n        ));\n        expect(wrapper.text()).to.equal('footest');\n      });\n    });\n\n    it('handles html entities', () => {\n      matchesRender(<div>&gt;</div>);\n    });\n\n    it('handles spaces the same between shallow and mount', () => {\n      /* eslint no-multiple-empty-lines: 0 */\n      const Space = (\n        <div>\n          <div> test  </div>\n          <div>Hello\n\n\n            World\n          </div>\n          <div>Hello World</div>\n          <div>Hello\n            World\n          </div>\n          <div>Hello     World</div>\n          <div>&nbsp;</div>\n          <div>&nbsp;&nbsp;</div>\n        </div>\n      );\n\n      const wrapper = Wrap(Space);\n\n      expect(wrapper.text()).to.equal(' test  Hello WorldHello WorldHello WorldHello     World   ');\n    });\n\n    it('handles non-breaking spaces correctly', () => {\n      class Foo extends React.Component {\n        render() {\n          return (\n            <div>\n              &nbsp; &nbsp;\n            </div>\n          );\n        }\n      }\n      const wrapper = Wrap(<Foo />);\n      const charCodes = wrapper.text().split('').map((x) => x.charCodeAt(0));\n      expect(charCodes).to.eql([\n        0x00a0, // non-breaking space\n        0x20, // normal space\n        0x00a0, // non-breaking space\n      ]);\n    });\n\n    describeIf(is('> 0.13'), 'stateless function components (SFCs)', () => {\n      it('handles nodes with mapped children', () => {\n        const Foo = ({ items }) => (\n          <div>\n            {items.map((x) => x)}\n          </div>\n        );\n        matchesRender(<Foo items={['abc', 'def', 'hij']} />);\n        matchesRender((\n          <Foo\n            items={[\n              <i key={1}>abc</i>,\n              <i key={2}>def</i>,\n              <i key={3}>hij</i>,\n            ]}\n          />\n        ));\n      });\n\n      const FooSFC = () => (\n        <div>foo</div>\n      );\n\n      itIf(isShallow, 'renders composite components dumbly', () => {\n        const wrapper = Wrap((\n          <div>\n            <FooSFC />\n            <div>test</div>\n          </div>\n        ));\n        expect(wrapper.text()).to.equal('<FooSFC />test');\n      });\n\n      // FIXME: figure out why this fails on 15.0 and 15.1\n      itIf(!isShallow && !is('~15.0 || ~15.1'), 'renders composite components smartly', () => {\n        const wrapper = Wrap((\n          <div>\n            <FooSFC />\n            <div>test</div>\n          </div>\n        ));\n        expect(wrapper.text()).to.equal('footest');\n      });\n    });\n\n    it('renders falsy numbers', () => {\n      [0, -0, '0', NaN].forEach((x) => {\n        const wrapper = Wrap(<div>{x}</div>);\n        expect(wrapper.text()).to.equal(String(x));\n      });\n    });\n\n    describe('text content with curly braces', () => {\n      it('handles literal strings', () => {\n        const wrapper = Wrap(<div><div>{'{}'}</div></div>);\n        expect(wrapper.text()).to.equal('{}');\n      });\n\n      // FIXME: fix for shallow\n      // FIXME: figure out why this fails on 15.0 and 15.1\n      itIf(!isShallow && !is('~15.0 || ~15.1'), 'handles innerHTML', () => {\n        const wrapper = Wrap((\n          <div>\n            <div dangerouslySetInnerHTML={{ __html: '{ some text }' }} />\n          </div>\n        ));\n        expect(wrapper.text()).to.equal('{ some text }');\n      });\n    });\n\n    describeIf(is('> 16.2'), 'fragments', () => {\n      class FragmentClassExample extends React.Component {\n        render() {\n          return (\n            <Fragment>\n              <div>Foo</div>\n              <div>Bar</div>\n            </Fragment>\n          );\n        }\n      }\n\n      const FragmentConstExample = () => (\n        <Fragment>\n          <div><span>Foo</span></div>\n          <div><span>Bar</span></div>\n        </Fragment>\n      );\n\n      it('correctly gets text for both children for class', () => {\n        const classWrapper = Wrap(<FragmentClassExample />);\n        expect(classWrapper.text()).to.include('Foo');\n        expect(classWrapper.text()).to.include('Bar');\n      });\n\n      it('correctly gets text for both children for const', () => {\n        const constWrapper = Wrap(<FragmentConstExample />);\n        expect(constWrapper.text()).to.include('Foo');\n        expect(constWrapper.text()).to.include('Bar');\n      });\n\n      it('works with a nested component', () => {\n        const Title = ({ children }) => <span>{children}</span>;\n        const Foobar = () => (\n          <Fragment>\n            <Title>Foo</Title>\n            <Fragment>Bar</Fragment>\n          </Fragment>\n        );\n\n        const wrapper = Wrap(<Foobar />);\n        const text = wrapper.text();\n        const expectedDebug = isShallow\n          ? `<Fragment>\n  <Title>\n    Foo\n  </Title>\n  Bar\n</Fragment>`\n          : `<Foobar>\n  <Title>\n    <span>\n      Foo\n    </span>\n  </Title>\n  Bar\n</Foobar>`;\n        expect(wrapper.debug()).to.equal(expectedDebug);\n        expect(text).to.equal(isShallow ? '<Title />Bar' : 'FooBar');\n      });\n    });\n\n    describeIf(is('> 16.6'), 'React.memo', () => {\n      class Dumb extends React.Component {\n        render() {\n          const { number } = this.props;\n          return <span>It’s number {String(number)}</span>;\n        }\n      }\n\n      function DumbSFC({ number }) {\n        return <span>It’s number {String(number)}</span>;\n      }\n\n      function areEqual(props, nextProps) {\n        return nextProps.number > 10 && nextProps.number < 20;\n      }\n\n      const DumbMemo = memo && memo(Dumb, areEqual);\n      const DumbMemoNoCompare = memo && memo(Dumb);\n      const DumbSFCMemo = memo && memo(DumbSFC, areEqual);\n      const DumbSFCMemoNoCompare = memo && memo(DumbSFC);\n\n      it('<Dumb /> - should always re-render', () => {\n        const tree = Wrap(<Dumb number={5} />);\n\n        expect(tree.text()).to.equal('It’s number 5');\n\n        tree.setProps({ number: 15 });\n\n        expect(tree.text()).to.equal('It’s number 15');\n      });\n\n      it('<DumbMemo /> - should only re-render when number is between 10 and 20', () => {\n        const tree = Wrap(<DumbMemo number={5} />);\n\n        expect(tree.text()).to.equal('It’s number 5');\n\n        tree.setProps({ number: 15 });\n\n        expect(tree.text()).to.equal('It’s number 5');\n      });\n\n      it('<DumbSFC /> - should always re-render', () => {\n        const tree = Wrap(<DumbSFC number={5} />);\n\n        expect(tree.text()).to.equal('It’s number 5');\n\n        tree.setProps({ number: 15 });\n\n        expect(tree.text()).to.equal('It’s number 15');\n      });\n\n      it('<DumbSFCMemo /> - should only re-render when number is between 10 and 20', () => {\n        const tree = Wrap(<DumbSFCMemo number={5} />);\n\n        expect(tree.text()).to.equal('It’s number 5');\n\n        tree.setProps({ number: 15 });\n\n        expect(tree.text()).to.equal('It’s number 5');\n      });\n\n      it('<DumbMemoNoCompare /> - should only re-render when prop identity changes', () => {\n        const obj = { toString() { return 5; } };\n\n        const tree = Wrap(<DumbMemoNoCompare number={obj} />);\n\n        expect(tree.text()).to.equal('It’s number 5');\n\n        obj.toString = () => 15;\n        tree.setProps({ number: obj });\n\n        expect(tree.text()).to.equal('It’s number 5');\n\n        tree.setProps({ number: { toString() { return 15; } } });\n\n        expect(tree.text()).to.equal('It’s number 15');\n      });\n\n      it('<DumbSFCMemoNoCompare /> - should only re-render when prop identity changes', () => {\n        const obj = { toString() { return 5; } };\n\n        const tree = Wrap(<DumbSFCMemoNoCompare number={obj} />);\n\n        expect(tree.text()).to.equal('It’s number 5');\n\n        obj.toString = () => 15;\n        tree.setProps({ number: obj });\n\n        expect(tree.text()).to.equal('It’s number 5');\n\n        tree.setProps({ number: { toString() { return 15; } } });\n\n        expect(tree.text()).to.equal('It’s number 15');\n      });\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/unmount.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\nimport sinon from 'sinon-sandbox';\n\nimport {\n  itIf,\n} from '../../_helpers';\n\nexport default function describeUnmount({\n  isShallow,\n  Wrap,\n  WrapRendered,\n}) {\n  describe('.unmount()', () => {\n    class WillUnmount extends React.Component {\n      componentWillUnmount() {}\n\n      render() {\n        const { id } = this.props;\n        return (\n          <div className={id}>\n            <span>\n              {id}\n            </span>\n          </div>\n        );\n      }\n    }\n\n    it('calls componentWillUnmount()', () => {\n      const spy = sinon.spy(WillUnmount.prototype, 'componentWillUnmount');\n      const wrapper = Wrap(<WillUnmount id=\"foo\" />);\n      expect(spy).to.have.property('callCount', 0);\n\n      wrapper.unmount();\n\n      expect(spy).to.have.property('callCount', 1);\n      const [args] = spy.args;\n      expect(args).to.eql([]);\n    });\n\n    itIf(!isShallow, 'throws on non-root', () => {\n      const wrapper = WrapRendered(<WillUnmount id=\"foo\" />);\n      const span = wrapper.find('span');\n      expect(span).to.have.lengthOf(1);\n      expect(() => span.unmount()).to.throw(Error);\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/shared/methods/wrap.jsx",
    "content": "import React from 'react';\nimport { expect } from 'chai';\n\nimport {\n  itIf,\n} from '../../_helpers';\n\nexport default function describeWrap({\n  Wrap,\n  Wrapper,\n  isShallow,\n  isMount,\n}) {\n  describe('.wrap()', () => {\n    class Foo extends React.Component {\n      render() {\n        return (\n          <div>\n            <a href=\"#1\">Hello</a>\n            <a href=\"#2\">Hello</a>\n          </div>\n        );\n      }\n    }\n\n    it('returns itself when it is already a Wrapper', () => {\n      const wrapperDiv = Wrap(<div />);\n      const wrapperFoo = Wrap(<Foo />);\n\n      expect(wrapperDiv.wrap(wrapperFoo)).to.equal(wrapperFoo);\n      expect(wrapperFoo.wrap(wrapperDiv)).to.equal(wrapperDiv);\n    });\n\n    itIf(isShallow, 'wraps when it is not already a Wrapper', () => {\n      const wrapper = Wrap(<Foo />);\n      const el = wrapper.find('a').at(1);\n      const wrappedEl = wrapper.wrap(el.getElement());\n      expect(wrappedEl).to.be.instanceOf(Wrapper);\n      expect(wrappedEl.props()).to.eql(el.props());\n\n      expect(wrappedEl.shallow().debug()).to.equal(el.debug());\n    });\n\n    itIf(isMount, 'wraps when it is not already a Wrapper', () => {\n      const wrapper = Wrap(<Foo />);\n      const el = wrapper.find('a').at(1);\n      const wrappedEl = wrapper.wrap(el.getElement());\n      expect(wrappedEl).to.be.instanceOf(Wrapper);\n      expect(wrappedEl.props()).to.eql(el.props());\n\n      // FIXME: enable this instead of that:\n      // expect(wrappedEl.mount().debug()).to.equal(el.debug());\n      expect(wrappedEl.debug()).to.equal('<a href=\"#2\" />');\n    });\n  });\n}\n"
  },
  {
    "path": "packages/enzyme-test-suite/test/staticRender-spec.jsx",
    "content": "import React from 'react';\nimport PropTypes from 'prop-types';\nimport { expect } from 'chai';\nimport { render } from 'enzyme';\nimport renderEntry from 'enzyme/render';\nimport { fakeDynamicImport } from 'enzyme-adapter-utils';\n\nimport './_helpers/setupAdapters';\nimport { describeWithDOM, describeIf } from './_helpers';\nimport { is } from './_helpers/version';\nimport { createClass, lazy } from './_helpers/react-compat';\n\ndescribeWithDOM('render', () => {\n  describe('top level entry points', () => {\n    expect(renderEntry).to.equal(render);\n  });\n\n  describeIf(is('> 0.13'), 'context', () => {\n    it('can pass in context', () => {\n      const SimpleComponent = createClass({\n        contextTypes: {\n          name: PropTypes.string,\n        },\n        render() {\n          const { name } = this.context;\n          return <div>{name}</div>;\n        },\n      });\n\n      const context = { name: 'foo' };\n      const wrapper = render(<SimpleComponent />, { context });\n      expect(wrapper).to.have.lengthOf(1);\n\n      expect(wrapper.is('div')).to.equal(true);\n      expect(wrapper.text()).to.equal('foo');\n\n      expect(String(wrapper)).to.equal('<div>foo</div>');\n    });\n\n    it('can pass context to the child of mounted component', () => {\n      const SimpleComponent = createClass({\n        contextTypes: {\n          name: PropTypes.string,\n        },\n        render() {\n          const { name } = this.context;\n          return <span>{name}</span>;\n        },\n      });\n      const ComplexComponent = createClass({\n        render() {\n          return <div><SimpleComponent /></div>;\n        },\n      });\n\n      const childContextTypes = {\n        name: PropTypes.string.isRequired,\n      };\n      const context = { name: 'foo' };\n      const wrapper = render(<ComplexComponent />, { context, childContextTypes });\n      expect(wrapper).to.have.lengthOf(1);\n\n      expect(wrapper.is('div')).to.equal(true);\n\n      const children = wrapper.children();\n      expect(children).to.have.lengthOf(1);\n      expect(children.is('span')).to.equal(true);\n\n      expect(children.first().text()).to.equal('foo');\n\n      expect(String(wrapper)).to.equal('<div><span>foo</span></div>');\n      expect(String(children)).to.equal('<span>foo</span>');\n    });\n\n    it('does not throw if context is passed in but contextTypes is missing', () => {\n      const SimpleComponent = createClass({\n        render() {\n          const { name } = this.context;\n          return <div>{name}</div>;\n        },\n      });\n\n      const context = { name: 'foo' };\n      expect(() => render(<SimpleComponent />, { context })).not.to.throw();\n    });\n  });\n\n  describe('rendering non-elements', () => {\n    it('can render strings', () => {\n      const StringComponent = createClass({\n        render() {\n          return 'foo';\n        },\n      });\n\n      const getWrapper = (options) => render(<StringComponent />, options);\n      if (is('>= 16')) {\n        expect(getWrapper).to.not.throw();\n\n        const wrapper = getWrapper();\n        expect(wrapper.text()).to.equal('foo');\n        expect(wrapper.html()).to.equal('foo');\n        expect(String(wrapper)).to.equal('foo');\n        expect(wrapper).to.have.lengthOf(1);\n      } else {\n        expect(getWrapper).to.throw();\n      }\n    });\n\n    it('can render numbers', () => {\n      const NumberComponent = createClass({\n        render() {\n          return 42;\n        },\n      });\n\n      const getWrapper = (options) => render(<NumberComponent />, options);\n      if (is('>= 16')) {\n        expect(getWrapper).to.not.throw();\n\n        const wrapper = getWrapper();\n        expect(wrapper.text()).to.equal('42');\n        expect(wrapper.html()).to.equal('42');\n        expect(String(wrapper)).to.equal('42');\n        expect(wrapper).to.have.lengthOf(1);\n      } else {\n        expect(getWrapper).to.throw();\n      }\n    });\n  });\n\n  describeIf(is('> 16.6'), 'suspense fallback option', () => {\n    it('throws if options.suspenseFallback is specified', () => {\n      class DynamicComponent extends React.Component {\n        render() {\n          return (\n            <div>Dynamic Component</div>\n          );\n        }\n      }\n      const LazyComponent = lazy(fakeDynamicImport(DynamicComponent));\n      expect(() => render(<LazyComponent />, { suspenseFallback: false })).to.throw();\n    });\n  });\n});\n"
  },
  {
    "path": "since.js",
    "content": "'use strict';\n\nconst fs = require('fs');\nconst path = require('path');\nconst { spawnSync } = require('child_process');\nconst glob = require('glob-gitignore');\n\nconst packagesDir = path.join(__dirname, 'packages');\nconst docsDir = path.join(__dirname, 'docs');\n\nconst packages = (process.argv.length > 2 ? [process.argv[2]] : glob.sync('*', { cwd: packagesDir }))\n  .map((name) => JSON.parse(fs.readFileSync(path.join(packagesDir, name, 'package.json'))))\n  .filter((x) => !x.private && x.name !== 'enzyme-example-mocha');\n\npackages.forEach((pkg) => {\n  const tag = `${pkg.name === 'docs' ? 'enzyme' : pkg.name}@${pkg.version}`;\n  const dir = path.join(packagesDir, pkg.name);\n  const logArgs = ['--no-pager', 'log', '--oneline', '--grep=\\\\[\\\\(dev \\\\)\\\\?deps\\\\]', '--invert-grep', `${tag}..HEAD`, dir, ':!**/.eslintrc'].concat(pkg.name === 'enzyme' ? docsDir : []);\n  const log = spawnSync('git', logArgs, { stdio: 'pipe' });\n  if (log.stdout.length > 0 || log.stderr.length > 0) {\n    console.log(tag);\n    spawnSync('git', logArgs, { stdio: 'inherit' });\n    console.log('\\n');\n  }\n});\n"
  },
  {
    "path": "tea.yaml",
    "content": "# https://tea.xyz/what-is-this-file\n---\nversion: 1.0.0\ncodeOwners:\n  - '0xcaA2C51DEC43C2ce6174F8a3cBD258BFeECFd5B6'\nquorum: 1\n\n"
  },
  {
    "path": "test/mocha.opts",
    "content": "--require ./packages/enzyme/withDom.js ./packages/enzyme-test-suite/build/_helpers/setupAdapters.js ./packages/enzyme-test-suite/build/_helpers/beforeEach.js\n"
  }
]