Showing preview only (1,403K chars total). Download the full file or copy to clipboard to get everything.
Repository: enzymejs/enzyme
Branch: master
Commit: 61e1b47c4bdc
Files: 403
Total size: 1.3 MB
Directory structure:
gitextract_ky2tl6yi/
├── .babelrc
├── .eslintrc
├── .github/
│ ├── FUNDING.yml
│ ├── ISSUE_TEMPLATE/
│ │ ├── Bug_report.md
│ │ └── Feature_request.md
│ └── workflows/
│ ├── node-pretest.yml
│ ├── node.yml
│ ├── rebase.yml
│ └── require-allow-edits.yml
├── .gitignore
├── .lgtm
├── .npmrc
├── .nycrc
├── CHANGELOG.md
├── CONTRIBUTING.md
├── INTHEWILD.md
├── LICENSE.md
├── MAINTAINERS
├── README.md
├── SUMMARY.md
├── book.json
├── docs/
│ ├── GLOSSARY.md
│ ├── api/
│ │ ├── README.md
│ │ ├── ReactWrapper/
│ │ │ ├── at.md
│ │ │ ├── childAt.md
│ │ │ ├── children.md
│ │ │ ├── closest.md
│ │ │ ├── contains.md
│ │ │ ├── containsAllMatchingElements.md
│ │ │ ├── containsAnyMatchingElements.md
│ │ │ ├── containsMatchingElement.md
│ │ │ ├── context.md
│ │ │ ├── debug.md
│ │ │ ├── detach.md
│ │ │ ├── equals.md
│ │ │ ├── every.md
│ │ │ ├── everyWhere.md
│ │ │ ├── exists.md
│ │ │ ├── filter.md
│ │ │ ├── filterWhere.md
│ │ │ ├── find.md
│ │ │ ├── findWhere.md
│ │ │ ├── first.md
│ │ │ ├── forEach.md
│ │ │ ├── get.md
│ │ │ ├── getDOMNode.md
│ │ │ ├── getElement.md
│ │ │ ├── getElements.md
│ │ │ ├── getWrappingComponent.md
│ │ │ ├── hasClass.md
│ │ │ ├── hostNodes.md
│ │ │ ├── html.md
│ │ │ ├── instance.md
│ │ │ ├── invoke.md
│ │ │ ├── is.md
│ │ │ ├── isEmpty.md
│ │ │ ├── isEmptyRender.md
│ │ │ ├── key.md
│ │ │ ├── last.md
│ │ │ ├── length.md
│ │ │ ├── map.md
│ │ │ ├── matchesElement.md
│ │ │ ├── mount.md
│ │ │ ├── name.md
│ │ │ ├── not.md
│ │ │ ├── parent.md
│ │ │ ├── parents.md
│ │ │ ├── prop.md
│ │ │ ├── props.md
│ │ │ ├── reduce.md
│ │ │ ├── reduceRight.md
│ │ │ ├── ref.md
│ │ │ ├── render.md
│ │ │ ├── renderProp.md
│ │ │ ├── setContext.md
│ │ │ ├── setProps.md
│ │ │ ├── setState.md
│ │ │ ├── simulate.md
│ │ │ ├── simulateError.md
│ │ │ ├── slice.md
│ │ │ ├── some.md
│ │ │ ├── someWhere.md
│ │ │ ├── state.md
│ │ │ ├── tap.md
│ │ │ ├── text.md
│ │ │ ├── type.md
│ │ │ ├── unmount.md
│ │ │ └── update.md
│ │ ├── ShallowWrapper/
│ │ │ ├── at.md
│ │ │ ├── childAt.md
│ │ │ ├── children.md
│ │ │ ├── closest.md
│ │ │ ├── contains.md
│ │ │ ├── containsAllMatchingElements.md
│ │ │ ├── containsAnyMatchingElements.md
│ │ │ ├── containsMatchingElement.md
│ │ │ ├── context.md
│ │ │ ├── debug.md
│ │ │ ├── dive.md
│ │ │ ├── equals.md
│ │ │ ├── every.md
│ │ │ ├── everyWhere.md
│ │ │ ├── exists.md
│ │ │ ├── filter.md
│ │ │ ├── filterWhere.md
│ │ │ ├── find.md
│ │ │ ├── findWhere.md
│ │ │ ├── first.md
│ │ │ ├── forEach.md
│ │ │ ├── get.md
│ │ │ ├── getElement.md
│ │ │ ├── getElements.md
│ │ │ ├── getWrappingComponent.md
│ │ │ ├── hasClass.md
│ │ │ ├── hostNodes.md
│ │ │ ├── html.md
│ │ │ ├── instance.md
│ │ │ ├── invoke.md
│ │ │ ├── is.md
│ │ │ ├── isEmpty.md
│ │ │ ├── isEmptyRender.md
│ │ │ ├── key.md
│ │ │ ├── last.md
│ │ │ ├── length.md
│ │ │ ├── map.md
│ │ │ ├── matchesElement.md
│ │ │ ├── name.md
│ │ │ ├── not.md
│ │ │ ├── parent.md
│ │ │ ├── parents.md
│ │ │ ├── prop.md
│ │ │ ├── props.md
│ │ │ ├── reduce.md
│ │ │ ├── reduceRight.md
│ │ │ ├── render.md
│ │ │ ├── renderProp.md
│ │ │ ├── setContext.md
│ │ │ ├── setProps.md
│ │ │ ├── setState.md
│ │ │ ├── shallow.md
│ │ │ ├── simulate.md
│ │ │ ├── simulateError.md
│ │ │ ├── slice.md
│ │ │ ├── some.md
│ │ │ ├── someWhere.md
│ │ │ ├── state.md
│ │ │ ├── tap.md
│ │ │ ├── text.md
│ │ │ ├── type.md
│ │ │ ├── unmount.md
│ │ │ └── update.md
│ │ ├── mount.md
│ │ ├── render.md
│ │ ├── selector.md
│ │ └── shallow.md
│ ├── common-issues.md
│ ├── future.md
│ ├── guides/
│ │ ├── browserify.md
│ │ ├── jest.md
│ │ ├── jsdom.md
│ │ ├── karma.md
│ │ ├── lab.md
│ │ ├── migration-from-2-to-3.md
│ │ ├── mocha.md
│ │ ├── react-native.md
│ │ ├── systemjs.md
│ │ ├── tape-ava.md
│ │ └── webpack.md
│ ├── guides.md
│ └── installation/
│ ├── README.md
│ ├── react-013.md
│ ├── react-014.md
│ ├── react-15.md
│ └── react-16.md
├── env.js
├── install-relevant-react.sh
├── karma.conf.js
├── lerna.json
├── package.json
├── packages/
│ ├── enzyme/
│ │ ├── .babelrc
│ │ ├── .eslintrc
│ │ ├── ReactWrapper.js
│ │ ├── ShallowWrapper.js
│ │ ├── mount.js
│ │ ├── package.json
│ │ ├── render.js
│ │ ├── shallow.js
│ │ ├── src/
│ │ │ ├── Debug.js
│ │ │ ├── EnzymeAdapter.js
│ │ │ ├── RSTTraversal.js
│ │ │ ├── ReactWrapper.js
│ │ │ ├── ShallowWrapper.js
│ │ │ ├── Utils.js
│ │ │ ├── configuration.js
│ │ │ ├── getAdapter.js
│ │ │ ├── index.js
│ │ │ ├── mount.js
│ │ │ ├── render.js
│ │ │ ├── selectors.js
│ │ │ ├── shallow.js
│ │ │ └── validateAdapter.js
│ │ └── withDom.js
│ ├── enzyme-adapter-react-13/
│ │ ├── .babelrc
│ │ ├── .eslintrc
│ │ ├── package.json
│ │ └── src/
│ │ ├── ReactThirteenAdapter.js
│ │ ├── ReactThirteenElementToTree.js
│ │ ├── ReactThirteenMapNativeEventNames.js
│ │ └── index.js
│ ├── enzyme-adapter-react-14/
│ │ ├── .babelrc
│ │ ├── .eslintrc
│ │ ├── package.json
│ │ └── src/
│ │ ├── ReactFourteenAdapter.js
│ │ └── index.js
│ ├── enzyme-adapter-react-15/
│ │ ├── .babelrc
│ │ ├── .eslintrc
│ │ ├── package.json
│ │ └── src/
│ │ ├── ReactFifteenAdapter.js
│ │ └── index.js
│ ├── enzyme-adapter-react-15.4/
│ │ ├── .babelrc
│ │ ├── .eslintrc
│ │ ├── package.json
│ │ └── src/
│ │ ├── ReactFifteenFourAdapter.js
│ │ └── index.js
│ ├── enzyme-adapter-react-16/
│ │ ├── .babelrc
│ │ ├── .eslintrc
│ │ ├── package.json
│ │ └── src/
│ │ ├── ReactSixteenAdapter.js
│ │ ├── detectFiberTags.js
│ │ ├── findCurrentFiberUsingSlowPath.js
│ │ └── index.js
│ ├── enzyme-adapter-react-16.1/
│ │ ├── .babelrc
│ │ ├── .eslintignore
│ │ ├── .eslintrc
│ │ ├── .npmrc
│ │ ├── package.json
│ │ └── src/
│ │ ├── ReactSixteenOneAdapter.js
│ │ └── index.js
│ ├── enzyme-adapter-react-16.2/
│ │ ├── .babelrc
│ │ ├── .eslintignore
│ │ ├── .eslintrc
│ │ ├── .npmrc
│ │ ├── package.json
│ │ └── src/
│ │ ├── ReactSixteenTwoAdapter.js
│ │ └── index.js
│ ├── enzyme-adapter-react-16.3/
│ │ ├── .babelrc
│ │ ├── .eslintignore
│ │ ├── .eslintrc
│ │ ├── .npmrc
│ │ ├── package.json
│ │ └── src/
│ │ ├── ReactSixteenThreeAdapter.js
│ │ └── index.js
│ ├── enzyme-adapter-react-helper/
│ │ ├── .babelrc
│ │ ├── .eslintrc
│ │ ├── package.json
│ │ └── src/
│ │ ├── enzyme-adapter-react-install.js
│ │ ├── getAdapterForReactVersion.js
│ │ ├── ifReact.js
│ │ ├── index.js
│ │ └── safeSFC.jsx
│ ├── enzyme-adapter-utils/
│ │ ├── .babelrc
│ │ ├── .eslintrc
│ │ ├── package.json
│ │ └── src/
│ │ ├── RootFinder.jsx
│ │ ├── Utils.js
│ │ ├── createMountWrapper.jsx
│ │ ├── createRenderWrapper.jsx
│ │ ├── index.js
│ │ └── wrapWithSimpleWrapper.jsx
│ ├── enzyme-example-mocha/
│ │ ├── .babelrc
│ │ ├── .eslintrc
│ │ ├── .gitignore
│ │ ├── .nycrc
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── package.json
│ │ ├── src/
│ │ │ ├── Foo.jsx
│ │ │ └── Foo.spec.jsx
│ │ └── test/
│ │ ├── .setup.js
│ │ └── mocha.opts
│ ├── enzyme-shallow-equal/
│ │ ├── .babelrc
│ │ ├── .eslintrc
│ │ ├── README.md
│ │ ├── package.json
│ │ └── src/
│ │ └── index.js
│ └── enzyme-test-suite/
│ ├── .babelrc
│ ├── .eslintrc
│ ├── package.json
│ └── test/
│ ├── Adapter-spec.jsx
│ ├── Debug-spec.jsx
│ ├── RSTTraversal-spec.jsx
│ ├── ReactWrapper-spec.jsx
│ ├── ShallowWrapper-spec.jsx
│ ├── Utils-spec.jsx
│ ├── _helpers/
│ │ ├── adapter.js
│ │ ├── beforeEach.js
│ │ ├── describeHooks.js
│ │ ├── describeLifecycles.js
│ │ ├── describeMethods.js
│ │ ├── getLoadedLazyComponent.js
│ │ ├── index.jsx
│ │ ├── react-compat.js
│ │ ├── realArrowFunction.js
│ │ ├── selectors.js
│ │ ├── setupAdapters.js
│ │ ├── untranspiledArrowFunction.js
│ │ ├── untranspiledSloppyReturnThis.js
│ │ └── version.js
│ ├── adapter-utils-spec.jsx
│ ├── enzyme-adapter-react-install-spec.js
│ ├── enzyme-shallow-equal-spec.js
│ ├── selector-spec.jsx
│ ├── shared/
│ │ ├── hooks/
│ │ │ ├── _hook.template
│ │ │ ├── custom.jsx
│ │ │ ├── useCallback.jsx
│ │ │ ├── useContext.jsx
│ │ │ ├── useDebugValue.jsx
│ │ │ ├── useEffect.jsx
│ │ │ ├── useImperativeHandle.jsx
│ │ │ ├── useLayoutEffect.jsx
│ │ │ ├── useMemo.jsx
│ │ │ ├── useReducer.jsx
│ │ │ ├── useRef.jsx
│ │ │ └── useState.jsx
│ │ ├── lifecycles/
│ │ │ ├── componentDidCatch.jsx
│ │ │ ├── componentDidMount.jsx
│ │ │ ├── componentDidUpdate.jsx
│ │ │ ├── componentWillUnmount.jsx
│ │ │ ├── getDerivedStateFromError.jsx
│ │ │ ├── getDerivedStateFromProps.jsx
│ │ │ ├── getSnapshotBeforeUpdate.jsx
│ │ │ └── misc.jsx
│ │ └── methods/
│ │ ├── @@iterator.jsx
│ │ ├── _method.template
│ │ ├── at.jsx
│ │ ├── childAt.jsx
│ │ ├── children.jsx
│ │ ├── closest.jsx
│ │ ├── contains.jsx
│ │ ├── containsAllMatchingElements.jsx
│ │ ├── containsAnyMatchingElements.jsx
│ │ ├── containsMatchingElement.jsx
│ │ ├── context.jsx
│ │ ├── debug.jsx
│ │ ├── deprecatedInstanceProperties.jsx
│ │ ├── equals.jsx
│ │ ├── every.jsx
│ │ ├── everyWhere.jsx
│ │ ├── exists.jsx
│ │ ├── filter.jsx
│ │ ├── filterWhere.jsx
│ │ ├── find.jsx
│ │ ├── findWhere.jsx
│ │ ├── first.jsx
│ │ ├── flatMap.jsx
│ │ ├── forEach.jsx
│ │ ├── get.jsx
│ │ ├── getElement.jsx
│ │ ├── getElements.jsx
│ │ ├── getNode.jsx
│ │ ├── getNodes.jsx
│ │ ├── getWrappingComponent.jsx
│ │ ├── hasClass.jsx
│ │ ├── hostNodes.jsx
│ │ ├── html.jsx
│ │ ├── instance.jsx
│ │ ├── invoke.jsx
│ │ ├── is.jsx
│ │ ├── isEmpty.jsx
│ │ ├── isEmptyRender.jsx
│ │ ├── key.jsx
│ │ ├── last.jsx
│ │ ├── map.jsx
│ │ ├── matchesElement.jsx
│ │ ├── name.jsx
│ │ ├── not.jsx
│ │ ├── parent.jsx
│ │ ├── parents.jsx
│ │ ├── prop.jsx
│ │ ├── props.jsx
│ │ ├── reduce.jsx
│ │ ├── reduceRight.jsx
│ │ ├── render.jsx
│ │ ├── renderProp.jsx
│ │ ├── root.jsx
│ │ ├── setContext.jsx
│ │ ├── setProps.jsx
│ │ ├── setState.jsx
│ │ ├── simulate.jsx
│ │ ├── simulateError.jsx
│ │ ├── single.jsx
│ │ ├── slice.jsx
│ │ ├── some.jsx
│ │ ├── someWhere.jsx
│ │ ├── state.jsx
│ │ ├── tap.jsx
│ │ ├── text.jsx
│ │ ├── unmount.jsx
│ │ └── wrap.jsx
│ └── staticRender-spec.jsx
├── since.js
├── tea.yaml
└── test/
└── mocha.opts
================================================
FILE CONTENTS
================================================
================================================
FILE: .babelrc
================================================
{
"presets": ["airbnb"],
"plugins": [
["transform-replace-object-assign", { "moduleSpecifier": "object.assign" }],
["add-module-exports"],
],
"ignore": [
"packages/enzyme-test-suite/test/_helpers/untranspiled*",
],
"sourceMaps": "both",
}
================================================
FILE: .eslintrc
================================================
{
"extends": "airbnb",
"root": true,
"env": {
"node": true,
},
"parser": "@babel/eslint-parser",
"ignorePatterns": [
"/build",
"_book",
"packages/*/build/",
// Temporarily copied
"packages/*/LICENSE.md",
"packages/enzyme/README.md",
"packages/enzyme-adapter-react-*/README.md",
"packages/enzyme-adapter-utils*/README.md",
],
"rules": {
"id-length": 0,
"react/no-find-dom-node": 1,
"import/first": 0,
"max-len": 0,
},
"overrides": [
{ // things that run in older envs, without babel
"files": [
"env.js",
"karma.conf.js",
"since.js",
],
"rules": {
"import/no-extraneous-dependencies": [2, {
"devDependencies": true,
}],
"comma-dangle": [2, {
"arrays": "always-multiline",
"objects": "always-multiline",
"imports": "always-multiline",
"exports": "always-multiline",
"functions": "ignore",
}],
"strict": [2, "safe"],
"prefer-destructuring": 0,
"prefer-template": 0,
},
"parserOptions": {
"sourceType": "script",
},
},
{
"files": [
"**/*.md",
"**/*.md/**"
],
"extends": ["plugin:markdown/recommended"],
"rules": {
"class-methods-use-this": 0,
"import/extensions": 0,
"import/no-extraneous-dependencies": 0,
"import/no-unresolved": 0,
"import/prefer-default-export": 0,
"max-len": 0,
"no-console": 0,
"no-undef": 0,
"no-unused-vars": 0,
"react/jsx-filename-extension": 0,
"react/jsx-fragments": 0,
"react/jsx-no-undef": 0,
"react/jsx-no-useless-fragment": 0,
"react/jsx-one-expression-per-line": 0,
"react/no-multi-comp": 0,
"react/no-unknown-property": 0,
"react/no-unused-class-component-methods": 0,
"react/react-in-jsx-scope": 0,
},
},
],
}
================================================
FILE: .github/FUNDING.yml
================================================
# These are supported funding model platforms
github: [ljharb]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: npm/enzyme
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
================================================
FILE: .github/ISSUE_TEMPLATE/Bug_report.md
================================================
---
name: 🐛 Bug report
about: Create a report to help us improve
---
Thanks for reporting an issue to us! We're glad you are using and invested in Enzyme.
Before submitting, please read over our commonly reported issues to prevent duplicates!
### All common issues
* [common issues](../blob/master/docs/common-issues.md)
### Notoriously common issues
* [Webpack build issues](../blob/master/docs/common-issues.md#webpack-build-issues)
* [Cannot find module 'react-dom/lib/ReactTestUtils'](../blob/master/docs/common-issues.md#error-cannot-find-module-react-domlibreacttestutils)
* [Query Selector fails](../blob/master/docs/common-issues.md#query-selector-fails)
* [Testing third party libraries](../blob/master/docs/common-issues.md#testing-third-party-libraries)
If you haven't found any duplicated issues, please report it with your environment!
### Current behavior
### Expected behavior
### Your environment
#### API
- [ ] shallow
- [ ] mount
- [ ] render
#### Version
| library | version
| ------------------- | -------
| enzyme |
| react |
| react-dom |
| react-test-renderer |
| adapter (below) |
#### Adapter
- [ ] enzyme-adapter-react-16
- [ ] enzyme-adapter-react-16.3
- [ ] enzyme-adapter-react-16.2
- [ ] enzyme-adapter-react-16.1
- [ ] enzyme-adapter-react-15
- [ ] enzyme-adapter-react-15.4
- [ ] enzyme-adapter-react-14
- [ ] enzyme-adapter-react-13
- [ ] enzyme-adapter-react-helper
- [ ] others ( )
================================================
FILE: .github/ISSUE_TEMPLATE/Feature_request.md
================================================
---
name: 🙏 Feature request
about: Suggest an idea for this project
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. e.g. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.
================================================
FILE: .github/workflows/node-pretest.yml
================================================
name: 'Tests: pretest/posttest'
on: [pull_request, push]
jobs:
pretest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ljharb/actions/node/install@main
with:
skip-ls-check: true
- run: sh install-relevant-react.sh
- run: npx lerna bootstrap
- run: npm run build
- run: npm run pretest
# posttest:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - uses: ljharb/actions/node/install@main
# - run: npm run build
# - run: npm run posttest
================================================
FILE: .github/workflows/node.yml
================================================
name: 'Tests: node.js'
on: [pull_request, push]
jobs:
build:
name: 'install deps and build'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ljharb/actions/node/install@main
with:
skip-ls-check: true
- run: npx lerna bootstrap
- run: npm run build
- uses: actions/cache@v3
with:
path: |
packages/*/build
node_modules
packages/*/node_modules
key: enzyme-${{ github.workflow }}-${{ github.action }}-${{ github.run_id }}
karma-matrix:
needs: [build]
name: 'karma tests'
runs-on: ubuntu-latest
continue-on-error: true
strategy:
fail-fast: false
matrix:
react:
- '16'
- '16.3'
- '16.2'
- '16.1'
- '15'
- '15.4'
- '0.14'
- '0.13'
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
packages/*/build
node_modules
packages/*/node_modules
key: enzyme-${{ github.workflow }}-${{ github.action }}-${{ github.run_id }}
- run: sudo chmod -R a+w .
- uses: ljharb/actions/node/install@main
with:
node-version: 'lts/*'
skip-install: true
after_install: '(nvm install node && REACT=${{ matrix.react }} TRAVIS=1 sh install-relevant-react.sh)'
skip-ls-check: true
- run: npm run test:karma -- --single-run
continue-on-error: true
env:
CHROME_BIN: chromium-browser
DISPLAY: 99.0
- run: echo 'karma tests expected to fail'
tests:
needs: [build]
name: 'tests'
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.continue-on-error == 'true' }}
strategy:
fail-fast: false
matrix:
node-version:
- '18'
- '4'
react:
- '16.14'
- '16.13'
- '16.12'
- '16.11'
- '16.10'
- '16.9'
- '16.8'
- '16.7'
- '16.6'
- '16.5'
- '16.4'
- '16.3'
- '16.2'
- '16.1'
- '16.0'
- '15.5'
- '15.4'
- '15.3'
- '15.2'
- '15.1'
- '15.0'
- '0.14'
- '0.13'
include:
- node-version: '16'
react: '16'
- node-version: '14'
react: '16'
- node-version: '12'
react: '16'
- node-version: '10'
react: '16'
- node-version: '8'
react: '16'
- node-version: '6'
react: '16'
- node-version: 'lts/*'
react: '16.8.3'
- node-version: 'lts/*'
react: '16.8.5'
env:
RENDERER: '16.8.5'
- node-version: 'lts/*'
react: '16.8.5'
env:
RENDERER: '16.8.3'
- node-version: 'lts/*'
react: '16.3'
env:
ADAPTER: '16'
- node-version: 'lts/*'
react: '16.8'
env:
RENDERER: '16.7'
- node-version: 'lts/*'
react: '16.7'
env:
RENDERER: '16.8'
- node-version: 'lts/*'
react: '16.7'
env:
RENDERER: '16.7'
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
packages/*/build
node_modules
packages/*/node_modules
key: enzyme-${{ github.workflow }}-${{ github.action }}-${{ github.run_id }}
- run: sudo chmod -R a+w .
- uses: ljharb/actions/node/install@main
with:
node-version: ${{ matrix.node-version || 'lts/* '}}
skip-install: true
after_install: '(nvm install node && sh install-relevant-react.sh)'
skip-ls-check: true
env:
REACT: ${{ matrix.react }}
- run: npm run travis
- uses: codecov/codecov-action@v3
node:
name: 'node + react'
needs: [tests]
runs-on: ubuntu-latest
steps:
- run: 'echo tests completed'
karma:
name: 'node + react + karma'
needs: [karma-matrix]
runs-on: ubuntu-latest
steps:
- run: 'echo tests completed'
================================================
FILE: .github/workflows/rebase.yml
================================================
name: Automatic Rebase
on: [pull_request_target]
jobs:
_:
name: "Automatic Rebase"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ljharb/rebase@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
================================================
FILE: .github/workflows/require-allow-edits.yml
================================================
name: Require “Allow Edits”
on: [pull_request_target]
jobs:
_:
name: "Require “Allow Edits”"
runs-on: ubuntu-latest
steps:
- uses: ljharb/require-allow-edits@main
================================================
FILE: .gitignore
================================================
# Logs
logs
*.log
# Runtime data
pids
*.pid
*.seed
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules
# Jetbrains IDEs
.idea
/build
_book
# Only apps should have lockfiles
npm-shrinkwrap.json
package-lock.json
yarn.lock
.DS_Store
._.DS_Store
packages/*/build/
# Temporarily copied
packages/*/LICENSE.md
packages/enzyme/README.md
packages/enzyme-adapter-react-*/README.md
packages/enzyme-adapter-utils*/README.md
.npmignore
================================================
FILE: .lgtm
================================================
approvals = 1
pattern = "(?i):shipit:|:\\+1:|LGTM"
================================================
FILE: .npmrc
================================================
package-lock=false
update-notifier=false
legacy-peer-deps=true
================================================
FILE: .nycrc
================================================
{
"extension": [
".js",
".jsx"
],
"include": [
"*",
"packages/*/*",
"packages/*/src"
],
"exclude": [
"packages/enzyme-test-suite",
"_book",
"coverage",
"packages/*/node_modules"
],
"require": [
],
"reporter": [
"text",
"html",
"json",
"lcov"
],
"all": false,
"check-coverage": false,
"statements": 100,
"branches": 100,
"lines": 100,
"functions": 100,
"sourceMap": true,
"instrument": true
}
================================================
FILE: CHANGELOG.md
================================================
# Change Log
## 3.11.0
### New Stuff
- `render`: handle Fiber strings and numbers (#2221)
### Fixes
- `shallow`: Share child context logic between `shallow` and `dive` (#2296)
- `mount`: `children`: include text nodes ($2269)
- `mount`: `invoke`: use adapter’s `wrapInvoke` if present (#2158)
### Docs
- `mount`/`shallow`: `closest`/`parent`: Add missing arguments description (#2264)
- `mount`/`shallow`: fix pluralization of “exist” (#2262)
- `shallow`/`mount`: `simulate`: added functional component example to simulate doc (#2248)
- `mount`: `debug`: add missing verbose option flag (#2184)
- `mount`/`shallow`: `update`: fix semantics description (#2194)
- add missing backticks to linked method names (#2170)
- `invoke`: Add missing backticks to end of codeblock (#2160)
- `invoke`: Fix typo (#2167)
- Explicit React CSS selector syntax description (#2178)
### Meta Stuff
- [meta] add `funding` field
- [meta] Update airbnb.io URLs to use https (#2222)
- [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`
- [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`
## 3.10.0
### New Stuff
- `shallow` add `suspenseFallback` option; support `Suspense`/`Lazy` (#1975)
- `shallow`/`mount`: add `invoke(propName)(...args)` (#1856, #945)
- `shallow`: Support rendering and `dive()`ing `createContext()` providers and consumers (#1966)
- `mount`/`shallow`: add `getWrappingComponent` (#1960)
- `Utils`: add `isCustomComponent` (#1960)
- `Utils`: add `stub` argument to `spyMethod`
- `EnzymeAdapter`: add `matchesElementType` (#2146)
- `RSTTraversal`: add `getHTMLFromHostNodes`
### Fixes
- `selectors`: unwrap `memo` elements - in both directions (#2146)
- `shallow`: properly determine "should render" for `PureComponent`s (#2096)
- `mount`/`shallow`: `renderProp`: improve error messages (#2070)
- `mount`: `setContext`: use proper wrapper name in error message
- `shallow`: `.contains()`: clean up error message
- `shallow`/`mount`: `hasClass`: avoid a crash with a non-string argument (#2057)
- `mount`: properly handle HTML of multiple nodes (#2052)
- `shallow`: ensure that if gDSFP exists, cDU is called. (#2027)
- `shallow`: Mock sCU if gDSFP defined in shallow renderer rerender (#1981)
- `mount`: `.state()`: allow getting state from stateful children of a stateless root (#2043)
- `mount`: `.text()`: properly recurse through fragments and arrays (#2028)
### Refactors
- `ReactWrapper`/`ShallowWrapper`: ensure calling an adapter‘s nodeToElement preserves the receiver
- `mount`: use `getHTMLFromHostNodes`
### Docs
- explain why need to re-call .find() after update (#2140)
- `shallow`: fix childAt (#2134)
- Update v2 -> v3 migration guide re props after a stage change (#1300)
- `debug`: Added documentation for `verbose` flag (#2104)
- Add on the fly JSDOM include example (#2072)
- `reduce`/`reduceRight`: fix example code (#2066, #2065, #2064)
- update `simulateError` with `getDerivedStateFromError` (#2036)
- `shallow`: `.hasClass`: fix use of `mount`
- add link to Cheerio API and another example (#756)
- `jest`: Update deprecated jest config key (#2024)
## 3.9.0
### New Stuff
- `shallow`: `isEmptyRender`: allow on multiple elements (#1924)
- `mount`: support `:focus` selector (#1965)
- `shallow`: Support `getChildContext()` (#1971)
- `shallow`/`mount`: `.find`: find HTML elements by their constructor (#1933)
- `shallow`/`mount`: `selectors`: support universal selector (#1945)
- `mount`/`shallow`: add regex support to `.hasClass` (#1987)
### Fixes
- `mount`/`shallow`: `.text`/`.html`: handle an array of nodes properly (#2001)
- `shallow`: `.setProps()`: only call cDU once (#2007)
- `mount`: ensure `findWhere` doesn‘t abort early on an empty string (#1995)
- `mount`: `findWhere`: avoid passing empty wrappers to predicate
- `mount`: `text()` via `findWhere`: return the string for a wrapper around a string
- `mount`/`shallow`: Fix .exists not accepting any EnzymeSelector (#1934)
- `mount`: Recursive `isEmptyRender` (#1924)
- `mount`: `setState`: allow setting state on a class child of an SFC root
### Documentation
- [jest] update Jest to setupFilesAfterEnv (#2015)
- [jest] Change deprecated `setupTestFrameworkScriptFile` to `setupFilesAfterEnv` (#2013)
- `mount`: `setState`: note that you can now call it on "not the root" (#2010)
- general improvements (#1947)
- Fix typos (#1992)
- Added missing pages: `isEmptyRender`, `renderProp`, `equals`, SystemJS guide (#1984, #1985)
- Fix link to .shallow() (#1951)
- update jsdoc to use "EnzymeSelector" where applicable
### Meta Stuff
- add "directory" field to package.json
## 3.8.0
### New Stuff
- `shallow`/`mount`: add `renderProp` (#1863, #1891)
### Fixes
- `shallow`/`mount`: improve error message for "single node" assertion (#1904)
- `shallow`: shallow compare, not deep compare, state and props to determine rerendering (#1915)
### Documentation
- `shallow`: `dive`: add a note about throwing an error (#1905)
- `selectors: update re `displayName` (#1932)
- `shallow`: `get`: fixed wrong `props()` usage (#1921)
- `shallow`: `html`: shallow renders full tree (#1912)
- Updated broken link for “.hostNodes()” in migration guide from enzyme 2 to 3 (#1909)
- Add tape example project link (#1898)
- `prop`: fix typo (#1883)
- Document full support for attribute selectors (#1881)
- Documentation update for testing React Native with jsdom (#1873)
- Update JSDOM docs to include {request|cancel}AnimationFrame polyfills (#1867)
- `mount`: `ref`: use correct type (#1865)
## 3.7.0
### New Stuff
- `mount`: `.state()`/`.setState()`: allow calling on children ([#1802](https://github.com/enzymejs/enzyme/pull/1802), @ljharb)
- `configuration`: add `reset` ([commit](https://github.com/enzymejs/enzyme/commit/d91d95b8da8900c8f4b7090d2256422a82398ca9))
### Fixes
- `makeOptions`: ensure that config-level `attachTo`/`hydrateIn` are inherited into wrapper options ([#1836](https://github.com/enzymejs/enzyme/issues/1836), @ljharb)
- `shallow`/`Utils`: call into adapter’s `isCustomComponentElement` if present ([#1832](https://github.com/enzymejs/enzyme/pull/1832), @SinHouse)
- `shallow`/`mount`: throw an explicit error when state is null/undefined ([commit](https://github.com/enzymejs/enzyme/commit/9ea33d7667a93885d6f1d6e12b0c2661d6d47cd1))
- freeze `ROOT_NODES` for child wrappers ([#1811](https://github.com/enzymejs/enzyme/pull/1811), @jgzuke)
- `shallow`: `.parents`: ensure that one `.find` call does not affect another ([#1781](https://github.com/enzymejs/enzyme/pull/1781), @ljharb)
- `mount`: update after `simulateError` ([#1812](https://github.com/enzymejs/enzyme/pull/1812), @jgzuke)
### Refactors
- `mount`/`shallow`: `getElement`: use `this.single` ([commit](https://github.com/enzymejs/enzyme/commit/6b63db3b002a419076c82d34554916400ef392fa))
## 3.6.0
### New Stuff
- `shallow`/`mount`: add `simulateError` ([#1797](https://github.com/enzymejs/enzyme/pull/1797), @ljharb)
## 3.5.1
### Fixes
- `shallow`/`mount`: `containsMatchingElement`: trim whitespace ([commit](https://github.com/enzymejs/enzyme/commit/171e952), [#636](https://github.com/enzymejs/enzyme/issues/636))
- `debug`: inspect objects instead of showing them as `<Component />` ([commit](https://github.com/enzymejs/enzyme/commit/a7b6e78))
### Documentation
- `mount`: `ref`: Update docs to be consistent with v3 ([#1242](https://github.com/enzymejs/enzyme/pull/1242), @adam-golab)
### Refactors
- `shallow`/`mount`: make tests and method ordering more consistent ([commit](https://github.com/enzymejs/enzyme/commit/d0fccaf))
- RSTTraversal: remove unnecessary `adapter` truthiness check ([commit](https://github.com/enzymejs/enzyme/commit/394a327))
## 3.5.0
### New Stuff
- Add forwardRef support ([#1592](https://github.com/enzymejs/enzyme/pull/1592), @jquense)
- 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)
- Add pointer events support ([#1753](https://github.com/enzymejs/enzyme/pull/1753), @ljharb)
### Fixes
- 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)
- `shallow`: prevent rerenders with PureComponents ([#1786](https://github.com/enzymejs/enzyme/pull/1786), @koba04)
- `shallow`: skip updates when nextState is `null` or `undefined` ([#1785](https://github.com/enzymejs/enzyme/pull/1785), @koba04)
- `shallow`: `setState` after `setProps` calls `componentWillReceiveProps` ([#1779](https://github.com/enzymejs/enzyme/pull/1779), @peanutenthusiast)
- `mount`/`shallow`: be stricter on the wrapper’s setState/setProps callback ([commit](https://github.com/enzymejs/enzyme/commit/ff11d2219da575d09ca8edfa19df42b8f78b506f))
- `shallow`/`mount`: improve error message when wrapping invalid elements ([#1759](https://github.com/enzymejs/enzyme/pull/1759), @jgzuke)
### Refactors
- remove most uses of lodash ([commit](https://github.com/enzymejs/enzyme/commit/89b39b6f1c59aa771f4452a27b159f7aa2616e84))
### Meta Stuff
- ensure a license and readme is present in all packages when published
## 3.4.4
### Fixes
- @koba04: `shallow`: fix unexpected call to componentDidMount ([#1768](https://github.com/enzymejs/enzyme/pull/1768))
## 3.4.3
### Fixes
- @ljharb/@koba04: `shallow`: `.setState()`: stub out `setState` on non-root code paths as well ([#1763](https://github.com/enzymejs/enzyme/pull/1763))
- @ljharb: `shallow`/`mount`: restore fallback when adapter lacks `invokeSetStateCallback` ([commit](https://github.com/enzymejs/enzyme/commit/093b2edb98d3abfe6b61d800503e04aac08e7496))
- @ljharb: `mount`: `setState`: invoke callback with the proper receiver ([commit](https://github.com/enzymejs/enzyme/commit/ec3beef3ba86c4352fe6e9ab2848b3b4f61ac1da))
- @ljharb: `mount`: `state` and `setState` should throw an explicit error message when called on an SFC ([commit](https://github.com/enzymejs/enzyme/commit/8feee5a89e9091636e9ec0ec3814d287ced20136))
## 3.4.2
### Fixes
- @koba04: `shallow`: call cDU when an instance calls setState ([#1742](https://github.com/enzymejs/enzyme/pull/1742))
- @ReactiveRaven: `selectors`: fix descendant selector ([#1680](https://github.com/enzymejs/enzyme/pull/1680))
## 3.4.1
### Fixes
- @ljharb: `shallow`: `setProps`: merge instead of replace props ([commit](https://github.com/enzymejs/enzyme/commit/9b4d0276f57e54be06aca6c3636120b3c4053310))
### Documentation
- @koba04: Fix an adapter table style in README.md and a migration guide ([#1734](https://github.com/enzymejs/enzyme/pull/1734))
## 3.4.0
### New Stuff
- @madicap: `shallow`/`mount`: account for React.Fragment nodes ([#1733](https://github.com/enzymejs/enzyme/pull/1733))
- @jquense: Debug: `debugNode` now returns `[function]` for function children ([commit](https://github.com/enzymejs/enzyme/commit/9745de0bf25e826186be07e7846f4ecd7c685592))
- @ljharb: `mount`: add `hydrateIn` option ([#1707](https://github.com/enzymejs/enzyme/pull/1707))
- @ljharb: `shallow`: add “lifecycles” adapter option ([#1696](https://github.com/enzymejs/enzyme/pull/1696))
- @krawaller: `shallow`/`mount`: allow `.exists()` to take an optional selector ([#1695](https://github.com/enzymejs/enzyme/pull/1695))
- @koba04: `shallow`: Add getSnapshotBeforeUpdate support ([#1657](https://github.com/enzymejs/enzyme/pull/1657))
- @jquense: `shallow`/`mount`: Add support for some pseudo selectors ([#1537](https://github.com/enzymejs/enzyme/pull/1537))
- @blainekasten: `debug`: Implement verbose debug output ([#1547](https://github.com/enzymejs/enzyme/pull/1547))
- @jquense/@ljharb: `Debug`: `typeName` now calls the adapter’s `displayNameOfNode` if available ([#1701](https://github.com/enzymejs/enzyme/pull/1701))
- @jquense/@ljharb: `mount`/`shallow`: `.name()`: call into adapter’s `displayNameOfNode`, if present ([#1701](https://github.com/enzymejs/enzyme/pull/1701))
- @jquense/@ljharb: `Utils`: `nodeHasType`: call into adapter’s `displayNameOfNode`, if present ([#1701](https://github.com/enzymejs/enzyme/pull/1701))
- @jquense/@ljharb: `selectors`: `buildPredicate`: call into adapter’s `isValidElementType`, if present ([#1701](https://github.com/enzymejs/enzyme/pull/1701))
- @emuraton/@ljharb: `shallow`: `setProps()`: Add callback argument ([#1721](https://github.com/enzymejs/enzyme/pull/1721))
- @ljharb: `mount`: add `.equals()` ([commit](https://github.com/enzymejs/enzyme/commit/dcc8ab10fde06a963364f6cc79b89aa967d9bef2))
- @madicap: Extract `getAdapter` from `Utils` into its own file ([#1732](https://github.com/enzymejs/enzyme/pull/1732))
### Fixes
- @ljharb: `shallow`/`mount`: `matchesElement`/`containsMatchingElement`: get adapter with options ([commit](https://github.com/enzymejs/enzyme/commit/e954e4610d1ad89ae94b8f7c7baa8835cd331662))
- @ljharb: `RSTTraversal`: remove `nodeHasProperty` export; broken since #1157 ([commit](https://github.com/enzymejs/enzyme/commit/edabb1b6b4648fb6469da43feb1d15c1b55666f7))
- @ljharb/@KordonDev: `shallow`: `.at()`: return an empty wrapper when an index does not exist ([#1478](https://github.com/enzymejs/enzyme/pull/1478))
- @ljharb: `shallow`: `.equals()`: flatten children when comparing ([commit](https://github.com/enzymejs/enzyme/commit/18de4ed2e68c25f9fff9983d996b024704183801))
- @ljharb: `mount`/`shallow`: do not dedupe in flatMap ([commit](https://github.com/enzymejs/enzyme/commit/72341740e1e650b16ca2e377fa4e3e144b35a558))
- @ljharb: `shallow`: `.closest()`: ensure an empty wrapper is returned for no match ([commit](https://github.com/enzymejs/enzyme/commit/ce1e1132d080948265567e88417dface9c0c45e7))
- @krawaller: `selectors`: make general sibling not throw on root ([#1698](https://github.com/enzymejs/enzyme/pull/1698))
- @ljharb/@angelikatyborska : `mount`: `text()`: null nodes return null ([#1582](https://github.com/enzymejs/enzyme/pull/1582))
- @ljharb: `shallow`: `simulate`: ensure it returns itself ([commit](https://github.com/enzymejs/enzyme/commit/1c2c58b4e554f3b0c5f862f8de79f15a62bef5cf))
- @koba04: `shallow`: ShallowWrapper calls update() automatically ([#1499](https://github.com/enzymejs/enzyme/pull/1499))
- @bdwain: `mount`/`shallow`: return null for missing keys ([#1536](https://github.com/enzymejs/enzyme/pull/1536))
- @vsiao: Fix ShallowWrapper for array-rendering components ([#1498](https://github.com/enzymejs/enzyme/pull/1498))
- @koba04: Call `setState` callback after finishing the render ([#1453](https://github.com/enzymejs/enzyme/pull/1453))
- @eddyerburgh: Convert nodes to RST nodes before comparing ([#1423](https://github.com/enzymejs/enzyme/pull/1423))
- @ljharb: improve "bad adapter" error message ([#1477](https://github.com/enzymejs/enzyme/pull/1477))
- @ljharb: `shallow`/`mount`: default iterator should be iterable ([commit](https://github.com/enzymejs/enzyme/commit/cfc5a3e47efa812f7a2c4fa5ad2b0687daacd280))
### Refactors
- @ReactiveRaven: `selectors`: fix typos; avoid reusing variable unnecessarily ([#1681](https://github.com/enzymejs/enzyme/pull/1681))
- @koba04/@ljharb: `shallow`: Use `spyMethod` to inspect the result of `shouldComponentUpdate`/`getSnapshotBeforeUpdate` ([#1192](https://github.com/enzymejs/enzyme/pull/1192))
- @ljharb: `Utils`: `configuration`: change to named exports. ([commit](https://github.com/enzymejs/enzyme/commit/d7f32617e6ea93b739f4e4c3f6228a8e382aeb06))
- @ljharb: use `array.prototype.flat` ([commit](https://github.com/enzymejs/enzyme/commit/e52a02ddac0fab0d1d93fd57d7f073f8bdc850bf))
### Documentation
- @jack-lewin: Clarify dev workflow in CONTRIBUTING.md ([#1207](https://github.com/enzymejs/enzyme/pull/1207))
- @robrichard: Provide migration instructions for `ref(refName)` ([#1470](https://github.com/enzymejs/enzyme/pull/1470))
- @DannyDelott: `shallow`/`mount`: Add callback arg to setProps header ([#1361](https://github.com/enzymejs/enzyme/pull/1361))
- @conor-cafferkey-sociomantic: `mount`: Updated docs for ReactWrapper.instance(); remove docs for v2's `getNode()`/`getNodes()` ([#1714](https://github.com/enzymejs/enzyme/pull/1714))
- @koba04: Make clearer the docs for .mount() ([#1540](https://github.com/enzymejs/enzyme/pull/1540))
- @ialexryan: Update signature of .type() in shallow.md (#1492]([https://github.com/enzymejs/enzyme/pull/1492))
### Meta Stuff
- @ljharb: ensure a license and readme is present in all packages when published
- @ljharb: [meta] fix package.json scripts
## 3.3.0
### New Stuff
- @ljharb/@joeldenning: `debug`: handle boxed primitives ([#1450](https://github.com/enzymejs/enzyme/pull/1450))
### Refactors
- @eddyerburgh: Use RSTTraversal childrenOfNode in Utils ([#1381](https://github.com/enzymejs/enzyme/pull/1381))
### Fixes
- @nicoder: Fix typo in error message ([#1379](https://github.com/enzymejs/enzyme/pull/1379))
## 3.2.0
### New Stuff
- @aweary: Support all attribute selector operators ([#1157](https://github.com/enzymejs/enzyme/pull/1157))
### Fixes
- @idanilt: Change ShallowWrapper.text() trim spaces with same behavior as ReactWrapper.text() ([#1350](https://github.com/enzymejs/enzyme/pull/1350))
## 3.1.1
### Fixes
- @koba04: Fix to call componentDidUpdate on setState of React v16 ([#1261](https://github.com/enzymejs/enzyme/pull/1261))
## 3.1.0
### New Stuff
- @FezVrasta: Added hostNodes method to ReactWrapper ([#1179](https://github.com/enzymejs/enzyme/pull/1179))
### Fixes
- @lelandrichardson: Add an npmignore file to all packages ([#1204](https://github.com/enzymejs/enzyme/pull/1204))
- @neoziro: Fix node resolving in React 16 adapter ([#100](https://github.com/enzymejs/enzyme/pull/100))
- @graingert: upgrade to rst-selector-parser@^2.2.2 ([#1146](https://github.com/enzymejs/enzyme/pull/1146))
### Documentation
- @lelandrichardson: Symlink readme to all packages ([#1205](https://github.com/enzymejs/enzyme/pull/1205))
- @AndersDJohnson: fix some typos ([#1165](https://github.com/enzymejs/enzyme/pull/1165))
- @dubbha: ES5 setup file correction ([#1194](https://github.com/enzymejs/enzyme/pull/1194))
- @morrowr08: updated component name being used in example ([#1180](https://github.com/enzymejs/enzyme/pull/1180))
- @apandichi: Fixing a few typos... ([#1171](https://github.com/enzymejs/enzyme/pull/1171))
- @nuc: Fix typo ([#1142](https://github.com/enzymejs/enzyme/pull/1142))
## 3.0.0
### Breaking Changes
Enzyme 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
library from v2 to v3, it is hard to categorize changes in terms of sem
- @lelandrichardson: Refactor enzyme to use Adapters, initial React 16 support ([#1007](https://github.com/enzymejs/enzyme/pull/1007))
- @lelandrichardson: Make private properties more private and harder to use ([#1083](https://github.com/enzymejs/enzyme/pull/1083))
- @ljharb: [breaking] update `cheerio` to v1 ([#1093](https://github.com/enzymejs/enzyme/pull/1093))
- @aweary: Integrate with a CSS parser for selector parsing ([#1086](https://github.com/enzymejs/enzyme/pull/1086))
- @vadimdemedes: Skip undefined props when comparing nodes ([#662](https://github.com/enzymejs/enzyme/pull/662))
- @koba04: Breaking: lifecycleExperimental by default ([#1140](https://github.com/enzymejs/enzyme/pull/1140))
### New Stuff
- @lelandrichardson: Move to lerna repo structure, multiple modules ([#1074](https://github.com/enzymejs/enzyme/pull/1074))
- @lelandrichardson: Remove all React dependencies from enzyme ([#1084](https://github.com/enzymejs/enzyme/pull/1084))
- @lelandrichardson: Add public root method ([#1127](https://github.com/enzymejs/enzyme/pull/1127))
### Fixes
- @aweary: Remove isFunctionalComponent, use nodeType instead ([#1076](https://github.com/enzymejs/enzyme/pull/1076))
- @LarsHassler: props not merged when shallow rendering in lifecycleExperimental ([#1088](https://github.com/enzymejs/enzyme/pull/1088))
- @ljharb: [Fix] `mount`: do not mutate `Component.contextTypes` ([#1099](https://github.com/enzymejs/enzyme/pull/1099))
- @ljharb: [Fix] `reduce`/`reduceRight`: follow `Array#reduce` when omitting initialValue ([#673](https://github.com/enzymejs/enzyme/pull/673))
- @koba04: Fix componentDidUpdate when updating by setState on v16 ([#1133](https://github.com/enzymejs/enzyme/pull/1133))
- @koba04: Fix componentDidUpdate no longer receives prevContext on React v16 ([#1139](https://github.com/enzymejs/enzyme/pull/1139))
### Documentation
- @ghost: added sinon to mocha guide ([#1075](https://github.com/enzymejs/enzyme/pull/1075))
- @samit4me: Update to GitBook 3 ([#1039](https://github.com/enzymejs/enzyme/pull/1039))
- @therewillbecode: Removed extraneous brackets from example in readme ([#1117](https://github.com/enzymejs/enzyme/pull/1117))
- @silvenon: Add note that mount() requires cleanup ([#1043](https://github.com/enzymejs/enzyme/pull/1043))
- @lelandrichardson: Add docs reflecting v3 ([#1121](https://github.com/enzymejs/enzyme/pull/1121))
## 2.9.1
### Fixes
- [Deps] Require uuid at least 3.0.1 ([#1001](https://github.com/enzymejs/enzyme/pull/1001))
## 2.9.0
### New Stuff
- `mount`/`shallow`: `debug`: add `ignoreProps` option ([#960](https://github.com/enzymejs/enzyme/pull/960))
### Fixes
- `shallow`: debug: fix indentation ([#926](https://github.com/enzymejs/enzyme/pull/926))
- react-compat: Make sure dependency error reporting always work ([#929](https://github.com/enzymejs/enzyme/pull/929))
- react-compat: correct error message ([#904](https://github.com/enzymejs/enzyme/pull/904))
### Documentation
- lint our markdown ([#988](https://github.com/enzymejs/enzyme/pull/988))
- correct `nvm` install instructions (never install it with homebrew) ([#988](https://github.com/enzymejs/enzyme/pull/988))
- fix typos ([#979](https://github.com/enzymejs/enzyme/pull/979)), ([#983](https://github.com/enzymejs/enzyme/pull/983))
- Added missing isEmptyRender() docs
- update jsdom guides for v10 and later ([#921](https://github.com/enzymejs/enzyme/pull/921))
### Refactors
- `shallow`/`mount`: Make all references to the wrapper `class` call into `this.wrap`
- update `uuid` from v2 to v3 ([#998](https://github.com/enzymejs/enzyme/pull/998))
## 2.8.2
### Fixes
- Loosen react-compat implicit dependency logic for React 15.4 ([#896](https://github.com/enzymejs/enzyme/pull/896))
### Documentation
- Update docs to use `prop-types` ([#894](https://github.com/enzymejs/enzyme/pull/894), [#890](https://github.com/enzymejs/enzyme/issues/890))
## 2.8.1
### Fixes
- support React@15.5 ([#876](https://github.com/enzymejs/enzyme/pull/876))
- no longer depend on `React.createClass` ([#877](https://github.com/enzymejs/enzyme/pull/877))
- Throw for malformed compound selectors ([#868](https://github.com/enzymejs/enzyme/pull/868))
## 2.8.0
### New Stuff
- add disableLifecycleMethods for shallow ([#789](https://github.com/enzymejs/enzyme/pull/789))
- Match children before and after interpolation ([#512](https://github.com/enzymejs/enzyme/pull/512))
- Supporting passing context to static rendering ([#429](https://github.com/enzymejs/enzyme/pull/429))
### Fixes
- Fix an issue w/ cleaning up global.document ([#855](https://github.com/enzymejs/enzyme/pull/855))
- Update props when shouldComponentUpdate returns `false` and `lifecycleExperimental` is on ([#807](https://github.com/enzymejs/enzyme/pull/807))
- Properly pass along options in `dive` ([#771](https://github.com/enzymejs/enzyme/pull/771))
## 2.7.1 (January 22, 2017)
### Fixes
- `mount`: Fix bug from ([#677](https://github.com/enzymejs/enzyme/pull/677) ([#680](https://github.com/enzymejs/enzyme/pull/680))
- `mount`: ignore text nodes in childrenOfInst ([#604](https://github.com/enzymejs/enzyme/pull/604))
### Documentation
- Update Docs for .getNode and .getNodes ([#743](https://github.com/enzymejs/enzyme/pull/743))
- Add a link for `ShallowWrapper#dive()` ([#759](https://github.com/enzymejs/enzyme/pull/759)
- Fix alphabetical order of API lists ([#761](https://github.com/enzymejs/enzyme/pull/761))
## 2.7.0 (December 21, 2016)
### New Stuff
- `shallow`/`mount`: Add `.slice()` method ([#661](https://github.com/enzymejs/enzyme/pull/661))
- `mount`: implement ReactWrapper#getDOMNode ([#679](https://github.com/enzymejs/enzyme/pull/679))
- `shallow`/`mount`: Add `exists`; deprecate isEmpty() ([#722](https://github.com/enzymejs/enzyme/pull/722))
### Fixes
- `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))
- `withDom`: Display a useful error when `withDom` fails to find "jsdom" ([#686](https://github.com/enzymejs/enzyme/pull/686))
- `mount`: ensure that `react-text` comment nodes don’t break `.find` ([#691](https://github.com/enzymejs/enzyme/pull/691))
- `mount`: `.parents()` now filters out sibling path trees ([#713](https://github.com/enzymejs/enzyme/pull/713))
## 2.6.0 (November 9, 2016)
### New Stuff
- ensure ShallowWrapper render output can't get stale ([#490](https://github.com/enzymejs/enzyme/pull/490))
### Fixes
- Use shim to detect constructor function name ([#659](https://github.com/enzymejs/enzyme/pull/659))
- `mount`/`shallow`: fix ID selectors ([#670](https://github.com/enzymejs/enzyme/pull/670))
## 2.5.2 (November 9, 2016)
### Fixes
- Use shim to detect constructor function name ([#659](https://github.com/enzymejs/enzyme/pull/659))
- `mount`/`shallow`: fix ID selectors ([#670](https://github.com/enzymejs/enzyme/pull/670))
## 2.5.1 (October 17, 2016)
### Patches
- continue to support one-argument `single` ([#632](https://github.com/enzymejs/enzyme/pull/632))
## 2.5.0 (October 17, 2016)
### Minor Changes
- pass callback on setState and setProps ([#617](https://github.com/enzymejs/enzyme/pull/617))
- Make ReactWrapper and ShallowWrapper iterable ([#594](https://github.com/enzymejs/enzyme/pull/594))
- add `.dive()` method to `shallow` ([#618](https://github.com/enzymejs/enzyme/pull/618))
### Patches
- Warn if selector contains a pseudo-class ([#591](https://github.com/enzymejs/enzyme/pull/591))
- change isCompoundSelector to not match prop selector ([#595](https://github.com/enzymejs/enzyme/pull/595))
- fixed hasClassName in case className is not a string and has toString method ([#518](https://github.com/enzymejs/enzyme/pull/518))
- Throw if some() is called on a root wrapper ([#523](https://github.com/enzymejs/enzyme/pull/523))
- Fix valid + falsy propvalues ([#563](https://github.com/enzymejs/enzyme/pull/563))
## 2.4.2 (November 9, 2016)
### Fixes
- Use shim to detect constructor function name ([#659](https://github.com/enzymejs/enzyme/pull/659))
- `mount`/`shallow`: fix ID selectors ([#670](https://github.com/enzymejs/enzyme/pull/670))
## 2.4.1 (July 8, 2016)
### Patches
- Fix backwards incompatible `shouldComponentUpdate` call ([#491](https://github.com/enzymejs/enzyme/pull/491))
## 2.4.0 (July 7, 2016)
### Minor Changes
- Support all Component Lifecycle methods in ShallowRenderer (behind an experimental flag) ([#318](https://github.com/enzymejs/enzyme/pull/318))
- Add an `isEmptyRender()` method to both `ShallowWrapper` and `ReactWrapper` ([#339](https://github.com/enzymejs/enzyme/pull/339))
- Add support for batched updates with `ShallowRender.simulate` ([#342](https://github.com/enzymejs/enzyme/pull/342))
### Patches
- Switch to using classList instead of className ([#448](https://github.com/enzymejs/enzyme/pull/448))
- fixes mount().debug() output with mixed children ([#476](https://github.com/enzymejs/enzyme/pull/476))
- Support additional characters in attribute selectors ([#412](https://github.com/enzymejs/enzyme/pull/412))
- fix id selector not working when combined with a tag selector ([#387](https://github.com/enzymejs/enzyme/pull/387))
- Support spaces in attribute selector values ([#427](https://github.com/enzymejs/enzyme/pull/427))
## 2.3.0 (May 9, 2016)
### Minor Changes
- add `.tap()` method to `ShallowWrapper` and `ReactWrapper` ([#299](https://github.com/enzymejs/enzyme/pull/299))
- add `.key()` method to `ShallowWrapper` and `ReactWrapper` ([#327](https://github.com/enzymejs/enzyme/pull/327))
- add support for descendent selectors, `>`, `~` and `+` ([#217](https://github.com/enzymejs/enzyme/pull/217))
- new `containsMatchingElement`, `containsAllMatchingElements`, and `containsAnyMatchingElements` APIs ([#362](https://github.com/enzymejs/enzyme/pull/362))
- new `.name()` method ([#335](https://github.com/enzymejs/enzyme/pull/335))
### Patches
- add `dblclick` to eventType map for simulate ([#317](https://github.com/enzymejs/enzyme/pull/317))
- fix `pathToNode` bug with child-containing children ([#296](https://github.com/enzymejs/enzyme/pull/296))
- prioritize `displayName` over `name` for consistency in `.debug()` ([#332](https://github.com/enzymejs/enzyme/pull/332))
- handle insignificant whitespace in className ([#348](https://github.com/enzymejs/enzyme/pull/348))
- fix handling of SFC components and `.instance()` ([#359](https://github.com/enzymejs/enzyme/pull/359))
- reduce false positives by using argument validation for `.contains` ([#259](https://github.com/enzymejs/enzyme/pull/259))
- fix equality algorithm so that non-renderable nodes are equivalent ([#192](https://github.com/enzymejs/enzyme/pull/192))
- add better error handling for `state`, `setState`, and `context` ([#373](https://github.com/enzymejs/enzyme/pull/373))
## 2.2.0 (March 21, 2016)
### Minor Changes
- add `options` param to `ShallowWrapper::shallow` ([#275](https://github.com/enzymejs/enzyme/pull/275))
### Patches
- make enzyme compatible with all React 15 RCs ([#272](https://github.com/enzymejs/enzyme/pull/272))
- increase coverage for Stateless Functional Components ([#267](https://github.com/enzymejs/enzyme/pull/267))
- improve context support for Stateless Functional Components ([#256](https://github.com/enzymejs/enzyme/pull/256))
- fix tree traversal for Stateless Functional Components ([#257](https://github.com/enzymejs/enzyme/pull/257))
- fix `.find` for nested Stateless Functional Components ([#274](https://github.com/enzymejs/enzyme/pull/274))
- fix `.props()` and `.debug()` methods for Stateless Functional Components ([#255](https://github.com/enzymejs/enzyme/pull/255))
- prevent falsy nodes from being counted as children ([#251](https://github.com/enzymejs/enzyme/pull/251))
## 2.1.0 (March 10, 2016)
### Minor Changes
- add support for React 15.0.0-rc.1 ([#240](https://github.com/enzymejs/enzyme/pull/240))
- add `.unmount()` method for ShallowWrapper ([#215](https://github.com/enzymejs/enzyme/pull/215))
- add direct imports for `mount`, `shallow`, and `render` ([#198](https://github.com/enzymejs/enzyme/pull/198))
- add a `.childAt(n)` shorthand method ([#187](https://github.com/enzymejs/enzyme/pull/187))
### Patches
- fix bug in .contains() for matching sub-arrays ([#226](https://github.com/enzymejs/enzyme/pull/226))
- fix bug in matching by type displayName ([#230](https://github.com/enzymejs/enzyme/pull/230))
- add more useful warnings for missing implicit dependencies ([#228](https://github.com/enzymejs/enzyme/pull/228))
- improve SFC support for `.type()` ([#196](https://github.com/enzymejs/enzyme/pull/196))
- fix null handling for `.html()` and `.render()` ([#196](https://github.com/enzymejs/enzyme/pull/196))
- moved from `underscore` to `lodash` ([#189](https://github.com/enzymejs/enzyme/pull/189))
## 2.0.0 (February 10, 2016)
### Major Changes (breaking)
- removed `describeWithDOM` utility ([#159](https://github.com/enzymejs/enzyme/pull/159))
- removed `useSinon`, `spyPrototype` and `spyLifecycle` utilities ([#159](https://github.com/enzymejs/enzyme/pull/159))
- removed `sinon` dependency ([#159](https://github.com/enzymejs/enzyme/pull/159))
- removed `jsdom` dependency ([#159](https://github.com/enzymejs/enzyme/pull/159))
## 1.6.0 (February 10, 2016)
### Minor Changes
- add option for childContextTypes of `ReactWrapper` ([#171](https://github.com/enzymejs/enzyme/pull/171))
### Patches
- Prevent null or false nodes from being passed into tree traversal ([#174](https://github.com/enzymejs/enzyme/pull/174))
- setProps no longer swallows exceptions ([#170](https://github.com/enzymejs/enzyme/pull/170))
- `.type()` and `.props()` should not fail on null now ([#162](https://github.com/enzymejs/enzyme/pull/162))
## 1.5.0 (February 2, 2016)
### Minor Changes
- Add `attachTo` option to `mount` to mount to a specific element ([#160](https://github.com/enzymejs/enzyme/pull/160))
- Add `.debug()` method to `ReactWrapper` ([#158](https://github.com/enzymejs/enzyme/pull/158))
- Add `.mount()` and `.unmount()` APIs to `ReactWrapper` ([#155](https://github.com/enzymejs/enzyme/pull/155))
- Add `.render()` method to `ReactWrapper` ([#156](https://github.com/enzymejs/enzyme/pull/156))
- Allow `.contains()` to accept an array of nodes ([#154](https://github.com/enzymejs/enzyme/pull/154))
- Add `.context()` method to `ReactWrapper` and `ShallowWrapper` ([#152](https://github.com/enzymejs/enzyme/pull/152))
### Patches
- Fixed some behavior with `.contains()` matching on strings ([#148](https://github.com/enzymejs/enzyme/pull/148))
- Fixed `.debug()`'s output for numeric children ([#149](https://github.com/enzymejs/enzyme/pull/149))
- Documentation fixes
- Update versions of dependencies
## 1.4.1 (January 24, 2016)
### Patches
- Upgrade to babel 6 ([#81](https://github.com/enzymejs/enzyme/pull/81))
- Fix event naming bug in ShallowWrapper ([#135](https://github.com/enzymejs/enzyme/pull/135))
- Documentation fixes
## 1.4.0 (January 21, 2016)
### Minor Changes
- `describeWithDOM` enhancement ([#126](https://github.com/enzymejs/enzyme/pull/126))
- add `.equals()` method to `ShallowWrapper` ([#124](https://github.com/enzymejs/enzyme/pull/124))
- add object selector syntax ([#110](https://github.com/enzymejs/enzyme/pull/110))
### Patches
- Fixed confusing behavior of prop selector syntax ([#130](https://github.com/enzymejs/enzyme/pull/130))
- Documentation fixes
## 1.3.1 (January 15, 2016)
### Patches
- Fix setProps not passing old context ([#121](https://github.com/enzymejs/enzyme/pull/121))
- Map lowercase mouse events in simulate ([#77](https://github.com/enzymejs/enzyme/pull/77))
## 1.3.0 (January 13, 2016)
### Minor Changes
- Added `.html()` method to `ReactWrapper` ([#71](https://github.com/enzymejs/enzyme/pull/71))
- Support property selector (i.e. `[prop="foo"]`) ([#70](https://github.com/enzymejs/enzyme/pull/70))
- jsdom dependency now allows a range of supported versions ([#95](https://github.com/enzymejs/enzyme/pull/95))
### Patches
- Normalized `setProps()` behavior between `mount`/`shallow` to merge props ([#103](https://github.com/enzymejs/enzyme/pull/103))
- Exclude `_book` from published package ([#85](https://github.com/enzymejs/enzyme/pull/85))
- Various documentation, tests, and style changes
## 1.2.0 (December 10, 2015)
### Minor Changes
- Support for context ([#62](https://github.com/enzymejs/enzyme/pull/62))
### Patches
- `nodeHasId` fix for some 0.14 corner cases ([#65](https://github.com/enzymejs/enzyme/pull/65))
## 1.1.0 (December 7, 2015)
### Minor Changes
- Support for Stateless Functional Components ([#53](https://github.com/enzymejs/enzyme/pull/53))
### Patches
- Tweak `describeWithDOM` messaging ([#48](https://github.com/enzymejs/enzyme/pull/48))
- Documentation Fixes
## 1.0.0 (December 3, 2015)
- Official Release!
================================================
FILE: CONTRIBUTING.md
================================================
# Contributing Guide
Contributions are welcome and are greatly appreciated! Every little bit helps, and credit will
always be given.
## Setting up your environment
After forking enzyme to your own github org, do the following steps to get started:
```bash
# clone your fork to your local machine
git clone https://github.com/enzymejs/enzyme.git
# step into local repo
cd enzyme
# install dependencies (use `react 13` if you want to use React 0.13)
npm install
# install react version
# accepts `13` for v0.13, `14` for v0.14, and for versions 15+,
# accepts either a major (`15`, `16`) or a minor (`15.4`, `16.8`)
npm run react 16
```
### Switching between React 16, React 15, React 0.14 and React 0.13
```bash
# switch to React 0.13
npm run react 13
```
```bash
# switch to React 0.14
npm run react 14
```
```bash
# switch to React 15
npm run react 15
```
```bash
# switch to React 16
npm run react 16
```
Specific versions can also be specified
```bash
# switch to React 16.5
npm run react 16.5
```
### Running Tests
The test suite runs on *built* Enzyme.
```bash
# build Enzyme locally before testing
npm run build
# run tests on whatever version of React is currently installed
npm test
```
```bash
# run tests on all supported versions of React
npm run test:all
```
If you are actively developing, Enzyme will always need to be built with the latest changes.
For this, the recommended workflow is to have the build and tests watching for changes in separate terminals. This should provide you with ~realtime feedback:
```bash
# build Enzyme locally upon save
npm run build:watch
# faster feedback for TDD
npm run test:watch
```
### Tests for functionality shared between `shallow` and `mount`
Tests 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:
- `Wrap`: e.g. `shallow`, `mount`
- `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.
- `Wrapper`: e.g. `ShallowWrapper`, `ReactWrapper`
- `WrapperName`: e.g. `"ShallowWrapper"`, `"ReactWrapper"`
- `isShallow`: true if `shallow`. note: needing to use this is a code smell, please avoid.
- `isMount`: true if `mount`. note: needing to use this is a code smell, please avoid.
- `makeDOMElement`: in `mount`, makes a real DOM element; in `shallow`, makes a mock object.
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.
### Style & Linting
This codebase adheres to the [Airbnb Styleguide](https://github.com/airbnb/javascript) and is
enforced using [ESLint](https://eslint.org).
As 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).
It is recommended that you install an ESLint plugin for your editor of choice when working on this
codebase, however you can always check to see if the source code is compliant by running:
```bash
# build Enzyme locally before linting
npm run build
npm run lint
```
### Publishing
Enzyme uses [lerna](https://github.com/lerna/lerna) to structure its repo, and has multiple packages
to publish out of this one repo. We use lerna's "independent" mode, which means that the versioning
of each package in the repo is versioned independently.
We are waiting on [this issue](https://github.com/lerna/lerna/issues/955) to be fixed, so that
`peerDependencies` do not get updated with patch updates.
Until this issue is fixed, we will publish each package manually instead of with `lerna publish`. In
order to do this, we will:
For enzyme:
```bash
# ... update version in enzyme/package.json, make changes to CHANGELOG, etc.
cd packages/enzyme
git commit -m v{version}
git tag -a -m v{version}
git push --follow-tags
npm publish
```
For other packages
```bash
# ... update version in {package}/package.json, make changes to CHANGELOG, etc.
cd packages/{package}
git commit -m "{package}: v{version}"
git tag -a -m "{package}: v{version}"
git push --follow-tags
npm publish
```
Once we are able to use `lerna publish`, the process will be as follows:
Lerna by default will only publish packages that have changed since the last release. It will also
create a tagged commit for each release.
To publish, run:
```bash
lerna publish -m "{tag name}"
```
The tag name is determined by the `-m` CLI option. If `enzyme` is one of the packages that has
updates, we default to just using that version as the tag name. For instance, when publishing
`enzyme@3.1.1` and `enzyme-adapter-react-16@1.2.3` we would run:
```bash
lerna publish -m "v3.1.1"
```
If `enzyme` is *not* one of the packages being updated, use the other package's name and the version:
```bash
lerna publish -m "enzyme-adapter-react-16: v1.2.3"
```
The `lerna publish` command will present interactive prompts asking which version to use for each
package independently. Just choose whichever
### Building Docs
Building the docs locally is extremely simple. First execute the following command:
```bash
npm run docs:watch
```
After this, you can open up your browser to the specified port (usually http://localhost:4000 )
The browser will automatically refresh when there are changes to any of the source files.
## Pull Request Guidelines
Before you submit a pull request from your forked repo, check that it meets these guidelines:
1. If the pull request fixes a bug, it should include tests that fail without the changes, and pass
with them.
1. If the pull request adds functionality, the docs should be updated as part of the same PR.
1. The pull request should work for React 15, React 0.14 and React 0.13. The CI server should run the
tests in all versions automatically when you push the PR, but if you'd like to check locally, you
can do so (see above).
1. Please rebase and resolve all conflicts before submitting.
================================================
FILE: INTHEWILD.md
================================================
Please use [pull requests](https://github.com/enzymejs/enzyme/pull/new/master) to add your organization and/or project to this document!
Organizations
----------
- [Airbnb](https://github.com/airbnb)
- [Cerner](https://github.com/cerner)
- [OpenGov](https://github.com/opengov)
- [Pinterest](https://github.com/pinterest)
- [Product Hunt](https://github.com/producthunt)
- [Walmart Labs](https://github.com/walmartlabs)
- [Hudl](http://hudl.github.io/)
- [NET-A-PORTER](https://github.com/NET-A-PORTER)
- [Rangle.io](https://github.com/rangle)
- [GoDaddy](https://github.com/godaddy)
- [Airware](https://github.com/airware)
- [Flatiron School](https://github.com/flatiron-labs)
- [Outreach.io](https://github.com/getoutreach)
- [crowdSPRING](https://crowdspring.com)
- [nteract](https://nteract.io)
- [Brave](https://brave.com)
- [Simple](https://github.com/simplefinance)
- [Grab](https://github.com/grab)
- [Megalytic](https://megalytic.com/)
- [Chroma](https://www.chromatic.com)
- [Mavens](https://github.com/mavens)
- [Cucumber](https://cucumber.io)
- [Genoa Telepsychiatry](https://genoatelepsychiatry.com)
- [IBM X-Force Exchange](https://exchange.xforce.ibmcloud.com)
- [Zendesk](https://zendesk.com/)
- [idealo](https://www.idealo.de/)
- [LendingHome](https://www.lendinghome.com)
- [Diffia](https://diffia.com)
- [MinuteMedia](https://www.minutemedia.com)
- [Webex Teams](https://www.webex.com/team-collaboration.html)
- [reformma](https://www.reformma.com)
Projects
----------
- [Rheostat](https://github.com/airbnb/rheostat)
- [React Boilerplate](https://github.com/mxstbr/react-boilerplate/tree/v3.0.0)
- [Reactstrap](https://github.com/reactstrap/reactstrap)
- [Recompose](https://github.com/acdlite/recompose)
- [Reapop](https://github.com/LouisBarranqueiro/reapop)
- [React Dates](https://github.com/airbnb/react-dates)
- [nteract notebook](https://github.com/nteract/nteract)
================================================
FILE: LICENSE.md
================================================
The MIT License (MIT)
Copyright (c) 2015 Airbnb, Inc. and contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: MAINTAINERS
================================================
ljharb
lelandrichardson
blainekasten
Aweary
nfcampos
================================================
FILE: README.md
================================================
Enzyme
=======
[](https://gitter.im/enzymejs/enzyme?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[](https://www.npmjs.com/package/enzyme) [](https://github.com/enzymejs/enzyme/blob/master/LICENSE.md) [](https://travis-ci.org/enzymejs/enzyme) [](https://codecov.io/gh/enzymejs/enzyme/branch/master)
Enzyme is a JavaScript Testing utility for React that makes it easier to test your React Components' output.
You can also manipulate, traverse, and in some ways simulate runtime given the output.
Enzyme's API is meant to be intuitive and flexible by mimicking jQuery's API for DOM manipulation
and traversal.
Upgrading from Enzyme 2.x or React < 16
===========
Are you here to check whether or not Enzyme is compatible with React 16? Are you currently using
Enzyme 2.x? Great! Check out our [migration guide](/docs/guides/migration-from-2-to-3.md) for help
moving on to Enzyme v3 where React 16 is supported.
### [Installation](/docs/installation/README.md)
To get started with enzyme, you can simply install it via npm. You will need to install enzyme
along with an Adapter corresponding to the version of react (or other UI Component library) you
are using. For instance, if you are using enzyme with React 16, you can run:
```bash
npm i --save-dev enzyme enzyme-adapter-react-16
```
Each adapter may have additional peer dependencies which you will need to install as well. For instance,
`enzyme-adapter-react-16` has peer dependencies on `react` and `react-dom`.
At the moment, Enzyme has adapters that provide compatibility with `React 16.x`, `React 15.x`,
`React 0.14.x` and `React 0.13.x`.
The following adapters are officially provided by enzyme, and have the following compatibility with
React:
| Enzyme Adapter Package | React semver compatibility |
| --- | --- |
| `enzyme-adapter-react-16` | `^16.4.0-0` |
| `enzyme-adapter-react-16.3` | `~16.3.0-0` |
| `enzyme-adapter-react-16.2` | `~16.2` |
| `enzyme-adapter-react-16.1` | <code>~16.0.0-0 || ~16.1</code> |
| `enzyme-adapter-react-15` | `^15.5.0` |
| `enzyme-adapter-react-15.4` | `15.0.0-0 - 15.4.x` |
| `enzyme-adapter-react-14` | `^0.14.0` |
| `enzyme-adapter-react-13` | `^0.13.0` |
Finally, you need to configure enzyme to use the adapter you want it to use. To do this, you can use
the top level `configure(...)` API.
```js
import Enzyme from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
Enzyme.configure({ adapter: new Adapter() });
```
3rd Party Adapters
=============
It is possible for the community to create additional (non-official) adapters that will make enzyme
work with other libraries. If you have made one and it's not included in the list below, feel free
to make a PR to this README and add a link to it! The known 3rd party adapters are:
| Adapter Package | For Library | Status |
| --- | --- | --- |
| [`enzyme-adapter-preact-pure`](https://github.com/preactjs/enzyme-adapter-preact-pure) | [`preact`](https://github.com/developit/preact) | (stable) |
|[`enzyme-adapter-inferno`](https://github.com/bbc/enzyme-adapter-inferno)|[`inferno`](https://github.com/infernojs/inferno)|(work in progress)|
Running Enzyme Tests
===========
Enzyme is unopinionated regarding which test runner or assertion library you use, and should be
compatible with all major test runners and assertion libraries out there. The documentation and
examples for enzyme use [Mocha](https://mochajs.org) and [Chai](https://chaijs.com), but you
should be able to extrapolate to your framework of choice.
If you are interested in using enzyme with custom assertions and convenience functions for
testing your React components, you can consider using:
* [`chai-enzyme`](https://github.com/producthunt/chai-enzyme) with Mocha/Chai.
* [`jasmine-enzyme`](https://github.com/FormidableLabs/enzyme-matchers/tree/master/packages/jasmine-enzyme) with Jasmine.
* [`jest-enzyme`](https://github.com/FormidableLabs/enzyme-matchers/tree/master/packages/jest-enzyme) with Jest.
* [`should-enzyme`](https://github.com/rkotze/should-enzyme) for should.js.
* [`expect-enzyme`](https://github.com/PsychoLlama/expect-enzyme) for expect.
[Using Enzyme with Mocha](/docs/guides/mocha.md)
[Using Enzyme with Karma](/docs/guides/karma.md)
[Using Enzyme with Browserify](/docs/guides/browserify.md)
[Using Enzyme with SystemJS](/docs/guides/systemjs.md)
[Using Enzyme with Webpack](/docs/guides/webpack.md)
[Using Enzyme with JSDOM](/docs/guides/jsdom.md)
[Using Enzyme with React Native](/docs/guides/react-native.md)
[Using Enzyme with Jest](/docs/guides/jest.md)
[Using Enzyme with Lab](/docs/guides/lab.md)
[Using Enzyme with Tape and AVA](/docs/guides/tape-ava.md)
Basic Usage
===========
## [Shallow Rendering](/docs/api/shallow.md)
```javascript
import React from 'react';
import { expect } from 'chai';
import { shallow } from 'enzyme';
import sinon from 'sinon';
import MyComponent from './MyComponent';
import Foo from './Foo';
describe('<MyComponent />', () => {
it('renders three <Foo /> components', () => {
const wrapper = shallow(<MyComponent />);
expect(wrapper.find(Foo)).to.have.lengthOf(3);
});
it('renders an `.icon-star`', () => {
const wrapper = shallow(<MyComponent />);
expect(wrapper.find('.icon-star')).to.have.lengthOf(1);
});
it('renders children when passed in', () => {
const wrapper = shallow((
<MyComponent>
<div className="unique" />
</MyComponent>
));
expect(wrapper.contains(<div className="unique" />)).to.equal(true);
});
it('simulates click events', () => {
const onButtonClick = sinon.spy();
const wrapper = shallow(<Foo onButtonClick={onButtonClick} />);
wrapper.find('button').simulate('click');
expect(onButtonClick).to.have.property('callCount', 1);
});
});
```
Read the full [API Documentation](/docs/api/shallow.md)
## [Full DOM Rendering](/docs/api/mount.md)
```javascript
import React from 'react';
import sinon from 'sinon';
import { expect } from 'chai';
import { mount } from 'enzyme';
import Foo from './Foo';
describe('<Foo />', () => {
it('allows us to set props', () => {
const wrapper = mount(<Foo bar="baz" />);
expect(wrapper.props().bar).to.equal('baz');
wrapper.setProps({ bar: 'foo' });
expect(wrapper.props().bar).to.equal('foo');
});
it('simulates click events', () => {
const onButtonClick = sinon.spy();
const wrapper = mount((
<Foo onButtonClick={onButtonClick} />
));
wrapper.find('button').simulate('click');
expect(onButtonClick).to.have.property('callCount', 1);
});
it('calls componentDidMount', () => {
sinon.spy(Foo.prototype, 'componentDidMount');
const wrapper = mount(<Foo />);
expect(Foo.prototype.componentDidMount).to.have.property('callCount', 1);
Foo.prototype.componentDidMount.restore();
});
});
```
Read the full [API Documentation](/docs/api/mount.md)
## [Static Rendered Markup](/docs/api/render.md)
```javascript
import React from 'react';
import { expect } from 'chai';
import { render } from 'enzyme';
import Foo from './Foo';
describe('<Foo />', () => {
it('renders three `.foo-bar`s', () => {
const wrapper = render(<Foo />);
expect(wrapper.find('.foo-bar')).to.have.lengthOf(3);
});
it('renders the title', () => {
const wrapper = render(<Foo title="unique" />);
expect(wrapper.text()).to.contain('unique');
});
});
```
Read the full [API Documentation](/docs/api/render.md)
### React Hooks support
Enzyme 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:
* `useEffect()` and `useLayoutEffect()` don't get called in the React shallow renderer. [Related issue](https://github.com/facebook/react/issues/15275)
* `useCallback()` doesn't memoize callback in React shallow renderer. [Related issue](https://github.com/facebook/react/issues/15774)
#### [`ReactTestUtils.act()`](https://reactjs.org/docs/test-utils.html#act) wrap
If 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.
A common pattern to trigger handlers with `.act()` and assert is:
```javascript
const wrapper = mount(<SomeComponent />);
act(() => wrapper.prop('handler')());
wrapper.update();
expect(/* ... */);
```
We cannot wrap the result of `.prop()` (or `.props()`) with `.act()` in Enzyme internally since it will break the equality of the returned value.
However, you could use `.invoke()` to simplify the code:
```javascript
const wrapper = mount(<SomeComponent />);
wrapper.invoke('handler')();
expect(/* ... */);
```
### Future
[Enzyme Future](/docs/future.md)
### Contributing
See the [Contributors Guide](/CONTRIBUTING.md)
### In the wild
Organizations and projects using `enzyme` can list themselves [here](INTHEWILD.md).
### License
[MIT](/LICENSE.md)
================================================
FILE: SUMMARY.md
================================================
## Table of Contents
* [Introduction](/README.md)
* [Guides](/docs/guides.md)
* [Migration from 2.x to 3.x](/docs/guides/migration-from-2-to-3.md)
* [Browserify](/docs/guides/browserify.md)
* [SystemJS](/docs/guides/systemjs.md)
* [Webpack](/docs/guides/webpack.md)
* [JSDOM](/docs/guides/jsdom.md)
* [Jest](/docs/guides/jest.md)
* [Karma](/docs/guides/karma.md)
* [Mocha](/docs/guides/mocha.md)
* [React Native](/docs/guides/react-native.md)
* [Lab](/docs/guides/lab.md)
* [Tape and AVA](/docs/guides/tape-ava.md)
* [Installation](/docs/installation/README.md)
* [Working with React 16.x](/docs/installation/react-16.md)
* [Working with React 15.x](/docs/installation/react-15.md)
* [Working with React 0.14.x](/docs/installation/react-014.md)
* [Working with React 0.13.x](/docs/installation/react-013.md)
* [API Reference](/docs/api/README.md)
* [Shallow Rendering](/docs/api/shallow.md)
* [at(index)](/docs/api/ShallowWrapper/at.md)
* [childAt()](/docs/api/ShallowWrapper/childAt.md)
* [children()](/docs/api/ShallowWrapper/children.md)
* [closest(selector)](/docs/api/ShallowWrapper/closest.md)
* [contains(nodeOrNodes)](/docs/api/ShallowWrapper/contains.md)
* [containsAllMatchingElements(nodes)](/docs/api/ShallowWrapper/containsAllMatchingElements.md)
* [containsAnyMatchingElements(nodes)](/docs/api/ShallowWrapper/containsAnyMatchingElements.md)
* [containsMatchingElement(node)](/docs/api/ShallowWrapper/containsMatchingElement.md)
* [context([key])](/docs/api/ShallowWrapper/context.md)
* [debug()](/docs/api/ShallowWrapper/debug.md)
* [dive()](/docs/api/ShallowWrapper/dive.md)
* [equals(node)](/docs/api/ShallowWrapper/equals.md)
* [every(selector)](/docs/api/ShallowWrapper/every.md)
* [everyWhere(predicate)](/docs/api/ShallowWrapper/everyWhere.md)
* [exists([selector])](/docs/api/ShallowWrapper/exists.md)
* [filter(selector)](/docs/api/ShallowWrapper/filter.md)
* [filterWhere(predicate)](/docs/api/ShallowWrapper/filterWhere.md)
* [find(selector)](/docs/api/ShallowWrapper/find.md)
* [findWhere(predicate)](/docs/api/ShallowWrapper/findWhere.md)
* [first()](/docs/api/ShallowWrapper/first.md)
* [forEach(fn)](/docs/api/ShallowWrapper/forEach.md)
* [get(index)](/docs/api/ShallowWrapper/get.md)
* [getWrappingComponent()](/docs/api/ShallowWrapper/getWrappingComponent.md)
* [getElement(index)](/docs/api/ShallowWrapper/getElement.md)
* [getElements(index)](/docs/api/ShallowWrapper/getElements.md)
* [hasClass(className)](/docs/api/ShallowWrapper/hasClass.md)
* [hostNodes()](/docs/api/ShallowWrapper/hostNodes.md)
* [html()](/docs/api/ShallowWrapper/html.md)
* [instance()](/docs/api/ShallowWrapper/instance.md)
* [invoke(propName)](/docs/api/ShallowWrapper/invoke.md)
* [is(selector)](/docs/api/ShallowWrapper/is.md)
* [isEmpty()](/docs/api/ShallowWrapper/isEmpty.md)
* [isEmptyRender()](/docs/api/ShallowWrapper/isEmptyRender.md)
* [key()](/docs/api/ShallowWrapper/key.md)
* [last()](/docs/api/ShallowWrapper/last.md)
* [map(fn)](/docs/api/ShallowWrapper/map.md)
* [matchesElement(node)](/docs/api/ShallowWrapper/matchesElement.md)
* [name()](/docs/api/ShallowWrapper/name.md)
* [not(selector)](/docs/api/ShallowWrapper/not.md)
* [parent()](/docs/api/ShallowWrapper/parent.md)
* [parents()](/docs/api/ShallowWrapper/parents.md)
* [prop(key)](/docs/api/ShallowWrapper/prop.md)
* [props()](/docs/api/ShallowWrapper/props.md)
* [reduce(fn[, initialValue])](/docs/api/ShallowWrapper/reduce.md)
* [reduceRight(fn[, initialValue])](/docs/api/ShallowWrapper/reduceRight.md)
* [render()](/docs/api/ShallowWrapper/render.md)
* [renderProp(key)](/docs/api/ShallowWrapper/renderProp.md)
* [setContext(context)](/docs/api/ShallowWrapper/setContext.md)
* [setProps(nextProps)](/docs/api/ShallowWrapper/setProps.md)
* [setState(nextState[, callback])](/docs/api/ShallowWrapper/setState.md)
* [shallow([options])](/docs/api/ShallowWrapper/shallow.md)
* [simulate(event[, data])](/docs/api/ShallowWrapper/simulate.md)
* [simulateError(error)](/docs/api/ShallowWrapper/simulateError.md)
* [slice([begin[, end]])](/docs/api/ShallowWrapper/slice.md)
* [some(selector)](/docs/api/ShallowWrapper/some.md)
* [someWhere(predicate)](/docs/api/ShallowWrapper/someWhere.md)
* [state([key])](/docs/api/ShallowWrapper/state.md)
* [tap(intercepter)](/docs/api/ShallowWrapper/tap.md)
* [text()](/docs/api/ShallowWrapper/text.md)
* [type()](/docs/api/ShallowWrapper/type.md)
* [unmount()](/docs/api/ShallowWrapper/unmount.md)
* [update()](/docs/api/ShallowWrapper/update.md)
* [Full DOM Rendering](/docs/api/mount.md)
* [at(index)](/docs/api/ReactWrapper/at.md)
* [childAt()](/docs/api/ReactWrapper/childAt.md)
* [children()](/docs/api/ReactWrapper/children.md)
* [contains(nodeOrNodes)](/docs/api/ReactWrapper/contains.md)
* [containsAllMatchingElements(nodes)](/docs/api/ReactWrapper/containsAllMatchingElements.md)
* [containsAnyMatchingElements(nodes)](/docs/api/ReactWrapper/containsAnyMatchingElements.md)
* [containsMatchingElement(node)](/docs/api/ReactWrapper/containsMatchingElement.md)
* [closest(selector)](/docs/api/ReactWrapper/closest.md)
* [context([key])](/docs/api/ReactWrapper/context.md)
* [debug()](/docs/api/ReactWrapper/debug.md)
* [detach()](/docs/api/ReactWrapper/detach.md)
* [equals(node)](/docs/api/ReactWrapper/equals.md)
* [every(selector)](/docs/api/ReactWrapper/every.md)
* [everyWhere(predicate)](/docs/api/ReactWrapper/everyWhere.md)
* [exists([selector])](/docs/api/ReactWrapper/exists.md)
* [filter(selector)](/docs/api/ReactWrapper/filter.md)
* [filterWhere(predicate)](/docs/api/ReactWrapper/filterWhere.md)
* [find(selector)](/docs/api/ReactWrapper/find.md)
* [findWhere(predicate)](/docs/api/ReactWrapper/findWhere.md)
* [first()](/docs/api/ReactWrapper/first.md)
* [forEach(fn)](/docs/api/ReactWrapper/forEach.md)
* [get(index)](/docs/api/ReactWrapper/get.md)
* [getDOMNode()](/docs/api/ReactWrapper/getDOMNode.md)
* [getWrappingComponent()](/docs/api/ReactWrapper/getWrappingComponent.md)
* [hasClass(className)](/docs/api/ReactWrapper/hasClass.md)
* [hostNodes()](/docs/api/ReactWrapper/hostNodes.md)
* [html()](/docs/api/ReactWrapper/html.md)
* [instance()](/docs/api/ReactWrapper/instance.md)
* [invoke(propName)](/docs/api/ReactWrapper/invoke.md)
* [is(selector)](/docs/api/ReactWrapper/is.md)
* [isEmpty()](/docs/api/ReactWrapper/isEmpty.md)
* [isEmptyRender()](/docs/api/ReactWrapper/isEmptyRender.md)
* [key()](/docs/api/ReactWrapper/key.md)
* [last()](/docs/api/ReactWrapper/last.md)
* [map(fn)](/docs/api/ReactWrapper/map.md)
* [matchesElement(node)](/docs/api/ReactWrapper/matchesElement.md)
* [mount()](/docs/api/ReactWrapper/mount.md)
* [name()](/docs/api/ReactWrapper/name.md)
* [not(selector)](/docs/api/ReactWrapper/not.md)
* [parent()](/docs/api/ReactWrapper/parent.md)
* [parents()](/docs/api/ReactWrapper/parents.md)
* [prop(key)](/docs/api/ReactWrapper/prop.md)
* [props()](/docs/api/ReactWrapper/props.md)
* [reduce(fn[, initialValue])](/docs/api/ReactWrapper/reduce.md)
* [reduceRight(fn[, initialValue])](/docs/api/ReactWrapper/reduceRight.md)
* [ref(refName)](/docs/api/ReactWrapper/ref.md)
* [render()](/docs/api/ReactWrapper/render.md)
* [renderProp(key)](/docs/api/ReactWrapper/renderProp.md)
* [setContext(context)](/docs/api/ReactWrapper/setContext.md)
* [setProps(nextProps[, callback])](/docs/api/ReactWrapper/setProps.md)
* [setState(nextState[, callback])](/docs/api/ReactWrapper/setState.md)
* [simulate(event[, data])](/docs/api/ReactWrapper/simulate.md)
* [simulateError(error)](/docs/api/ReactWrapper/simulateError.md)
* [slice([begin[, end]])](/docs/api/ReactWrapper/slice.md)
* [some(selector)](/docs/api/ReactWrapper/some.md)
* [someWhere(predicate)](/docs/api/ReactWrapper/someWhere.md)
* [state([key])](/docs/api/ReactWrapper/state.md)
* [tap(intercepter)](/docs/api/ReactWrapper/tap.md)
* [text()](/docs/api/ReactWrapper/text.md)
* [type()](/docs/api/ReactWrapper/type.md)
* [unmount()](/docs/api/ReactWrapper/unmount.md)
* [update()](/docs/api/ReactWrapper/update.md)
* [Static Rendering](/docs/api/render.md)
* [Selectors](/docs/api/selector.md)
* [Change Log](/CHANGELOG.md)
* [Future](/docs/future.md)
* [Contributing Guide](/CONTRIBUTING.md)
================================================
FILE: book.json
================================================
{
"gitbook": "3.2.2",
"title": "Enzyme",
"description": "React Testing",
"plugins": [
"edit-link",
"github",
"-search",
"codeblock-disable-glossary",
"collapsible-menu",
"anchors"
],
"pluginsConfig": {
"edit-link": {
"base": "https://github.com/enzymejs/enzyme/tree/master",
"label": "Edit This Page"
},
"github": {
"url": "https://github.com/enzymejs/enzyme/"
}
}
}
================================================
FILE: docs/GLOSSARY.md
================================================
# selector
A Selector in enzyme is similar to a CSS selector, but can be a number of other things as well in
order to easily specify a criteria by which you want to find nodes in an enzyme wrapper. See the
[Selector page](/docs/api/selector.md) for more information.
# wrapper
A wrapper refers to the enzyme wrapper class that provides the API.
# predicate
A function that returns true or false
================================================
FILE: docs/api/README.md
================================================
# API Reference
### [Shallow Rendering](shallow.md)
```jsx
import { shallow } from 'enzyme';
const wrapper = shallow(<MyComponent />);
// ...
```
### [Full Rendering](mount.md)
```jsx
import { mount } from 'enzyme';
const wrapper = mount(<MyComponent />);
// ...
```
### [Static Rendering](render.md)
```jsx
import { render } from 'enzyme';
const wrapper = render(<MyComponent />);
// ...
```
================================================
FILE: docs/api/ReactWrapper/at.md
================================================
# `.at(index) => ReactWrapper`
Returns a wrapper around the node at a given index of the current wrapper.
#### Arguments
1. `index` (`Number`): A zero-based integer indicating which node to retrieve.
#### Returns
`ReactWrapper`: A new wrapper that wraps the retrieved node.
#### Examples
```jsx
const wrapper = mount(<MyComponent />);
expect(wrapper.find(Foo).at(0).props().foo).to.equal('bar');
```
#### Related Methods
- [`.get(index) => ReactElement`](get.md) - same, but returns the React node itself, with no wrapper.
- [`.first() => ReactWrapper`](first.md) - same as at(0)
- [`.last() => ReactWrapper`](last.md)
================================================
FILE: docs/api/ReactWrapper/childAt.md
================================================
# `.childAt(index) => ReactWrapper`
Returns a new wrapper with child at the specified index.
#### Arguments
1. `index` (`number`): A zero-based integer indicating which node to retrieve.
#### Returns
`ReactWrapper`: A new wrapper that wraps the resulting node.
#### Examples
```jsx
const wrapper = mount(<ToDoList items={items} />);
expect(wrapper.find('ul').childAt(0).type()).to.equal('li');
```
#### Related Methods
- [`.parents([selector]) => ReactWrapper`](parents.md)
- [`.parent() => ReactWrapper`](parent.md)
- [`.closest(selector) => ReactWrapper`](closest.md)
- [`.children([selector]) => ReactWrapper`](children.md)
================================================
FILE: docs/api/ReactWrapper/children.md
================================================
# `.children([selector]) => ReactWrapper`
Returns a new wrapper with all of the children of the node(s) in the current wrapper. Optionally, a
selector can be provided and it will filter the children by this selector
#### Arguments
1. `selector` ([`EnzymeSelector`](../selector.md) [optional]): A selector to filter the children by.
#### Returns
`ReactWrapper`: A new wrapper that wraps the resulting nodes.
#### Examples
```jsx
const wrapper = mount(<ToDoList items={items} />);
expect(wrapper.find('ul').children()).to.have.lengthOf(items.length);
```
#### Related Methods
- [`.parents([selector]) => ReactWrapper`](parents.md)
- [`.parent() => ReactWrapper`](parent.md)
- [`.closest(selector) => ReactWrapper`](closest.md)
================================================
FILE: docs/api/ReactWrapper/closest.md
================================================
# `.closest(selector) => ReactWrapper`
Returns a wrapper of the first element that matches the selector by traversing up through the
wrapped node's ancestors in the tree, starting with itself. It must be a single-node wrapper.
#### Arguments
1. `selector` ([`EnzymeSelector`](../selector.md)): The selector to match.
#### Returns
`ReactWrapper`: A new wrapper that wraps the resulting node.
#### Examples
```jsx
const wrapper = mount(<MyComponent />);
expect(wrapper.find(Foo).closest('.bar')).to.have.lengthOf(1);
```
#### Related Methods
- [`.children([selector]) => ReactWrapper`](children.md)
- [`.parent() => ReactWrapper`](parent.md)
- [`.parents([selector]) => ReactWrapper`](parents.md)
================================================
FILE: docs/api/ReactWrapper/contains.md
================================================
# `.contains(nodeOrNodes) => Boolean`
Returns whether or not all given react elements match elements in the render tree.
It 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.
#### Arguments
1. `nodeOrNodes` (`ReactElement|Array<ReactElement>`): The node or array of nodes whose presence you are detecting in the current instance's
render tree.
#### Returns
`Boolean`: whether or not the current wrapper has nodes anywhere in its render tree that match
the ones passed in.
#### Example
```jsx
const wrapper = mount((
<div>
<div data-foo="foo" data-bar="bar">Hello</div>
</div>
));
expect(wrapper.contains(<div data-foo="foo" data-bar="bar">Hello</div>)).to.equal(true);
expect(wrapper.contains(<div data-foo="foo">Hello</div>)).to.equal(false);
expect(wrapper.contains(<div data-foo="foo" data-bar="bar" data-baz="baz">Hello</div>)).to.equal(false);
expect(wrapper.contains(<div data-foo="foo" data-bar="Hello">Hello</div>)).to.equal(false);
expect(wrapper.contains(<div data-foo="foo" data-bar="bar" />)).to.equal(false);
```
```jsx
const wrapper = mount((
<div>
<span>Hello</span>
<div>Goodbye</div>
<span>Again</span>
</div>
));
expect(wrapper.contains([
<span>Hello</span>,
<div>Goodbye</div>,
])).to.equal(true);
expect(wrapper.contains([
<span>Hello</span>,
<div>World</div>,
])).to.equal(false);
```
#### Common Gotchas
- `.contains()` expects a ReactElement, not a selector (like many other methods). Make sure that
when you are calling it you are calling it with a ReactElement or a JSX expression.
- Keep in mind that this method determines equality based on the equality of the node's children as
well.
- 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.
================================================
FILE: docs/api/ReactWrapper/containsAllMatchingElements.md
================================================
# `.containsAllMatchingElements(patternNodes) => Boolean`
Returns 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`.
#### Arguments
1. `patternNodes` (`Array<ReactElement>`): The array of nodes whose presence you are detecting in the current instance's
render tree.
#### Returns
`Boolean`: whether or not the current wrapper has nodes anywhere in its render tree that looks
like the nodes passed in.
#### Example
```jsx
const style = { fontSize: 13 };
const wrapper = mount((
<div>
<span className="foo">Hello</span>
<div style={style}>Goodbye</div>
<span>Again</span>
</div>
));
expect(wrapper.containsAllMatchingElements([
<span>Hello</span>,
<div>Goodbye</div>,
])).to.equal(true);
```
#### Common Gotchas
- `.containsAllMatchingElements()` expects an array of ReactElement, not a selector (like many other methods). Make sure that
when you are calling it you are calling it with an array of ReactElement or a JSX expression.
- Keep in mind that this method determines matching based on the matching of the node's children as
well.
#### Related Methods
- [`.matchesElement() => ReactWrapper`](matchesElement.md) - rules for matching each node
- [`.containsMatchingElement() => ReactWrapper`](containsMatchingElement.md) - rules for matching whole wrapper
- [`.containsAnyMatchingElements() => ReactWrapper`](containsAnyMatchingElements.md) - must match at least one in patternNodes
================================================
FILE: docs/api/ReactWrapper/containsAnyMatchingElements.md
================================================
# `.containsAnyMatchingElements(patternNodes) => Boolean`
Returns 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`.
#### Arguments
1. `patternNodes` (`Array<ReactElement>`): The array of nodes whose presence you are detecting in the current instance's
render tree.
#### Returns
`Boolean`: whether or not the current wrapper has a node anywhere in its render tree that looks
like one of the array passed in.
#### Example
```jsx
const style = { fontSize: 13 };
const wrapper = mount((
<div>
<span className="foo">Hello</span>
<div style={style}>Goodbye</div>
<span>Again</span>
</div>
));
expect(wrapper.containsAnyMatchingElements([
<span>Bonjour</span>,
<div>Goodbye</div>,
])).to.equal(true);
```
#### Common Gotchas
- `.containsAnyMatchingElements()` expects an array of ReactElement, not a selector (like many other methods). Make sure that
when you are calling it you are calling it with an array ReactElement or a JSX expression.
- Keep in mind that this method determines equality based on the equality of the node's children as
well.
#### Related Methods
- [`.matchesElement() => ReactWrapper`](matchesElement.md) - rules for matching each node
- [`.containsMatchingElement() => ReactWrapper`](containsMatchingElement.md) - rules for matching whole wrapper
- [`.containsAllMatchingElements() => ReactWrapper`](containsAllMatchingElements.md) - must match all nodes in patternNodes
================================================
FILE: docs/api/ReactWrapper/containsMatchingElement.md
================================================
# `.containsMatchingElement(patternNode) => Boolean`
Returns whether or not a `patternNode` react element matches any element in the render tree.
* the matches can happen anywhere in the wrapper's contents
* the wrapper can contain more than one node; all are searched
Otherwise, the match follows the same rules as `matchesElement`.
#### Arguments
1. `patternNode` (`ReactElement`): The node whose presence you are detecting in the current instance's
render tree.
#### Returns
`Boolean`: whether or not the current wrapper has a node anywhere in its render tree that matches
the one passed in.
#### Example
```jsx
const wrapper = mount((
<div>
<div data-foo="foo" data-bar="bar">Hello</div>
</div>
));
expect(wrapper.containsMatchingElement(<div data-foo="foo" data-bar="bar">Hello</div>)).to.equal(true);
expect(wrapper.containsMatchingElement(<div data-foo="foo">Hello</div>)).to.equal(true);
expect(wrapper.containsMatchingElement(<div data-foo="foo" data-bar="bar" data-baz="baz">Hello</div>)).to.equal(false);
expect(wrapper.containsMatchingElement(<div data-foo="foo" data-bar="Hello">Hello</div>)).to.equal(false);
expect(wrapper.containsMatchingElement(<div data-foo="foo" data-bar="bar" />)).to.equal(false);
```
#### Common Gotchas
- `.containsMatchingElement()` expects a ReactElement, not a selector (like many other methods). Make sure that
when you are calling it you are calling it with a ReactElement or a JSX expression.
- Keep in mind that this method determines equality based on the equality of the node's children as
well.
#### Related Methods
- [`.containsAllMatchingElements() => ReactWrapper`](containsAllMatchingElements.md) - must match all nodes in patternNodes
- [`.containsAnyMatchingElements() => ReactWrapper`](containsAnyMatchingElements.md) - must match at least one in patternNodes
================================================
FILE: docs/api/ReactWrapper/context.md
================================================
# `.context([key]) => Any`
Returns the context hash for the root node of the wrapper. Optionally pass in a prop name and it
will return just that value.
#### Arguments
1. `key` (`String` [optional]): If provided, the return value will be the `this.context[key]` of the
root component instance.
#### Example
```jsx
const wrapper = mount(
<MyComponent />,
{ context: { foo: 10 } },
);
expect(wrapper.context().foo).to.equal(10);
expect(wrapper.context('foo')).to.equal(10);
```
#### Related Methods
- [`.state([key]) => Any`](state.md)
- [`.props() => Object`](props.md)
- [`.prop(key) => Any`](prop.md)
================================================
FILE: docs/api/ReactWrapper/debug.md
================================================
# `.debug([options]) => String`
Returns an HTML-like string of the wrapper for debugging purposes. Useful to print out to the
console when tests are not passing when you expect them to.
#### Arguments
`options` (`Object` [optional]):
- `options.ignoreProps`: (`Boolean` [optional]): Whether props should be omitted in the resulting string. Props are included by default.
- `options.verbose`: (`Boolean` [optional]): Whether arrays and objects passed as props should be verbosely printed.
#### Returns
`String`: The resulting string.
#### Examples
Say we have the following components:
```jsx
function Foo() {
return (
<div className="foo">
<span>Foo</span>
</div>
);
}
function Bar() {
return (
<div className="bar">
<span>Non-Foo</span>
<Foo baz="bax" object={{ a: 1, b: 2 }} />
</div>
);
}
```
In this case, running:
```jsx
console.log(mount(<Bar id="2" />).debug());
```
Would output the following to the console:
<!-- eslint-disable -->
```text
<Bar id="2">
<div className="bar">
<span>
Non-Foo
</span>
<Foo baz="bax" object={{...}}>
<div className="foo">
<span>
Foo
</span>
</div>
</Foo>
</div>
</Bar>
```
Likewise, running:
```jsx
console.log(mount(<Bar id="2" />).find(Foo).debug());
```
Would output the following to the console:
<!-- eslint-disable -->
```text
<Foo baz="bax">
<div className="foo">
<span>
Foo
</span>
</div>
</Foo>
```
and:
```jsx
console.log(mount(<Bar id="2" />).find(Foo).debug({ ignoreProps: true }));
```
Would output the following to the console:
<!-- eslint-disable -->
```text
<Foo>
<div>
<span>
Foo
</span>
</div>
</Foo>
```
and:
```jsx
console.log(mount(<Bar id="2" />).find(Foo).debug({ verbose: true }));
```
Would output the following to the console:
<!-- eslint-disable -->
```text
<Foo baz="bax" object={{ a: 1, b: 2 }}>
<div className="foo">
<span>
Foo
</span>
</div>
</Foo>
```
================================================
FILE: docs/api/ReactWrapper/detach.md
================================================
# `.detach() => void`
Detaches the react tree from the DOM. Runs `ReactDOM.unmountComponentAtNode()` under the hood.
This method will most commonly be used as a "cleanup" method if you decide to use the
`attachTo` or `hydrateIn` option in `mount(node, options)`.
The method is intentionally not "fluent" (in that it doesn't return `this`) because you should
not be doing anything with this wrapper after this method is called.
Using `attachTo`/`hydrateIn` is not generally recommended unless it is absolutely necessary to test
something. It is your responsibility to clean up after yourself at the end of the test if you do
decide to use it, though.
#### Examples
With the `attachTo` option, you can mount components to attached DOM elements:
```jsx
// render a component directly into document.body
const wrapper = mount(<Bar />, { attachTo: document.body });
// Or, with the `hydrateIn` option, you can mount components on top of existing DOM elements:
// hydrate a component directly onto document.body
const hydratedWrapper = mount(<Bar />, { hydrateIn: document.body });
// we can see that the component is rendered into the document
expect(wrapper.find('.in-bar')).to.have.lengthOf(1);
expect(document.body.childNodes).to.have.lengthOf(1);
// detach it to clean up after yourself
wrapper.detach();
// now we can see that
expect(document.body.childNodes).to.have.lengthOf(0);
```
Similarly, if you want to create some one-off elements for your test to mount into:
```jsx
// create a div in the document to mount into
const div = global.document.createElement('div');
global.document.body.appendChild(div);
// div is empty. body has the div attached.
expect(document.body.childNodes).to.have.lengthOf(1);
expect(div.childNodes).to.have.lengthOf(0);
// mount a component passing div into the `attachTo` option
const wrapper = mount(<Foo />, { attachTo: div });
// or, mount a component passing div into the `hydrateIn` option
const hydratedWrapper = mount(<Foo />, { hydrateIn: div });
// we can see now the component is rendered into the document
expect(wrapper.find('.in-foo')).to.have.lengthOf(1);
expect(document.body.childNodes).to.have.lengthOf(1);
expect(div.childNodes).to.have.lengthOf(1);
// call detach to clean up
wrapper.detach();
// div is now empty, but still attached to the document
expect(document.body.childNodes).to.have.lengthOf(1);
expect(div.childNodes).to.have.lengthOf(0);
// remove div if you want
global.document.body.removeChild(div);
expect(document.body.childNodes).to.have.lengthOf(0);
expect(div.childNodes).to.have.lengthOf(0);
```
================================================
FILE: docs/api/ReactWrapper/equals.md
================================================
# `.equals(node) => Boolean`
Returns whether or not the current wrapper root node render tree looks like the one passed in.
#### Arguments
1. `node` (`ReactElement`): The node whose presence you are detecting in the current instance's
render tree.
#### Returns
`Boolean`: whether or not the current wrapper has a node anywhere in it's render tree that looks
like the one passed in.
#### Example
```jsx
function MyComponent() {
return <div className="foo bar" />;
}
const wrapper = mount(<MyComponent />).childAt(0);
expect(wrapper.equals(<div className="foo bar" />)).to.equal(true);
```
#### Common Gotchas
- `.equals()` expects a ReactElement, not a selector (like many other methods). Make sure that
when you are calling it you are calling it with a ReactElement or a JSX expression.
- Keep in mind that this method determines equality based on the equality of the node's children as
well.
- Following React's behavior, `.equals()` ignores properties whose values are `undefined`.
================================================
FILE: docs/api/ReactWrapper/every.md
================================================
# `.every(selector) => Boolean`
Returns whether or not all of the nodes in the wrapper match the provided selector.
#### Arguments
1. `selector` ([`EnzymeSelector`](../selector.md)): The selector to match.
#### Returns
`Boolean`: True if every node in the current wrapper matched the provided selector.
#### Examples
```jsx
const wrapper = mount((
<div>
<div className="foo qoo" />
<div className="foo boo" />
<div className="foo hoo" />
</div>
));
expect(wrapper.find('.foo').every('.foo')).to.equal(true);
expect(wrapper.find('.foo').every('.qoo')).to.equal(false);
expect(wrapper.find('.foo').every('.bar')).to.equal(false);
```
#### Related Methods
- [`.someWhere(predicate) => Boolean`](someWhere.md)
- [`.everyWhere(predicate) => Boolean`](everyWhere.md)
================================================
FILE: docs/api/ReactWrapper/everyWhere.md
================================================
# `.everyWhere(fn) => Boolean`
Returns whether or not all of the nodes in the wrapper pass the provided predicate function.
#### Arguments
1. `predicate` (`ReactWrapper => Boolean`): A predicate function to match the nodes.
#### Returns
`Boolean`: True if every node in the current wrapper passed the predicate function.
#### Example
```jsx
const wrapper = mount((
<div>
<div className="foo qoo" />
<div className="foo boo" />
<div className="foo hoo" />
</div>
));
expect(wrapper.find('.foo').everyWhere((n) => n.hasClass('foo'))).to.equal(true);
expect(wrapper.find('.foo').everyWhere((n) => n.hasClass('qoo'))).to.equal(false);
expect(wrapper.find('.foo').everyWhere((n) => n.hasClass('bar'))).to.equal(false);
```
#### Related Methods
- [`.some(selector) => Boolean`](some.md)
- [`.every(selector) => Boolean`](every.md)
================================================
FILE: docs/api/ReactWrapper/exists.md
================================================
# `.exists([selector]) => Boolean`
Returns 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.
#### Arguments
1. `selector` ([`EnzymeSelector`](../selector.md) [optional]): The selector to check existence for.
#### Returns
`Boolean`: whether or not any nodes are on the list, or the selector had any matches.
#### Example
```jsx
const wrapper = mount(<div className="some-class" />);
expect(wrapper.exists('.some-class')).to.equal(true);
expect(wrapper.find('.other-class').exists()).to.equal(false);
```
================================================
FILE: docs/api/ReactWrapper/filter.md
================================================
# `.filter(selector) => ReactWrapper`
Returns a new wrapper with only the nodes of the current wrapper that match the provided selector.
#### Arguments
1. `selector` ([`EnzymeSelector`](../selector.md)): The selector to match.
#### Returns
`ReactWrapper`: A new wrapper that wraps the filtered nodes.
#### Examples
```jsx
const wrapper = mount(<MyComponent />);
expect(wrapper.find('.foo').filter('.bar')).to.have.lengthOf(1);
```
#### Related Methods
- [`.filterWhere(predicate) => ReactWrapper`](filterWhere.md)
================================================
FILE: docs/api/ReactWrapper/filterWhere.md
================================================
# `.filterWhere(fn) => ReactWrapper`
Returns a new wrapper with only the nodes of the current wrapper that, when passed into the
provided predicate function, return true.
#### Arguments
1. `predicate` (`ReactWrapper => Boolean`): A predicate function that is passed a wrapped node.
#### Returns
`ReactWrapper`: A new wrapper that wraps the filtered nodes.
#### Example
```jsx
const wrapper = mount(<MyComponent />);
const complexComponents = wrapper.find('.foo').filterWhere((n) => typeof n.type() !== 'string');
expect(complexComponents).to.have.lengthOf(4);
```
#### Related Methods
- [`.filter(selector) => ReactWrapper`](filter.md)
================================================
FILE: docs/api/ReactWrapper/find.md
================================================
# `.find(selector) => ReactWrapper`
Finds every node in the render tree of the current wrapper that matches the provided selector.
#### Arguments
1. `selector` ([`EnzymeSelector`](../selector.md)): The selector to match.
#### Returns
`ReactWrapper`: A new wrapper that wraps the found nodes.
#### Examples
CSS Selectors:
```jsx
const wrapper = mount(<MyComponent />);
expect(wrapper.find('.foo')).to.have.lengthOf(1);
expect(wrapper.find('.bar')).to.have.lengthOf(3);
// compound selector
expect(wrapper.find('div.some-class')).to.have.lengthOf(3);
// CSS id selector
expect(wrapper.find('#foo')).to.have.lengthOf(1);
// property selector
expect(wrapper.find('[htmlFor="checkbox"]')).to.have.lengthOf(1);
```
Component Constructors:
```jsx
import Foo from '../components/Foo';
const wrapper = mount(<MyComponent />);
expect(wrapper.find(Foo)).to.have.lengthOf(1);
```
Component Display Name:
```jsx
const wrapper = mount(<MyComponent />);
expect(wrapper.find('Foo')).to.have.lengthOf(1);
```
Object Property Selector:
```jsx
const wrapper = mount(<MyComponent />);
expect(wrapper.find({ prop: 'value' })).to.have.lengthOf(1);
```
#### Related Methods
- [`.findWhere(predicate) => ReactWrapper`](findWhere.md)
================================================
FILE: docs/api/ReactWrapper/findWhere.md
================================================
# `.findWhere(fn) => ReactWrapper`
Finds every node in the render tree that returns true for the provided predicate function.
#### Arguments
1. `predicate` (`ReactWrapper => Boolean`): A predicate function called with the passed in wrapped
nodes.
#### Returns
`ReactWrapper`: A new wrapper that wraps the found nodes.
#### Example
```jsx
const wrapper = mount(<MyComponent />);
const complexComponents = wrapper.findWhere((n) => typeof n.type() !== 'string');
expect(complexComponents).to.have.lengthOf(8);
```
#### Related Methods
- [`.find(selector) => ReactWrapper`](find.md)
================================================
FILE: docs/api/ReactWrapper/first.md
================================================
# `.first() => ReactWrapper`
Reduce the set of matched nodes to the first in the set, just like `.at(0)`.
#### Returns
`ReactWrapper`: A new wrapper that wraps the first node in the set.
#### Examples
```jsx
const wrapper = mount(<MyComponent />);
expect(wrapper.find(Foo).first().props().foo).to.equal('bar');
```
#### Related Methods
- [`.at(index) => ReactWrapper`](at.md) - retrieve a wrapper node at given index
- [`.last() => ReactWrapper`](last.md)
================================================
FILE: docs/api/ReactWrapper/forEach.md
================================================
# `.forEach(fn) => Self`
Iterates through each node of the current wrapper and executes the provided function with a
wrapper around the corresponding node passed in as the first argument.
#### Arguments
1. `fn` (`Function ( ReactWrapper node, Number index )`): A callback to be run for every node in the collection.
Should expect a ReactWrapper as the first argument, and will be run with a context of the original
instance.
#### Returns
`ReactWrapper`: Returns itself.
#### Example
```jsx
const wrapper = mount((
<div>
<div className="foo bax" />
<div className="foo bar" />
<div className="foo baz" />
</div>
));
wrapper.find('.foo').forEach((node) => {
expect(node.hasClass('foo')).to.equal(true);
});
```
#### Related Methods
- [`.map(fn) => ReactWrapper`](map.md)
================================================
FILE: docs/api/ReactWrapper/get.md
================================================
# `.get(index) => ReactElement`
Returns the node at a given index of the current wrapper.
#### Arguments
1. `index` (`Number`): A zero-based integer indicating which node to retrieve.
#### Returns
`ReactElement`: The retrieved node.
#### Examples
```jsx
const wrapper = mount(<MyComponent />);
expect(wrapper.find(Foo).get(0).props.foo).to.equal('bar');
```
#### Related Methods
- [`.at(index) => ReactWrapper`](at.md) - same, but returns the React node in a single-node wrapper.
================================================
FILE: docs/api/ReactWrapper/getDOMNode.md
================================================
# `.getDOMNode() => DOMComponent`
Returns the outer most DOMComponent of the current wrapper.
Notes:
- can only be called on a wrapper of a single node.
- will raise if called on a wrapper of a stateless functional component.
#### Returns
`DOMComponent`: The retrieved DOM component.
#### Examples
```jsx
const wrapper = mount(<MyComponent />);
expect(wrapper.getDOMNode()).to.have.property('className');
```
================================================
FILE: docs/api/ReactWrapper/getElement.md
================================================
# `.getElement() => ReactElement`
Returns the wrapped ReactElement.
If the current wrapper is wrapping the root component, returns the root component's latest render output.
#### Returns
`ReactElement`: The retrieved ReactElement.
#### Examples
```jsx
const element = (
<div>
<span />
<span />
</div>
);
function MyComponent() {
return element;
}
const wrapper = mount(<MyComponent />);
expect(wrapper.getElement()).to.equal(element);
```
#### Related Methods
- [`.getElements() => Array<ReactElement>`](getElements.md)
================================================
FILE: docs/api/ReactWrapper/getElements.md
================================================
# `.getElements() => Array<ReactElement>`
Returns the wrapped ReactElements
If the current wrapper is wrapping the root component, returns the root component's latest render output wrapped in an array.
#### Returns
`Array<ReactElement>`: The retrieved ReactElements.
#### Examples
```jsx
const one = <span />;
const two = <span />;
function Test() {
return (
<div>
{one}
{two}
</div>
);
}
const wrapper = mount(<Test />);
expect(wrapper.find('span').getElements()).to.deep.equal([one, two]);
```
#### Related Methods
- [`.getElement() => ReactElement`](getElement.md)
================================================
FILE: docs/api/ReactWrapper/getWrappingComponent.md
================================================
# `.getWrappingComponent() => ReactWrapper`
If 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.
#### Returns
`ReactWrapper`: A `ReactWrapper` around the rendered `wrappingComponent`
#### Examples
```jsx
import { Provider } from 'react-redux';
import { Router } from 'react-router';
import store from './my/app/store';
import mockStore from './my/app/mockStore';
function MyProvider(props) {
const { children, customStore } = props;
return (
<Provider store={customStore || store}>
<Router>
{children}
</Router>
</Provider>
);
}
MyProvider.propTypes = {
children: PropTypes.node,
customStore: PropTypes.shape({}),
};
MyProvider.defaultProps = {
children: null,
customStore: null,
};
const wrapper = mount(<MyComponent />, {
wrappingComponent: MyProvider,
});
const provider = wrapper.getWrappingComponent();
provider.setProps({ customStore: mockStore });
```
================================================
FILE: docs/api/ReactWrapper/hasClass.md
================================================
# `.hasClass(className) => Boolean`
Returns whether or not the wrapped node has a `className` prop including the passed in class name. It must be a single-node wrapper.
#### Arguments
1. `className` (`String` | `RegExp`): A single class name or a regex expression.
#### Returns
`Boolean`: whether or not the wrapped node has found the class name.
#### Examples
```jsx
const wrapper = mount(<MyComponent />);
expect(wrapper.find('.my-button').hasClass('disabled')).to.equal(true);
```
```jsx
// Searching using RegExp works fine when classes were injected by a jss decorator
const wrapper = mount(<MyComponent />);
expect(wrapper.find('.my-button').hasClass(/(ComponentName)-(other)-(\d+)/)).to.equal(true);
```
### Common Gotchas
- `.hasClass()` expects a class name, NOT a CSS selector. `.hasClass('.foo')` should be
`.hasClass('foo')`
================================================
FILE: docs/api/ReactWrapper/hostNodes.md
================================================
# `.hostNodes() => ReactWrapper`
Returns a new wrapper with only host nodes.
When using `react-dom`, host nodes are HTML elements rather than custom React components, e.g. `<div>` versus `<MyComponent>`.
#### Returns
`ReactWrapper`: A new wrapper that wraps the filtered nodes.
#### Examples
The following code takes a wrapper with two nodes, one a `<MyComponent>` React component, and the other a `<span>`, and filters out the React component.
```jsx
const wrapper = mount((
<div>
<MyComponent className="foo" />
<span className="foo" />
</div>
));
const twoNodes = wrapper.find('.foo');
expect(twoNodes.hostNodes()).to.have.lengthOf(1);
```
================================================
FILE: docs/api/ReactWrapper/html.md
================================================
# `.html() => String`
Returns a string of the rendered HTML markup of the current render tree. See also [`.debug()`](debug.md)
Note: can only be called on a wrapper of a single node.
#### Returns
`String`: The resulting HTML string
#### Examples
```jsx
function Foo() {
return (<div className="in-foo" />);
}
```
```jsx
function Bar() {
return (
<div className="in-bar">
<Foo />
</div>
);
}
```
```jsx
const wrapper = mount(<Bar />);
expect(wrapper.html()).to.equal('<div class="in-bar"><div class="in-foo"></div></div>');
expect(wrapper.find(Foo).html()).to.equal('<div class="in-foo"></div>');
```
```jsx
const wrapper = mount(<div><b>important</b></div>);
expect(wrapper.html()).to.equal('<div><b>important</b></div>');
```
#### Related Methods
[`.text() => String`](text.md)
================================================
FILE: docs/api/ReactWrapper/instance.md
================================================
# `.instance() => ReactComponent`
Returns the single-node wrapper's node's underlying class instance; `this` in its methods. It must be a single-node wrapper.
NOTE: 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.
#### Returns
`ReactComponent|DOMComponent`: The retrieved instance.
#### Example
<!-- eslint react/prop-types: 0, react/prefer-stateless-function: 0 -->
```jsx
function SFC() {
return <div>MyFunction</div>;
}
class Stateful extends React.Component {
render() {
return <div>MyClass</div>;
}
}
```
#### React 16.x
```jsx
test('wrapper instance is null', () => {
const wrapper = mount(<SFC />);
const instance = wrapper.instance();
expect(instance).to.equal(null);
});
test('wrapper instance is not null', () => {
const wrapper = mount(<Stateful />);
const instance = wrapper.instance();
expect(instance).to.be.instanceOf(MyCStatefullass);
});
```
#### React 15.x
```jsx
test('wrapper instance is not null', () => {
const wrapper = mount(<SFC />);
const instance = wrapper.instance();
expect(instance).to.be.instanceOf(SFC);
});
test('wrapper instance is not null', () => {
const wrapper = mount(<Stateful />);
const instance = wrapper.instance();
expect(instance).to.be.instanceOf(Stateful);
});
```
================================================
FILE: docs/api/ReactWrapper/invoke.md
================================================
# `.invoke(propName)(...args) => Any`
Invokes a function prop.
Note 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.
#### Arguments
1. `propName` (`String`): The function prop that is invoked
2. `...args` (`Any` [optional]): Arguments that is passed to the prop function
#### Returns
`Any`: Returns the value from the prop function
#### Example
```jsx
class Foo extends React.Component {
loadData() {
return fetch();
}
render() {
return (
<div>
<button
type="button"
onClick={() => this.loadData()}
>
Load more
</button>
</div>
);
}
}
const wrapper = mount(<Foo />);
wrapper.find('button').invoke('onClick')().then(() => {
// expect()
});
```
================================================
FILE: docs/api/ReactWrapper/is.md
================================================
# `.is(selector) => Boolean`
Returns whether or not the single wrapped node matches the provided selector. It must be a single-node wrapper.
#### Arguments
1. `selector` ([`EnzymeSelector`](../selector.md)): The selector to match.
#### Returns
`Boolean`: whether or not the wrapped node matches the provided selector.
#### Example
```jsx
const wrapper = mount(<div className="some-class other-class" />);
expect(wrapper.is('.some-class')).to.equal(true);
```
================================================
FILE: docs/api/ReactWrapper/isEmpty.md
================================================
# `.isEmpty() => Boolean`
**Deprecated**: Use [`.exists()`](exists.md) instead.
Returns whether or not the wrapper is empty.
#### Returns
`Boolean`: whether or not the wrapper is empty.
#### Example
```jsx
const wrapper = mount(<div className="some-class" />);
expect(wrapper.find('.other-class').isEmpty()).to.equal(true);
```
================================================
FILE: docs/api/ReactWrapper/isEmptyRender.md
================================================
# `.isEmptyRender() => Boolean`
Returns whether or not the wrapper would ultimately render only the allowed falsy values: `false` or `null`.
#### Returns
`Boolean`: whether the return is falsy
#### Example
```jsx
function Foo() {
return null;
}
const wrapper = mount(<Foo />);
expect(wrapper.isEmptyRender()).to.equal(true);
```
================================================
FILE: docs/api/ReactWrapper/key.md
================================================
# `.key() => String`
Returns the key value for the node of the current wrapper. It must be a single-node wrapper.
#### Example
```jsx
const wrapper = mount((
<ul>
{['foo', 'bar'].map((s) => <li key={s}>{s}</li>)}
</ul>
)).find('li');
expect(wrapper.at(0).key()).to.equal('foo');
expect(wrapper.at(1).key()).to.equal('bar');
```
================================================
FILE: docs/api/ReactWrapper/last.md
================================================
# `.last() => ReactWrapper`
Reduce the set of matched nodes to the last in the set, just like `.at(length - 1)`.
#### Returns
`ReactWrapper`: A new wrapper that wraps the last node in the set.
#### Examples
```jsx
const wrapper = mount(<MyComponent />);
expect(wrapper.find(Foo).last().props().foo).to.equal('bar');
```
#### Related Methods
- [`.at(index) => ReactWrapper`](at.md) - retrieve a wrapper node by index
- [`.first() => ReactWrapper`](first.md)
================================================
FILE: docs/api/ReactWrapper/length.md
================================================
# `.length => number`
Returns the number of React nodes enclosed in this wrapper.
#### Returns
`Number`: count of nodes in the list in this wrapper.
#### Example
```jsx
const wrapper = mount(<div />);
expect(wrapper.length).to.equal(1);
```
================================================
FILE: docs/api/ReactWrapper/map.md
================================================
# `.map(fn) => Array<Any>`
Maps the current array of nodes to another array. Each node is passed in as a `ReactWrapper`
to the map function.
#### Arguments
1. `fn` (`Function ( ReactWrapper node, Number index ) => Any`): A mapping function to be run for every node in
the 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
the original instance.
#### Returns
`Array<Any>`: Returns an array of the returned values from the mapping function..
#### Example
```jsx
const wrapper = mount((
<div>
<div className="foo">bax</div>
<div className="foo">bar</div>
<div className="foo">baz</div>
</div>
));
const texts = wrapper.find('.foo').map((node) => node.text());
expect(texts).to.eql(['bax', 'bar', 'baz']);
```
#### Related Methods
- [`.forEach(fn) => ReactWrapper`](forEach.md)
- [`.reduce(fn[, initialValue]) => Any`](reduce.md)
- [`.reduceRight(fn[, initialValue]) => Any`](reduceRight.md)
================================================
FILE: docs/api/ReactWrapper/matchesElement.md
================================================
# `.matchesElement(patternNode) => Boolean`
Returns 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.
The `patternNode` acts like a wildcard. For it to match a node in the wrapper:
* tag names must match
* 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.
* `patternNode` props (attributes) must appear in the wrapper's nodes, but not the other way around. Their values must match if they do appear.
* `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.
#### Arguments
1. `patternNode` (`ReactElement`): The node whose presence you are detecting in the wrapper's single node.
#### Returns
`Boolean`: whether or not the current wrapper match the one passed in.
#### Example
<!-- eslint-disable react/button-has-type -->
```jsx
class MyComponent extends React.Component {
constructor(props) {
super(props);
this.handleClick = this.handleClick.bind(this);
}
handleClick() {
// ...
}
render() {
return (
<button type="button" onClick={this.handleClick} className="foo bar">Hello</button>
);
}
}
const wrapper = mount(<MyComponent />).childAt(0);
expect(wrapper.matchesElement(<button>Hello</button>)).to.equal(true);
expect(wrapper.matchesElement(<button className="foo bar">Hello</button>)).to.equal(true);
```
#### Common Gotchas
- `.matchesElement()` expects a ReactElement, not a selector (like many other methods). Make sure that
when you are calling it you are calling it with a ReactElement or a JSX expression.
- Keep in mind that this method determines matching based on the matching of the node's children as
well.
#### Related Methods
- [`.containsMatchingElement() => ReactWrapper`](containsMatchingElement.md) - searches all nodes in the wrapper, and searches their entire depth
================================================
FILE: docs/api/ReactWrapper/mount.md
================================================
# `.mount() => Self`
A method that re-mounts the component, if it is not currently mounted. This can be used to simulate a component going through
an unmount/mount lifecycle.
No equivalent for ShallowWrappers.
#### Returns
`ReactWrapper`: Returns itself.
#### Example
```jsx
import PropTypes from 'prop-types';
import sinon from 'sinon';
const willMount = sinon.spy();
const didMount = sinon.spy();
const willUnmount = sinon.spy();
class Foo extends React.Component {
constructor(props) {
super(props);
this.componentWillUnmount = willUnmount;
this.componentWillMount = willMount;
this.componentDidMount = didMount;
}
render() {
const { id } = this.props;
return (
<div className={id}>
{id}
</div>
);
}
}
Foo.propTypes = {
id: PropTypes.string.isRequired,
};
const wrapper = mount(<Foo id="foo" />);
expect(willMount).to.have.property('callCount', 1);
expect(didMount).to.have.property('callCount', 1);
expect(willUnmount).to.have.property('callCount', 0);
wrapper.unmount();
expect(willMount).to.have.property('callCount', 1);
expect(didMount).to.have.property('callCount', 1);
expect(willUnmount).to.have.property('callCount', 1);
wrapper.mount();
expect(willMount).to.have.property('callCount', 2);
expect(didMount).to.have.property('callCount', 2);
expect(willUnmount).to.have.property('callCount', 1);
```
#### Related Methods
- [`.unmount() => Self`](unmount.md)
================================================
FILE: docs/api/ReactWrapper/name.md
================================================
# `.name() => String|null`
Returns the name of the current node of this wrapper. If it's a composite component, this will be
the name of the component. If it's a native DOM node, it will be a string of the tag name. If it's
`null`, it will be `null`.
The order of precedence on returning the name is: `type.displayName` -> `type.name` -> `type`.
Note: can only be called on a wrapper of a single node.
#### Returns
`String|null`: The name of the current node
#### Examples
```jsx
const wrapper = mount(<div />);
expect(wrapper.name()).to.equal('div');
```
```jsx
const wrapper = mount(<Foo />);
expect(wrapper.name()).to.equal('Foo');
```
```jsx
Foo.displayName = 'A cool custom name';
const wrapper = mount(<Foo />);
expect(wrapper.name()).to.equal('A cool custom name');
```
================================================
FILE: docs/api/ReactWrapper/not.md
================================================
# `.not(selector) => ReactWrapper`
Returns a new wrapper with only the nodes of the current wrapper that don't match the provided
selector.
This method is effectively the negation or inverse of [`filter`](filter.md).
#### Arguments
1. `selector` ([`EnzymeSelector`](../selector.md)): The selector to match.
#### Returns
`ReactWrapper`: A new wrapper that wraps the filtered nodes.
#### Examples
```jsx
const wrapper = mount(<MyComponent />);
expect(wrapper.find('.foo').not('.bar')).to.have.lengthOf(1);
```
#### Related Methods
- [`.filterWhere(predicate) => ReactWrapper`](filterWhere.md)
- [`.filter(selector) => ReactWrapper`](filter.md)
================================================
FILE: docs/api/ReactWrapper/parent.md
================================================
# `.parent() => ReactWrapper`
Returns a wrapper with the direct parent of the node in the current wrapper.
#### Returns
`ReactWrapper`: A new wrapper that wraps the resulting nodes.
#### Examples
```jsx
const wrapper = mount(<ToDoList />);
expect(wrapper.find('ul').parent().is('div')).to.equal(true);
```
#### Related Methods
- [`.parents([selector]) => ReactWrapper`](parents.md)
- [`.children([selector]) => ReactWrapper`](children.md)
- [`.closest(selector) => ReactWrapper`](closest.md)
================================================
FILE: docs/api/ReactWrapper/parents.md
================================================
# `.parents([selector]) => ReactWrapper`
Returns a wrapper around all of the parents/ancestors of the single node in the wrapper. Does not include the node itself.
Optionally, a selector can be provided and it will filter the parents by this selector. It must be a single-node wrapper.
#### Arguments
1. `selector` ([`EnzymeSelector`](../selector.md) [optional]): The selector to filter the parents by.
#### Returns
`ReactWrapper`: A new wrapper that wraps the resulting nodes.
#### Examples
```jsx
const wrapper = mount(<ToDoList />);
expect(wrapper.find('ul').parents()).to.have.lengthOf(2);
```
#### Related Methods
- [`.children([selector]) => ReactWrapper`](children.md)
- [`.parent() => ReactWrapper`](parent.md)
- [`.closest(selector) => ReactWrapper`](closest.md)
================================================
FILE: docs/api/ReactWrapper/prop.md
================================================
# `.prop(key) => Any`
Returns the prop value for the root node of the wrapper with the provided key. It must be a single-node wrapper.
#### Arguments
1. `key` (`String`): The prop name, that is, `this.props[key]` or `props[key]` for the root node of the wrapper.
#### Example
```jsx
const wrapper = mount(<MyComponent foo={10} />);
expect(wrapper.prop('foo')).to.equal(10);
```
#### Related Methods
- [`.props() => Object`](props.md)
- [`.state([key]) => Any`](state.md)
- [`.context([key]) => Any`](context.md)
================================================
FILE: docs/api/ReactWrapper/props.md
================================================
# `.props() => Object`
Returns the props object for the root node of the wrapper. It must be a single-node wrapper.
This 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)
#### Example
```jsx
import PropTypes from 'prop-types';
function MyComponent(props) {
const { includedProp } = props;
return (
<div className="foo bar" includedProp={includedProp}>Hello</div>
);
}
MyComponent.propTypes = {
includedProp: PropTypes.string.isRequired,
};
const wrapper = mount(<MyComponent includedProp="Success!" excludedProp="I'm not included" />);
expect(wrapper.props().includedProp).to.equal('Success!');
// Warning: .props() only returns props that are passed to the root node,
// which does not include excludedProp in this example.
// See the note above about wrapper.instance().props.
console.log(wrapper.props());
// {children: "Hello", className: "foo bar", includedProp="Success!"}
console.log(wrapper.instance().props); // React 15.x - working as expected
// {children: "Hello", className: "foo bar", includedProp:"Success!", excludedProp: "I'm not included"}
console.log(wrapper.instance().props);
// React 16.* - Uncaught TypeError: Cannot read property 'props' of null
```
#### Related Methods
- [`.prop(key) => Any`](prop.md)
- [`.state([key]) => Any`](state.md)
- [`.context([key]) => Any`](context.md)
================================================
FILE: docs/api/ReactWrapper/reduce.md
================================================
# `.reduce(fn[, initialValue]) => Any`
Applies the provided reducing function to every node in the wrapper to reduce to a single value.
Each node is passed in as a `ReactWrapper`, and is processed from left to right.
#### Arguments
1. `fn` (`Function`): A reducing function to be run for every node in the collection, with the
following arguments:
- `value` (`T`): The value returned by the previous invocation of this function
- `node` (`ReactWrapper`): A wrapper around the node being processed
- `index` (`Number`): The index of the node being processed
2. `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.
#### Returns
`T`: Returns an array of the returned values from the mapping function...
#### Example
```jsx
function Foo() {
return (
<div>
<Bar amount={2} />
<Bar amount={4} />
<Bar amount={8} />
</div>
);
}
```
```jsx
const wrapper = mount(<Foo />);
const total = wrapper.find(Bar).reduce((amount, n) => amount + n.prop('amount'), 0);
expect(total).to.equal(14);
```
#### Related Methods
- [`.reduceRight(fn[, initialValue]) => Any`](reduceRight.md)
- [`.forEach(fn) => ReactWrapper`](forEach.md)
- [`.map(fn) => Array<Any>`](map.md)
================================================
FILE: docs/api/ReactWrapper/reduceRight.md
================================================
# `.reduceRight(fn[, initialValue]) => Any`
Applies the provided reducing function to every node in the wrapper to reduce to a single value.
Each node is passed in as a `ReactWrapper`, and is processed from right to left.
#### Arguments
1. `fn` (`Function`): A reducing function to be run for every node in the collection, with the
following arguments:
- `value` (`T`): The value returned by the previous invocation of this function
- `node` (`ReactWrapper`): A single-node wrapper around the node being processed
- `index` (`Number`): The index of the node being processed
2. `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.
#### Returns
`T`: Returns an array of the returned values from the mapping function...
#### Example
```jsx
function Foo() {
return (
<div>
<Bar amount={2} />
<Bar amount={4} />
<Bar amount={8} />
</div>
);
}
```
```jsx
const wrapper = mount(<Foo />);
const total = wrapper.find(Bar).reduceRight((amount, n) => amount + n.prop('amount'), 0);
expect(total).to.equal(14);
```
#### Related Methods
- [`.reduce(fn[, initialValue]) => Any`](reduce.md)
- [`.forEach(fn) => ReactWrapper`](forEach.md)
- [`.map(fn) => Array<Any>`](map.md)
================================================
FILE: docs/api/ReactWrapper/ref.md
================================================
# `.ref(refName) => ReactComponent | HTMLElement`
Returns the node that matches the provided reference name.
NOTE: can only be called on a wrapper instance that is also the root instance.
#### Arguments
1. `refName` (`String`): The ref attribute of the node
#### Returns
`ReactComponent | HTMLElement`: The node that matches the provided reference name. This can be a react component instance, or an HTML element instance.
#### Examples
<!-- eslint react/no-string-refs: 1 -->
```jsx
class Foo extends React.Component {
render() {
return (
<div>
<span ref="firstRef" amount={2}>First</span>
<span ref="secondRef" amount={4}>Second</span>
<span ref="thirdRef" amount={8}>Third</span>
</div>
);
}
}
```
```jsx
const wrapper = mount(<Foo />);
expect(wrapper.ref('secondRef').innerText).to.equal('Second');
```
#### Related Methods
- [`.find(selector) => ReactWrapper`](find.md)
- [`.findWhere(predicate) => ReactWrapper`](findWhere.md)
================================================
FILE: docs/api/ReactWrapper/render.md
================================================
# `.render() => CheerioWrapper`
Returns a CheerioWrapper around the rendered HTML of the single node's subtree.
It must be a single-node wrapper.
#### Returns
`CheerioWrapper`: The resulting Cheerio object
#### Examples
```jsx
function Foo() {
return (<div className="in-foo" />);
}
```
```jsx
function Bar() {
return (
<div className="in-bar">
<Foo />
</div>
);
}
```
```jsx
const wrapper = mount(<Bar />);
expect(wrapper.find('.in-foo')).to.have.lengthOf(1);
expect(wrapper.render().find('.in-foo')).to.have.lengthOf(1);
```
================================================
FILE: docs/api/ReactWrapper/renderProp.md
================================================
# `.renderProp(propName)(...args) => ReactWrapper`
Returns 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`.
NOTE: can only be called on wrapper of a single non-DOM component element node.
#### Arguments
1. `propName` (`String`):
1. `...args` (`Array<Any>`):
This essentially calls `wrapper.prop(propName)(...args)`.
#### Returns
`ReactWrapper`: A new wrapper that wraps the node returned from the render prop.
#### Examples
##### Test Setup
```jsx
class Mouse extends React.Component {
constructor() {
super();
this.state = { x: 0, y: 0 };
}
render() {
const { render } = this.props;
return (
<div
style={{ height: '100%' }}
onMouseMove={(event) => {
this.setState({
x: event.clientX,
y: event.clientY,
});
}}
>
{render(this.state)}
</div>
);
}
}
Mouse.propTypes = {
render: PropTypes.func.isRequired,
};
```
```jsx
function App() {
return (
<div style={{ height: '100%' }}>
<Mouse
render={(x = 0, y = 0) => (
<h1>
The mouse position is ({x}, {y})
</h1>
)}
/>
</div>
);
}
```
##### Testing with no arguments
```jsx
const wrapper = mount(<App />)
.find(Mouse)
.renderProp('render')();
expect(wrapper.equals(<h1>The mouse position is 0, 0</h1>)).to.equal(true);
```
##### Testing with multiple arguments
```jsx
const wrapper = mount(<App />)
.find(Mouse)
.renderProp('render')(10, 20);
expect(wrapper.equals(<h1>The mouse position is 10, 20</h1>)).to.equal(true);
```
================================================
FILE: docs/api/ReactWrapper/setContext.md
================================================
# `.setContext(context) => Self`
A method that sets the context of the root component, and re-renders. Useful for when you are
wanting to test how the component behaves over time with changing contexts.
NOTE: can only be called on a wrapper instance that is also the root instance.
#### Arguments
1. `context` (`Object`): An object containing new props to merge in with the current state
#### Returns
`ReactWrapper`: Returns itself.
#### Example
```jsx
import React from 'react';
import PropTypes from 'prop-types';
function SimpleComponent(props, context) {
const { name } = context;
return <div>{name}</div>;
}
SimpleComponent.contextTypes = {
name: PropTypes.string,
};
```
```jsx
const context = { name: 'foo' };
const wrapper = mount(<SimpleComponent />, { context });
expect(wrapper.text()).to.equal('foo');
wrapper.setContext({ name: 'bar' });
expect(wrapper.text()).to.equal('bar');
wrapper.setContext({ name: 'baz' });
expect(wrapper.text()).to.equal('baz');
```
#### Common Gotchas
- `.setContext()` can only be used on a wrapper that was initially created with a call to `mount()`
that includes a `context` specified in the options argument.
- The root component you are rendering must have a `contextTypes` static property.
#### Related Methods
- [`.setState(state[, callback]) => Self`](setState.md)
- [`.setProps(props[, callback]) => Self`](setProps.md)
================================================
FILE: docs/api/ReactWrapper/setProps.md
================================================
# `.setProps(nextProps[, callback]) => Self`
A method that sets the props of the root component, and re-renders. Useful for when you are
wanting to test how the component behaves over time with changing props. Calling this, for
instance, will call the `componentWillReceiveProps` lifecycle method.
Similar to `setState`, this method accepts a props object and will merge it in with the already
existing props.
NOTE: can only be called on a wrapper instance that is also the root instance.
#### Arguments
1. `nextProps` (`Object`): An object containing new props to merge in with the current props
2. `callback` (`Function` [optional]): If provided, the callback function will be executed once setProps has completed
#### Returns
`ReactWrapper`: Returns itself.
#### Example
```jsx
import React from 'react';
import PropTypes from 'prop-types';
function Foo({ name }) {
return (
<div className={name} />
);
}
Foo.propTypes = {
name: PropTypes.string.isRequired,
};
```
```jsx
const wrapper = mount(<Foo name="foo" />);
expect(wrapper.find('.foo')).to.have.lengthOf(1);
expect(wrapper.find('.bar')).to.have.lengthOf(0);
wrapper.setProps({ name: 'bar' });
expect(wrapper.find('.foo')).to.have.lengthOf(0);
expect(wrapper.find('.bar')).to.have.lengthOf(1);
```
```jsx
import sinon from 'sinon';
const spy = sinon.spy(MyComponent.prototype, 'componentWillReceiveProps');
const wrapper = mount(<MyComponent foo="bar" />);
expect(spy).to.have.property('callCount', 0);
wrapper.setProps({ foo: 'foo' });
expect(spy).to.have.property('callCount', 1);
```
#### Related Methods
- [`.setState(state) => Self`](setState.md)
- [`.setContext(context) => Self`](setContext.md)
================================================
FILE: docs/api/ReactWrapper/setState.md
================================================
# `.setState(nextState[, callback]) => Self`
A method to invoke `setState()` on the root component instance, similar to how you might in the
methods of the component, and re-renders. This method is useful for testing your component
in hard-to-achieve states, however should be used sparingly. If possible, you should utilize
your component's external API (which is often accessible via [`.instance()`](instance.md)) in order
to get it into whatever state you want to test, in order to be as accurate of a test as possible.
This is not always practical, however.
NOTE: Prior to v3.8.0 of enzyme, can only be called on a wrapper instance that is also the root instance.
#### Arguments
1. `nextState` (`Object`): An object containing new state to merge in with the current state
2. `callback` (`Function` [optional]): If provided, the callback function will be executed once setState has completed
#### Returns
`ReactWrapper`: Returns itself.
#### Example
```jsx
class Foo extends React.Component {
constructor(props) {
super(props);
this.state = { name: 'foo' };
}
render() {
const { name } = this.state;
return (
<div className={name} />
);
}
}
```
```jsx
const wrapper = mount(<Foo />);
expect(wrapper.find('.foo')).to.have.lengthOf(1);
expect(wrapper.find('.bar')).to.have.lengthOf(0);
wrapper.setState({ name: 'bar' });
expect(wrapper.find('.foo')).to.have.lengthOf(0);
expect(wrapper.find('.bar')).to.have.lengthOf(1);
```
#### Related Methods
- [`.setProps(props[, callback]) => Self`](setProps.md)
- [`.setContext(context) => Self`](setContext.md)
================================================
FILE: docs/api/ReactWrapper/simulate.md
================================================
# `.simulate(event[, mock]) => Self`
Simulate events on the root node in the wrapper. It must be a single-node wrapper.
#### Arguments
1. `event` (`String`): The event name to be simulated
2. `mock` (`Object` [optional]): A mock event object that will be merged with the event object passed to the handlers.
#### Returns
`ReactWrapper`: Returns itself.
#### Example `class component`
```jsx
class Foo extends React.Component {
constructor(props) {
super(props);
this.state = { count: 0 };
}
render() {
const { count } = this.state;
return (
<div>
<div className={`clicks-${count}`}>
{count} clicks
</div>
<a href="url" onClick={() => { this.setState({ count: count + 1 }); }}>
Increment
</a>
</div>
);
}
}
const wrapper = mount(<Foo />);
expect(wrapper.find('.clicks-0').length).to.equal(1);
wrapper.find('a').simulate('click');
expect(wrapper.find('.clicks-1').length).to.equal(1);
```
#### Example `functional component`
```jsx
function Foo({ width, height, onChange }) {
return (
<div>
<input name="width" value={width} onChange={onChange} />
<input name="height" value={height} onChange={onChange} />
</div>
);
}
Foo.propTypes = {
width: PropTypes.number.isRequired,
height: PropTypes.number.isRequired,
onChange: PropTypes.func.isRequired,
};
const testState = { width: 10, height: 20 };
const wrapper = mount((
<Foo
width={testState.width}
height={testState.height}
onChange={(e) => {
testState[e.target.name] = e.target.value;
}}
/>
));
expect(wrapper.find('input').at(0).props().value).to.equal(10);
expect(wrapper.find('input').at(1).props().value).to.equal(20);
wrapper.find('input').at(0).simulate('change', { target: { name: 'width', value: 50 } });
wrapper.find('input').at(1).simulate('change', { target: { name: 'height', value: 70 } });
expect(testState.width).to.equal(50);
expect(testState.height).to.equal(70);
```
#### Common Gotchas
- 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.
================================================
FILE: docs/api/ReactWrapper/simulateError.md
================================================
# `.simulateError(error) => Self`
Simulate a component throwing an error as part of its rendering lifecycle.
This is particularly useful in combination with React 16 error boundaries (ie, the `componentDidCatch` and `static getDerivedStateFromError` lifecycle methods).
#### Arguments
1. `error` (`Any`): The error to throw.
#### Returns
`ReactWrapper`: Returns itself.
#### Example
```jsx
function Something() {
// this is just a placeholder
return null;
}
class ErrorBoundary extends React.Component {
static getDerivedStateFromError(error) {
return {
hasError: true,
};
}
constructor(props) {
super(props);
this.state = { hasError: false };
}
componentDidCatch(error, info) {
const { spy } = this.props;
spy(error, info);
}
render() {
const { children } = this.props;
const { hasError } = this.state;
return (
<React.Fragment>
{hasError ? 'Error' : children}
</React.Fragment>
);
}
}
ErrorBoundary.propTypes = {
children: PropTypes.node.isRequired,
spy: PropTypes.func.isRequired,
};
const spy = sinon.spy();
const wrapper = mount(<ErrorBoundary spy={spy}><Something /></ErrorBoundary>);
const error = new Error('hi!');
wrapper.find(Something).simulateError(error);
expect(wrapper.state()).to.have.property('hasError', true);
expect(spy).to.have.property('callCount', 1);
expect(spy.args).to.deep.equal([
error,
{
componentStack: `
in Something (created by ErrorBoundary)
in ErrorBoundary (created by WrapperComponent)
in WrapperComponent`,
},
]);
```
================================================
FILE: docs/api/ReactWrapper/slice.md
================================================
# `.slice([begin[, end]]) => ReactWrapper`
Returns a new wrapper with a subset of the nodes of the original wrapper, according to the rules of `Array#slice`.
#### Arguments
1. `begin` (`Number` [optional]): Index from which to slice (defaults to `0`). If negative, this is treated as `length+begin`.
1. `end` (`Number` [optional]): Index at which to end slicing (defaults to `length`). If negative, this is treated as `length+end`.
#### Returns
`ReactWrapper`: A new wrapper with the subset of nodes specified.
#### Examples
```jsx
const wrapper = mount((
<div>
<div className="foo bax" />
<div className="foo bar" />
<div className="foo baz" />
</div>
));
expect(wrapper.find('.foo').slice(1)).to.have.lengthOf(2);
expect(wrapper.find('.foo').slice(1).at(0).hasClass('bar')).to.equal(true);
expect(wrapper.find('.foo').slice(1).at(1).hasClass('baz')).to.equal(true);
```
```jsx
const wrapper = mount((
<div>
<div className="foo bax" />
<div className="foo bar" />
<div className="foo baz" />
</div>
));
expect(wrapper.find('.foo').slice(1, 2)).to.have.lengthOf(1);
expect(wrapper.find('.foo').slice(1, 2).at(0).hasClass('bar')).to.equal(true);
```
================================================
FILE: docs/api/ReactWrapper/some.md
================================================
# `.some(selector) => Boolean`
Returns whether or not any of the nodes in the wrapper match the provided selector.
#### Arguments
1. `selector` ([`EnzymeSelector`](../selector.md)): The selector to match.
#### Returns
`Boolean`: True if at least one of the nodes in the current wrapper matched the provided selector.
#### Examples
```jsx
const wrapper = mount((
<div>
<div className="foo qoo" />
<div className="foo boo" />
<div className="foo hoo" />
</div>
));
expect(wrapper.find('.foo').some('.qoo')).to.equal(true);
expect(wrapper.find('.foo').some('.foo')).to.equal(true);
expect(wrapper.find('.foo').some('.bar')).to.equal(false);
```
#### Related Methods
- [`.someWhere(predicate) => Boolean`](someWhere.md)
- [`.every(selector) => Boolean`](every.md)
- [`.everyWhere(predicate) => Boolean`](everyWhere.md)
================================================
FILE: docs/api/ReactWrapper/someWhere.md
================================================
# `.someWhere(fn) => Boolean`
Returns whether or not any of the nodes in the wrapper pass the provided predicate function.
#### Arguments
1. `predicate` (`ReactWrapper => Boolean`): A predicate function to match the nodes.
#### Returns
`Boolean`: True if at least one of the nodes in the current wrapper passed the predicate function.
#### Example
```jsx
const wrapper = mount((
<div>
<div className="foo qoo" />
<div className="foo boo" />
<div className="foo hoo" />
</div>
));
expect(wrapper.find('.foo').someWhere((n) => n.hasClass('qoo'))).to.equal(true);
expect(wrapper.find('.foo').someWhere((n) => n.hasClass('foo'))).to.equal(true);
expect(wrapper.find('.foo').someWhere((n) => n.hasClass('bar'))).to.equal(false);
```
#### Related Methods
- [`.some(selector) => Boolean`](some.md)
- [`.every(selector) => Boolean`](every.md)
- [`.everyWhere(predicate) => Boolean`](everyWhere.md)
================================================
FILE: docs/api/ReactWrapper/state.md
================================================
# `.state([key]) => Any`
Returns the state hash for the root node of the wrapper. Optionally pass in a prop name and it
will return just that value.
#### Arguments
1. `key` (`String` [optional]): If provided, the return value will be the `this.state[key]` of the
root component instance.
#### Example
```jsx
const wrapper = mount(<MyComponent />);
expect(wrapper.state().foo).to.equal(10);
expect(wrapper.state('foo')).to.equal(10);
```
#### Related Methods
- [`.props() => Object`](props.md)
- [`.prop(key) => Any`](prop.md)
- [`.context([key]) => Any`](context.md)
================================================
FILE: docs/api/ReactWrapper/tap.md
================================================
# `.tap(intercepter) => Self`
Invokes intercepter and returns itself. intercepter is called with itself.
This is helpful when debugging nodes in method chains.
#### Arguments
1. `intercepter` (`Self`): the current ReactWrapper instance.
#### Returns
`Self`: the current ReactWrapper instance.
#### Example
```jsx
const result = mount((
<ul>
<li>xxx</li>
<li>yyy</li>
<li>zzz</li>
</ul>
)).find('li')
.tap((n) => console.log(n.debug()))
.map((n) => n.text());
```
================================================
FILE: docs/api/ReactWrapper/text.md
================================================
# `.text() => String`
Returns a string of the rendered text of the current render tree. This function should be
looked at with skepticism if being used to test what the actual HTML output of the component
will be. If that is what you would like to test, use enzyme's `render` function instead.
Note: can only be called on a wrapper of a single node.
#### Returns
`String`: The resulting string
#### Examples
```jsx
const wrapper = mount(<div><b>important</b></div>);
expect(wrapper.text()).to.equal('important');
```
```jsx
function Foo() {
return <div>This is</div>;
}
const wrapper = mount(<div><Foo /> <b>really</b> important</div>);
expect(wrapper.text()).to.equal('This is really important');
```
#### Related Methods
[`.html() => String`](html.md)
================================================
FILE: docs/api/ReactWrapper/type.md
================================================
# `.type() => String | Function | null`
Returns the type of the only node of this wrapper.
If it's a React component, this will be the component constructor.
If it's a native DOM node, it will be a string with the tag name.
If it's `null`, it will be `null`. It must be a single-node wrapper.
#### Returns
`String | Function | null`: The type of the node
#### Examples
```jsx
function Foo() {
return <div />;
}
const wrapper = mount(<Foo />).childAt(0);
expect(wrapper.type()).to.equal('div');
```
```jsx
function Foo() {
return (
<div>
<button type="button" className="btn">Button</button>
</div>
);
}
const wrapper = mount(<Foo />);
expect(wrapper.find('.btn').type()).to.equal('button');
```
```jsx
function Foo() {
return <Bar />;
}
const wrapper = mount(<Foo />);
expect(wrapper.type()).to.equal(Foo);
expect(wrapper.childAt(0).type()).to.equal(Bar);
```
```jsx
function Null() {
return null;
}
const wrapper = mount(<Null />);
expect(wrapper.type()).to.equal(null);
```
================================================
FILE: docs/api/ReactWrapper/unmount.md
================================================
# `.unmount() => Self`
A method that unmounts the component. This can be used to simulate a component going through
an unmount/mount lifecycle.
#### Returns
`ReactWrapper`: Returns itself.
#### Example
```jsx
import PropTypes from 'prop-types';
import sinon from 'sinon';
const willMount = sinon.spy();
const didMount = sinon.spy();
const willUnmount = sinon.spy();
class Foo extends React.Component {
constructor(props) {
super(props);
this.componentWillUnmount = willUnmount;
this.componentWillMount = willMount;
this.componentDidMount = didMount;
}
render() {
const { id } = this.props;
return (
<div className={id}>
{id}
</div>
);
}
}
Foo.propTypes = {
id: PropTypes.string.isRequired,
};
const wrapper = mount(<Foo id="foo" />);
expect(willMount).to.have.property('callCount', 1);
expect(didMount).to.have.property('callCount', 1);
expect(willUnmount).to.have.property('callCount', 0);
wrapper.unmount();
expect(willMount).to.have.property('callCount', 1);
expect(didMount).to.have.property('callCount', 1);
expect(willUnmount).to.have.property('callCount', 1);
```
#### Related Methods
- [`.mount() => Self`](mount.md)
================================================
FILE: docs/api/ReactWrapper/update.md
================================================
# `.update() => Self`
Syncs the enzyme component tree snapshot with the react component tree. Useful to run before checking the render output if something external
may be updating the state of the component somewhere.
NOTE: no matter what instance this is called on, it will always update the root.
NOTE: only updates Enzyme's representation of rendered tree.
NOTE: this does not force a re-render. Use `wrapper.setProps({})` to force a re-render.
#### Returns
`ReactWrapper`: Returns itself.
#### Example
```jsx
class UpdateEnzyme extends React.Component {
constructor(props) {
super(props);
this.state = {
count: 0,
};
this.increment = this.increment.bind(this);
}
increment() {
const { count } = this.state;
this.setState({ count: count + 1 });
}
render() {
const { count } = this.state;
return <button type="button" className="increment" onClick={this.increment}>{count}</button>;
}
}
```
```jsx
const wrapper = mount(<UpdateEnzyme />);
expect(wrapper.find('button.increment').text()).to.equal('0');
wrapper.instance().increment();
// Update Enzyme's view of output
wrapper.update();
expect(wrapper.find('button.increment').text()).to.equal('1');
```
================================================
FILE: docs/api/ShallowWrapper/at.md
================================================
# `.at(index) => ShallowWrapper`
Returns a wrapper around the node at a given index of the current wrapper.
#### Arguments
1. `index` (`Number`): A zero-based integer indicating which node to retrieve.
#### Returns
`ShallowWrapper`: A new wrapper that wraps the retrieved node.
#### Examples
```jsx
const wrapper = shallow(<MyComponent />);
expect(wrapper.find(Foo).at(0).props().foo).to.equal('bar');
```
#### Related Methods
- [`.get(index) => ReactElement`](get.md) - same, but returns the React node itself, with no wrapper.
- [`.first() => ShallowWrapper`](first.md) - same as at(0)
- [`.last() => ShallowWrapper`](last.md)
================================================
FILE: docs/api/ShallowWrapper/childAt.md
================================================
# `.childAt(index) => ShallowWrapper`
Returns a new wrapper with child at the specified index.
#### Arguments
1. `index` (`number`): A zero-based integer indicating which node to retrieve.
#### Returns
`ShallowWrapper`: A new wrapper that wraps the resulting node.
#### Examples
```jsx
const wrapper = shallow(<ToDoList items={items} />);
expect(wrapper.find('ul').childAt(0).type()).to.equal('li');
```
#### Related Methods
- [`.parents([selector]) => ShallowWrapper`](parents.md)
- [`.parent() => ShallowWrapper`](parent.md)
- [`.closest(selector) => ShallowWrapper`](closest.md)
- [`.children([selector]) => ShallowWrapper`](children.md)
================================================
FILE: docs/api/ShallowWrapper/children.md
================================================
# `.children([selector]) => ShallowWrapper`
Returns a new wrapper with all of the children of the node(s) in the current wrapper. Optionally, a
selector can be provided and it will filter the children by this selector
#### Arguments
1. `selector` ([`EnzymeSelector`](../selector.md) [optional]): A selector to filter the children by.
#### Returns
`ShallowWrapper`: A new wrapper that wraps the resulting nodes.
#### Examples
```jsx
const wrapper = shallow(<ToDoList items={items} />);
expect(wrapper.find('ul').children()).to.have.lengthOf(items.length);
```
#### Related Methods
- [`.parents([selector]) => ShallowWrapper`](parents.md)
- [`.parent() => ShallowWrapper`](parent.md)
- [`.closest(selector) => ShallowWrapper`](closest.md)
================================================
FILE: docs/api/ShallowWrapper/closest.md
================================================
# `.closest(selector) => ShallowWrapper`
Returns a wrapper of the first element that matches the selector by traversing up through the
wrapped node's ancestors in the tree, starting with itself. It must be a single-node wrapper.
#### Arguments
1. `selector` ([`EnzymeSelector`](../selector.md)): The selector to match.
#### Returns
`ShallowWrapper`: A new wrapper that wraps the resulting node.
#### Examples
```jsx
const wrapper = shallow(<MyComponent />);
expect(wrapper.find(Foo).closest('.bar')).to.have.lengthOf(1);
```
#### Related Methods
- [`.children([selector]) => ShallowWrapper`](children.md)
- [`.parent() => ShallowWrapper`](parent.md)
- [`.parents([selector]) => ShallowWrapper`](parents.md)
================================================
FILE: docs/api/ShallowWrapper/contains.md
================================================
# `.contains(nodeOrNodes) => Boolean`
Returns whether or not all given react elements match elements in the render tree.
It 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.
#### Arguments
1. `nodeOrNodes` (`ReactElement|Array<ReactElement>`): The node or array of nodes whose presence you are detecting in the current instance's
render tree.
#### Returns
`Boolean`: whether or not the current wrapper has nodes anywhere in its render tree that match
the ones passed in.
#### Example
```jsx
const wrapper = shallow((
<div>
<div data-foo="foo" data-bar="bar">Hello</div>
</div>
));
expect(wrapper.contains(<div data-foo="foo" data-bar="bar">Hello</div>)).to.equal(true);
expect(wrapper.contains(<div data-foo="foo">Hello</div>)).to.equal(false);
expect(wrapper.contains(<div data-foo="foo" data-bar="bar" data-baz="baz">Hello</div>)).to.equal(false);
expect(wrapper.contains(<div data-foo="foo" data-bar="Hello">Hello</div>)).to.equal(false);
expect(wrapper.contains(<div data-foo="foo" data-bar="bar" />)).to.equal(false);
```
```jsx
const wrapper = shallow((
<div>
<span>Hello</span>
<div>Goodbye</div>
<span>Again</span>
</div>
));
expect(wrapper.contains([
<span>Hello</span>,
<div>Goodbye</div>,
])).to.equal(true);
expect(wrapper.contains([
<span>Hello</span>,
<div>World</div>,
])).to.equal(false);
```
```jsx
const calculatedValue = 2 + 2;
const wrapper = shallow((
<div>
<div data-foo="foo" data-bar="bar">{calculatedValue}</div>
</div>
));
expect(wrapper.contains(<div data-foo="foo" data-bar="bar">{4}</div>)).to.equal(true);
```
#### Common Gotchas
- `.contains()` expects a ReactElement, not a selector (like many other methods). Make sure that
when you are calling it you are calling it with a ReactElement or a JSX expression.
- Keep in mind that this method determines equality based on the equality of the node's children as
well.
================================================
FILE: docs/api/ShallowWrapper/containsAllMatchingElements.md
================================================
# `.containsAllMatchingElements(patternNodes) => Boolean`
Returns 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`.
#### Arguments
1. `patternNodes` (`Array<ReactElement>`): The array of nodes whose presence you are detecting in the current instance's
render tree.
#### Returns
`Boolean`: whether or not the current wrapper has nodes anywhere in its render tree that looks
like the nodes passed in.
#### Example
```jsx
const style = { fontSize: 13 };
const wrapper = shallow((
<div>
<span className="foo">Hello</span>
<div style={style}>Goodbye</div>
<span>Again</span>
</div>
));
expect(wrapper.containsAllMatchingElements([
<span>Hello</span>,
<div>Goodbye</div>,
])).to.equal(true);
```
#### Common Gotchas
- `.containsAllMatchingElements()` expects an array of ReactElement, not a selector (like many other methods). Make sure that
when you are calling it you are calling it with an array of ReactElement or a JSX expression.
- Keep in mind that this method determines matching based on the matching of the node's children as
well.
#### Related Methods
- [`.matchesElement() => ShallowWrapper`](matchesElement.md) - rules for matching each node
- [`.containsMatchingElement() => ShallowWrapper`](containsMatchingElement.md) - rules for matching whole wrapper
- [`.containsAnyMatchingElements() => ShallowWrapper`](containsAnyMatchingElements.md) - must match at least one in patternNodes
================================================
FILE: docs/api/ShallowWrapper/containsAnyMatchingElements.md
================================================
# `.containsAnyMatchingElements(patternNodes) => Boolean`
Returns 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`.
#### Arguments
1. `patternNodes` (`Array<ReactElement>`): The array of nodes whose presence you are detecting in the current instance's
render tree.
#### Returns
`Boolean`: whether or not the current wrapper has a node anywhere in its render tree that looks
like one of the array passed in.
#### Example
```jsx
const style = { fontSize: 13 };
const wrapper = shallow((
<div>
<span className="foo">Hello</span>
<div style={style}>Goodbye</div>
<span>Again</span>
</div>
));
expect(wrapper.containsAnyMatchingElements([
<span>Bonjour</span>,
<div>Goodbye</div>,
])).to.equal(true);
```
#### Common Gotchas
- `.containsAnyMatchingElements()` expects an array of ReactElement, not a selector (like many other methods). Make sure that
when you are calling it you are calling it with an array ReactElement or a JSX expression.
- Keep in mind that this method determines equality based on the equality of the node's children as
well.
#### Related Methods
- [`.matchesElement() => ShallowWrapper`](matchesElement.md) - rules for matching each node
- [`.containsMatchingElement() => ShallowWrapper`](containsMatchingElement.md) - rules for matching whole wrapper
- [`.containsAllMatchingElements() => ShallowWrapper`](containsAllMatchingElements.md) - must match all nodes in patternNodes
================================================
FILE: docs/api/ShallowWrapper/containsMatchingElement.md
================================================
# `.containsMatchingElement(patternNode) => Boolean`
Returns whether or not a `patternNode` react element matches any element in the render tree.
* the matches can happen anywhere in the wrapper's contents
* the wrapper can contain more than one node; all are searched
Otherwise, the match follows the same rules as `matchesElement`.
#### Arguments
1. `patternNode` (`ReactElement`): The node whose presence you are detecting in the current instance's
render tree.
#### Returns
`Boolean`: whether or not the current wrapper has a node anywhere in its render tree that matches
the one passed in.
#### Example
```jsx
const wrapper = shallow((
<div>
<div data-foo="foo" data-bar="bar">Hello</div>
</div>
));
expect(wrapper.containsMatchingElement(<div data-foo="foo" data-bar="bar">Hello</div>)).to.equal(true);
expect(wrapper.containsMatchingElement(<div data-foo="foo">Hello</div>)).to.equal(true);
expect(wrapper.containsMatchingElement(<div data-foo="foo" data-bar="bar" data-baz="baz">Hello</div>)).to.equal(false);
expect(wrapper.containsMatchingElement(<div data-foo="foo" data-bar="Hello">Hello</div>)).to.equal(false);
expect(wrapper.containsMatchingElement(<div data-foo="foo" data-bar="bar" />)).to.equal(false);
```
#### Common Gotchas
- `.containsMatchingElement()` expects a ReactElement, not a selector (like many other methods). Make sure that
when you are calling it you are calling it with a ReactElement or a JSX expression.
- Keep in mind that this method determines equality based on the equality of the node's children as
well.
#### Related Methods
- [`.containsAllMatchingElements() => ShallowWrapper`](containsAllMatchingElements.md) - must match all nodes in patternNodes
- [`.containsAnyMatchingElements() => ShallowWrapper`](containsAnyMatchingElements.md) - must match at least one in patternNodes
================================================
FILE: docs/api/ShallowWrapper/context.md
================================================
# `.context([key]) => Any`
Returns the context hash for the root node of the wrapper. Optionally pass in a prop name and it
will return just that value.
#### Arguments
1. `key` (`String` [optional]): If provided, the return value will be the `this.context[key]` of the
root component instance.
#### Example
```jsx
const wrapper = shallow(
<MyComponent />,
{ context: { foo: 10 } },
);
expect(wrapper.context().foo).to.equal(10);
expect(wrapper.context('foo')).to.equal(10);
```
#### Related Methods
- [`.props() => Object`](props.md)
- [`.prop(key) => Any`](prop.md)
- [`.state([key]) => Any`](state.md)
================================================
FILE: docs/api/ShallowWrapper/debug.md
================================================
# `.debug([options]) => String`
Returns an HTML-like string of the wrapper for debugging purposes. Useful to print out to the
console when tests are not passing when you expect them to.
#### Arguments
`options` (`Object` [optional]):
- `options.ignoreProps`: (`Boolean` [optional]): Whether props should be omitted in the resulting string. Props are included by default.
- `options.verbose`: (`Boolean` [optional]): Whether arrays and objects passed as props should be verbosely printed.
#### Returns
`String`: The resulting string.
#### Examples
```jsx
function Book({ title, pages }) {
return (
<div>
<h1 className="title">{title}</h1>
{pages && (
<NumberOfPages
pages={pages}
object={{ a: 1, b: 2 }}
/>
)}
</div>
);
}
Book.propTypes = {
title: PropTypes.string.isRequired,
pages: PropTypes.number,
};
Book.defaultProps = {
pages: null,
};
```
```jsx
const wrapper = shallow(<Book title="Huckleberry Finn" />);
console.log(wrapper.debug());
```
Outputs to console:
```text
<div>
<h1 className="title">Huckleberry Finn</h1>
</div>
```
```jsx
const wrapper = shallow((
<Book
title="Huckleberry Finn"
pages="633 pages"
/>
));
console.log(wrapper.debug());
```
Outputs to console:
```text
<div>
<h1 className="title">Huckleberry Finn</h1>
<NumberOfPages pages="633 pages" object={{...}}/>
</div>
```
```jsx
const wrapper = shallow((
<Book
title="Huckleberry Finn"
pages="633 pages"
/>
));
console.log(wrapper.debug({ ignoreProps: true }));
```
Outputs to console:
```text
<div>
<h1>Huckleberry Finn</h1>
<NumberOfPages />
</div>
```
```jsx
const wrapper = shallow((
<Book
title="Huckleberry Finn"
pages="633 pages"
/>
));
console.log(wrapper.debug({ verbose: true }));
```
Outputs to console:
```text
<div>
<h1 className="title">Huckleberry Finn</h1>
<NumberOfPages pages="633 pages" object={{ a: 1, b: 2 }}/>
</div>
```
================================================
FILE: docs/api/ShallowWrapper/dive.md
================================================
# `.dive([options]) => ShallowWrapper`
Shallow 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.
There is no corresponding `dive` method for ReactWrappers.
NOTE: 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).
#### Arguments
1. `options` (`Object` [optional]):
- `options.context`: (`Object` [optional]): Context to be passed into the component
#### Returns
`ShallowWrapper`: A new wrapper that wraps the current node after it's been shallow rendered.
#### Examples
```jsx
function Bar() {
return (
<div>
<div className="in-bar" />
</div>
);
}
```
```jsx
function Foo() {
return (
<div>
<Bar />
</div>
);
}
```
```jsx
const wrapper = shallow(<Foo />);
expect(wrapper.find('.in-bar')).to.have.lengthOf(0);
expect(wrapper.find(Bar)).to.have.lengthOf(1);
expect(wrapper.find(Bar).dive().find('.in-bar')).to.have.lengthOf(1);
```
================================================
FILE: docs/api/ShallowWrapper/equals.md
================================================
# `.equals(node) => Boolean`
Returns whether or not the current wrapper root node render tree looks like the one passed in.
#### Arguments
1. `node` (`ReactElement`): The node whose presence you are detecting in the current instance's
render tree.
#### Returns
`Boolean`: whether or not the current wrapper has a node anywhere in it's render tree that looks
like the one passed in.
#### Example
```jsx
function MyComponent() {
return <div className="foo bar" />;
}
const wrapper = shallow(<MyComponent />);
expect(wrapper.equals(<div className="foo bar" />)).to.equal(true);
```
#### Common Gotchas
- `.equals()` expects a ReactElement, not a selector (like many other methods). Make sure that
when you are calling it you are calling it with a ReactElement or a JSX expression.
- Keep in mind that this method determines equality based on the equality of the node's children as
well.
- Following React's behavior, `.equals()` ignores properties whose values are `undefined`.
================================================
FILE: docs/api/ShallowWrapper/every.md
================================================
# `.every(selector) => Boolean`
Returns whether or not all of the nodes in the wrapper match the provided selector.
#### Arguments
1. `selector` ([`EnzymeSelector`](../selector.md)): The selector to match.
#### Returns
`Boolean`: True if every node in the current wrapper matched the provided selector.
#### Examples
```jsx
const wrapper = shallow((
<div>
<div className="foo qoo" />
<div className="foo boo" />
<div className="foo hoo" />
</div>
));
expect(wrapper.find('.foo').every('.foo')).to.equal(true);
expect(wrapper.find('.foo').every('.qoo')).to.equal(false);
expect(wrapper.find('.foo').every('.bar')).to.equal(false);
```
#### Related Methods
- [`.someWhere(predicate) => Boolean`](someWhere.md)
- [`.everyWhere(predicate) => Boolean`](everyWhere.md)
================================================
FILE: docs/api/ShallowWrapper/everyWhere.md
================================================
# `.everyWhere(fn) => Boolean`
Returns whether or not all of the nodes in the wrapper pass the provided predicate function.
#### Arguments
1. `predicate` (`ShallowWrapper => Boolean`): A predicate function to match the nodes.
#### Returns
`Boolean`: True if every node in the current wrapper passed the predicate function.
#### Example
```jsx
const wrapper = shallow((
<div>
<div className="foo qoo" />
<div className="foo boo" />
<div className="foo hoo" />
</div>
));
expect(wrapper.find('.foo').everyWhere((n) => n.hasClass('foo'))).to.equal(true);
expect(wrapper.find('.foo').everyWhere((n) => n.hasClass('qoo'))).to.equal(false);
expect(wrapper.find('.foo').everyWhere((n) => n.hasClass('bar'))).to.equal(false);
```
#### Related Methods
- [`.some(selector) => Boolean`](some.md)
- [`.every(selector) => Boolean`](every.md)
- [`.everyWhere(predicate) => Boolean`](everyWhere.md)
================================================
FILE: docs/api/ShallowWrapper/exists.md
================================================
# `.exists([selector]) => Boolean`
Returns 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.
#### Arguments
1. `selector` ([`EnzymeSelector`](../selector.md) [optional]): The selector to check existence for.
#### Returns
`Boolean`: whether or not any nodes are on the list, or the selector had any matches.
#### Example
```jsx
const wrapper = shallow(<div className="some-class" />);
expect(wrapper.exists('.some-class')).to.equal(true);
expect(wrapper.find('.other-class').exists()).to.equal(false);
```
================================================
FILE: docs/api/ShallowWrapper/filter.md
================================================
# `.filter(selector) => ShallowWrapper`
Returns a new wrapper with only the nodes of the current wrapper that match the provided selector.
#### Arguments
1. `selector` ([`EnzymeSelector`](../selector.md)): The selector to match.
#### Returns
`ShallowWrapper`: A new wrapper that wraps the filtered nodes.
#### Examples
```jsx
const wrapper = shallow(<MyComponent />);
expect(wrapper.find('.foo').filter('.bar')).to.have.lengthOf(1);
```
#### Related Methods
- [`.filterWhere(predicate) => ShallowWrapper`](filterWhere.md)
================================================
FILE: docs/api/ShallowWrapper/filterWhere.md
================================================
# `.filterWhere(fn) => ShallowWrapper`
Returns a new wrapper with only the nodes of the current wrapper that, when passed into the
provided predicate function, return true.
#### Arguments
1. `predicate` (`ShallowWrapper => Boolean`): A predicate function that is passed a wrapped node.
#### Returns
`ShallowWrapper`: A new wrapper that wraps the filtered nodes.
#### Example
```jsx
const wrapper = shallow(<MyComponent />);
const complexFoo = wrapper.find('.foo').filterWhere((n) => typeof n.type() !== 'string');
expect(complexFoo).to.have.lengthOf(4);
```
#### Related Methods
- [`.filter(selector) => ShallowWrapper`](filter.md)
================================================
FILE: docs/api/ShallowWrapper/find.md
================================================
# `.find(selector) => ShallowWrapper`
Finds every node in the render tree of the current wrapper that matches the provided selector.
#### Arguments
1. `selector` ([`EnzymeSelector`](../selector.md)): The selector to match.
#### Returns
`ShallowWrapper`: A new wrapper that wraps the found nodes.
#### Examples
CSS Selectors:
```jsx
const wrapper = shallow(<MyComponent />);
expect(wrapper.find('.foo')).to.have.lengthOf(1);
expect(wrapper.find('.bar')).to.have.lengthOf(3);
// compound selector
expect(wrapper.find('div.some-class')).to.have.lengthOf(3);
// CSS id selector
expect(wrapper.find('#foo')).to.have.lengthOf(1);
```
Component Constructors:
```jsx
import Foo from '../components/Foo';
const wrapper = shallow(<MyComponent />);
expect(wrapper.find(Foo)).to.have.lengthOf(1);
```
Component Display Name:
```jsx
const wrapper = shallow(<MyComponent />);
expect(wrapper.find('Foo')).to.have.lengthOf(1);
```
Object Property Selector:
```jsx
const wrapper = shallow(<MyComponent />);
expect(wrapper.find({ prop: 'value' })).to.have.lengthOf(1);
```
#### Related Methods
- [`.findWhere(predicate) => ShallowWrapper`](findWhere.md)
================================================
FILE: docs/api/ShallowWrapper/findWhere.md
================================================
# `.findWhere(fn) => ShallowWrapper`
Finds every node in the render tree that returns true for the provided predicate function.
#### Arguments
1. `predicate` (`ShallowWrapper => Boolean`): A predicate function called with the passed in wrapped
nodes.
#### Returns
`ShallowWrapper`: A new wrapper that wraps the found nodes.
#### Example
```jsx
const wrapper = shallow(<MyComponent />);
const complexComponents = wrapper.findWhere((n) => n.type() !== 'string');
expect(complexComponents).to.have.lengthOf(8);
```
#### Related Methods
- [`.find(selector) => ShallowWrapper`](find.md)
================================================
FILE: docs/api/ShallowWrapper/first.md
================================================
# `.first() => ShallowWrapper`
Reduce the set of matched nodes to the first in the set, just like `.at(0)`.
#### Returns
`ShallowWrapper`: A new wrapper that wraps the first node in the set.
#### Examples
```jsx
const wrapper = shallow(<MyComponent />);
expect(wrapper.find(Foo).first().props().foo).to.equal('bar');
```
#### Related Methods
- [`.at(index) => ShallowWrapper`](at.md) - retrieve a wrapper node at given index
- [`.last() => ShallowWrapper`](last.md)
================================================
FILE: docs/api/ShallowWrapper/forEach.md
================================================
# `.forEach(fn) => Self`
Iterates through each node of the current wrapper and executes the provided function with a
wrapper around the corresponding node passed in as the first argument.
#### Arguments
1. `fn` (`Function ( ShallowWrapper node, Number index )`): A callback to be run for every node in the collection.
Should expect a ShallowWrapper as the first argument, and will be run with a context of the original
instance.
#### Returns
`ShallowWrapper`: Returns itself.
#### Example
```jsx
const wrapper = shallow((
<div>
<div className="foo bax" />
<div className="foo bar" />
<div className="foo baz" />
</div>
));
wrapper.find('.foo').forEach((node) => {
expect(node.hasClass('foo')).to.equal(true);
});
```
#### Related Methods
- [`.map(fn) => ShallowWrapper`](map.md)
================================================
FILE: docs/api/ShallowWrapper/get.md
================================================
# `.get(index) => ReactElement`
Returns the node at a given index of the current wrapper.
#### Arguments
1. `index` (`Number`): A zero-based integer indicating which node to retrieve.
#### Returns
`ReactElement`: The retrieved node.
#### Examples
```jsx
const wrapper = shallow(<MyComponent />);
expect(wrapper.find(Foo).get(0).props.foo).to.equal('bar');
```
#### Related Methods
- [`.at(index) => ShallowWrapper`](at.md) - same, but returns the React node in a single-node wrapper.
================================================
FILE: docs/api/ShallowWrapper/getElement.md
================================================
# `.getElement() => ReactElement`
Returns the wrapped ReactElement.
If the current wrapper is wrapping the root component, returns the root component's latest render output.
#### Returns
`ReactElement`: The retrieved ReactElement.
#### Examples
```jsx
const element = (
<div>
<span />
<span />
</div>
);
function MyComponent() {
return element;
}
const wrapper = shallow(<MyComponent />);
expect(wrapper.getElement()).to.equal(element);
```
#### Related Methods
- [`.getElements() => Array<ReactElement>`](getElements.md)
================================================
FILE: docs/api/ShallowWrapper/getElements.md
================================================
# `.getElements() => Array<ReactElement>`
Returns the wrapped ReactElements
If the current wrapper is wrapping the root component, returns the root component's latest render output wrapped in an array.
#### Returns
`Array<ReactElement>`: The retrieved ReactElements.
#### Examples
```jsx
const one = <span />;
const two = <span />;
function Test() {
return (
<div>
{one}
{two}
</div>
);
}
const wrapper = shallow(<Test />);
expect(wrapper.find('span').getElements()).to.deep.equal([one, two]);
```
#### Related Methods
- [`.getElement() => ReactElement`](getElement.md)
================================================
FILE: docs/api/ShallowWrapper/getWrappingComponent.md
================================================
# `.getWrappingComponent() => ShallowWrapper`
If 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.
#### Returns
`ShallowWrapper`: A `ShallowWrapper` around the rendered `wrappingComponent`
#### Examples
```jsx
import { Provider } from 'react-redux';
import { Router } from 'react-router';
import store from './my/app/store';
import mockStore from './my/app/mockStore';
function MyProvider(props) {
const { children, customStore } = props;
return (
<Provider store={customStore || store}>
<Router>
{children}
</Router>
</Provider>
);
}
MyProvider.propTypes = {
children: PropTypes.node,
customStore: PropTypes.shape({}),
};
MyProvider.defaultProps = {
children: null,
customStore: null,
};
const wrapper = shallow(<MyComponent />, {
wrappingComponent: MyProvider,
});
const provider = wrapper.getWrappingComponent();
provider.setProps({ customStore: mockStore });
```
================================================
FILE: docs/api/ShallowWrapper/hasClass.md
================================================
# `.hasClass(className) => Boolean`
Returns whether or not the wrapped node has a `className` prop including the passed in class name. It must be a single-node wrapper.
#### Arguments
1. `className` (`String` | `RegExp`): A single class name or a regex expression.
#### Returns
`Boolean`: whether or not the wrapped node has the class.
#### Example
```jsx
const wrapper = shallow(<MyComponent />);
expect(wrapper.find('.my-button').hasClass('disabled')).to.equal(true);
```
```jsx
// Searching using RegExp works fine when classes were injected by a jss decorator
const wrapper = shallow(<MyComponent />);
expect(wrapper.find('.my-button').hasClass(/(ComponentName)-(other)-(\d+)/)).to.equal(true);
```
### Common Gotchas
- `.hasClass()` expects a class name, NOT a CSS selector. `.hasClass('.foo')` should be
`.hasClass('foo')`
================================================
FILE: docs/api/ShallowWrapper/hostNodes.md
================================================
# `.hostNodes() => ShallowWrapper`
Returns a new wrapper with only host nodes.
When using `react-dom`, host nodes are HTML elements rather than custom React components, e.g. `<div>` versus `<MyComponent>`.
#### Returns
`ShallowWrapper`: A new wrapper that wraps the filtered nodes.
#### Examples
The following code takes a wrapper with two nodes, one a `<MyComponent>` React component, and the other a `<span>`, and filters out the React component.
```jsx
const wrapper = shallow((
<div>
<MyComponent className="foo" />
<span className="foo" />
</div>
));
const twoNodes = wrapper.find('.foo');
expect(twoNodes.hostNodes()).to.have.lengthOf(1);
```
================================================
FILE: docs/api/ShallowWrapper/html.md
================================================
# `.html() => String`
Returns 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).
Note: can only be called on a wrapper of a single node.
#### Returns
`String`: The resulting HTML string
#### Examples
```jsx
function Foo() {
return (<div className="in-foo" />);
}
```
```jsx
function Bar() {
return (
<div className="in-bar">
<Foo />
</div>
);
}
```
```jsx
const wrapper = shallow(<Bar />);
expect(wrapper.html()).to.equal('<div class="in-bar"><div class="in-foo"></div></div>');
expect(wrapper.find(Foo).html()).to.equal('<div class="in-foo"></div>');
```
```jsx
const wrapper = shallow(<div><b>important</b></div>);
expect(wrapper.html()).to.equal('<div><b>important</b></div>');
```
#### Related Methods
- [`.text() => String`](text.md)
- [`.debug() => String`](debug.md)
================================================
FILE: docs/api/ShallowWrapper/instance.md
================================================
# `.instance() => ReactComponent`
Returns the single-node wrapper's node's underlying class instance; `this` in its methods. It must be a single-node wrapper.
NOTE: 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.
#### Returns
`ReactComponent|DOMComponent`: The retrieved instance.
#### Example
<!-- eslint react/prop-types: 0, react/prefer-stateless-function: 0 -->
```jsx
function SFC() {
return <div>MyFunction</div>;
}
class Stateful extends React.Component {
render() {
return <div>MyClass</div>;
}
}
```
#### React 16.x
```jsx
test('wrapper instance is null', () => {
const wrapper = shallow(<SFC />);
const instance = wrapper.instance();
expect(instance).to.equal(null);
});
test('wrapper instance is not null', () => {
const wrapper = shallow(<Stateful />);
const instance = wrapper.instance();
expect(instance).to.be.instanceOf(MyCStatefullass);
});
```
#### React 15.x
```jsx
test('wrapper instance is not null', () => {
const wrapper = shallow(<SFC />);
const instance = wrapper.instance();
expect(instance).to.be.instanceOf(SFC);
});
test('wrapper instance is not null', () => {
const wrapper = shallow(<Stateful />);
const instance = wrapper.instance();
expect(instance).to.be.instanceOf(Stateful);
});
```
================================================
FILE: docs/api/ShallowWrapper/invoke.md
================================================
# `.invoke(invokePropName)(...args) => Any`
Invokes a function prop.
#### Arguments
1. `propName` (`String`): The function prop that is invoked
2. `...args` (`Any` [optional]): Arguments that is passed to the prop function
This essentially calls wrapper.prop(propName)(...args).
#### Returns
`Any`: Returns the value from the prop function
#### Example
```jsx
class Foo extends React.Component {
loadData() {
return fetch();
}
render() {
return (
<div>
<button
type="button"
onClick={() => this.loadData()}
>
Load more
</button>
</div>
);
}
}
const wrapper = shallow(<Foo />);
wrapper.find('button').invoke('onClick')().then(() => {
// expect()
});
```
================================================
FILE: docs/api/ShallowWrapper/is.md
================================================
# `.is(selector) => Boolean`
Returns whether or not the single wrapped node matches the provided selector. It must be a single-node wrapper.
#### Arguments
1. `selector` ([`EnzymeSelector`](../selector.md)): The selector to match.
#### Returns
`Boolean`: whether or not the wrapped node matches the provided selector.
#### Example
```jsx
const wrapper = shallow(<div className="some-class other-class" />);
expect(wrapper.is('.some-class')).to.equal(true);
```
================================================
FILE: docs/api/ShallowWrapper/isEmpty.md
================================================
# `.isEmpty() => Boolean`
**Deprecated**: Use [`.exists()`](exists.md) instead.
Returns whether or not the wrapper is empty.
#### Returns
`Boolean`: whether or not the wrapper is empty.
#### Example
```jsx
const wrapper = shallow(<div className="some-class" />);
expect(wrapper.find('.other-class').isEmpty()).to.equal(true);
```
================================================
FILE: docs/api/ShallowWrapper/isEmptyRender.md
================================================
# `.isEmptyRender() => Boolean`
Returns whether or not the wrapper would ultimately render only the allowed falsy values: `false` or `null`.
#### Returns
`Boolean`: whether the return is falsy
#### Example
```jsx
function Foo() {
return null;
}
const wrapper = shallow(<Foo />);
expect(wrapper.isEmptyRender()).to.equal(true);
```
================================================
FILE: docs/api/ShallowWrapper/key.md
================================================
# `.key() => String`
Returns the key value for the node of the current wrapper. It must be a single-node wrapper.
#### Example
```jsx
const wrapper = shallow((
<ul>
{['foo', 'bar'].map((s) => <li key={s}>{s}</li>)}
</ul>
)).find('li');
expect(wrapper.at(0).key()).to.equal('foo');
expect(wrapper.at(1).key()).to.equal('bar');
```
================================================
FILE: docs/api/ShallowWrapper/last.md
================================================
# `.last() => ShallowWrapper`
Reduce the set of matched nodes to the last in the set, just like `.at(length - 1)`.
#### Returns
`ShallowWrapper`: A new wrapper that wraps the last node in the set.
#### Examples
```jsx
const wrapper = shallow(<MyComponent />);
expect(wrapper.find(Foo).last().props().foo).to.equal('bar');
```
#### Related Methods
- [`.at(index) => ShallowWrapper`](at.md) - retrieve a wrapper node by index
- [`.first() => ShallowWrapper`](first.md)
================================================
FILE: docs/api/ShallowWrapper/length.md
================================================
# `.length => number`
Returns the number of React nodes enclosed in this wrapper.
#### Returns
`Number`: count of nodes in the list in this wrapper.
#### Example
```jsx
const wrapper = shallow(<div />);
expect(wrapper.length).to.equal(1);
```
================================================
FILE: docs/api/ShallowWrapper/map.md
================================================
# `.map(fn) => Array<Any>`
Maps the current array of nodes to another array. Each node is passed in as a `ShallowWrapper`
to the map function.
#### Arguments
1. `fn` (`Function ( ShallowWrapper node, Number index ) => Any`): A mapping function to be run for every node in
the 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
the original instance.
#### Returns
`Array<Any>`: Returns an array of the returned values from the mapping function..
#### Example
```jsx
const wrapper = shallow((
<div>
<div className="foo">bax</div>
<div className="foo">bar</div>
<div className="foo">baz</div>
</div>
));
const texts = wrapper.find('.foo').map((node) => node.text());
expect(texts).to.eql(['bax', 'bar', 'baz']);
```
#### Related Methods
- [`.forEach(fn) => ShallowWrapper`](forEach.md)
- [`.reduce(fn[, initialValue]) => Any`](reduce.md)
- [`.reduceRight(fn[, initialValue]) => Any`](reduceRight.md)
================================================
FILE: docs/api/ShallowWrapper/matchesElement.md
================================================
# `.matchesElement(patternNode) => Boolean`
Returns 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.
The `patternNode` acts like a wildcard. For it to match a node in the wrapper:
* tag names must match
* 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.
* `patternNode` props (attributes) must appear in the wrapper's nodes, but not the other way around. Their values must match if they do appear.
* `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.
#### Arguments
1. `patternNode` (`ReactElement`): The node whose presence you are detecting in the wrapper's single node.
#### Returns
`Boolean`: whether or not the current wrapper match the one passed in.
#### Example
<!-- eslint-disable react/button-has-type -->
```jsx
class MyComponent extends React.Component {
constructor(props) {
super(props);
this.handleClick = this.handleClick.bind(this);
}
handleClick() {
// ...
}
render() {
return (
<button type="button" onClick={this.handleClick} className="foo bar">Hello</button>
);
}
}
const wrapper = shallow(<MyComponent />);
expect(wrapper.matchesElement(<button>Hello</button>)).to.equal(true);
expect(wrapper.matchesElement(<button className="foo bar">Hello</button>)).to.equal(true);
```
#### Common Gotchas
- `.matchesElement()` expects a ReactElement, not a selector (like many other methods). Make sure that
when you are calling it you are calling it with a ReactElement or a JSX expression.
- Keep in mind that this method determines matching based on the matching of the node's children as
well.
#### Related Methods
- [`.containsMatchingElement() => ShallowWrapper`](containsMatchingElement.md) - searches all nodes in the wrapper, and searches their entire depth
================================================
FILE: docs/api/ShallowWrapper/name.md
================================================
# `.name() => String|null`
Returns the name of the current node of this wrapper. If it's a composite component, this will be
the name of the top-most rendered component. If it's a native DOM node, it will be a string of the
tag name. If it's `null`, it will be `null`.
The order of precedence on returning the name is: `type.displayName` -> `type.name` -> `type`.
Note: can only be called on a wrapper of a single node.
#### Returns
`String|null`: The name of the current node
#### Examples
```jsx
const wrapper = shallow(<div />);
expect(wrapper.name()).to.equal('div');
```
```jsx
function SomeWrappingComponent() {
return <Foo />;
}
const wrapper = shallow(<SomeWrappingComponent />);
expect(wrapper.name()).to.equal('Foo');
```
```jsx
Foo.displayName = 'A cool custom name';
function SomeWrappingComponent() {
return <Foo />;
}
const wrapper = shallow(<SomeWrappingComponent />);
expect(wrapper.name()).to.equal('A cool custom name');
```
================================================
FILE: docs/api/ShallowWrapper/not.md
================================================
# `.not(selector) => ShallowWrapper`
Returns a new wrapper with only the nodes of the current wrapper that don't match the provided
selector.
This method is effectively the negation or inverse of [`filter`](filter.md).
#### Arguments
1. `selector` ([`EnzymeSelector`](../selector.md)): The selector to match.
#### Returns
`ShallowWrapper`: A new wrapper that wraps the filtered nodes.
#### Examples
```jsx
const wrapper = shallow(<MyComponent />);
expect(wrapper.find('.foo').not('.bar')).to.have.lengthOf(1);
```
#### Related Methods
- [`.filterWhere(predicate) => ShallowWrapper`](filterWhere.md)
- [`.filter(selector) => ShallowWrapper`](filter.md)
================================================
FILE: docs/api/ShallowWrapper/parent.md
================================================
# `.parent() => ShallowWrapper`
Returns a wrapper with the direct parent of the node in the current wrapper.
#### Returns
`ShallowWrapper`: A new wrapper that wraps the resulting nodes.
#### Examples
```jsx
const wrapper = shallow(<ToDoList />);
expect(wrapper.find('ul').parent().is('div')).to.equal(true);
```
#### Related Methods
- [`.parents([selector]) => ShallowWrapper`](parents.md)
- [`.children([selector]) => ShallowWrapper`](children.md)
- [`.closest(selector) => ShallowWrapper`](closest.md)
================================================
FILE: docs/api/ShallowWrapper/parents.md
================================================
# `.parents([selector]) => ShallowWrapper`
Returns a wrapper around all of the parents/ancestors of the single node in the wrapper. Does not include the node itself.
Optionally, a selector can be provided and it will filter the parents by this selector. It must be a single-node wrapper.
#### Arguments
1. `selector` ([`EnzymeSelector`](../selector.md) [optional]): The selector to filter the parents by.
#### Returns
`ShallowWrapper`: A new wrapper that wraps the resulting nodes.
#### Examples
```jsx
const wrapper = shallow(<ToDoList />);
expect(wrapper.find('ul').parents()).to.have.lengthOf(2);
```
#### Related Methods
- [`.children([selector]) => ShallowWrapper`](children.md)
- [`.parent() => ShallowWrapper`](parent.md)
- [`.closest(selector) => ShallowWrapper`](closest.md)
================================================
FILE: docs/api/ShallowWrapper/prop.md
================================================
# `.prop(key) => Any`
Returns the prop value for the root node of the wrapper with the provided key. It must be a single-node wrapper.
NOTE: When called on a shallow wrapper, `.prop(key)` will return values for
props on the root node that the component *renders*, not the component itself.
To return the props for the entire React component, use `wrapper.instance().props`.
See [`.instance() => ReactComponent`](instance.md)
#### Arguments
1. `key` (`String`): The prop name, that is, `this.props[key]` or `props[key]` for the root node of the wrapper.
#### Example
```jsx
import PropTypes from 'prop-types';
import ValidateNumberInputComponent from './ValidateNumberInputComponent';
class MyComponent extends React.Component {
constructor(...args) {
super(...args);
this.state = {
number: 0,
};
this.onValidNumberInput = this.onValidNumberInput.bind(this);
}
onValidNumberInput(e) {
const number = e.target.value;
if (!number || typeof number === 'number') {
this.setState({ number });
}
}
render() {
const { includedProp } = this.props;
const { number } = this.state;
return (
<div className="foo bar" includedProp={includedProp}>
<ValidateNumberInputComponent onChangeHandler={onValidNumberInput} number={number} />
</div>
);
}
}
MyComponent.propTypes = {
includedProp: PropTypes.string.isRequired,
};
const wrapper = shallow(<MyComponent includedProp="Success!" excludedProp="I'm not included" />);
expect(wrapper.prop('includedProp')).to.equal('Success!');
const validInput = 1;
wrapper.find('ValidateNumberInputComponent').prop('onChangeHandler')(validInput);
expect(wrapper.state('number')).to.equal(validInput);
const invalidInput = 'invalid input';
wrapper.find('ValidateNumberInputComponent').prop('onChangeHandler')(invalidInput);
expect(wrapper.state('number')).to.equal(0);
// Warning: .prop(key) only returns values for props that exist in the root node.
// See the note above about wrapper.instance().props to return all props in the React component.
console.log(wrapper.prop('includedProp'));
// "Success!"
console.log(wrapper.prop('excludedProp'));
// undefined
console.log(wrapper.instance().props.excludedProp);
// "I'm not included"
```
#### Related Methods
- [`.props() => Object`](props.md)
- [`.state([key]) => Any`](state.md)
- [`.context([key]) => Any`](context.md)
================================================
FILE: docs/api/ShallowWrapper/props.md
================================================
# `.props() => Object`
Returns the props object for the root node of the wrapper. It must be a single-node wrapper.
NOTE: When called on a shallow wrapper, `.props()` will return values for props on the root node that the component *renders*, not the component itself.
This method is a reliable way of accessing the props of a node; `wrapper.instance().props` will work as well, but in React 16+, stateless functiona
gitextract_ky2tl6yi/
├── .babelrc
├── .eslintrc
├── .github/
│ ├── FUNDING.yml
│ ├── ISSUE_TEMPLATE/
│ │ ├── Bug_report.md
│ │ └── Feature_request.md
│ └── workflows/
│ ├── node-pretest.yml
│ ├── node.yml
│ ├── rebase.yml
│ └── require-allow-edits.yml
├── .gitignore
├── .lgtm
├── .npmrc
├── .nycrc
├── CHANGELOG.md
├── CONTRIBUTING.md
├── INTHEWILD.md
├── LICENSE.md
├── MAINTAINERS
├── README.md
├── SUMMARY.md
├── book.json
├── docs/
│ ├── GLOSSARY.md
│ ├── api/
│ │ ├── README.md
│ │ ├── ReactWrapper/
│ │ │ ├── at.md
│ │ │ ├── childAt.md
│ │ │ ├── children.md
│ │ │ ├── closest.md
│ │ │ ├── contains.md
│ │ │ ├── containsAllMatchingElements.md
│ │ │ ├── containsAnyMatchingElements.md
│ │ │ ├── containsMatchingElement.md
│ │ │ ├── context.md
│ │ │ ├── debug.md
│ │ │ ├── detach.md
│ │ │ ├── equals.md
│ │ │ ├── every.md
│ │ │ ├── everyWhere.md
│ │ │ ├── exists.md
│ │ │ ├── filter.md
│ │ │ ├── filterWhere.md
│ │ │ ├── find.md
│ │ │ ├── findWhere.md
│ │ │ ├── first.md
│ │ │ ├── forEach.md
│ │ │ ├── get.md
│ │ │ ├── getDOMNode.md
│ │ │ ├── getElement.md
│ │ │ ├── getElements.md
│ │ │ ├── getWrappingComponent.md
│ │ │ ├── hasClass.md
│ │ │ ├── hostNodes.md
│ │ │ ├── html.md
│ │ │ ├── instance.md
│ │ │ ├── invoke.md
│ │ │ ├── is.md
│ │ │ ├── isEmpty.md
│ │ │ ├── isEmptyRender.md
│ │ │ ├── key.md
│ │ │ ├── last.md
│ │ │ ├── length.md
│ │ │ ├── map.md
│ │ │ ├── matchesElement.md
│ │ │ ├── mount.md
│ │ │ ├── name.md
│ │ │ ├── not.md
│ │ │ ├── parent.md
│ │ │ ├── parents.md
│ │ │ ├── prop.md
│ │ │ ├── props.md
│ │ │ ├── reduce.md
│ │ │ ├── reduceRight.md
│ │ │ ├── ref.md
│ │ │ ├── render.md
│ │ │ ├── renderProp.md
│ │ │ ├── setContext.md
│ │ │ ├── setProps.md
│ │ │ ├── setState.md
│ │ │ ├── simulate.md
│ │ │ ├── simulateError.md
│ │ │ ├── slice.md
│ │ │ ├── some.md
│ │ │ ├── someWhere.md
│ │ │ ├── state.md
│ │ │ ├── tap.md
│ │ │ ├── text.md
│ │ │ ├── type.md
│ │ │ ├── unmount.md
│ │ │ └── update.md
│ │ ├── ShallowWrapper/
│ │ │ ├── at.md
│ │ │ ├── childAt.md
│ │ │ ├── children.md
│ │ │ ├── closest.md
│ │ │ ├── contains.md
│ │ │ ├── containsAllMatchingElements.md
│ │ │ ├── containsAnyMatchingElements.md
│ │ │ ├── containsMatchingElement.md
│ │ │ ├── context.md
│ │ │ ├── debug.md
│ │ │ ├── dive.md
│ │ │ ├── equals.md
│ │ │ ├── every.md
│ │ │ ├── everyWhere.md
│ │ │ ├── exists.md
│ │ │ ├── filter.md
│ │ │ ├── filterWhere.md
│ │ │ ├── find.md
│ │ │ ├── findWhere.md
│ │ │ ├── first.md
│ │ │ ├── forEach.md
│ │ │ ├── get.md
│ │ │ ├── getElement.md
│ │ │ ├── getElements.md
│ │ │ ├── getWrappingComponent.md
│ │ │ ├── hasClass.md
│ │ │ ├── hostNodes.md
│ │ │ ├── html.md
│ │ │ ├── instance.md
│ │ │ ├── invoke.md
│ │ │ ├── is.md
│ │ │ ├── isEmpty.md
│ │ │ ├── isEmptyRender.md
│ │ │ ├── key.md
│ │ │ ├── last.md
│ │ │ ├── length.md
│ │ │ ├── map.md
│ │ │ ├── matchesElement.md
│ │ │ ├── name.md
│ │ │ ├── not.md
│ │ │ ├── parent.md
│ │ │ ├── parents.md
│ │ │ ├── prop.md
│ │ │ ├── props.md
│ │ │ ├── reduce.md
│ │ │ ├── reduceRight.md
│ │ │ ├── render.md
│ │ │ ├── renderProp.md
│ │ │ ├── setContext.md
│ │ │ ├── setProps.md
│ │ │ ├── setState.md
│ │ │ ├── shallow.md
│ │ │ ├── simulate.md
│ │ │ ├── simulateError.md
│ │ │ ├── slice.md
│ │ │ ├── some.md
│ │ │ ├── someWhere.md
│ │ │ ├── state.md
│ │ │ ├── tap.md
│ │ │ ├── text.md
│ │ │ ├── type.md
│ │ │ ├── unmount.md
│ │ │ └── update.md
│ │ ├── mount.md
│ │ ├── render.md
│ │ ├── selector.md
│ │ └── shallow.md
│ ├── common-issues.md
│ ├── future.md
│ ├── guides/
│ │ ├── browserify.md
│ │ ├── jest.md
│ │ ├── jsdom.md
│ │ ├── karma.md
│ │ ├── lab.md
│ │ ├── migration-from-2-to-3.md
│ │ ├── mocha.md
│ │ ├── react-native.md
│ │ ├── systemjs.md
│ │ ├── tape-ava.md
│ │ └── webpack.md
│ ├── guides.md
│ └── installation/
│ ├── README.md
│ ├── react-013.md
│ ├── react-014.md
│ ├── react-15.md
│ └── react-16.md
├── env.js
├── install-relevant-react.sh
├── karma.conf.js
├── lerna.json
├── package.json
├── packages/
│ ├── enzyme/
│ │ ├── .babelrc
│ │ ├── .eslintrc
│ │ ├── ReactWrapper.js
│ │ ├── ShallowWrapper.js
│ │ ├── mount.js
│ │ ├── package.json
│ │ ├── render.js
│ │ ├── shallow.js
│ │ ├── src/
│ │ │ ├── Debug.js
│ │ │ ├── EnzymeAdapter.js
│ │ │ ├── RSTTraversal.js
│ │ │ ├── ReactWrapper.js
│ │ │ ├── ShallowWrapper.js
│ │ │ ├── Utils.js
│ │ │ ├── configuration.js
│ │ │ ├── getAdapter.js
│ │ │ ├── index.js
│ │ │ ├── mount.js
│ │ │ ├── render.js
│ │ │ ├── selectors.js
│ │ │ ├── shallow.js
│ │ │ └── validateAdapter.js
│ │ └── withDom.js
│ ├── enzyme-adapter-react-13/
│ │ ├── .babelrc
│ │ ├── .eslintrc
│ │ ├── package.json
│ │ └── src/
│ │ ├── ReactThirteenAdapter.js
│ │ ├── ReactThirteenElementToTree.js
│ │ ├── ReactThirteenMapNativeEventNames.js
│ │ └── index.js
│ ├── enzyme-adapter-react-14/
│ │ ├── .babelrc
│ │ ├── .eslintrc
│ │ ├── package.json
│ │ └── src/
│ │ ├── ReactFourteenAdapter.js
│ │ └── index.js
│ ├── enzyme-adapter-react-15/
│ │ ├── .babelrc
│ │ ├── .eslintrc
│ │ ├── package.json
│ │ └── src/
│ │ ├── ReactFifteenAdapter.js
│ │ └── index.js
│ ├── enzyme-adapter-react-15.4/
│ │ ├── .babelrc
│ │ ├── .eslintrc
│ │ ├── package.json
│ │ └── src/
│ │ ├── ReactFifteenFourAdapter.js
│ │ └── index.js
│ ├── enzyme-adapter-react-16/
│ │ ├── .babelrc
│ │ ├── .eslintrc
│ │ ├── package.json
│ │ └── src/
│ │ ├── ReactSixteenAdapter.js
│ │ ├── detectFiberTags.js
│ │ ├── findCurrentFiberUsingSlowPath.js
│ │ └── index.js
│ ├── enzyme-adapter-react-16.1/
│ │ ├── .babelrc
│ │ ├── .eslintignore
│ │ ├── .eslintrc
│ │ ├── .npmrc
│ │ ├── package.json
│ │ └── src/
│ │ ├── ReactSixteenOneAdapter.js
│ │ └── index.js
│ ├── enzyme-adapter-react-16.2/
│ │ ├── .babelrc
│ │ ├── .eslintignore
│ │ ├── .eslintrc
│ │ ├── .npmrc
│ │ ├── package.json
│ │ └── src/
│ │ ├── ReactSixteenTwoAdapter.js
│ │ └── index.js
│ ├── enzyme-adapter-react-16.3/
│ │ ├── .babelrc
│ │ ├── .eslintignore
│ │ ├── .eslintrc
│ │ ├── .npmrc
│ │ ├── package.json
│ │ └── src/
│ │ ├── ReactSixteenThreeAdapter.js
│ │ └── index.js
│ ├── enzyme-adapter-react-helper/
│ │ ├── .babelrc
│ │ ├── .eslintrc
│ │ ├── package.json
│ │ └── src/
│ │ ├── enzyme-adapter-react-install.js
│ │ ├── getAdapterForReactVersion.js
│ │ ├── ifReact.js
│ │ ├── index.js
│ │ └── safeSFC.jsx
│ ├── enzyme-adapter-utils/
│ │ ├── .babelrc
│ │ ├── .eslintrc
│ │ ├── package.json
│ │ └── src/
│ │ ├── RootFinder.jsx
│ │ ├── Utils.js
│ │ ├── createMountWrapper.jsx
│ │ ├── createRenderWrapper.jsx
│ │ ├── index.js
│ │ └── wrapWithSimpleWrapper.jsx
│ ├── enzyme-example-mocha/
│ │ ├── .babelrc
│ │ ├── .eslintrc
│ │ ├── .gitignore
│ │ ├── .nycrc
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── package.json
│ │ ├── src/
│ │ │ ├── Foo.jsx
│ │ │ └── Foo.spec.jsx
│ │ └── test/
│ │ ├── .setup.js
│ │ └── mocha.opts
│ ├── enzyme-shallow-equal/
│ │ ├── .babelrc
│ │ ├── .eslintrc
│ │ ├── README.md
│ │ ├── package.json
│ │ └── src/
│ │ └── index.js
│ └── enzyme-test-suite/
│ ├── .babelrc
│ ├── .eslintrc
│ ├── package.json
│ └── test/
│ ├── Adapter-spec.jsx
│ ├── Debug-spec.jsx
│ ├── RSTTraversal-spec.jsx
│ ├── ReactWrapper-spec.jsx
│ ├── ShallowWrapper-spec.jsx
│ ├── Utils-spec.jsx
│ ├── _helpers/
│ │ ├── adapter.js
│ │ ├── beforeEach.js
│ │ ├── describeHooks.js
│ │ ├── describeLifecycles.js
│ │ ├── describeMethods.js
│ │ ├── getLoadedLazyComponent.js
│ │ ├── index.jsx
│ │ ├── react-compat.js
│ │ ├── realArrowFunction.js
│ │ ├── selectors.js
│ │ ├── setupAdapters.js
│ │ ├── untranspiledArrowFunction.js
│ │ ├── untranspiledSloppyReturnThis.js
│ │ └── version.js
│ ├── adapter-utils-spec.jsx
│ ├── enzyme-adapter-react-install-spec.js
│ ├── enzyme-shallow-equal-spec.js
│ ├── selector-spec.jsx
│ ├── shared/
│ │ ├── hooks/
│ │ │ ├── _hook.template
│ │ │ ├── custom.jsx
│ │ │ ├── useCallback.jsx
│ │ │ ├── useContext.jsx
│ │ │ ├── useDebugValue.jsx
│ │ │ ├── useEffect.jsx
│ │ │ ├── useImperativeHandle.jsx
│ │ │ ├── useLayoutEffect.jsx
│ │ │ ├── useMemo.jsx
│ │ │ ├── useReducer.jsx
│ │ │ ├── useRef.jsx
│ │ │ └── useState.jsx
│ │ ├── lifecycles/
│ │ │ ├── componentDidCatch.jsx
│ │ │ ├── componentDidMount.jsx
│ │ │ ├── componentDidUpdate.jsx
│ │ │ ├── componentWillUnmount.jsx
│ │ │ ├── getDerivedStateFromError.jsx
│ │ │ ├── getDerivedStateFromProps.jsx
│ │ │ ├── getSnapshotBeforeUpdate.jsx
│ │ │ └── misc.jsx
│ │ └── methods/
│ │ ├── @@iterator.jsx
│ │ ├── _method.template
│ │ ├── at.jsx
│ │ ├── childAt.jsx
│ │ ├── children.jsx
│ │ ├── closest.jsx
│ │ ├── contains.jsx
│ │ ├── containsAllMatchingElements.jsx
│ │ ├── containsAnyMatchingElements.jsx
│ │ ├── containsMatchingElement.jsx
│ │ ├── context.jsx
│ │ ├── debug.jsx
│ │ ├── deprecatedInstanceProperties.jsx
│ │ ├── equals.jsx
│ │ ├── every.jsx
│ │ ├── everyWhere.jsx
│ │ ├── exists.jsx
│ │ ├── filter.jsx
│ │ ├── filterWhere.jsx
│ │ ├── find.jsx
│ │ ├── findWhere.jsx
│ │ ├── first.jsx
│ │ ├── flatMap.jsx
│ │ ├── forEach.jsx
│ │ ├── get.jsx
│ │ ├── getElement.jsx
│ │ ├── getElements.jsx
│ │ ├── getNode.jsx
│ │ ├── getNodes.jsx
│ │ ├── getWrappingComponent.jsx
│ │ ├── hasClass.jsx
│ │ ├── hostNodes.jsx
│ │ ├── html.jsx
│ │ ├── instance.jsx
│ │ ├── invoke.jsx
│ │ ├── is.jsx
│ │ ├── isEmpty.jsx
│ │ ├── isEmptyRender.jsx
│ │ ├── key.jsx
│ │ ├── last.jsx
│ │ ├── map.jsx
│ │ ├── matchesElement.jsx
│ │ ├── name.jsx
│ │ ├── not.jsx
│ │ ├── parent.jsx
│ │ ├── parents.jsx
│ │ ├── prop.jsx
│ │ ├── props.jsx
│ │ ├── reduce.jsx
│ │ ├── reduceRight.jsx
│ │ ├── render.jsx
│ │ ├── renderProp.jsx
│ │ ├── root.jsx
│ │ ├── setContext.jsx
│ │ ├── setProps.jsx
│ │ ├── setState.jsx
│ │ ├── simulate.jsx
│ │ ├── simulateError.jsx
│ │ ├── single.jsx
│ │ ├── slice.jsx
│ │ ├── some.jsx
│ │ ├── someWhere.jsx
│ │ ├── state.jsx
│ │ ├── tap.jsx
│ │ ├── text.jsx
│ │ ├── unmount.jsx
│ │ └── wrap.jsx
│ └── staticRender-spec.jsx
├── since.js
├── tea.yaml
└── test/
└── mocha.opts
SYMBOL INDEX (1170 symbols across 139 files)
FILE: env.js
function getAdapter (line 62) | function getAdapter(reactVersion) {
FILE: karma.conf.js
function getPlugins (line 10) | function getPlugins() {
FILE: packages/enzyme-adapter-react-13/src/ReactThirteenAdapter.js
class Foo (line 32) | class Foo extends React.Component {
method render (line 33) | render() {
function instanceToTree (line 58) | function instanceToTree(inst) {
class ReactThirteenAdapter (line 99) | class ReactThirteenAdapter extends EnzymeAdapter {
method constructor (line 100) | constructor() {
method createMountRenderer (line 117) | createMountRenderer(options) {
method createShallowRenderer (line 164) | createShallowRenderer(/* options */) {
method createStringRenderer (line 216) | createStringRenderer(options) {
method createRenderer (line 235) | createRenderer(options) {
method wrap (line 245) | wrap(element) {
method nodeToElement (line 253) | nodeToElement(node) {
method displayNameOfNode (line 258) | displayNameOfNode(node) {
method elementToNode (line 262) | elementToNode(element) {
method nodeToHostNode (line 266) | nodeToHostNode(node) {
method isValidElement (line 270) | isValidElement(element) {
method isValidElementType (line 274) | isValidElementType(object) {
method isCustomComponent (line 278) | isCustomComponent(component) {
method createElement (line 282) | createElement(...args) {
FILE: packages/enzyme-adapter-react-13/src/ReactThirteenElementToTree.js
function nodeTypeFromType (line 3) | function nodeTypeFromType(type) {
function elementToTree (line 13) | function elementToTree(el) {
FILE: packages/enzyme-adapter-react-13/src/ReactThirteenMapNativeEventNames.js
function mapNativeEventNames (line 1) | function mapNativeEventNames(event) {
FILE: packages/enzyme-adapter-react-14/src/ReactFourteenAdapter.js
function typeToNodeType (line 30) | function typeToNodeType(type) {
function instanceToTree (line 40) | function instanceToTree(inst) {
class ReactFourteenAdapter (line 80) | class ReactFourteenAdapter extends EnzymeAdapter {
method constructor (line 81) | constructor() {
method createMountRenderer (line 101) | createMountRenderer(options) {
method createShallowRenderer (line 165) | createShallowRenderer(/* options */) {
method createStringRenderer (line 261) | createStringRenderer(options) {
method createRenderer (line 280) | createRenderer(options) {
method wrap (line 290) | wrap(element) {
method nodeToElement (line 298) | nodeToElement(node) {
method elementToNode (line 303) | elementToNode(element) {
method nodeToHostNode (line 307) | nodeToHostNode(node) {
method displayNameOfNode (line 311) | displayNameOfNode(node) {
method isValidElement (line 315) | isValidElement(element) {
method isValidElementType (line 319) | isValidElementType(object) {
method isCustomComponent (line 323) | isCustomComponent(component) {
method createElement (line 327) | createElement(...args) {
method wrapWithWrappingComponent (line 331) | wrapWithWrappingComponent(node, options) {
FILE: packages/enzyme-adapter-react-15.4/src/ReactFifteenFourAdapter.js
function compositeTypeToNodeType (line 29) | function compositeTypeToNodeType(type) {
function childrenFromInst (line 39) | function childrenFromInst(inst, el) {
function nodeType (line 49) | function nodeType(inst) {
function instanceToTree (line 64) | function instanceToTree(inst) {
function nodeToDOMNode (line 119) | function nodeToDOMNode(node) {
class ReactFifteenFourAdapter (line 146) | class ReactFifteenFourAdapter extends EnzymeAdapter {
method constructor (line 147) | constructor() {
method createMountRenderer (line 167) | createMountRenderer(options) {
method createShallowRenderer (line 231) | createShallowRenderer(/* options */) {
method createStringRenderer (line 284) | createStringRenderer(options) {
method createRenderer (line 303) | createRenderer(options) {
method wrap (line 313) | wrap(element) {
method nodeToElement (line 321) | nodeToElement(node) {
method elementToNode (line 326) | elementToNode(element) {
method nodeToHostNode (line 330) | nodeToHostNode(node) {
method displayNameOfNode (line 337) | displayNameOfNode(node) {
method isValidElement (line 341) | isValidElement(element) {
method isValidElementType (line 345) | isValidElementType(object) {
method isCustomComponent (line 349) | isCustomComponent(component) {
method createElement (line 353) | createElement(...args) {
method invokeSetStateCallback (line 357) | invokeSetStateCallback(instance, callback) {
method wrapWithWrappingComponent (line 367) | wrapWithWrappingComponent(node, options) {
FILE: packages/enzyme-adapter-react-15/src/ReactFifteenAdapter.js
function compositeTypeToNodeType (line 30) | function compositeTypeToNodeType(type) {
function childrenFromInst (line 39) | function childrenFromInst(inst, el) {
function nodeType (line 49) | function nodeType(inst) {
function instanceToTree (line 56) | function instanceToTree(inst) {
class ReactFifteenAdapter (line 113) | class ReactFifteenAdapter extends EnzymeAdapter {
method constructor (line 114) | constructor() {
method createMountRenderer (line 134) | createMountRenderer(options) {
method createShallowRenderer (line 198) | createShallowRenderer(/* options */) {
method createStringRenderer (line 251) | createStringRenderer(options) {
method createRenderer (line 270) | createRenderer(options) {
method wrap (line 280) | wrap(element) {
method nodeToElement (line 288) | nodeToElement(node) {
method elementToNode (line 293) | elementToNode(element) {
method nodeToHostNode (line 297) | nodeToHostNode(node) {
method displayNameOfNode (line 301) | displayNameOfNode(node) {
method isValidElement (line 305) | isValidElement(element) {
method isValidElementType (line 309) | isValidElementType(object) {
method isCustomComponent (line 313) | isCustomComponent(component) {
method createElement (line 317) | createElement(...args) {
method invokeSetStateCallback (line 321) | invokeSetStateCallback(instance, callback) {
method wrapWithWrappingComponent (line 326) | wrapWithWrappingComponent(node, options) {
FILE: packages/enzyme-adapter-react-16.1/src/ReactSixteenOneAdapter.js
function nodeAndSiblingsArray (line 53) | function nodeAndSiblingsArray(nodeWithSibling) {
function flatten (line 68) | function flatten(arr) {
function nodeTypeFromType (line 87) | function nodeTypeFromType(type) {
function elementToTree (line 95) | function elementToTree(el) {
function toTree (line 114) | function toTree(vnode) {
function childrenToTree (line 186) | function childrenToTree(node) {
function nodeToHostNode (line 200) | function nodeToHostNode(_node) {
function getEmptyStateValue (line 230) | function getEmptyStateValue() {
class ReactSixteenOneAdapter (line 246) | class ReactSixteenOneAdapter extends EnzymeAdapter {
method constructor (line 247) | constructor() {
method createMountRenderer (line 268) | createMountRenderer(options) {
method createShallowRenderer (line 349) | createShallowRenderer(/* options */) {
method createStringRenderer (line 484) | createStringRenderer(options) {
method createRenderer (line 503) | createRenderer(options) {
method wrap (line 513) | wrap(element) {
method nodeToElement (line 521) | nodeToElement(node) {
method elementToNode (line 526) | elementToNode(element) {
method nodeToHostNode (line 530) | nodeToHostNode(node, supportsArray = false) {
method displayNameOfNode (line 538) | displayNameOfNode(node) {
method isValidElement (line 545) | isValidElement(element) {
method isValidElementType (line 549) | isValidElementType(object) {
method isCustomComponent (line 553) | isCustomComponent(component) {
method createElement (line 557) | createElement(...args) {
method wrapWithWrappingComponent (line 561) | wrapWithWrappingComponent(node, options) {
FILE: packages/enzyme-adapter-react-16.2/src/ReactSixteenTwoAdapter.js
function nodeAndSiblingsArray (line 54) | function nodeAndSiblingsArray(nodeWithSibling) {
function flatten (line 69) | function flatten(arr) {
function nodeTypeFromType (line 88) | function nodeTypeFromType(type) {
function elementToTree (line 96) | function elementToTree(el) {
function toTree (line 115) | function toTree(vnode) {
function childrenToTree (line 187) | function childrenToTree(node) {
function nodeToHostNode (line 201) | function nodeToHostNode(_node) {
function getEmptyStateValue (line 231) | function getEmptyStateValue() {
class ReactSixteenTwoAdapter (line 247) | class ReactSixteenTwoAdapter extends EnzymeAdapter {
method constructor (line 248) | constructor() {
method createMountRenderer (line 270) | createMountRenderer(options) {
method createShallowRenderer (line 351) | createShallowRenderer(/* options */) {
method createStringRenderer (line 486) | createStringRenderer(options) {
method createRenderer (line 505) | createRenderer(options) {
method wrap (line 515) | wrap(element) {
method nodeToElement (line 523) | nodeToElement(node) {
method elementToNode (line 528) | elementToNode(element) {
method nodeToHostNode (line 532) | nodeToHostNode(node, supportsArray = false) {
method displayNameOfNode (line 540) | displayNameOfNode(node) {
method isValidElement (line 547) | isValidElement(element) {
method isValidElementType (line 551) | isValidElementType(object) {
method isCustomComponent (line 555) | isCustomComponent(component) {
method isFragment (line 559) | isFragment(fragment) {
method createElement (line 563) | createElement(...args) {
method wrapWithWrappingComponent (line 567) | wrapWithWrappingComponent(node, options) {
FILE: packages/enzyme-adapter-react-16.3/src/ReactSixteenThreeAdapter.js
function nodeAndSiblingsArray (line 65) | function nodeAndSiblingsArray(nodeWithSibling) {
function flatten (line 75) | function flatten(arr) {
function nodeTypeFromType (line 94) | function nodeTypeFromType(type) {
function elementToTree (line 102) | function elementToTree(el) {
function toTree (line 121) | function toTree(vnode) {
function childrenToTree (line 206) | function childrenToTree(node) {
function nodeToHostNode (line 220) | function nodeToHostNode(_node) {
function getProviderDefaultValue (line 248) | function getProviderDefaultValue(Provider) {
function makeFakeElement (line 256) | function makeFakeElement(type) {
class ReactSixteenThreeAdapter (line 262) | class ReactSixteenThreeAdapter extends EnzymeAdapter {
method constructor (line 263) | constructor() {
method createMountRenderer (line 289) | createMountRenderer(options) {
method createShallowRenderer (line 370) | createShallowRenderer(/* options */) {
method createStringRenderer (line 503) | createStringRenderer(options) {
method createRenderer (line 522) | createRenderer(options) {
method wrap (line 532) | wrap(element) {
method nodeToElement (line 540) | nodeToElement(node) {
method elementToNode (line 545) | elementToNode(element) {
method nodeToHostNode (line 549) | nodeToHostNode(node, supportsArray = false) {
method displayNameOfNode (line 557) | displayNameOfNode(node) {
method isValidElement (line 590) | isValidElement(element) {
method isValidElementType (line 594) | isValidElementType(object) {
method isFragment (line 598) | isFragment(fragment) {
method isCustomComponent (line 602) | isCustomComponent(type) {
method isContextConsumer (line 612) | isContextConsumer(type) {
method isCustomComponentElement (line 616) | isCustomComponentElement(inst) {
method getProviderFromConsumer (line 623) | getProviderFromConsumer(Consumer) {
method createElement (line 631) | createElement(...args) {
method wrapWithWrappingComponent (line 635) | wrapWithWrappingComponent(node, options) {
FILE: packages/enzyme-adapter-react-16/src/ReactSixteenAdapter.js
function nodeAndSiblingsArray (line 75) | function nodeAndSiblingsArray(nodeWithSibling) {
function flatten (line 85) | function flatten(arr) {
function nodeTypeFromType (line 104) | function nodeTypeFromType(type) {
function isMemo (line 112) | function isMemo(type) {
function isLazy (line 116) | function isLazy(type) {
function unmemoType (line 120) | function unmemoType(type) {
function transformSuspense (line 124) | function transformSuspense(renderedEl, prerenderEl, { suspenseFallback }) {
function elementToTree (line 174) | function elementToTree(el) {
function toTree (line 193) | function toTree(vnode) {
function childrenToTree (line 317) | function childrenToTree(node) {
function nodeToHostNode (line 331) | function nodeToHostNode(_node) {
function replaceLazyWithFallback (line 359) | function replaceLazyWithFallback(node, fallback) {
function getEmptyStateValue (line 384) | function getEmptyStateValue() {
function wrapAct (line 400) | function wrapAct(fn) {
function getProviderDefaultValue (line 409) | function getProviderDefaultValue(Provider) {
function makeFakeElement (line 420) | function makeFakeElement(type) {
function isStateful (line 424) | function isStateful(Component) {
class ReactSixteenAdapter (line 431) | class ReactSixteenAdapter extends EnzymeAdapter {
method constructor (line 432) | constructor() {
method createMountRenderer (line 459) | createMountRenderer(options) {
method createShallowRenderer (line 561) | createShallowRenderer(options = {}) {
method createStringRenderer (line 821) | createStringRenderer(options) {
method createRenderer (line 843) | createRenderer(options) {
method wrap (line 853) | wrap(element) {
method nodeToElement (line 861) | nodeToElement(node) {
method matchesElementType (line 868) | matchesElementType(node, matchingType) {
method elementToNode (line 876) | elementToNode(element) {
method nodeToHostNode (line 880) | nodeToHostNode(node, supportsArray = false) {
method displayNameOfNode (line 888) | displayNameOfNode(node) {
method isValidElement (line 931) | isValidElement(element) {
method isValidElementType (line 935) | isValidElementType(object) {
method isFragment (line 939) | isFragment(fragment) {
method isCustomComponent (line 943) | isCustomComponent(type) {
method isContextConsumer (line 954) | isContextConsumer(type) {
method isCustomComponentElement (line 958) | isCustomComponentElement(inst) {
method getProviderFromConsumer (line 965) | getProviderFromConsumer(Consumer) {
method createElement (line 981) | createElement(...args) {
method wrapWithWrappingComponent (line 985) | wrapWithWrappingComponent(node, options) {
FILE: packages/enzyme-adapter-react-16/src/detectFiberTags.js
function getFiber (line 5) | function getFiber(element) {
function getLazyFiber (line 18) | function getLazyFiber(LazyComponent) {
function detectFiberTags (line 42) | function detectFiberTags() {
FILE: packages/enzyme-adapter-react-16/src/findCurrentFiberUsingSlowPath.js
function findCurrentFiberUsingSlowPath (line 2) | function findCurrentFiberUsingSlowPath(fiber) {
FILE: packages/enzyme-adapter-react-helper/src/getAdapterForReactVersion.js
function getValidRange (line 3) | function getValidRange(version) {
function getAdapterForReactVersion (line 13) | function getAdapterForReactVersion(reactVersion) {
FILE: packages/enzyme-adapter-react-helper/src/ifReact.js
function ifReact (line 4) | function ifReact(range, yes, no) {
FILE: packages/enzyme-adapter-react-helper/src/index.js
function setupEnzymeAdapter (line 3) | function setupEnzymeAdapter(enzymeOptions = {}, adapterOptions = {}) {
FILE: packages/enzyme-adapter-react-helper/src/safeSFC.jsx
function assertFunction (line 6) | function assertFunction(fn) {
function copyStatics (line 13) | function copyStatics(source, target) {
function nullToNoScript (line 27) | function nullToNoScript(fn) {
function safeSFC (line 37) | function safeSFC(fn) {
FILE: packages/enzyme-adapter-utils/src/RootFinder.jsx
class RootFinder (line 4) | class RootFinder extends React.Component {
method render (line 5) | render() {
FILE: packages/enzyme-adapter-utils/src/Utils.js
function mapNativeEventNames (line 16) | function mapNativeEventNames(event, {
function propFromEvent (line 86) | function propFromEvent(event, eventOptions = {}) {
function withSetStateAllowed (line 91) | function withSetStateAllowed(fn) {
function assertDomAvailable (line 110) | function assertDomAvailable(feature) {
function displayNameOfNode (line 116) | function displayNameOfNode(node) {
function nodeTypeFromType (line 126) | function nodeTypeFromType(type) {
function getIteratorFn (line 136) | function getIteratorFn(obj) {
function isIterable (line 149) | function isIterable(obj) {
function isArrayLike (line 153) | function isArrayLike(obj) {
function flatten (line 157) | function flatten(arrs) {
function ensureKeyOrUndefined (line 192) | function ensureKeyOrUndefined(key) {
function elementToTree (line 196) | function elementToTree(el, recurse = elementToTree) {
function mapFind (line 239) | function mapFind(arraylike, mapper, finder) {
function findElement (line 248) | function findElement(el, predicate) {
function propsWithKeysAndRef (line 262) | function propsWithKeysAndRef(node) {
function getComponentStack (line 273) | function getComponentStack(
function simulateError (line 292) | function simulateError(
function getMaskedContext (line 322) | function getMaskedContext(contextTypes, unmaskedContext) {
function getNodeFromRootFinder (line 329) | function getNodeFromRootFinder(isCustomComponent, tree, options) {
function wrapWithWrappingComponent (line 340) | function wrapWithWrappingComponent(createElement, node, options) {
function getWrappingComponentMountRenderer (line 352) | function getWrappingComponentMountRenderer({ toTree, getMountWrapperInst...
function fakeDynamicImport (line 368) | function fakeDynamicImport(moduleToImport) {
function compareNodeTypeOf (line 372) | function compareNodeTypeOf(node, matchingTypeOf) {
function spyMethod (line 380) | function spyMethod(instance, methodName, getStub = () => {}) {
function spyProperty (line 420) | function spyProperty(instance, propertyName, handlers = {}) {
FILE: packages/enzyme-adapter-utils/src/createMountWrapper.jsx
function validElementTypeRequired (line 14) | function validElementTypeRequired(props, propName, ...args) {
function validElementType (line 25) | function validElementType(props, propName, ...args) {
function createMountWrapper (line 45) | function createMountWrapper(node, options = {}) {
FILE: packages/enzyme-adapter-utils/src/createRenderWrapper.jsx
function createRenderWrapper (line 3) | function createRenderWrapper(node, context, childContextTypes) {
FILE: packages/enzyme-adapter-utils/src/wrapWithSimpleWrapper.jsx
class SimpleClassWrapper (line 20) | class SimpleClassWrapper extends React.Component {
method render (line 21) | render() {
function wrap (line 32) | function wrap(element) {
FILE: packages/enzyme-example-mocha/test/.setup.js
function copyProps (line 6) | function copyProps(src, target) {
FILE: packages/enzyme-shallow-equal/src/index.js
function shallowEqual (line 5) | function shallowEqual(objA, objB) {
FILE: packages/enzyme-test-suite/test/Adapter-spec.jsx
function cleanNode (line 46) | function cleanNode(node) {
class RendersNull (line 66) | class RendersNull extends React.Component {
method render (line 67) | render() {
method adapter (line 91) | adapter() {}
function hydratedTreeMatchesUnhydrated (line 131) | function hydratedTreeMatchesUnhydrated(element, hydrate = false) {
class BamBam (line 158) | class BamBam extends React.Component {
method render (line 159) | render() {
class FooBar (line 164) | class FooBar extends React.Component {
method render (line 165) | render() {
class One (line 170) | class One extends React.Component {
method render (line 171) | render() { return (<FooBar><span><FooBar /></span></FooBar>); }
class Two (line 173) | class Two extends React.Component {
method render (line 174) | render() { return (<FooBar><span>2</span></FooBar>); }
class Three (line 176) | class Three extends React.Component {
method render (line 177) | render() { return (<FooBar><span><div /></span></FooBar>); }
class Four (line 179) | class Four extends React.Component {
method render (line 180) | render() { return (<FooBar><span>{'some string'}4{'another string'}</s...
class Foo (line 198) | class Foo extends React.Component {
method render (line 199) | render() {
method render (line 569) | render() {
method render (line 725) | render() { // eslint-disable-line react/require-render-return
class Qoo (line 392) | class Qoo extends React.Component {
method render (line 393) | render() {
method render (line 561) | render() {
class Bar (line 461) | class Bar extends React.Component {
method render (line 462) | render() {
method render (line 582) | render() {
method constructor (line 714) | constructor(props) {
method render (line 719) | render() { // eslint-disable-line react/require-render-return
class Bam (line 473) | class Bam extends React.Component {
method render (line 474) | render() {
method render (line 594) | render() {
method render (line 732) | render() {
class Qoo (line 560) | class Qoo extends React.Component {
method render (line 393) | render() {
method render (line 561) | render() {
class Foo (line 568) | class Foo extends React.Component {
method render (line 199) | render() {
method render (line 569) | render() {
method render (line 725) | render() { // eslint-disable-line react/require-render-return
class Bar (line 581) | class Bar extends React.Component {
method render (line 462) | render() {
method render (line 582) | render() {
method constructor (line 714) | constructor(props) {
method render (line 719) | render() { // eslint-disable-line react/require-render-return
class Bam (line 593) | class Bam extends React.Component {
method render (line 474) | render() {
method render (line 594) | render() {
method render (line 732) | render() {
class Counter (line 681) | class Counter extends React.Component {
method constructor (line 682) | constructor(props) {
method increment (line 687) | increment() {
method render (line 691) | render() {
class Bar (line 713) | class Bar extends React.Component {
method render (line 462) | render() {
method render (line 582) | render() {
method constructor (line 714) | constructor(props) {
method render (line 719) | render() { // eslint-disable-line react/require-render-return
class Foo (line 724) | class Foo extends React.Component {
method render (line 199) | render() {
method render (line 569) | render() {
method render (line 725) | render() { // eslint-disable-line react/require-render-return
class Bam (line 731) | class Bam extends React.Component {
method render (line 474) | render() {
method render (line 594) | render() {
method render (line 732) | render() {
class Inner (line 800) | class Inner extends React.Component {
method constructor (line 801) | constructor(props) {
method render (line 806) | render() { // eslint-disable-line react/require-render-return
method constructor (line 856) | constructor(props) {
method render (line 861) | render() { // eslint-disable-line react/require-render-return
method constructor (line 902) | constructor(props) {
method render (line 907) | render() { // eslint-disable-line react/require-render-return
class Outer (line 811) | class Outer extends React.Component {
method constructor (line 812) | constructor(props) {
method setRef (line 817) | setRef(r) {
method render (line 821) | render() {
method render (line 867) | render() {
method render (line 913) | render() {
class Inner (line 855) | class Inner extends React.Component {
method constructor (line 801) | constructor(props) {
method render (line 806) | render() { // eslint-disable-line react/require-render-return
method constructor (line 856) | constructor(props) {
method render (line 861) | render() { // eslint-disable-line react/require-render-return
method constructor (line 902) | constructor(props) {
method render (line 907) | render() { // eslint-disable-line react/require-render-return
class Outer (line 866) | class Outer extends React.Component {
method constructor (line 812) | constructor(props) {
method setRef (line 817) | setRef(r) {
method render (line 821) | render() {
method render (line 867) | render() {
method render (line 913) | render() {
class Inner (line 901) | class Inner extends React.Component {
method constructor (line 801) | constructor(props) {
method render (line 806) | render() { // eslint-disable-line react/require-render-return
method constructor (line 856) | constructor(props) {
method render (line 861) | render() { // eslint-disable-line react/require-render-return
method constructor (line 902) | constructor(props) {
method render (line 907) | render() { // eslint-disable-line react/require-render-return
class Outer (line 912) | class Outer extends React.Component {
method constructor (line 812) | constructor(props) {
method setRef (line 817) | setRef(r) {
method render (line 821) | render() {
method render (line 867) | render() {
method render (line 913) | render() {
class Component (line 954) | class Component extends React.Component {
method render (line 955) | render() { return null; }
method render (line 1008) | render() { return null; }
class WrappingComponent (line 981) | class WrappingComponent extends React.Component {
method render (line 982) | render() {
class Component (line 1007) | class Component extends React.Component {
method render (line 955) | render() { return null; }
method render (line 1008) | render() { return null; }
class Something (line 1010) | class Something extends React.Component {
method render (line 1011) | render() { return null; }
class DynamicComponent (line 1067) | class DynamicComponent extends React.Component {
method render (line 1068) | render() {
class Root (line 1104) | class Root extends React.Component {
method render (line 1105) | render() {
function A (line 1109) | function A() {
class B (line 1112) | class B extends React.Component {
method render (line 1113) | render() {
class C (line 1117) | class C extends React.Component {
method render (line 1118) | render() {
function FunctionComponent (line 1159) | function FunctionComponent() {
class ClassComponent (line 1162) | class ClassComponent extends React.Component {
method render (line 1163) | render() {
FILE: packages/enzyme-test-suite/test/Debug-spec.jsx
function Foo (line 43) | function Foo() {}
method render (line 172) | render() { return <div />; }
method render (line 189) | render() { return <div />; }
method render (line 282) | render() {
method render (line 303) | render() {
method render (line 321) | render() {
method render (line 359) | render() {
method render (line 390) | render() {
method render (line 540) | render() {
method render (line 578) | render() {
method render (line 598) | render() {
method render (line 632) | render() {
method render (line 664) | render() {
method render (line 706) | render() {
method render (line 738) | render() {
method render (line 792) | render() {
function Foo (line 48) | function Foo() {}
method render (line 172) | render() { return <div />; }
method render (line 189) | render() { return <div />; }
method render (line 282) | render() {
method render (line 303) | render() {
method render (line 321) | render() {
method render (line 359) | render() {
method render (line 390) | render() {
method render (line 540) | render() {
method render (line 578) | render() {
method render (line 598) | render() {
method render (line 632) | render() {
method render (line 664) | render() {
method render (line 706) | render() {
method render (line 738) | render() {
method render (line 792) | render() {
class Foo (line 171) | class Foo extends React.Component {
method render (line 172) | render() { return <div />; }
method render (line 189) | render() { return <div />; }
method render (line 282) | render() {
method render (line 303) | render() {
method render (line 321) | render() {
method render (line 359) | render() {
method render (line 390) | render() {
method render (line 540) | render() {
method render (line 578) | render() {
method render (line 598) | render() {
method render (line 632) | render() {
method render (line 664) | render() {
method render (line 706) | render() {
method render (line 738) | render() {
method render (line 792) | render() {
class Foo (line 188) | class Foo extends React.Component {
method render (line 172) | render() { return <div />; }
method render (line 189) | render() { return <div />; }
method render (line 282) | render() {
method render (line 303) | render() {
method render (line 321) | render() {
method render (line 359) | render() {
method render (line 390) | render() {
method render (line 540) | render() {
method render (line 578) | render() {
method render (line 598) | render() {
method render (line 632) | render() {
method render (line 664) | render() {
method render (line 706) | render() {
method render (line 738) | render() {
method render (line 792) | render() {
class Foo (line 281) | class Foo extends React.Component {
method render (line 172) | render() { return <div />; }
method render (line 189) | render() { return <div />; }
method render (line 282) | render() {
method render (line 303) | render() {
method render (line 321) | render() {
method render (line 359) | render() {
method render (line 390) | render() {
method render (line 540) | render() {
method render (line 578) | render() {
method render (line 598) | render() {
method render (line 632) | render() {
method render (line 664) | render() {
method render (line 706) | render() {
method render (line 738) | render() {
method render (line 792) | render() {
class Foo (line 302) | class Foo extends React.Component {
method render (line 172) | render() { return <div />; }
method render (line 189) | render() { return <div />; }
method render (line 282) | render() {
method render (line 303) | render() {
method render (line 321) | render() {
method render (line 359) | render() {
method render (line 390) | render() {
method render (line 540) | render() {
method render (line 578) | render() {
method render (line 598) | render() {
method render (line 632) | render() {
method render (line 664) | render() {
method render (line 706) | render() {
method render (line 738) | render() {
method render (line 792) | render() {
class Foo (line 320) | class Foo extends React.Component {
method render (line 172) | render() { return <div />; }
method render (line 189) | render() { return <div />; }
method render (line 282) | render() {
method render (line 303) | render() {
method render (line 321) | render() {
method render (line 359) | render() {
method render (line 390) | render() {
method render (line 540) | render() {
method render (line 578) | render() {
method render (line 598) | render() {
method render (line 632) | render() {
method render (line 664) | render() {
method render (line 706) | render() {
method render (line 738) | render() {
method render (line 792) | render() {
class Bar (line 329) | class Bar extends React.Component {
method render (line 330) | render() {
method render (line 368) | render() {
method render (line 401) | render() {
method render (line 552) | render() {
method render (line 608) | render() {
method render (line 675) | render() {
method render (line 749) | render() {
class Foo (line 358) | class Foo extends React.Component {
method render (line 172) | render() { return <div />; }
method render (line 189) | render() { return <div />; }
method render (line 282) | render() {
method render (line 303) | render() {
method render (line 321) | render() {
method render (line 359) | render() {
method render (line 390) | render() {
method render (line 540) | render() {
method render (line 578) | render() {
method render (line 598) | render() {
method render (line 632) | render() {
method render (line 664) | render() {
method render (line 706) | render() {
method render (line 738) | render() {
method render (line 792) | render() {
class Bar (line 367) | class Bar extends React.Component {
method render (line 330) | render() {
method render (line 368) | render() {
method render (line 401) | render() {
method render (line 552) | render() {
method render (line 608) | render() {
method render (line 675) | render() {
method render (line 749) | render() {
class Foo (line 389) | class Foo extends React.Component {
method render (line 172) | render() { return <div />; }
method render (line 189) | render() { return <div />; }
method render (line 282) | render() {
method render (line 303) | render() {
method render (line 321) | render() {
method render (line 359) | render() {
method render (line 390) | render() {
method render (line 540) | render() {
method render (line 578) | render() {
method render (line 598) | render() {
method render (line 632) | render() {
method render (line 664) | render() {
method render (line 706) | render() {
method render (line 738) | render() {
method render (line 792) | render() {
class Bar (line 400) | class Bar extends React.Component {
method render (line 330) | render() {
method render (line 368) | render() {
method render (line 401) | render() {
method render (line 552) | render() {
method render (line 608) | render() {
method render (line 675) | render() {
method render (line 749) | render() {
class Foo (line 539) | class Foo extends React.Component {
method render (line 172) | render() { return <div />; }
method render (line 189) | render() { return <div />; }
method render (line 282) | render() {
method render (line 303) | render() {
method render (line 321) | render() {
method render (line 359) | render() {
method render (line 390) | render() {
method render (line 540) | render() {
method render (line 578) | render() {
method render (line 598) | render() {
method render (line 632) | render() {
method render (line 664) | render() {
method render (line 706) | render() {
method render (line 738) | render() {
method render (line 792) | render() {
class Bar (line 551) | class Bar extends React.Component {
method render (line 330) | render() {
method render (line 368) | render() {
method render (line 401) | render() {
method render (line 552) | render() {
method render (line 608) | render() {
method render (line 675) | render() {
method render (line 749) | render() {
class Foo (line 577) | class Foo extends React.Component {
method render (line 172) | render() { return <div />; }
method render (line 189) | render() { return <div />; }
method render (line 282) | render() {
method render (line 303) | render() {
method render (line 321) | render() {
method render (line 359) | render() {
method render (line 390) | render() {
method render (line 540) | render() {
method render (line 578) | render() {
method render (line 598) | render() {
method render (line 632) | render() {
method render (line 664) | render() {
method render (line 706) | render() {
method render (line 738) | render() {
method render (line 792) | render() {
class Foo (line 597) | class Foo extends React.Component {
method render (line 172) | render() { return <div />; }
method render (line 189) | render() { return <div />; }
method render (line 282) | render() {
method render (line 303) | render() {
method render (line 321) | render() {
method render (line 359) | render() {
method render (line 390) | render() {
method render (line 540) | render() {
method render (line 578) | render() {
method render (line 598) | render() {
method render (line 632) | render() {
method render (line 664) | render() {
method render (line 706) | render() {
method render (line 738) | render() {
method render (line 792) | render() {
class Bar (line 607) | class Bar extends React.Component {
method render (line 330) | render() {
method render (line 368) | render() {
method render (line 401) | render() {
method render (line 552) | render() {
method render (line 608) | render() {
method render (line 675) | render() {
method render (line 749) | render() {
class Foo (line 631) | class Foo extends React.Component {
method render (line 172) | render() { return <div />; }
method render (line 189) | render() { return <div />; }
method render (line 282) | render() {
method render (line 303) | render() {
method render (line 321) | render() {
method render (line 359) | render() {
method render (line 390) | render() {
method render (line 540) | render() {
method render (line 578) | render() {
method render (line 598) | render() {
method render (line 632) | render() {
method render (line 664) | render() {
method render (line 706) | render() {
method render (line 738) | render() {
method render (line 792) | render() {
class Foo (line 663) | class Foo extends React.Component {
method render (line 172) | render() { return <div />; }
method render (line 189) | render() { return <div />; }
method render (line 282) | render() {
method render (line 303) | render() {
method render (line 321) | render() {
method render (line 359) | render() {
method render (line 390) | render() {
method render (line 540) | render() {
method render (line 578) | render() {
method render (line 598) | render() {
method render (line 632) | render() {
method render (line 664) | render() {
method render (line 706) | render() {
method render (line 738) | render() {
method render (line 792) | render() {
class Bar (line 674) | class Bar extends React.Component {
method render (line 330) | render() {
method render (line 368) | render() {
method render (line 401) | render() {
method render (line 552) | render() {
method render (line 608) | render() {
method render (line 675) | render() {
method render (line 749) | render() {
class Foo (line 705) | class Foo extends React.Component {
method render (line 172) | render() { return <div />; }
method render (line 189) | render() { return <div />; }
method render (line 282) | render() {
method render (line 303) | render() {
method render (line 321) | render() {
method render (line 359) | render() {
method render (line 390) | render() {
method render (line 540) | render() {
method render (line 578) | render() {
method render (line 598) | render() {
method render (line 632) | render() {
method render (line 664) | render() {
method render (line 706) | render() {
method render (line 738) | render() {
method render (line 792) | render() {
class Foo (line 737) | class Foo extends React.Component {
method render (line 172) | render() { return <div />; }
method render (line 189) | render() { return <div />; }
method render (line 282) | render() {
method render (line 303) | render() {
method render (line 321) | render() {
method render (line 359) | render() {
method render (line 390) | render() {
method render (line 540) | render() {
method render (line 578) | render() {
method render (line 598) | render() {
method render (line 632) | render() {
method render (line 664) | render() {
method render (line 706) | render() {
method render (line 738) | render() {
method render (line 792) | render() {
class Bar (line 748) | class Bar extends React.Component {
method render (line 330) | render() {
method render (line 368) | render() {
method render (line 401) | render() {
method render (line 552) | render() {
method render (line 608) | render() {
method render (line 675) | render() {
method render (line 749) | render() {
class Foo (line 791) | class Foo extends React.Component {
method render (line 172) | render() { return <div />; }
method render (line 189) | render() { return <div />; }
method render (line 282) | render() {
method render (line 303) | render() {
method render (line 321) | render() {
method render (line 359) | render() {
method render (line 390) | render() {
method render (line 540) | render() {
method render (line 578) | render() {
method render (line 598) | render() {
method render (line 632) | render() {
method render (line 664) | render() {
method render (line 706) | render() {
method render (line 738) | render() {
method render (line 792) | render() {
class Abomination (line 825) | class Abomination extends React.Component {
method render (line 826) | render() {
FILE: packages/enzyme-test-suite/test/RSTTraversal-spec.jsx
function classes (line 41) | function classes() {}
method next (line 244) | next() {
class Subject (line 460) | class Subject extends React.Component {
method render (line 461) | render() {
method render (line 475) | render() {
class Subject (line 474) | class Subject extends React.Component {
method render (line 461) | render() {
method render (line 475) | render() {
FILE: packages/enzyme-test-suite/test/ReactWrapper-spec.jsx
class Box (line 70) | class Box extends React.Component {
method render (line 71) | render() {
class Foo (line 77) | class Foo extends React.Component {
method render (line 78) | render() {
method render (line 133) | render() {
method render (line 189) | render() {
method render (line 199) | render() {
method render (line 535) | render() {
method render (line 774) | render() {
method constructor (line 1331) | constructor(props) {
method render (line 1338) | render() {
method render (line 1363) | render() {
method render (line 1494) | render() {
method render (line 1549) | render() {
method render (line 1580) | render() {
method render (line 1721) | render() {
method render (line 1736) | render() {
method render (line 1917) | render() {
class Foo (line 132) | class Foo extends React.Component {
method render (line 78) | render() {
method render (line 133) | render() {
method render (line 189) | render() {
method render (line 199) | render() {
method render (line 535) | render() {
method render (line 774) | render() {
method constructor (line 1331) | constructor(props) {
method render (line 1338) | render() {
method render (line 1363) | render() {
method render (line 1494) | render() {
method render (line 1549) | render() {
method render (line 1580) | render() {
method render (line 1721) | render() {
method render (line 1736) | render() {
method render (line 1917) | render() {
class Foo (line 188) | class Foo extends React.Component {
method render (line 78) | render() {
method render (line 133) | render() {
method render (line 189) | render() {
method render (line 199) | render() {
method render (line 535) | render() {
method render (line 774) | render() {
method constructor (line 1331) | constructor(props) {
method render (line 1338) | render() {
method render (line 1363) | render() {
method render (line 1494) | render() {
method render (line 1549) | render() {
method render (line 1580) | render() {
method render (line 1721) | render() {
method render (line 1736) | render() {
method render (line 1917) | render() {
class Foo (line 198) | class Foo extends React.Component {
method render (line 78) | render() {
method render (line 133) | render() {
method render (line 189) | render() {
method render (line 199) | render() {
method render (line 535) | render() {
method render (line 774) | render() {
method constructor (line 1331) | constructor(props) {
method render (line 1338) | render() {
method render (line 1363) | render() {
method render (line 1494) | render() {
method render (line 1549) | render() {
method render (line 1580) | render() {
method render (line 1721) | render() {
method render (line 1736) | render() {
method render (line 1917) | render() {
class More (line 225) | class More extends React.Component {
method render (line 226) | render() {
class TestProvider (line 231) | class TestProvider extends React.Component {
method getChildContext (line 232) | getChildContext() {
method render (line 241) | render() {
class MyWrappingComponent (line 252) | class MyWrappingComponent extends React.Component {
method render (line 253) | render() {
class MyComponent (line 264) | class MyComponent extends React.Component {
method render (line 265) | render() {
function WrappingComponent (line 307) | function WrappingComponent(props) {
function Component (line 318) | function Component() {
method render (line 1154) | render() {
class BadWrapper (line 351) | class BadWrapper extends React.Component {
method render (line 352) | render() {
class RendersChildren (line 387) | class RendersChildren extends React.Component {
method render (line 388) | render() {
method render (line 420) | render() {
method render (line 436) | render() {
method render (line 442) | render() {
method render (line 458) | render() {
class ClassComponent (line 463) | class ClassComponent extends React.Component {
method render (line 464) | render() {
method render (line 498) | render() {
method render (line 513) | render() {
class Foo (line 534) | class Foo extends React.Component {
method render (line 78) | render() {
method render (line 133) | render() {
method render (line 189) | render() {
method render (line 199) | render() {
method render (line 535) | render() {
method render (line 774) | render() {
method constructor (line 1331) | constructor(props) {
method render (line 1338) | render() {
method render (line 1363) | render() {
method render (line 1494) | render() {
method render (line 1549) | render() {
method render (line 1580) | render() {
method render (line 1721) | render() {
method render (line 1736) | render() {
method render (line 1917) | render() {
class A (line 611) | class A extends React.PureComponent {
method render (line 612) | render() {
class B (line 617) | class B extends React.PureComponent {
method render (line 618) | render() {
class InnerComp (line 767) | class InnerComp extends React.Component {
method render (line 768) | render() {
class Foo (line 773) | class Foo extends React.Component {
method render (line 78) | render() {
method render (line 133) | render() {
method render (line 189) | render() {
method render (line 199) | render() {
method render (line 535) | render() {
method render (line 774) | render() {
method constructor (line 1331) | constructor(props) {
method render (line 1338) | render() {
method render (line 1363) | render() {
method render (line 1494) | render() {
method render (line 1549) | render() {
method render (line 1580) | render() {
method render (line 1721) | render() {
method render (line 1736) | render() {
method render (line 1917) | render() {
function SomeComponent (line 910) | function SomeComponent() {
function AnotherComponent (line 968) | function AnotherComponent() {
function AnotherComponent (line 993) | function AnotherComponent() {
class DynamicComponent (line 1136) | class DynamicComponent extends React.Component {
method render (line 1137) | render() {
class Fallback (line 1144) | class Fallback extends React.Component {
method render (line 1145) | render() {
class Component (line 1153) | class Component extends React.Component {
method render (line 1154) | render() {
function Component (line 1294) | function Component() {
method render (line 1154) | render() {
class Foo (line 1330) | class Foo extends React.Component {
method render (line 78) | render() {
method render (line 133) | render() {
method render (line 189) | render() {
method render (line 199) | render() {
method render (line 535) | render() {
method render (line 774) | render() {
method constructor (line 1331) | constructor(props) {
method render (line 1338) | render() {
method render (line 1363) | render() {
method render (line 1494) | render() {
method render (line 1549) | render() {
method render (line 1580) | render() {
method render (line 1721) | render() {
method render (line 1736) | render() {
method render (line 1917) | render() {
class Foo (line 1362) | class Foo extends React.Component {
method render (line 78) | render() {
method render (line 133) | render() {
method render (line 189) | render() {
method render (line 199) | render() {
method render (line 535) | render() {
method render (line 774) | render() {
method constructor (line 1331) | constructor(props) {
method render (line 1338) | render() {
method render (line 1363) | render() {
method render (line 1494) | render() {
method render (line 1549) | render() {
method render (line 1580) | render() {
method render (line 1721) | render() {
method render (line 1736) | render() {
method render (line 1917) | render() {
class Test (line 1374) | class Test extends React.Component {
method render (line 1375) | render() {
method componentWillMount (line 1767) | componentWillMount() {
method safeSetState (line 1771) | safeSetState(newState) {
method asyncSetState (line 1777) | asyncSetState() {
method callbackSetState (line 1783) | callbackSetState() {
method render (line 1787) | render() {
class TestZero (line 1386) | class TestZero extends React.Component {
method render (line 1387) | render() {
class WithoutRef (line 1463) | class WithoutRef extends React.Component {
method render (line 1464) | render() { return <div />; }
class WithRef (line 1467) | class WithRef extends React.Component {
method render (line 1468) | render() { return <div ref="r" />; }
class RendersWithRef (line 1471) | class RendersWithRef extends React.Component {
method render (line 1472) | render() { return <WithRef />; }
class Foo (line 1493) | class Foo extends React.Component {
method render (line 78) | render() {
method render (line 133) | render() {
method render (line 189) | render() {
method render (line 199) | render() {
method render (line 535) | render() {
method render (line 774) | render() {
method constructor (line 1331) | constructor(props) {
method render (line 1338) | render() {
method render (line 1363) | render() {
method render (line 1494) | render() {
method render (line 1549) | render() {
method render (line 1580) | render() {
method render (line 1721) | render() {
method render (line 1736) | render() {
method render (line 1917) | render() {
class Comp (line 1519) | class Comp extends React.Component {
method render (line 1520) | render() {
class Foo (line 1548) | class Foo extends React.Component {
method render (line 78) | render() {
method render (line 133) | render() {
method render (line 189) | render() {
method render (line 199) | render() {
method render (line 535) | render() {
method render (line 774) | render() {
method constructor (line 1331) | constructor(props) {
method render (line 1338) | render() {
method render (line 1363) | render() {
method render (line 1494) | render() {
method render (line 1549) | render() {
method render (line 1580) | render() {
method render (line 1721) | render() {
method render (line 1736) | render() {
method render (line 1917) | render() {
class Foo (line 1579) | class Foo extends React.Component {
method render (line 78) | render() {
method render (line 133) | render() {
method render (line 189) | render() {
method render (line 199) | render() {
method render (line 535) | render() {
method render (line 774) | render() {
method constructor (line 1331) | constructor(props) {
method render (line 1338) | render() {
method render (line 1363) | render() {
method render (line 1494) | render() {
method render (line 1549) | render() {
method render (line 1580) | render() {
method render (line 1721) | render() {
method render (line 1736) | render() {
method render (line 1917) | render() {
class Bar (line 1584) | class Bar extends React.Component {
method render (line 1585) | render() {
method render (line 1625) | render() {
class Bar (line 1624) | class Bar extends React.Component {
method render (line 1585) | render() {
method render (line 1625) | render() {
class Foo (line 1720) | class Foo extends React.Component {
method render (line 78) | render() {
method render (line 133) | render() {
method render (line 189) | render() {
method render (line 199) | render() {
method render (line 535) | render() {
method render (line 774) | render() {
method constructor (line 1331) | constructor(props) {
method render (line 1338) | render() {
method render (line 1363) | render() {
method render (line 1494) | render() {
method render (line 1549) | render() {
method render (line 1580) | render() {
method render (line 1721) | render() {
method render (line 1736) | render() {
method render (line 1917) | render() {
class Foo (line 1735) | class Foo extends React.Component {
method render (line 78) | render() {
method render (line 133) | render() {
method render (line 189) | render() {
method render (line 199) | render() {
method render (line 535) | render() {
method render (line 774) | render() {
method constructor (line 1331) | constructor(props) {
method render (line 1338) | render() {
method render (line 1363) | render() {
method render (line 1494) | render() {
method render (line 1549) | render() {
method render (line 1580) | render() {
method render (line 1721) | render() {
method render (line 1736) | render() {
method render (line 1917) | render() {
class Child (line 1760) | class Child extends React.Component {
method render (line 1761) | render() {
method render (line 1824) | render() {
method render (line 1869) | render() {
class Test (line 1766) | class Test extends React.Component {
method render (line 1375) | render() {
method componentWillMount (line 1767) | componentWillMount() {
method safeSetState (line 1771) | safeSetState(newState) {
method asyncSetState (line 1777) | asyncSetState() {
method callbackSetState (line 1783) | callbackSetState() {
method render (line 1787) | render() {
class Child (line 1823) | class Child extends React.Component {
method render (line 1761) | render() {
method render (line 1824) | render() {
method render (line 1869) | render() {
class App (line 1832) | class App extends React.Component {
method constructor (line 1833) | constructor(props) {
method onIncrement (line 1840) | onIncrement() {
method render (line 1846) | render() {
class Child (line 1868) | class Child extends React.Component {
method render (line 1761) | render() {
method render (line 1824) | render() {
method render (line 1869) | render() {
method constructor (line 1880) | constructor(props) {
method onIncrement (line 1887) | onIncrement() {
method render (line 1895) | render() {
class Foo (line 1916) | class Foo extends React.Component {
method render (line 78) | render() {
method render (line 133) | render() {
method render (line 189) | render() {
method render (line 199) | render() {
method render (line 535) | render() {
method render (line 774) | render() {
method constructor (line 1331) | constructor(props) {
method render (line 1338) | render() {
method render (line 1363) | render() {
method render (line 1494) | render() {
method render (line 1549) | render() {
method render (line 1580) | render() {
method render (line 1721) | render() {
method render (line 1736) | render() {
method render (line 1917) | render() {
FILE: packages/enzyme-test-suite/test/ShallowWrapper-spec.jsx
class Box (line 52) | class Box extends React.Component {
method render (line 53) | render() {
class Foo (line 58) | class Foo extends React.Component {
method render (line 59) | render() {
method render (line 129) | render() {
method render (line 139) | render() {
method render (line 1365) | render() {
method render (line 1391) | render() {
method render (line 1414) | render() {
method render (line 1439) | render() {
method render (line 1465) | render() {
method componentWillMount (line 2116) | componentWillMount() { spy('componentWillMount'); }
method componentDidMount (line 2118) | componentDidMount() { spy('componentDidMount'); }
method componentWillReceiveProps (line 2120) | componentWillReceiveProps() { spy('componentWillReceiveProps'); }
method shouldComponentUpdate (line 2122) | shouldComponentUpdate() {
method componentWillUpdate (line 2127) | componentWillUpdate() { spy('componentWillUpdate'); }
method componentDidUpdate (line 2129) | componentDidUpdate() { spy('componentDidUpdate'); }
method componentWillUnmount (line 2131) | componentWillUnmount() { spy('componentWillUnmount'); }
method render (line 2133) | render() {
method componentDidMount (line 2247) | componentDidMount() {
method render (line 2251) | render() {
method constructor (line 2292) | constructor(props) {
method shouldComponentUpdate (line 2299) | shouldComponentUpdate() {
method render (line 2304) | render() {
method render (line 2389) | render() {
method render (line 2404) | render() {
method render (line 2580) | render() {
class Foo (line 128) | class Foo extends React.Component {
method render (line 59) | render() {
method render (line 129) | render() {
method render (line 139) | render() {
method render (line 1365) | render() {
method render (line 1391) | render() {
method render (line 1414) | render() {
method render (line 1439) | render() {
method render (line 1465) | render() {
method componentWillMount (line 2116) | componentWillMount() { spy('componentWillMount'); }
method componentDidMount (line 2118) | componentDidMount() { spy('componentDidMount'); }
method componentWillReceiveProps (line 2120) | componentWillReceiveProps() { spy('componentWillReceiveProps'); }
method shouldComponentUpdate (line 2122) | shouldComponentUpdate() {
method componentWillUpdate (line 2127) | componentWillUpdate() { spy('componentWillUpdate'); }
method componentDidUpdate (line 2129) | componentDidUpdate() { spy('componentDidUpdate'); }
method componentWillUnmount (line 2131) | componentWillUnmount() { spy('componentWillUnmount'); }
method render (line 2133) | render() {
method componentDidMount (line 2247) | componentDidMount() {
method render (line 2251) | render() {
method constructor (line 2292) | constructor(props) {
method shouldComponentUpdate (line 2299) | shouldComponentUpdate() {
method render (line 2304) | render() {
method render (line 2389) | render() {
method render (line 2404) | render() {
method render (line 2580) | render() {
class Foo (line 138) | class Foo extends React.Component {
method render (line 59) | render() {
method render (line 129) | render() {
method render (line 139) | render() {
method render (line 1365) | render() {
method render (line 1391) | render() {
method render (line 1414) | render() {
method render (line 1439) | render() {
method render (line 1465) | render() {
method componentWillMount (line 2116) | componentWillMount() { spy('componentWillMount'); }
method componentDidMount (line 2118) | componentDidMount() { spy('componentDidMount'); }
method componentWillReceiveProps (line 2120) | componentWillReceiveProps() { spy('componentWillReceiveProps'); }
method shouldComponentUpdate (line 2122) | shouldComponentUpdate() {
method componentWillUpdate (line 2127) | componentWillUpdate() { spy('componentWillUpdate'); }
method componentDidUpdate (line 2129) | componentDidUpdate() { spy('componentDidUpdate'); }
method componentWillUnmount (line 2131) | componentWillUnmount() { spy('componentWillUnmount'); }
method render (line 2133) | render() {
method componentDidMount (line 2247) | componentDidMount() {
method render (line 2251) | render() {
method constructor (line 2292) | constructor(props) {
method shouldComponentUpdate (line 2299) | shouldComponentUpdate() {
method render (line 2304) | render() {
method render (line 2389) | render() {
method render (line 2404) | render() {
method render (line 2580) | render() {
class More (line 161) | class More extends React.Component {
method render (line 162) | render() {
class StateTester (line 167) | class StateTester extends React.Component {
method render (line 168) | render() {
class TestProvider (line 173) | class TestProvider extends React.Component {
method getChildContext (line 174) | getChildContext() {
method render (line 184) | render() {
class MyWrappingComponent (line 196) | class MyWrappingComponent extends React.Component {
method constructor (line 197) | constructor() {
method render (line 202) | render() {
class MyComponent (line 222) | class MyComponent extends React.Component {
method render (line 223) | render() {
method render (line 566) | render() {
method render (line 638) | render() {
method render (line 1989) | render() {
method constructor (line 2267) | constructor(props) {
method componentDidMount (line 2274) | componentDidMount() {
method render (line 2278) | render() {
function WrappingComponent (line 283) | function WrappingComponent(props) {
function Component (line 294) | function Component() {
method render (line 1756) | render() {
class BadWrapper (line 324) | class BadWrapper extends React.Component {
method render (line 325) | render() {
class RendersChildren (line 359) | class RendersChildren extends React.Component {
method render (line 360) | render() {
method render (line 392) | render() {
method render (line 405) | render() {
method render (line 420) | render() {
class Consumes (line 436) | class Consumes extends React.Component {
method render (line 437) | render() {
method render (line 546) | render() {
method render (line 618) | render() {
class Provides (line 446) | class Provides extends React.Component {
method render (line 447) | render() {
method render (line 556) | render() {
method render (line 628) | render() {
function DivRenderer (line 509) | function DivRenderer({ children }) {
class Consumes (line 545) | class Consumes extends React.Component {
method render (line 437) | render() {
method render (line 546) | render() {
method render (line 618) | render() {
class Provides (line 555) | class Provides extends React.Component {
method render (line 447) | render() {
method render (line 556) | render() {
method render (line 628) | render() {
class MyComponent (line 565) | class MyComponent extends React.Component {
method render (line 223) | render() {
method render (line 566) | render() {
method render (line 638) | render() {
method render (line 1989) | render() {
method constructor (line 2267) | constructor(props) {
method componentDidMount (line 2274) | componentDidMount() {
method render (line 2278) | render() {
class Consumes (line 617) | class Consumes extends React.Component {
method render (line 437) | render() {
method render (line 546) | render() {
method render (line 618) | render() {
class Provides (line 627) | class Provides extends React.Component {
method render (line 447) | render() {
method render (line 556) | render() {
method render (line 628) | render() {
class MyComponent (line 637) | class MyComponent extends React.Component {
method render (line 223) | render() {
method render (line 566) | render() {
method render (line 638) | render() {
method render (line 1989) | render() {
method constructor (line 2267) | constructor(props) {
method componentDidMount (line 2274) | componentDidMount() {
method render (line 2278) | render() {
class FooProvider (line 725) | class FooProvider extends React.Component {
method getChildContext (line 726) | getChildContext() {
method render (line 731) | render() {
class BarProvider (line 740) | class BarProvider extends React.Component {
method constructor (line 741) | constructor(...args) {
method getChildContext (line 747) | getChildContext() {
method render (line 752) | render() {
class FooBarBazConsumer (line 761) | class FooBarBazConsumer extends React.Component {
method render (line 762) | render() {
class TestComponent (line 772) | class TestComponent extends React.Component {
method render (line 773) | render() {
class FaultyFooProvider (line 913) | class FaultyFooProvider extends React.Component {
method getChildContext (line 914) | getChildContext() {
method render (line 919) | render() {
method getChildContext (line 979) | getChildContext() {
method render (line 986) | render() {
class Provider (line 944) | class Provider extends React.Component {
method getChildContext (line 945) | getChildContext() {
method render (line 952) | render() {
class Receiver (line 958) | class Receiver extends React.Component {
method render (line 959) | render() {
class FaultyFooProvider (line 978) | class FaultyFooProvider extends React.Component {
method getChildContext (line 914) | getChildContext() {
method render (line 919) | render() {
method getChildContext (line 979) | getChildContext() {
method render (line 986) | render() {
function SomeComponent (line 1130) | function SomeComponent() {
function AnotherComponent (line 1187) | function AnotherComponent() {
function AnotherComponent (line 1213) | function AnotherComponent() {
class Bar (line 1355) | class Bar extends React.Component {
method render (line 1356) | render() {
method render (line 1382) | render() {
method render (line 1408) | render() {
method render (line 1430) | render() {
method render (line 1457) | render() {
method render (line 1973) | render() {
class Foo (line 1364) | class Foo extends React.Component {
method render (line 59) | render() {
method render (line 129) | render() {
method render (line 139) | render() {
method render (line 1365) | render() {
method render (line 1391) | render() {
method render (line 1414) | render() {
method render (line 1439) | render() {
method render (line 1465) | render() {
method componentWillMount (line 2116) | componentWillMount() { spy('componentWillMount'); }
method componentDidMount (line 2118) | componentDidMount() { spy('componentDidMount'); }
method componentWillReceiveProps (line 2120) | componentWillReceiveProps() { spy('componentWillReceiveProps'); }
method shouldComponentUpdate (line 2122) | shouldComponentUpdate() {
method componentWillUpdate (line 2127) | componentWillUpdate() { spy('componentWillUpdate'); }
method componentDidUpdate (line 2129) | componentDidUpdate() { spy('componentDidUpdate'); }
method componentWillUnmount (line 2131) | componentWillUnmount() { spy('componentWillUnmount'); }
method render (line 2133) | render() {
method componentDidMount (line 2247) | componentDidMount() {
method render (line 2251) | render() {
method constructor (line 2292) | constructor(props) {
method shouldComponentUpdate (line 2299) | shouldComponentUpdate() {
method render (line 2304) | render() {
method render (line 2389) | render() {
method render (line 2404) | render() {
method render (line 2580) | render() {
class Bar (line 1381) | class Bar extends React.Component {
method render (line 1356) | render() {
method render (line 1382) | render() {
method render (line 1408) | render() {
method render (line 1430) | render() {
method render (line 1457) | render() {
method render (line 1973) | render() {
class Foo (line 1390) | class Foo extends React.Component {
method render (line 59) | render() {
method render (line 129) | render() {
method render (line 139) | render() {
method render (line 1365) | render() {
method render (line 1391) | render() {
method render (line 1414) | render() {
method render (line 1439) | render() {
method render (line 1465) | render() {
method componentWillMount (line 2116) | componentWillMount() { spy('componentWillMount'); }
method componentDidMount (line 2118) | componentDidMount() { spy('componentDidMount'); }
method componentWillReceiveProps (line 2120) | componentWillReceiveProps() { spy('componentWillReceiveProps'); }
method shouldComponentUpdate (line 2122) | shouldComponentUpdate() {
method componentWillUpdate (line 2127) | componentWillUpdate() { spy('componentWillUpdate'); }
method componentDidUpdate (line 2129) | componentDidUpdate() { spy('componentDidUpdate'); }
method componentWillUnmount (line 2131) | componentWillUnmount() { spy('componentWillUnmount'); }
method render (line 2133) | render() {
method componentDidMount (line 2247) | componentDidMount() {
method render (line 2251) | render() {
method constructor (line 2292) | constructor(props) {
method shouldComponentUpdate (line 2299) | shouldComponentUpdate() {
method render (line 2304) | render() {
method render (line 2389) | render() {
method render (line 2404) | render() {
method render (line 2580) | render() {
class Bar (line 1407) | class Bar extends React.Component {
method render (line 1356) | render() {
method render (line 1382) | render() {
method render (line 1408) | render() {
method render (line 1430) | render() {
method render (line 1457) | render() {
method render (line 1973) | render() {
class Foo (line 1413) | class Foo extends React.Component {
method render (line 59) | render() {
method render (line 129) | render() {
method render (line 139) | render() {
method render (line 1365) | render() {
method render (line 1391) | render() {
method render (line 1414) | render() {
method render (line 1439) | render() {
method render (line 1465) | render() {
method componentWillMount (line 2116) | componentWillMount() { spy('componentWillMount'); }
method componentDidMount (line 2118) | componentDidMount() { spy('componentDidMount'); }
method componentWillReceiveProps (line 2120) | componentWillReceiveProps() { spy('componentWillReceiveProps'); }
method shouldComponentUpdate (line 2122) | shouldComponentUpdate() {
method componentWillUpdate (line 2127) | componentWillUpdate() { spy('componentWillUpdate'); }
method componentDidUpdate (line 2129) | componentDidUpdate() { spy('componentDidUpdate'); }
method componentWillUnmount (line 2131) | componentWillUnmount() { spy('componentWillUnmount'); }
method render (line 2133) | render() {
method componentDidMount (line 2247) | componentDidMount() {
method render (line 2251) | render() {
method constructor (line 2292) | constructor(props) {
method shouldComponentUpdate (line 2299) | shouldComponentUpdate() {
method render (line 2304) | render() {
method render (line 2389) | render() {
method render (line 2404) | render() {
method render (line 2580) | render() {
class Bar (line 1429) | class Bar extends React.Component {
method render (line 1356) | render() {
method render (line 1382) | render() {
method render (line 1408) | render() {
method render (line 1430) | render() {
method render (line 1457) | render() {
method render (line 1973) | render() {
class Foo (line 1438) | class Foo extends React.Component {
method render (line 59) | render() {
method render (line 129) | render() {
method render (line 139) | render() {
method render (line 1365) | render() {
method render (line 1391) | render() {
method render (line 1414) | render() {
method render (line 1439) | render() {
method render (line 1465) | render() {
method componentWillMount (line 2116) | componentWillMount() { spy('componentWillMount'); }
method componentDidMount (line 2118) | componentDidMount() { spy('componentDidMount'); }
method componentWillReceiveProps (line 2120) | componentWillReceiveProps() { spy('componentWillReceiveProps'); }
method shouldComponentUpdate (line 2122) | shouldComponentUpdate() {
method componentWillUpdate (line 2127) | componentWillUpdate() { spy('componentWillUpdate'); }
method componentDidUpdate (line 2129) | componentDidUpdate() { spy('componentDidUpdate'); }
method componentWillUnmount (line 2131) | componentWillUnmount() { spy('componentWillUnmount'); }
method render (line 2133) | render() {
method componentDidMount (line 2247) | componentDidMount() {
method render (line 2251) | render() {
method constructor (line 2292) | constructor(props) {
method shouldComponentUpdate (line 2299) | shouldComponentUpdate() {
method render (line 2304) | render() {
method render (line 2389) | render() {
method render (line 2404) | render() {
method render (line 2580) | render() {
class Bar (line 1456) | class Bar extends React.Component {
method render (line 1356) | render() {
method render (line 1382) | render() {
method render (line 1408) | render() {
method render (line 1430) | render() {
method render (line 1457) | render() {
method render (line 1973) | render() {
class Foo (line 1464) | class Foo extends React.Component {
method render (line 59) | render() {
method render (line 129) | render() {
method render (line 139) | render() {
method render (line 1365) | render() {
method render (line 1391) | render() {
method render (line 1414) | render() {
method render (line 1439) | render() {
method render (line 1465) | render() {
method componentWillMount (line 2116) | componentWillMount() { spy('componentWillMount'); }
method componentDidMount (line 2118) | componentDidMount() { spy('componentDidMount'); }
method componentWillReceiveProps (line 2120) | componentWillReceiveProps() { spy('componentWillReceiveProps'); }
method shouldComponentUpdate (line 2122) | shouldComponentUpdate() {
method componentWillUpdate (line 2127) | componentWillUpdate() { spy('componentWillUpdate'); }
method componentDidUpdate (line 2129) | componentDidUpdate() { spy('componentDidUpdate'); }
method componentWillUnmount (line 2131) | componentWillUnmount() { spy('componentWillUnmount'); }
method render (line 2133) | render() {
method componentDidMount (line 2247) | componentDidMount() {
method render (line 2251) | render() {
method constructor (line 2292) | constructor(props) {
method shouldComponentUpdate (line 2299) | shouldComponentUpdate() {
method render (line 2304) | render() {
method render (line 2389) | render() {
method render (line 2404) | render() {
method render (line 2580) | render() {
class RendersDOM (line 1577) | class RendersDOM extends React.Component {
method render (line 1578) | render() {
class RendersNull (line 1582) | class RendersNull extends React.Component {
method render (line 1583) | render() {
class RendersMultiple (line 1587) | class RendersMultiple extends React.Component {
method render (line 1588) | render() {
class RendersZero (line 1597) | class RendersZero extends React.Component {
method render (line 1598) | render() {
class WrapsRendersDOM (line 1602) | class WrapsRendersDOM extends React.Component {
method render (line 1603) | render() {
class DoubleWrapsRendersDOM (line 1608) | class DoubleWrapsRendersDOM extends React.Component {
method render (line 1609) | render() {
class ContextWrapsRendersDOM (line 1613) | class ContextWrapsRendersDOM extends React.Component {
method render (line 1614) | render() {
class DynamicComponent (line 1738) | class DynamicComponent extends React.Component {
method render (line 1739) | render() {
class Fallback (line 1746) | class Fallback extends React.Component {
method render (line 1747) | render() {
class Component (line 1755) | class Component extends React.Component {
method render (line 1756) | render() {
class Bar (line 1972) | class Bar extends React.Component {
method render (line 1356) | render() {
method render (line 1382) | render() {
method render (line 1408) | render() {
method render (line 1430) | render() {
method render (line 1457) | render() {
method render (line 1973) | render() {
class MyComponent (line 1988) | class MyComponent extends React.Component {
method render (line 223) | render() {
method render (line 566) | render() {
method render (line 638) | render() {
method render (line 1989) | render() {
method constructor (line 2267) | constructor(props) {
method componentDidMount (line 2274) | componentDidMount() {
method render (line 2278) | render() {
function MySFC (line 2003) | function MySFC({ fallback, requiredString }) {
class Foo (line 2115) | class Foo extends React.Component {
method render (line 59) | render() {
method render (line 129) | render() {
method render (line 139) | render() {
method render (line 1365) | render() {
method render (line 1391) | render() {
method render (line 1414) | render() {
method render (line 1439) | render() {
method render (line 1465) | render() {
method componentWillMount (line 2116) | componentWillMount() { spy('componentWillMount'); }
method componentDidMount (line 2118) | componentDidMount() { spy('componentDidMount'); }
method componentWillReceiveProps (line 2120) | componentWillReceiveProps() { spy('componentWillReceiveProps'); }
method shouldComponentUpdate (line 2122) | shouldComponentUpdate() {
method componentWillUpdate (line 2127) | componentWillUpdate() { spy('componentWillUpdate'); }
method componentDidUpdate (line 2129) | componentDidUpdate() { spy('componentDidUpdate'); }
method componentWillUnmount (line 2131) | componentWillUnmount() { spy('componentWillUnmount'); }
method render (line 2133) | render() {
method componentDidMount (line 2247) | componentDidMount() {
method render (line 2251) | render() {
method constructor (line 2292) | constructor(props) {
method shouldComponentUpdate (line 2299) | shouldComponentUpdate() {
method render (line 2304) | render() {
method render (line 2389) | render() {
method render (line 2404) | render() {
method render (line 2580) | render() {
class Foo (line 2246) | class Foo extends React.Component {
method render (line 59) | render() {
method render (line 129) | render() {
method render (line 139) | render() {
method render (line 1365) | render() {
method render (line 1391) | render() {
method render (line 1414) | render() {
method render (line 1439) | render() {
method render (line 1465) | render() {
method componentWillMount (line 2116) | componentWillMount() { spy('componentWillMount'); }
method componentDidMount (line 2118) | componentDidMount() { spy('componentDidMount'); }
method componentWillReceiveProps (line 2120) | componentWillReceiveProps() { spy('componentWillReceiveProps'); }
method shouldComponentUpdate (line 2122) | shouldComponentUpdate() {
method componentWillUpdate (line 2127) | componentWillUpdate() { spy('componentWillUpdate'); }
method componentDidUpdate (line 2129) | componentDidUpdate() { spy('componentDidUpdate'); }
method componentWillUnmount (line 2131) | componentWillUnmount() { spy('componentWillUnmount'); }
method render (line 2133) | render() {
method componentDidMount (line 2247) | componentDidMount() {
method render (line 2251) | render() {
method constructor (line 2292) | constructor(props) {
method shouldComponentUpdate (line 2299) | shouldComponentUpdate() {
method render (line 2304) | render() {
method render (line 2389) | render() {
method render (line 2404) | render() {
method render (line 2580) | render() {
class Table (line 2260) | class Table extends React.Component {
method render (line 2261) | render() {
class MyComponent (line 2266) | class MyComponent extends React.Component {
method render (line 223) | render() {
method render (line 566) | render() {
method render (line 638) | render() {
method render (line 1989) | render() {
method constructor (line 2267) | constructor(props) {
method componentDidMount (line 2274) | componentDidMount() {
method render (line 2278) | render() {
class Foo (line 2291) | class Foo extends React.Component {
method render (line 59) | render() {
method render (line 129) | render() {
method render (line 139) | render() {
method render (line 1365) | render() {
method render (line 1391) | render() {
method render (line 1414) | render() {
method render (line 1439) | render() {
method render (line 1465) | render() {
method componentWillMount (line 2116) | componentWillMount() { spy('componentWillMount'); }
method componentDidMount (line 2118) | componentDidMount() { spy('componentDidMount'); }
method componentWillReceiveProps (line 2120) | componentWillReceiveProps() { spy('componentWillReceiveProps'); }
method shouldComponentUpdate (line 2122) | shouldComponentUpdate() {
method componentWillUpdate (line 2127) | componentWillUpdate() { spy('componentWillUpdate'); }
method componentDidUpdate (line 2129) | componentDidUpdate() { spy('componentDidUpdate'); }
method componentWillUnmount (line 2131) | componentWillUnmount() { spy('componentWillUnmount'); }
method render (line 2133) | render() {
method componentDidMount (line 2247) | componentDidMount() {
method render (line 2251) | render() {
method constructor (line 2292) | constructor(props) {
method shouldComponentUpdate (line 2299) | shouldComponentUpdate() {
method render (line 2304) | render() {
method render (line 2389) | render() {
method render (line 2404) | render() {
method render (line 2580) | render() {
class Foo (line 2388) | class Foo extends React.Component {
method render (line 59) | render() {
method render (line 129) | render() {
method render (line 139) | render() {
method render (line 1365) | render() {
method render (line 1391) | render() {
method render (line 1414) | render() {
method render (line 1439) | render() {
method render (line 1465) | render() {
method componentWillMount (line 2116) | componentWillMount() { spy('componentWillMount'); }
method componentDidMount (line 2118) | componentDidMount() { spy('componentDidMount'); }
method componentWillReceiveProps (line 2120) | componentWillReceiveProps() { spy('componentWillReceiveProps'); }
method shouldComponentUpdate (line 2122) | shouldComponentUpdate() {
method componentWillUpdate (line 2127) | componentWillUpdate() { spy('componentWillUpdate'); }
method componentDidUpdate (line 2129) | componentDidUpdate() { spy('componentDidUpdate'); }
method componentWillUnmount (line 2131) | componentWillUnmount() { spy('componentWillUnmount'); }
method render (line 2133) | render() {
method componentDidMount (line 2247) | componentDidMount() {
method render (line 2251) | render() {
method constructor (line 2292) | constructor(props) {
method shouldComponentUpdate (line 2299) | shouldComponentUpdate() {
method render (line 2304) | render() {
method render (line 2389) | render() {
method render (line 2404) | render() {
method render (line 2580) | render() {
class Foo (line 2403) | class Foo extends React.Component {
method render (line 59) | render() {
method render (line 129) | render() {
method render (line 139) | render() {
method render (line 1365) | render() {
method render (line 1391) | render() {
method render (line 1414) | render() {
method render (line 1439) | render() {
method render (line 1465) | render() {
method componentWillMount (line 2116) | componentWillMount() { spy('componentWillMount'); }
method componentDidMount (line 2118) | componentDidMount() { spy('componentDidMount'); }
method componentWillReceiveProps (line 2120) | componentWillReceiveProps() { spy('componentWillReceiveProps'); }
method shouldComponentUpdate (line 2122) | shouldComponentUpdate() {
method componentWillUpdate (line 2127) | componentWillUpdate() { spy('componentWillUpdate'); }
method componentDidUpdate (line 2129) | componentDidUpdate() { spy('componentDidUpdate'); }
method componentWillUnmount (line 2131) | componentWillUnmount() { spy('componentWillUnmount'); }
method render (line 2133) | render() {
method componentDidMount (line 2247) | componentDidMount() {
method render (line 2251) | render() {
method constructor (line 2292) | constructor(props) {
method shouldComponentUpdate (line 2299) | shouldComponentUpdate() {
method render (line 2304) | render() {
method render (line 2389) | render() {
method render (line 2404) | render() {
method render (line 2580) | render() {
class Child (line 2426) | class Child extends React.Component {
method render (line 2427) | render() {
method render (line 2489) | render() {
method render (line 2533) | render() {
class Test (line 2432) | class Test extends React.Component {
method componentWillMount (line 2433) | componentWillMount() {
method safeSetState (line 2437) | safeSetState(newState) {
method asyncSetState (line 2443) | asyncSetState() {
method callbackSetState (line 2449) | callbackSetState() {
method render (line 2453) | render() {
class Child (line 2488) | class Child extends React.Component {
method render (line 2427) | render() {
method render (line 2489) | render() {
method render (line 2533) | render() {
class App (line 2496) | class App extends React.Component {
method constructor (line 2497) | constructor(props) {
method onIncrement (line 2504) | onIncrement() {
method render (line 2510) | render() {
class Child (line 2532) | class Child extends React.Component {
method render (line 2427) | render() {
method render (line 2489) | render() {
method render (line 2533) | render() {
method constructor (line 2543) | constructor(props) {
method onIncrement (line 2550) | onIncrement() {
method render (line 2558) | render() {
class Foo (line 2579) | class Foo extends React.Component {
method render (line 59) | render() {
method render (line 129) | render() {
method render (line 139) | render() {
method render (line 1365) | render() {
method render (line 1391) | render() {
method render (line 1414) | render() {
method render (line 1439) | render() {
method render (line 1465) | render() {
method componentWillMount (line 2116) | componentWillMount() { spy('componentWillMount'); }
method componentDidMount (line 2118) | componentDidMount() { spy('componentDidMount'); }
method componentWillReceiveProps (line 2120) | componentWillReceiveProps() { spy('componentWillReceiveProps'); }
method shouldComponentUpdate (line 2122) | shouldComponentUpdate() {
method componentWillUpdate (line 2127) | componentWillUpdate() { spy('componentWillUpdate'); }
method componentDidUpdate (line 2129) | componentDidUpdate() { spy('componentDidUpdate'); }
method componentWillUnmount (line 2131) | componentWillUnmount() { spy('componentWillUnmount'); }
method render (line 2133) | render() {
method componentDidMount (line 2247) | componentDidMount() {
method render (line 2251) | render() {
method constructor (line 2292) | constructor(props) {
method shouldComponentUpdate (line 2299) | shouldComponentUpdate() {
method render (line 2304) | render() {
method render (line 2389) | render() {
method render (line 2404) | render() {
method render (line 2580) | render() {
FILE: packages/enzyme-test-suite/test/Utils-spec.jsx
function nodesMatchTwoWays (line 227) | function nodesMatchTwoWays(aProps, bProps, LeftTag = 'div', RightTag = '...
function nodesDoNotMatchTwoWays (line 238) | function nodesDoNotMatchTwoWays(aProps, bProps, LeftTag = 'div', RightTa...
class Foo (line 521) | class Foo extends React.Component {
method render (line 522) | render() { return <div />; }
method render (line 543) | render() { return <div />; }
method render (line 931) | render() { return <div />; }
method render (line 978) | render() { return <div />; }
method render (line 1025) | render() { return <div />; }
class Foo (line 542) | class Foo extends React.Component {
method render (line 522) | render() { return <div />; }
method render (line 543) | render() { return <div />; }
method render (line 931) | render() { return <div />; }
method render (line 978) | render() { return <div />; }
method render (line 1025) | render() { return <div />; }
function expectEqualArrays (line 609) | function expectEqualArrays(a, b) {
class Counter (line 784) | class Counter {
method constructor (line 785) | constructor() {
method incrementAndGet (line 789) | incrementAndGet() {
method incrementAndGet (line 797) | incrementAndGet() {
method accessor (line 858) | get accessor() {
method accessor (line 861) | set accessor(v) {
class Foo (line 930) | class Foo extends React.Component {
method render (line 522) | render() { return <div />; }
method render (line 543) | render() { return <div />; }
method render (line 931) | render() { return <div />; }
method render (line 978) | render() { return <div />; }
method render (line 1025) | render() { return <div />; }
class Foo (line 977) | class Foo extends React.Component {
method render (line 522) | render() { return <div />; }
method render (line 543) | render() { return <div />; }
method render (line 931) | render() { return <div />; }
method render (line 978) | render() { return <div />; }
method render (line 1025) | render() { return <div />; }
class Foo (line 1024) | class Foo extends React.Component {
method render (line 522) | render() { return <div />; }
method render (line 543) | render() { return <div />; }
method render (line 931) | render() { return <div />; }
method render (line 978) | render() { return <div />; }
method render (line 1025) | render() { return <div />; }
function namedType (line 1115) | function namedType() {}
class TestAdapter (line 1149) | class TestAdapter extends EnzymeAdapter {
method isCustomComponent (line 1150) | isCustomComponent() {}
FILE: packages/enzyme-test-suite/test/_helpers/describeHooks.js
function describeHooks (line 3) | function describeHooks({
FILE: packages/enzyme-test-suite/test/_helpers/describeLifecycles.js
function describeLifecycles (line 1) | function describeLifecycles({
FILE: packages/enzyme-test-suite/test/_helpers/describeMethods.js
function describeMethods (line 1) | function describeMethods({
FILE: packages/enzyme-test-suite/test/_helpers/getLoadedLazyComponent.js
function fakeSyncThenable (line 5) | function fakeSyncThenable(result) {
function getLoadedLazyComponent (line 13) | function getLoadedLazyComponent(wrappedComponent) {
FILE: packages/enzyme-test-suite/test/_helpers/index.jsx
function describeIf (line 13) | function describeIf(test, a, b) {
function itIf (line 51) | function itIf(test, a, b) {
function itWithData (line 91) | function itWithData(data, message, factory) {
function only (line 97) | function only(a, b) {
function skip (line 109) | function skip(a, b) {
function describeWithDOM (line 121) | function describeWithDOM(a, b) {
class TestHelper (line 138) | class TestHelper extends React.Component {
method render (line 139) | render() {
function generateEmptyRenderData (line 147) | function generateEmptyRenderData() {
function delay (line 160) | function delay(ms) {
function isMemo (line 166) | function isMemo(type) {
function argSpy (line 170) | function argSpy() {
function expectArgs (line 176) | function expectArgs(spy, counter, args) {
FILE: packages/enzyme-test-suite/test/_helpers/setupAdapters.js
method error (line 22) | error(msg) {
method warn (line 27) | warn(msg) {
method beforeEach (line 33) | beforeEach() {
method afterEach (line 36) | afterEach() {
FILE: packages/enzyme-test-suite/test/_helpers/version.js
constant VERSION (line 4) | const VERSION = React.version;
function is (line 6) | function is(range) {
constant REACT16 (line 13) | const REACT16 = is('16');
constant BATCHING (line 17) | const BATCHING = !REACT16;
FILE: packages/enzyme-test-suite/test/adapter-utils-spec.jsx
class Foo (line 52) | class Foo extends React.Component {
method render (line 53) | render() { return <div />; }
method render (line 82) | render() { return <div />; }
method render (line 496) | render() {
method render (line 554) | render() { return <div />; }
class Foo (line 81) | class Foo extends React.Component {
method render (line 53) | render() { return <div />; }
method render (line 82) | render() { return <div />; }
method render (line 496) | render() {
method render (line 554) | render() { return <div />; }
method a (line 114) | a() {}
method c (line 115) | c() {}
function A (line 145) | function A() {
class B (line 148) | class B extends React.Component {
method render (line 149) | render() {
class C (line 153) | class C extends React.Component {
method render (line 154) | render() {
function getNodeType (line 183) | function getNodeType(type) {
function getDisplayName (line 191) | function getDisplayName(node) {
class Target (line 217) | class Target extends React.Component { render() { return null; } }
method render (line 217) | render() { return null; }
method render (line 276) | render() { return null; }
method render (line 308) | render() { return null; }
method render (line 362) | render() { return null; }
class Target (line 276) | class Target extends React.Component { render() { return null; } }
method render (line 217) | render() { return null; }
method render (line 276) | render() { return null; }
method render (line 308) | render() { return null; }
method render (line 362) | render() { return null; }
class Other (line 277) | class Other extends React.Component { render() { return null; } }
method render (line 277) | render() { return null; }
class Unfound (line 278) | class Unfound extends React.Component { render() { return null; } }
method render (line 278) | render() { return null; }
class Target (line 308) | class Target extends React.Component { render() { return null; } }
method render (line 217) | render() { return null; }
method render (line 276) | render() { return null; }
method render (line 308) | render() { return null; }
method render (line 362) | render() { return null; }
class WrappingComponent (line 309) | class WrappingComponent extends React.Component { render() { return null...
method render (line 309) | render() { return null; }
method render (line 363) | render() { return null; }
class Target (line 362) | class Target extends React.Component { render() { return null; } }
method render (line 217) | render() { return null; }
method render (line 276) | render() { return null; }
method render (line 308) | render() { return null; }
method render (line 362) | render() { return null; }
class WrappingComponent (line 363) | class WrappingComponent extends React.Component { render() { return null...
method render (line 309) | render() { return null; }
method render (line 363) | render() { return null; }
class Foo (line 495) | class Foo extends React.Component {
method render (line 53) | render() { return <div />; }
method render (line 82) | render() { return <div />; }
method render (line 496) | render() {
method render (line 554) | render() { return <div />; }
class Foo (line 553) | class Foo extends React.Component {
method render (line 53) | render() { return <div />; }
method render (line 82) | render() { return <div />; }
method render (line 496) | render() {
method render (line 554) | render() { return <div />; }
class FooBang (line 556) | class FooBang extends React.Component {
method render (line 557) | render() { return <div />; }
function Bar (line 566) | function Bar() { return null; }
class Counter (line 624) | class Counter {
method constructor (line 625) | constructor() {
method incrementAndGet (line 629) | incrementAndGet() {
method incrementAndGet (line 637) | incrementAndGet() {
method accessor (line 698) | get accessor() {
method accessor (line 701) | set accessor(v) {
FILE: packages/enzyme-test-suite/test/selector-spec.jsx
class ExampleComponent (line 122) | class ExampleComponent extends React.Component {
method render (line 123) | render() {
method render (line 205) | render() {
class ExampleComponent (line 204) | class ExampleComponent extends React.Component {
method render (line 123) | render() {
method render (line 205) | render() {
class ClassComponent (line 426) | class ClassComponent extends React.Component {
method render (line 427) | render() {
class InnerComponent (line 448) | class InnerComponent extends React.Component {
method render (line 449) | render() {
class WrapComponent (line 455) | class WrapComponent extends React.Component {
method render (line 456) | render() {
class Foo (line 621) | class Foo extends React.Component {
method render (line 622) | render() {
class Bar (line 627) | class Bar extends React.Component {
method render (line 628) | render() {
FILE: packages/enzyme-test-suite/test/shared/hooks/custom.jsx
function describeCustomHooks (line 14) | function describeCustomHooks({
FILE: packages/enzyme-test-suite/test/shared/hooks/useCallback.jsx
function describeUseCallback (line 13) | function describeUseCallback({
FILE: packages/enzyme-test-suite/test/shared/hooks/useContext.jsx
function describeUseContext (line 15) | function describeUseContext({
FILE: packages/enzyme-test-suite/test/shared/hooks/useDebugValue.jsx
function describeUseDebugValue (line 13) | function describeUseDebugValue({
FILE: packages/enzyme-test-suite/test/shared/hooks/useEffect.jsx
function describeUseEffect (line 18) | function describeUseEffect({
FILE: packages/enzyme-test-suite/test/shared/hooks/useImperativeHandle.jsx
function describeUseImperativeHandle (line 15) | function describeUseImperativeHandle({
FILE: packages/enzyme-test-suite/test/shared/hooks/useLayoutEffect.jsx
function describeUseLayoutEffect (line 14) | function describeUseLayoutEffect({
FILE: packages/enzyme-test-suite/test/shared/hooks/useMemo.jsx
function describeUseMemo (line 12) | function describeUseMemo({
FILE: packages/enzyme-test-suite/test/shared/hooks/useReducer.jsx
function describeUseReducer (line 8) | function describeUseReducer({
FILE: packages/enzyme-test-suite/test/shared/hooks/useRef.jsx
function describeUseRef (line 12) | function describeUseRef({
FILE: packages/enzyme-test-suite/test/shared/hooks/useState.jsx
function describeUseState (line 15) | function describeUseState({
FILE: packages/enzyme-test-suite/test/shared/lifecycles/componentDidCatch.jsx
function describeCDC (line 14) | function describeCDC({
FILE: packages/enzyme-test-suite/test/shared/lifecycles/componentDidMount.jsx
function describeCDM (line 5) | function describeCDM({
FILE: packages/enzyme-test-suite/test/shared/lifecycles/componentDidUpdate.jsx
function describeCDU (line 18) | function describeCDU({
FILE: packages/enzyme-test-suite/test/shared/lifecycles/componentWillUnmount.jsx
function describeCWU (line 5) | function describeCWU({
FILE: packages/enzyme-test-suite/test/shared/lifecycles/getDerivedStateFromError.jsx
function describeCDC (line 14) | function describeCDC({
FILE: packages/enzyme-test-suite/test/shared/lifecycles/getDerivedStateFromProps.jsx
function describeGDSFP (line 10) | function describeGDSFP({
FILE: packages/enzyme-test-suite/test/shared/lifecycles/getSnapshotBeforeUpdate.jsx
function describeGSBU (line 12) | function describeGSBU({
FILE: packages/enzyme-test-suite/test/shared/lifecycles/misc.jsx
function describeMisc (line 20) | function describeMisc({
FILE: packages/enzyme-test-suite/test/shared/methods/@@iterator.jsx
function describeIterator (line 12) | function describeIterator({
FILE: packages/enzyme-test-suite/test/shared/methods/at.jsx
function describeAt (line 4) | function describeAt({
FILE: packages/enzyme-test-suite/test/shared/methods/childAt.jsx
function describeChildAt (line 4) | function describeChildAt({
FILE: packages/enzyme-test-suite/test/shared/methods/children.jsx
function describeChildren (line 9) | function describeChildren({
FILE: packages/enzyme-test-suite/test/shared/methods/closest.jsx
function describeClosest (line 4) | function describeClosest({
FILE: packages/enzyme-test-suite/test/shared/methods/contains.jsx
function describeContains (line 10) | function describeContains({
FILE: packages/enzyme-test-suite/test/shared/methods/containsAllMatchingElements.jsx
function describeContainsAllMatchingElements (line 5) | function describeContainsAllMatchingElements({
FILE: packages/enzyme-test-suite/test/shared/methods/containsAnyMatchingElements.jsx
function describeContainsAnyMatchingElements (line 5) | function describeContainsAnyMatchingElements({
FILE: packages/enzyme-test-suite/test/shared/methods/containsMatchingElement.jsx
function describeContainsMatchingElement (line 5) | function describeContainsMatchingElement({
FILE: packages/enzyme-test-suite/test/shared/methods/context.jsx
function describeContext (line 16) | function describeContext({
FILE: packages/enzyme-test-suite/test/shared/methods/debug.jsx
function describeDebug (line 20) | function describeDebug({
FILE: packages/enzyme-test-suite/test/shared/methods/deprecatedInstanceProperties.jsx
function describeDeprecatedInstanceProperties (line 4) | function describeDeprecatedInstanceProperties({
FILE: packages/enzyme-test-suite/test/shared/methods/equals.jsx
function describeEquals (line 9) | function describeEquals({
FILE: packages/enzyme-test-suite/test/shared/methods/every.jsx
function describeEvery (line 4) | function describeEvery({
FILE: packages/enzyme-test-suite/test/shared/methods/everyWhere.jsx
function describeEveryWhere (line 4) | function describeEveryWhere({
FILE: packages/enzyme-test-suite/test/shared/methods/exists.jsx
function describeExists (line 5) | function describeExists({
FILE: packages/enzyme-test-suite/test/shared/methods/filter.jsx
function describeFilter (line 4) | function describeFilter({
FILE: packages/enzyme-test-suite/test/shared/methods/filterWhere.jsx
function describeFilterWhere (line 5) | function describeFilterWhere({
FILE: packages/enzyme-test-suite/test/shared/methods/find.jsx
function describeFind (line 23) | function describeFind({
FILE: packages/enzyme-test-suite/test/shared/methods/findWhere.jsx
function describeFindWhere (line 18) | function describeFindWhere({
FILE: packages/enzyme-test-suite/test/shared/methods/first.jsx
function describeFirst (line 4) | function describeFirst({
FILE: packages/enzyme-test-suite/test/shared/methods/flatMap.jsx
function describeFlatMap (line 4) | function describeFlatMap({
FILE: packages/enzyme-test-suite/test/shared/methods/forEach.jsx
function describeForEach (line 5) | function describeForEach({
FILE: packages/enzyme-test-suite/test/shared/methods/get.jsx
function describeGet (line 6) | function describeGet({
FILE: packages/enzyme-test-suite/test/shared/methods/getElement.jsx
function describeGetElement (line 12) | function describeGetElement({
FILE: packages/enzyme-test-suite/test/shared/methods/getElements.jsx
function describeGetElements (line 6) | function describeGetElements({
FILE: packages/enzyme-test-suite/test/shared/methods/getNode.jsx
function describeGetNode (line 4) | function describeGetNode({
FILE: packages/enzyme-test-suite/test/shared/methods/getNodes.jsx
function describeGetNodes (line 4) | function describeGetNodes({
FILE: packages/enzyme-test-suite/test/shared/methods/getWrappingComponent.jsx
function describeGetWrappingComponent (line 13) | function describeGetWrappingComponent({
FILE: packages/enzyme-test-suite/test/shared/methods/hasClass.jsx
function describeHasClass (line 11) | function describeHasClass({
FILE: packages/enzyme-test-suite/test/shared/methods/hostNodes.jsx
function describeHostNodes (line 9) | function describeHostNodes({
FILE: packages/enzyme-test-suite/test/shared/methods/html.jsx
function describeHTML (line 13) | function describeHTML({
FILE: packages/enzyme-test-suite/test/shared/methods/instance.jsx
function describeInstance (line 10) | function describeInstance({
FILE: packages/enzyme-test-suite/test/shared/methods/invoke.jsx
function describeInvoke (line 16) | function describeInvoke({
FILE: packages/enzyme-test-suite/test/shared/methods/is.jsx
function describeIs (line 14) | function describeIs({
FILE: packages/enzyme-test-suite/test/shared/methods/isEmpty.jsx
function describeLast (line 5) | function describeLast({
FILE: packages/enzyme-test-suite/test/shared/methods/isEmptyRender.jsx
function describeIsEmptyRender (line 17) | function describeIsEmptyRender({
FILE: packages/enzyme-test-suite/test/shared/methods/key.jsx
function describeKey (line 4) | function describeKey({
FILE: packages/enzyme-test-suite/test/shared/methods/last.jsx
function describeLast (line 4) | function describeLast({
FILE: packages/enzyme-test-suite/test/shared/methods/map.jsx
function describeMap (line 5) | function describeMap({
FILE: packages/enzyme-test-suite/test/shared/methods/matchesElement.jsx
function describeMatchesElement (line 5) | function describeMatchesElement({
FILE: packages/enzyme-test-suite/test/shared/methods/name.jsx
function describeName (line 17) | function describeName({
FILE: packages/enzyme-test-suite/test/shared/methods/not.jsx
function describeNot (line 4) | function describeNot({
FILE: packages/enzyme-test-suite/test/shared/methods/parent.jsx
function describeParent (line 12) | function describeParent({
FILE: packages/enzyme-test-suite/test/shared/methods/parents.jsx
function describeParents (line 12) | function describeParents({
FILE: packages/enzyme-test-suite/test/shared/methods/prop.jsx
function describeProp (line 10) | function describeProp({
FILE: packages/enzyme-test-suite/test/shared/methods/props.jsx
function describeProps (line 12) | function describeProps({
FILE: packages/enzyme-test-suite/test/shared/methods/reduce.jsx
function describeReduce (line 7) | function describeReduce({
FILE: packages/enzyme-test-suite/test/shared/methods/reduceRight.jsx
function describeReduceRight (line 7) | function describeReduceRight({
FILE: packages/enzyme-test-suite/test/shared/methods/render.jsx
function describeRender (line 9) | function describeRender({
FILE: packages/enzyme-test-suite/test/shared/methods/renderProp.jsx
function describeRenderProp (line 13) | function describeRenderProp({
FILE: packages/enzyme-test-suite/test/shared/methods/root.jsx
function describeRoot (line 8) | function describeRoot({
FILE: packages/enzyme-test-suite/test/shared/methods/setContext.jsx
function describeSetContext (line 16) | function describeSetContext({
FILE: packages/enzyme-test-suite/test/shared/methods/setProps.jsx
function describeSetProps (line 16) | function describeSetProps({
FILE: packages/enzyme-test-suite/test/shared/methods/setState.jsx
constant CALLING_SETSTATE_CALLBACK_WITH_UNDEFINED (line 15) | const CALLING_SETSTATE_CALLBACK_WITH_UNDEFINED = is('^15.5');
function describeSetState (line 17) | function describeSetState({
FILE: packages/enzyme-test-suite/test/shared/methods/simulate.jsx
function describeSimulate (line 20) | function describeSimulate({
FILE: packages/enzyme-test-suite/test/shared/methods/simulateError.jsx
function describeSimulateError (line 16) | function describeSimulateError({
FILE: packages/enzyme-test-suite/test/shared/methods/single.jsx
function describeSingle (line 8) | function describeSingle({
FILE: packages/enzyme-test-suite/test/shared/methods/slice.jsx
function describeSlice (line 4) | function describeSlice({
FILE: packages/enzyme-test-suite/test/shared/methods/some.jsx
function describeSome (line 4) | function describeSome({
FILE: packages/enzyme-test-suite/test/shared/methods/someWhere.jsx
function describeSomeWhere (line 4) | function describeSomeWhere({
FILE: packages/enzyme-test-suite/test/shared/methods/state.jsx
function describeState (line 14) | function describeState({
FILE: packages/enzyme-test-suite/test/shared/methods/tap.jsx
function describeTap (line 5) | function describeTap({
FILE: packages/enzyme-test-suite/test/shared/methods/text.jsx
function describeText (line 17) | function describeText({
FILE: packages/enzyme-test-suite/test/shared/methods/unmount.jsx
function describeUnmount (line 9) | function describeUnmount({
FILE: packages/enzyme-test-suite/test/shared/methods/wrap.jsx
function describeWrap (line 8) | function describeWrap({
FILE: packages/enzyme-test-suite/test/staticRender-spec.jsx
method render (line 24) | render() {
method render (line 45) | render() {
method render (line 51) | render() {
method render (line 77) | render() {
method render (line 91) | render() {
method render (line 112) | render() {
class DynamicComponent (line 134) | class DynamicComponent extends React.Component {
method render (line 135) | render() {
FILE: packages/enzyme/src/Debug.js
function typeName (line 18) | function typeName(node) {
function spaces (line 28) | function spaces(n) {
function indent (line 32) | function indent(depth, string) {
function propString (line 36) | function propString(prop, options) {
function propsString (line 59) | function propsString(node, options) {
function indentChildren (line 65) | function indentChildren(childrenStrs, indentLength) {
function isRSTNodeLike (line 71) | function isRSTNodeLike(node) {
function debugNode (line 81) | function debugNode(node, indentLength = 2, options = {}) {
function debugNodes (line 109) | function debugNodes(nodes, options = {}) {
FILE: packages/enzyme/src/EnzymeAdapter.js
function unimplementedError (line 1) | function unimplementedError(methodName, classname) {
class EnzymeAdapter (line 5) | class EnzymeAdapter {
method constructor (line 6) | constructor() {
method createRenderer (line 13) | createRenderer(options) {
method nodeToElement (line 21) | nodeToElement(node) {
method matchesElementType (line 26) | matchesElementType(node, matchingType) {
method isValidElement (line 35) | isValidElement(element) {
method createElement (line 40) | createElement(type, props, ...children) {
method invokeSetStateCallback (line 45) | invokeSetStateCallback(instance, callback) {
FILE: packages/enzyme/src/RSTTraversal.js
function propsOfNode (line 9) | function propsOfNode(node) {
function childrenOfNode (line 13) | function childrenOfNode(node) {
function hasClassName (line 36) | function hasClassName(node, className) {
function treeForEach (line 43) | function treeForEach(tree, fn) {
function treeFilter (line 50) | function treeFilter(tree, fn) {
function findParentNode (line 70) | function findParentNode(root, targetNode) {
function pathFilter (line 84) | function pathFilter(path, fn) {
function pathToNode (line 88) | function pathToNode(node, root) {
function parentsOfNode (line 111) | function parentsOfNode(node, root) {
function nodeHasId (line 115) | function nodeHasId(node, id) {
constant CAN_NEVER_MATCH (line 119) | const CAN_NEVER_MATCH = {};
function replaceUndefined (line 120) | function replaceUndefined(v) {
function replaceUndefinedValues (line 123) | function replaceUndefinedValues(obj) {
function nodeMatchesObjectProps (line 128) | function nodeMatchesObjectProps(node, props) {
function getTextFromHostNode (line 132) | function getTextFromHostNode(hostNode) {
function getTextFromRSTNode (line 142) | function getTextFromRSTNode(node, {
function getTextFromNode (line 169) | function getTextFromNode(node) {
function getTextFromHostNodes (line 178) | function getTextFromHostNodes(node, adapter) {
function getHTMLFromHostNode (line 190) | function getHTMLFromHostNode(hostNode) {
function getHTMLFromHostNodes (line 197) | function getHTMLFromHostNodes(node, adapter) {
FILE: packages/enzyme/src/ReactWrapper.js
constant NODE (line 34) | const NODE = sym('__node__');
constant NODES (line 35) | const NODES = sym('__nodes__');
constant RENDERER (line 36) | const RENDERER = sym('__renderer__');
constant UNRENDERED (line 37) | const UNRENDERED = sym('__unrendered__');
constant ROOT (line 38) | const ROOT = sym('__root__');
constant OPTIONS (line 39) | const OPTIONS = sym('__options__');
constant ROOT_NODES (line 40) | const ROOT_NODES = sym('__rootNodes__');
constant WRAPPING_COMPONENT (line 41) | const WRAPPING_COMPONENT = sym('__wrappingComponent__');
constant LINKED_ROOTS (line 42) | const LINKED_ROOTS = sym('__linkedRoots__');
constant UPDATED_BY (line 43) | const UPDATED_BY = sym('__updatedBy__');
function findWhereUnwrapped (line 54) | function findWhereUnwrapped(wrapper, predicate, filter = treeFilter) {
function filterWhereUnwrapped (line 66) | function filterWhereUnwrapped(wrapper, predicate) {
function getRootNodeInternal (line 70) | function getRootNodeInternal(wrapper) {
function nodeParents (line 80) | function nodeParents(wrapper, node) {
function privateSetNodes (line 84) | function privateSetNodes(wrapper, nodes) {
class ReactWrapper (line 101) | class ReactWrapper {
method constructor (line 102) | constructor(nodes, root, passedOptions = {}) {
method root (line 152) | root() {
method getNodeInternal (line 161) | getNodeInternal() {
method getNodesInternal (line 173) | getNodesInternal() {
method getElement (line 182) | getElement() {
method getElements (line 191) | getElements() {
method getNode (line 196) | getNode() {
method getNodes (line 201) | getNodes() {
method getDOMNode (line 212) | getDOMNode() {
method ref (line 226) | ref(refname) {
method instance (line 244) | instance() {
method getWrappingComponent (line 255) | getWrappingComponent() {
method update (line 273) | update() {
method unmount (line 302) | unmount() {
method mount (line 320) | mount() {
method setProps (line 342) | setProps(props, callback = undefined) {
method setState (line 373) | setState(state, callback = undefined) {
method setContext (line 404) | setContext(context) {
method contains (line 427) | contains(nodeOrNodes) {
method containsMatchingElement (line 457) | containsMatchingElement(node) {
method containsAllMatchingElements (line 481) | containsAllMatchingElements(nodes) {
method containsAnyMatchingElements (line 507) | containsAnyMatchingElements(nodes) {
method equals (line 523) | equals(node) {
method matchesElement (line 544) | matchesElement(node) {
method find (line 558) | find(selector) {
method is (line 570) | is(selector) {
method isEmptyRender (line 580) | isEmptyRender() {
method filterWhere (line 593) | filterWhere(predicate) {
method filter (line 604) | filter(selector) {
method not (line 616) | not(selector) {
method text (line 630) | text() {
method html (line 642) | html() {
method render (line 654) | render() {
method simulate (line 667) | simulate(event, mock = {}) {
method simulateError (line 681) | simulateError(error) {
method props (line 712) | props() {
method state (line 725) | state(name) {
method context (line 749) | context(name) {
method children (line 770) | children(selector) {
method childAt (line 781) | childAt(index) {
method parents (line 794) | parents(selector) {
method parent (line 806) | parent() {
method closest (line 815) | closest(selector) {
method prop (line 829) | prop(propName) {
method invoke (line 840) | invoke(propName) {
method renderProp (line 862) | renderProp(propName) {
method key (line 897) | key() {
method type (line 907) | type() {
method name (line 918) | name() {
method hasClass (line 933) | hasClass(className) {
method forEach (line 948) | forEach(fn) {
method map (line 960) | map(fn) {
method reduce (line 972) | reduce(fn, initialValue = undefined) {
method reduceRight (line 995) | reduceRight(fn, initialValue = undefined) {
method slice (line 1018) | slice(begin, end) {
method some (line 1028) | some(selector) {
method someWhere (line 1042) | someWhere(predicate) {
method every (line 1052) | every(selector) {
method everyWhere (line 1063) | everyWhere(predicate) {
method flatMap (line 1075) | flatMap(fn) {
method findWhere (line 1088) | findWhere(predicate) {
method get (line 1101) | get(index) {
method at (line 1111) | at(index) {
method first (line 1124) | first() {
method last (line 1133) | last() {
method isEmpty (line 1142) | isEmpty() {
method exists (line 1155) | exists(selector = null) {
method single (line 1167) | single(name, fn) {
method wrap (line 1183) | wrap(node, root = this[ROOT], ...args) {
method debug (line 1198) | debug(options = {}) {
method tap (line 1208) | tap(intercepter) {
method detach (line 1222) | detach() {
method hostNodes (line 1238) | hostNodes() {
class WrappingComponentWrapper (line 1250) | class WrappingComponentWrapper extends ReactWrapper {
method constructor (line 1252) | constructor(root, renderer) {
method getWrappingComponent (line 1260) | getWrappingComponent() {
method [ITERATOR_SYMBOL] (line 1272) | [ITERATOR_SYMBOL]() { return this; }
method next (line 1273) | next() {
function privateWarning (line 1288) | function privateWarning(prop, extraMessage) {
FILE: packages/enzyme/src/ShallowWrapper.js
constant NODE (line 37) | const NODE = sym('__node__');
constant NODES (line 38) | const NODES = sym('__nodes__');
constant RENDERER (line 39) | const RENDERER = sym('__renderer__');
constant UNRENDERED (line 40) | const UNRENDERED = sym('__unrendered__');
constant ROOT (line 41) | const ROOT = sym('__root__');
constant OPTIONS (line 42) | const OPTIONS = sym('__options__');
constant SET_STATE (line 43) | const SET_STATE = sym('__setState__');
constant ROOT_NODES (line 44) | const ROOT_NODES = sym('__rootNodes__');
constant CHILD_CONTEXT (line 45) | const CHILD_CONTEXT = sym('__childContext__');
constant WRAPPING_COMPONENT (line 46) | const WRAPPING_COMPONENT = sym('__wrappingComponent__');
constant PRIMARY_WRAPPER (line 47) | const PRIMARY_WRAPPER = sym('__primaryWrapper__');
constant ROOT_FINDER (line 48) | const ROOT_FINDER = sym('__rootFinder__');
constant PROVIDER_VALUES (line 49) | const PROVIDER_VALUES = sym('__providerValues__');
function findWhereUnwrapped (line 60) | function findWhereUnwrapped(wrapper, predicate, filter = treeFilter) {
function filterWhereUnwrapped (line 72) | function filterWhereUnwrapped(wrapper, predicate) {
function validateOptions (line 80) | function validateOptions(options) {
function getAdapterLifecycles (line 121) | function getAdapterLifecycles({ options }) {
function getRootNode (line 159) | function getRootNode(node) {
function getRootNodeInternal (line 166) | function getRootNodeInternal(wrapper) {
function nodeParents (line 176) | function nodeParents(wrapper, node) {
function privateSetNodes (line 180) | function privateSetNodes(wrapper, nodes) {
function pureComponentShouldComponentUpdate (line 191) | function pureComponentShouldComponentUpdate(prevProps, props, prevState,...
function isPureComponent (line 195) | function isPureComponent(instance) {
function getChildContext (line 199) | function getChildContext(node, hierarchy, renderer) {
function spyOnGetChildContextInitialRender (line 227) | function spyOnGetChildContextInitialRender(nodes, adapter) {
function privateSetChildContext (line 239) | function privateSetChildContext(adapter, wrapper, instance, renderedNode...
function mockSCUIfgDSFPReturnNonNull (line 257) | function mockSCUIfgDSFPReturnNonNull(node, state) {
function deepRender (line 292) | function deepRender(wrapper, target, adapter) {
function getContextFromWrappingComponent (line 321) | function getContextFromWrappingComponent(wrapper, adapter) {
function makeShallowOptions (line 344) | function makeShallowOptions(nodes, root, passedOptions, wrapper) {
function makeInheritedChildOptions (line 372) | function makeInheritedChildOptions(wrapper, options = {}) {
class ShallowWrapper (line 388) | class ShallowWrapper {
method constructor (line 389) | constructor(nodes, root, passedOptions = {}) {
method root (line 450) | root() {
method getNodeInternal (line 459) | getNodeInternal() {
method getNodesInternal (line 474) | getNodesInternal() {
method getElement (line 486) | getElement() {
method getElements (line 495) | getElements() {
method getNode (line 500) | getNode() {
method getNodes (line 505) | getNodes() {
method instance (line 522) | instance() {
method getWrappingComponent (line 536) | getWrappingComponent() {
method update (line 554) | update() {
method unmount (line 570) | unmount() {
method rerender (line 588) | rerender(props, context) {
method setProps (line 703) | setProps(props, callback = undefined) {
method setState (line 730) | setState(state, callback = undefined) {
method setContext (line 859) | setContext(context) {
method contains (line 881) | contains(nodeOrNodes) {
method containsMatchingElement (line 914) | containsMatchingElement(node) {
method containsAllMatchingElements (line 940) | containsAllMatchingElements(nodes) {
method containsAnyMatchingElements (line 967) | containsAnyMatchingElements(nodes) {
method equals (line 983) | equals(node) {
method matchesElement (line 1004) | matchesElement(node) {
method find (line 1018) | find(selector) {
method is (line 1030) | is(selector) {
method isEmptyRender (line 1040) | isEmptyRender() {
method filterWhere (line 1054) | filterWhere(predicate) {
method filter (line 1065) | filter(selector) {
method not (line 1077) | not(selector) {
method text (line 1091) | text() {
method html (line 1102) | html() {
method render (line 1118) | render() {
method simulate (line 1131) | simulate(event, ...args) {
method simulateError (line 1145) | simulateError(error) {
method props (line 1173) | props() {
method state (line 1186) | state(name) {
method context (line 1212) | context(name) {
method children (line 1235) | children(selector) {
method childAt (line 1246) | childAt(index) {
method parents (line 1259) | parents(selector) {
method parent (line 1271) | parent() {
method closest (line 1280) | closest(selector) {
method shallow (line 1296) | shallow(options = {}) {
method prop (line 1309) | prop(propName) {
method invoke (line 1320) | invoke(propName) {
method renderProp (line 1340) | renderProp(propName) {
method key (line 1375) | key() {
method type (line 1386) | type() {
method name (line 1397) | name() {
method hasClass (line 1412) | hasClass(className) {
method forEach (line 1427) | forEach(fn) {
method map (line 1439) | map(fn) {
method reduce (line 1451) | reduce(fn, initialValue = undefined) {
method reduceRight (line 1474) | reduceRight(fn, initialValue = undefined) {
method slice (line 1497) | slice(begin, end) {
method some (line 1507) | some(selector) {
method someWhere (line 1521) | someWhere(predicate) {
method every (line 1531) | every(selector) {
method everyWhere (line 1542) | everyWhere(predicate) {
method flatMap (line 1554) | flatMap(fn) {
method findWhere (line 1568) | findWhere(predicate) {
method get (line 1581) | get(index) {
method at (line 1591) | at(index) {
method first (line 1604) | first() {
method last (line 1613) | last() {
method isEmpty (line 1622) | isEmpty() {
method exists (line 1635) | exists(selector = null) {
method single (line 1647) | single(name, fn) {
method wrap (line 1663) | wrap(node, root = this[ROOT], ...args) {
method debug (line 1678) | debug(options = {}) {
method tap (line 1688) | tap(intercepter) {
method dive (line 1700) | dive(options = {}) {
method hostNodes (line 1722) | hostNodes() {
function updatePrimaryRootContext (line 1731) | function updatePrimaryRootContext(wrappingComponent) {
class WrappingComponentWrapper (line 1769) | class WrappingComponentWrapper extends ShallowWrapper {
method constructor (line 1770) | constructor(nodes, root, RootFinder) {
method rerender (line 1780) | rerender(...args) {
method setState (line 1790) | setState(...args) {
method getWrappingComponent (line 1797) | getWrappingComponent() {
method [ITERATOR_SYMBOL] (line 1809) | [ITERATOR_SYMBOL]() { return this; }
method next (line 1810) | next() {
function privateWarning (line 1825) | function privateWarning(prop, extraMessage) {
FILE: packages/enzyme/src/Utils.js
constant ITERATOR_SYMBOL (line 18) | const ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
function getAdapter (line 20) | function getAdapter(options = {}) {
function validateMountOptions (line 25) | function validateMountOptions(attachTo, hydrateIn) {
function makeOptions (line 31) | function makeOptions(options) {
function isCustomComponent (line 56) | function isCustomComponent(component, adapter) {
function isCustomComponentElement (line 64) | function isCustomComponentElement(inst, adapter) {
function propsOfNode (line 71) | function propsOfNode(node) {
function typeOfNode (line 77) | function typeOfNode(node) {
function nodeHasType (line 81) | function nodeHasType(node, type) {
function internalChildrenCompare (line 97) | function internalChildrenCompare(a, b, lenComp, isLoose) {
function childrenMatch (line 114) | function childrenMatch(a, b, lenComp) {
function childrenEqual (line 118) | function childrenEqual(a, b, lenComp) {
function removeNullaryReducer (line 122) | function removeNullaryReducer(acc, [key, value]) {
function internalNodeCompare (line 127) | function internalNodeCompare(a, b, lenComp, isLoose) {
function nodeMatches (line 177) | function nodeMatches(a, b, lenComp = is) {
function nodeEqual (line 181) | function nodeEqual(a, b, lenComp = is) {
function containsChildrenSubArray (line 185) | function containsChildrenSubArray(match, node, subArray) {
function arraysEqual (line 191) | function arraysEqual(match, left, right) {
function childrenToArray (line 195) | function childrenToArray(children) {
function childrenToSimplifiedArray (line 211) | function childrenToSimplifiedArray(nodeChildren, isLoose = false) {
function isTextualNode (line 236) | function isTextualNode(node) {
function isReactElementAlike (line 240) | function isReactElementAlike(arg, adapter) {
function withSetStateAllowed (line 245) | function withSetStateAllowed(fn) {
function AND (line 264) | function AND(fns) {
function displayNameOfNode (line 269) | function displayNameOfNode(node) {
function sym (line 279) | function sym(s) {
function privateSet (line 283) | function privateSet(obj, prop, value) {
function cloneElement (line 291) | function cloneElement(adapter, el, props) {
function spyMethod (line 298) | function spyMethod(instance, methodName, getStub = () => {}) {
function spyProperty (line 337) | function spyProperty(instance, propertyName, handlers = {}) {
function isEmptyValue (line 392) | function isEmptyValue(renderedValue) {
function renderedDive (line 396) | function renderedDive(nodes) {
function loadCheerioRoot (line 411) | function loadCheerioRoot(html) {
FILE: packages/enzyme/src/configuration.js
function get (line 5) | function get() {
function merge (line 9) | function merge(extra) {
function reset (line 16) | function reset(replacementConfig = {}) {
FILE: packages/enzyme/src/getAdapter.js
function getAdapter (line 4) | function getAdapter(options = {}) {
FILE: packages/enzyme/src/mount.js
function mount (line 9) | function mount(node, options) {
FILE: packages/enzyme/src/render.js
function render (line 18) | function render(node, options = {}) {
FILE: packages/enzyme/src/selectors.js
constant CHILD (line 21) | const CHILD = 'childCombinator';
constant ADJACENT_SIBLING (line 22) | const ADJACENT_SIBLING = 'adjacentSiblingCombinator';
constant GENERAL_SIBLING (line 23) | const GENERAL_SIBLING = 'generalSiblingCombinator';
constant DESCENDANT (line 24) | const DESCENDANT = 'descendantCombinator';
constant SELECTOR (line 27) | const SELECTOR = 'selector';
constant TYPE_SELECTOR (line 28) | const TYPE_SELECTOR = 'typeSelector';
constant CLASS_SELECTOR (line 29) | const CLASS_SELECTOR = 'classSelector';
constant ID_SELECTOR (line 30) | const ID_SELECTOR = 'idSelector';
constant UNIVERSAL_SELECTOR (line 31) | const UNIVERSAL_SELECTOR = 'universalSelector';
constant ATTRIBUTE_PRESENCE (line 32) | const ATTRIBUTE_PRESENCE = 'attributePresenceSelector';
constant ATTRIBUTE_VALUE (line 33) | const ATTRIBUTE_VALUE = 'attributeValueSelector';
constant PSEUDO_CLASS (line 35) | const PSEUDO_CLASS = 'pseudoClassSelector';
constant PSEUDO_ELEMENT (line 36) | const PSEUDO_ELEMENT = 'pseudoElementSelector';
constant EXACT_ATTRIBUTE_OPERATOR (line 38) | const EXACT_ATTRIBUTE_OPERATOR = '=';
constant WHITELIST_ATTRIBUTE_OPERATOR (line 39) | const WHITELIST_ATTRIBUTE_OPERATOR = '~=';
constant HYPHENATED_ATTRIBUTE_OPERATOR (line 40) | const HYPHENATED_ATTRIBUTE_OPERATOR = '|=';
constant PREFIX_ATTRIBUTE_OPERATOR (line 41) | const PREFIX_ATTRIBUTE_OPERATOR = '^=';
constant SUFFIX_ATTRIBUTE_OPERATOR (line 42) | const SUFFIX_ATTRIBUTE_OPERATOR = '$=';
constant SUBSTRING_ATTRIBUTE_OPERATOR (line 43) | const SUBSTRING_ATTRIBUTE_OPERATOR = '*=';
function unique (line 45) | function unique(arr) {
function uniqueReduce (line 55) | function uniqueReduce(fn, nodes) {
function safelyGenerateTokens (line 64) | function safelyGenerateTokens(selector) {
function matchAttributeSelector (line 72) | function matchAttributeSelector(node, token) {
function matchPseudoSelector (line 146) | function matchPseudoSelector(node, token, root) {
function nodeMatchesToken (line 182) | function nodeMatchesToken(node, token, root) {
function buildPredicateFromToken (line 239) | function buildPredicateFromToken(token, root) {
function isComplexSelector (line 248) | function isComplexSelector(tokens) {
function buildPredicate (line 258) | function buildPredicate(selector) {
function matchAdjacentSiblings (line 299) | function matchAdjacentSiblings(nodes, predicate, root) {
function matchGeneralSibling (line 327) | function matchGeneralSibling(nodes, predicate, root) {
function matchDirectChild (line 346) | function matchDirectChild(nodes, predicate) {
function matchDescendant (line 359) | function matchDescendant(nodes, predicate) {
function reduceTreeBySelector (line 375) | function reduceTreeBySelector(selector, root) {
function reduceTreesBySelector (line 454) | function reduceTreesBySelector(selector, roots) {
FILE: packages/enzyme/src/shallow.js
function shallow (line 9) | function shallow(node, options) {
FILE: packages/enzyme/src/validateAdapter.js
function validateAdapter (line 3) | function validateAdapter(adapter) {
Condensed preview — 403 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,411K chars).
[
{
"path": ".babelrc",
"chars": 263,
"preview": "{\n \"presets\": [\"airbnb\"],\n \"plugins\": [\n [\"transform-replace-object-assign\", { \"moduleSpecifier\": \"object.assign\" }"
},
{
"path": ".eslintrc",
"chars": 2003,
"preview": "{\n \"extends\": \"airbnb\",\n \"root\": true,\n \"env\": {\n \"node\": true,\n },\n \"parser\": \"@babel/eslint-parser\",\n \"ignore"
},
{
"path": ".github/FUNDING.yml",
"chars": 577,
"preview": "# These are supported funding model platforms\n\ngithub: [ljharb]\npatreon: # Replace with a single Patreon username\nopen_c"
},
{
"path": ".github/ISSUE_TEMPLATE/Bug_report.md",
"chars": 1491,
"preview": "---\nname: 🐛 Bug report\nabout: Create a report to help us improve\n\n---\nThanks for reporting an issue to us! We're glad yo"
},
{
"path": ".github/ISSUE_TEMPLATE/Feature_request.md",
"chars": 563,
"preview": "---\nname: 🙏 Feature request\nabout: Suggest an idea for this project\n\n---\n\n**Is your feature request related to a problem"
},
{
"path": ".github/workflows/node-pretest.yml",
"chars": 575,
"preview": "name: 'Tests: pretest/posttest'\n\non: [pull_request, push]\n\njobs:\n pretest:\n runs-on: ubuntu-latest\n\n steps:\n "
},
{
"path": ".github/workflows/node.yml",
"chars": 4412,
"preview": "name: 'Tests: node.js'\n\non: [pull_request, push]\n\njobs:\n build:\n name: 'install deps and build'\n runs-on: ubuntu-"
},
{
"path": ".github/workflows/rebase.yml",
"chars": 257,
"preview": "name: Automatic Rebase\n\non: [pull_request_target]\n\njobs:\n _:\n name: \"Automatic Rebase\"\n\n runs-on: ubuntu-latest\n\n"
},
{
"path": ".github/workflows/require-allow-edits.yml",
"chars": 185,
"preview": "name: Require “Allow Edits”\n\non: [pull_request_target]\n\njobs:\n _:\n name: \"Require “Allow Edits”\"\n\n runs-on: ubunt"
},
{
"path": ".gitignore",
"chars": 868,
"preview": "# Logs\nlogs\n*.log\n\n# Runtime data\npids\n*.pid\n*.seed\n\n# Directory for instrumented libs generated by jscoverage/JSCover\nl"
},
{
"path": ".lgtm",
"chars": 51,
"preview": "approvals = 1\npattern = \"(?i):shipit:|:\\\\+1:|LGTM\"\n"
},
{
"path": ".npmrc",
"chars": 63,
"preview": "package-lock=false\nupdate-notifier=false\nlegacy-peer-deps=true\n"
},
{
"path": ".nycrc",
"chars": 480,
"preview": "{\n \"extension\": [\n \".js\",\n \".jsx\"\n ],\n \"include\": [\n \"*\",\n \"packages/*/*\",\n \"packages/*/src\"\n ],\n \"e"
},
{
"path": "CHANGELOG.md",
"chars": 36360,
"preview": "# Change Log\n\n## 3.11.0\n\n### New Stuff\n - `render`: handle Fiber strings and numbers (#2221)\n\n### Fixes\n - `shallow`: Sh"
},
{
"path": "CONTRIBUTING.md",
"chars": 6410,
"preview": "# Contributing Guide\n\nContributions are welcome and are greatly appreciated! Every little bit helps, and credit will\nalw"
},
{
"path": "INTHEWILD.md",
"chars": 1933,
"preview": "Please use [pull requests](https://github.com/enzymejs/enzyme/pull/new/master) to add your organization and/or project t"
},
{
"path": "LICENSE.md",
"chars": 1097,
"preview": "\nThe MIT License (MIT)\n\nCopyright (c) 2015 Airbnb, Inc. and contributors\n\nPermission is hereby granted, free of charge, "
},
{
"path": "MAINTAINERS",
"chars": 53,
"preview": "ljharb\nlelandrichardson\nblainekasten\nAweary\nnfcampos\n"
},
{
"path": "README.md",
"chars": 9755,
"preview": "Enzyme\n=======\n\n[](https:"
},
{
"path": "SUMMARY.md",
"chars": 8657,
"preview": "## Table of Contents\n\n* [Introduction](/README.md)\n* [Guides](/docs/guides.md)\n * [Migration from 2.x to 3.x](/docs/gui"
},
{
"path": "book.json",
"chars": 439,
"preview": "{\n \"gitbook\": \"3.2.2\",\n \"title\": \"Enzyme\",\n \"description\": \"React Testing\",\n \"plugins\": [\n \"edit-link\",\n \"gith"
},
{
"path": "docs/GLOSSARY.md",
"chars": 401,
"preview": "# 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 e"
},
{
"path": "docs/api/README.md",
"chars": 406,
"preview": "# API Reference\n\n\n\n### [Shallow Rendering](shallow.md)\n\n```jsx\nimport { shallow } from 'enzyme';\n\nconst wrapper = shallo"
},
{
"path": "docs/api/ReactWrapper/at.md",
"chars": 635,
"preview": "# `.at(index) => ReactWrapper`\n\nReturns a wrapper around the node at a given index of the current wrapper.\n\n\n#### Argume"
},
{
"path": "docs/api/ReactWrapper/childAt.md",
"chars": 639,
"preview": "# `.childAt(index) => ReactWrapper`\n\nReturns a new wrapper with child at the specified index.\n\n#### Arguments\n\n1. `index"
},
{
"path": "docs/api/ReactWrapper/children.md",
"chars": 738,
"preview": "# `.children([selector]) => ReactWrapper`\n\nReturns a new wrapper with all of the children of the node(s) in the current "
},
{
"path": "docs/api/ReactWrapper/closest.md",
"chars": 706,
"preview": "# `.closest(selector) => ReactWrapper`\n\nReturns a wrapper of the first element that matches the selector by traversing u"
},
{
"path": "docs/api/ReactWrapper/contains.md",
"chars": 1992,
"preview": "# `.contains(nodeOrNodes) => Boolean`\n\nReturns whether or not all given react elements match elements in the render tree"
},
{
"path": "docs/api/ReactWrapper/containsAllMatchingElements.md",
"chars": 1616,
"preview": "# `.containsAllMatchingElements(patternNodes) => Boolean`\n\nReturns whether or not all of the given react elements in `pa"
},
{
"path": "docs/api/ReactWrapper/containsAnyMatchingElements.md",
"chars": 1631,
"preview": "# `.containsAnyMatchingElements(patternNodes) => Boolean`\n\nReturns whether or not at least one of the given react elemen"
},
{
"path": "docs/api/ReactWrapper/containsMatchingElement.md",
"chars": 1845,
"preview": "# `.containsMatchingElement(patternNode) => Boolean`\n\nReturns whether or not a `patternNode` react element matches any e"
},
{
"path": "docs/api/ReactWrapper/context.md",
"chars": 619,
"preview": "# `.context([key]) => Any`\n\nReturns the context hash for the root node of the wrapper. Optionally pass in a prop name an"
},
{
"path": "docs/api/ReactWrapper/debug.md",
"chars": 1997,
"preview": "# `.debug([options]) => String`\n\nReturns an HTML-like string of the wrapper for debugging purposes. Useful to print out "
},
{
"path": "docs/api/ReactWrapper/detach.md",
"chars": 2588,
"preview": "# `.detach() => void`\n\nDetaches the react tree from the DOM. Runs `ReactDOM.unmountComponentAtNode()` under the hood.\n\nT"
},
{
"path": "docs/api/ReactWrapper/equals.md",
"chars": 1003,
"preview": "# `.equals(node) => Boolean`\n\nReturns whether or not the current wrapper root node render tree looks like the one passed"
},
{
"path": "docs/api/ReactWrapper/every.md",
"chars": 791,
"preview": "# `.every(selector) => Boolean`\n\nReturns whether or not all of the nodes in the wrapper match the provided selector.\n\n\n#"
},
{
"path": "docs/api/ReactWrapper/everyWhere.md",
"chars": 857,
"preview": "# `.everyWhere(fn) => Boolean`\n\nReturns whether or not all of the nodes in the wrapper pass the provided predicate funct"
},
{
"path": "docs/api/ReactWrapper/exists.md",
"chars": 600,
"preview": "# `.exists([selector]) => Boolean`\n\nReturns whether or not any nodes exist in the wrapper. Or, if a selector is passed i"
},
{
"path": "docs/api/ReactWrapper/filter.md",
"chars": 528,
"preview": "# `.filter(selector) => ReactWrapper`\n\nReturns a new wrapper with only the nodes of the current wrapper that match the p"
},
{
"path": "docs/api/ReactWrapper/filterWhere.md",
"chars": 651,
"preview": "# `.filterWhere(fn) => ReactWrapper`\n\nReturns a new wrapper with only the nodes of the current wrapper that, when passed"
},
{
"path": "docs/api/ReactWrapper/find.md",
"chars": 1230,
"preview": "# `.find(selector) => ReactWrapper`\n\nFinds every node in the render tree of the current wrapper that matches the provide"
},
{
"path": "docs/api/ReactWrapper/findWhere.md",
"chars": 594,
"preview": "# `.findWhere(fn) => ReactWrapper`\n\nFinds every node in the render tree that returns true for the provided predicate fun"
},
{
"path": "docs/api/ReactWrapper/first.md",
"chars": 466,
"preview": "# `.first() => ReactWrapper`\n\nReduce the set of matched nodes to the first in the set, just like `.at(0)`.\n\n\n#### Return"
},
{
"path": "docs/api/ReactWrapper/forEach.md",
"chars": 803,
"preview": "# `.forEach(fn) => Self`\n\nIterates through each node of the current wrapper and executes the provided function with a\nwr"
},
{
"path": "docs/api/ReactWrapper/get.md",
"chars": 493,
"preview": "# `.get(index) => ReactElement`\n\nReturns the node at a given index of the current wrapper.\n\n\n#### Arguments\n\n1. `index` "
},
{
"path": "docs/api/ReactWrapper/getDOMNode.md",
"chars": 418,
"preview": "# `.getDOMNode() => DOMComponent`\n\nReturns the outer most DOMComponent of the current wrapper.\n\nNotes:\n- can only be cal"
},
{
"path": "docs/api/ReactWrapper/getElement.md",
"chars": 549,
"preview": "# `.getElement() => ReactElement`\n\nReturns the wrapped ReactElement.\n\nIf the current wrapper is wrapping the root compon"
},
{
"path": "docs/api/ReactWrapper/getElements.md",
"chars": 607,
"preview": "# `.getElements() => Array<ReactElement>`\n\nReturns the wrapped ReactElements\n\nIf the current wrapper is wrapping the roo"
},
{
"path": "docs/api/ReactWrapper/getWrappingComponent.md",
"chars": 1077,
"preview": "# `.getWrappingComponent() => ReactWrapper`\n\nIf a `wrappingComponent` was passed in `options`, this methods returns a `R"
},
{
"path": "docs/api/ReactWrapper/hasClass.md",
"chars": 851,
"preview": "# `.hasClass(className) => Boolean`\n\nReturns whether or not the wrapped node has a `className` prop including the passed"
},
{
"path": "docs/api/ReactWrapper/hostNodes.md",
"chars": 663,
"preview": "# `.hostNodes() => ReactWrapper`\n\nReturns a new wrapper with only host nodes.\nWhen using `react-dom`, host nodes are HTM"
},
{
"path": "docs/api/ReactWrapper/html.md",
"chars": 814,
"preview": "# `.html() => String`\n\nReturns a string of the rendered HTML markup of the current render tree. See also [`.debug()`](de"
},
{
"path": "docs/api/ReactWrapper/instance.md",
"chars": 1442,
"preview": "# `.instance() => ReactComponent`\n\nReturns the single-node wrapper's node's underlying class instance; `this` in its met"
},
{
"path": "docs/api/ReactWrapper/invoke.md",
"chars": 856,
"preview": "# `.invoke(propName)(...args) => Any`\n\nInvokes a function prop.\nNote that in React 16.8+, `.invoke` will wrap your handl"
},
{
"path": "docs/api/ReactWrapper/is.md",
"chars": 470,
"preview": "# `.is(selector) => Boolean`\n\nReturns whether or not the single wrapped node matches the provided selector. It must be a"
},
{
"path": "docs/api/ReactWrapper/isEmpty.md",
"chars": 336,
"preview": "# `.isEmpty() => Boolean`\n**Deprecated**: Use [`.exists()`](exists.md) instead.\n\nReturns whether or not the wrapper is e"
},
{
"path": "docs/api/ReactWrapper/isEmptyRender.md",
"chars": 337,
"preview": "# `.isEmptyRender() => Boolean`\n\nReturns whether or not the wrapper would ultimately render only the allowed falsy value"
},
{
"path": "docs/api/ReactWrapper/key.md",
"chars": 340,
"preview": "# `.key() => String`\n\nReturns the key value for the node of the current wrapper. It must be a single-node wrapper.\n\n####"
},
{
"path": "docs/api/ReactWrapper/last.md",
"chars": 467,
"preview": "# `.last() => ReactWrapper`\n\nReduce the set of matched nodes to the last in the set, just like `.at(length - 1)`.\n\n\n####"
},
{
"path": "docs/api/ReactWrapper/length.md",
"chars": 251,
"preview": "# `.length => number`\n\nReturns the number of React nodes enclosed in this wrapper.\n\n\n\n#### Returns\n\n`Number`: count of n"
},
{
"path": "docs/api/ReactWrapper/map.md",
"chars": 1027,
"preview": "# `.map(fn) => Array<Any>`\n\nMaps the current array of nodes to another array. Each node is passed in as a `ReactWrapper`"
},
{
"path": "docs/api/ReactWrapper/matchesElement.md",
"chars": 2072,
"preview": "# `.matchesElement(patternNode) => Boolean`\n\nReturns whether or not a given react element `patternNode` matches the wrap"
},
{
"path": "docs/api/ReactWrapper/mount.md",
"chars": 1441,
"preview": "# `.mount() => Self`\n\nA method that re-mounts the component, if it is not currently mounted. This can be used to simulat"
},
{
"path": "docs/api/ReactWrapper/name.md",
"chars": 789,
"preview": "# `.name() => String|null`\n\nReturns the name of the current node of this wrapper. If it's a composite component, this wi"
},
{
"path": "docs/api/ReactWrapper/not.md",
"chars": 657,
"preview": "# `.not(selector) => ReactWrapper`\n\nReturns a new wrapper with only the nodes of the current wrapper that don't match th"
},
{
"path": "docs/api/ReactWrapper/parent.md",
"chars": 501,
"preview": "# `.parent() => ReactWrapper`\n\nReturns a wrapper with the direct parent of the node in the current wrapper.\n\n\n#### Retur"
},
{
"path": "docs/api/ReactWrapper/parents.md",
"chars": 784,
"preview": "# `.parents([selector]) => ReactWrapper`\n\nReturns a wrapper around all of the parents/ancestors of the single node in th"
},
{
"path": "docs/api/ReactWrapper/prop.md",
"chars": 522,
"preview": "# `.prop(key) => Any`\n\nReturns the prop value for the root node of the wrapper with the provided key. It must be a singl"
},
{
"path": "docs/api/ReactWrapper/props.md",
"chars": 1511,
"preview": "# `.props() => Object`\n\nReturns the props object for the root node of the wrapper. It must be a single-node wrapper.\n\nTh"
},
{
"path": "docs/api/ReactWrapper/reduce.md",
"chars": 1400,
"preview": "# `.reduce(fn[, initialValue]) => Any`\n\nApplies the provided reducing function to every node in the wrapper to reduce to"
},
{
"path": "docs/api/ReactWrapper/reduceRight.md",
"chars": 1412,
"preview": "# `.reduceRight(fn[, initialValue]) => Any`\n\nApplies the provided reducing function to every node in the wrapper to redu"
},
{
"path": "docs/api/ReactWrapper/ref.md",
"chars": 996,
"preview": "# `.ref(refName) => ReactComponent | HTMLElement`\n\nReturns the node that matches the provided reference name.\n\n\nNOTE: ca"
},
{
"path": "docs/api/ReactWrapper/render.md",
"chars": 556,
"preview": "# `.render() => CheerioWrapper`\n\nReturns a CheerioWrapper around the rendered HTML of the single node's subtree.\nIt must"
},
{
"path": "docs/api/ReactWrapper/renderProp.md",
"chars": 1686,
"preview": "# `.renderProp(propName)(...args) => ReactWrapper`\n\nReturns a function that, when called with arguments `args`, will ret"
},
{
"path": "docs/api/ReactWrapper/setContext.md",
"chars": 1396,
"preview": "# `.setContext(context) => Self`\n\nA method that sets the context of the root component, and re-renders. Useful for when "
},
{
"path": "docs/api/ReactWrapper/setProps.md",
"chars": 1690,
"preview": "# `.setProps(nextProps[, callback]) => Self`\n\nA method that sets the props of the root component, and re-renders. Useful"
},
{
"path": "docs/api/ReactWrapper/setState.md",
"chars": 1601,
"preview": "# `.setState(nextState[, callback]) => Self`\n\nA method to invoke `setState()` on the root component instance, similar to"
},
{
"path": "docs/api/ReactWrapper/simulate.md",
"chars": 2466,
"preview": "# `.simulate(event[, mock]) => Self`\n\nSimulate events on the root node in the wrapper. It must be a single-node wrapper."
},
{
"path": "docs/api/ReactWrapper/simulateError.md",
"chars": 1586,
"preview": "# `.simulateError(error) => Self`\n\nSimulate a component throwing an error as part of its rendering lifecycle.\n\nThis is p"
},
{
"path": "docs/api/ReactWrapper/slice.md",
"chars": 1194,
"preview": "# `.slice([begin[, end]]) => ReactWrapper`\n\nReturns a new wrapper with a subset of the nodes of the original wrapper, ac"
},
{
"path": "docs/api/ReactWrapper/some.md",
"chars": 845,
"preview": "# `.some(selector) => Boolean`\n\nReturns whether or not any of the nodes in the wrapper match the provided selector.\n\n\n##"
},
{
"path": "docs/api/ReactWrapper/someWhere.md",
"chars": 921,
"preview": "# `.someWhere(fn) => Boolean`\n\nReturns whether or not any of the nodes in the wrapper pass the provided predicate functi"
},
{
"path": "docs/api/ReactWrapper/state.md",
"chars": 579,
"preview": "# `.state([key]) => Any`\n\nReturns the state hash for the root node of the wrapper. Optionally pass in a prop name and it"
},
{
"path": "docs/api/ReactWrapper/tap.md",
"chars": 495,
"preview": "# `.tap(intercepter) => Self`\n\nInvokes intercepter and returns itself. intercepter is called with itself.\nThis is helpfu"
},
{
"path": "docs/api/ReactWrapper/text.md",
"chars": 769,
"preview": "# `.text() => String`\n\nReturns a string of the rendered text of the current render tree. This function should be\nlooked "
},
{
"path": "docs/api/ReactWrapper/type.md",
"chars": 1010,
"preview": "# `.type() => String | Function | null`\n\nReturns the type of the only node of this wrapper.\nIf it's a React component, t"
},
{
"path": "docs/api/ReactWrapper/unmount.md",
"chars": 1196,
"preview": "# `.unmount() => Self`\n\nA method that unmounts the component. This can be used to simulate a component going through\nan "
},
{
"path": "docs/api/ReactWrapper/update.md",
"chars": 1220,
"preview": "# `.update() => Self`\n\nSyncs the enzyme component tree snapshot with the react component tree. Useful to run before chec"
},
{
"path": "docs/api/ShallowWrapper/at.md",
"chars": 645,
"preview": "# `.at(index) => ShallowWrapper`\n\nReturns a wrapper around the node at a given index of the current wrapper.\n\n\n#### Argu"
},
{
"path": "docs/api/ShallowWrapper/childAt.md",
"chars": 653,
"preview": "# `.childAt(index) => ShallowWrapper`\n\nReturns a new wrapper with child at the specified index.\n\n#### Arguments\n\n1. `ind"
},
{
"path": "docs/api/ShallowWrapper/children.md",
"chars": 750,
"preview": "# `.children([selector]) => ShallowWrapper`\n\nReturns a new wrapper with all of the children of the node(s) in the curren"
},
{
"path": "docs/api/ShallowWrapper/closest.md",
"chars": 718,
"preview": "# `.closest(selector) => ShallowWrapper`\n\nReturns a wrapper of the first element that matches the selector by traversing"
},
{
"path": "docs/api/ShallowWrapper/contains.md",
"chars": 2040,
"preview": "# `.contains(nodeOrNodes) => Boolean`\n\nReturns whether or not all given react elements match elements in the render tree"
},
{
"path": "docs/api/ShallowWrapper/containsAllMatchingElements.md",
"chars": 1624,
"preview": "# `.containsAllMatchingElements(patternNodes) => Boolean`\n\nReturns whether or not all of the given react elements in `pa"
},
{
"path": "docs/api/ShallowWrapper/containsAnyMatchingElements.md",
"chars": 1639,
"preview": "# `.containsAnyMatchingElements(patternNodes) => Boolean`\n\nReturns whether or not at least one of the given react elemen"
},
{
"path": "docs/api/ShallowWrapper/containsMatchingElement.md",
"chars": 1851,
"preview": "# `.containsMatchingElement(patternNode) => Boolean`\n\nReturns whether or not a `patternNode` react element matches any e"
},
{
"path": "docs/api/ShallowWrapper/context.md",
"chars": 620,
"preview": "# `.context([key]) => Any`\n\nReturns the context hash for the root node of the wrapper. Optionally pass in a prop name an"
},
{
"path": "docs/api/ShallowWrapper/debug.md",
"chars": 1953,
"preview": "# `.debug([options]) => String`\n\nReturns an HTML-like string of the wrapper for debugging purposes. Useful to print out "
},
{
"path": "docs/api/ShallowWrapper/dive.md",
"chars": 1152,
"preview": "# `.dive([options]) => ShallowWrapper`\n\nShallow render the one non-DOM child of the current wrapper, and return a wrappe"
},
{
"path": "docs/api/ShallowWrapper/equals.md",
"chars": 994,
"preview": "# `.equals(node) => Boolean`\n\nReturns whether or not the current wrapper root node render tree looks like the one passed"
},
{
"path": "docs/api/ShallowWrapper/every.md",
"chars": 793,
"preview": "# `.every(selector) => Boolean`\n\nReturns whether or not all of the nodes in the wrapper match the provided selector.\n\n\n#"
},
{
"path": "docs/api/ShallowWrapper/everyWhere.md",
"chars": 915,
"preview": "# `.everyWhere(fn) => Boolean`\n\nReturns whether or not all of the nodes in the wrapper pass the provided predicate funct"
},
{
"path": "docs/api/ShallowWrapper/exists.md",
"chars": 602,
"preview": "# `.exists([selector]) => Boolean`\n\nReturns whether or not any nodes exist in the wrapper. Or, if a selector is passed i"
},
{
"path": "docs/api/ShallowWrapper/filter.md",
"chars": 536,
"preview": "# `.filter(selector) => ShallowWrapper`\n\nReturns a new wrapper with only the nodes of the current wrapper that match the"
},
{
"path": "docs/api/ShallowWrapper/filterWhere.md",
"chars": 647,
"preview": "# `.filterWhere(fn) => ShallowWrapper`\n\nReturns a new wrapper with only the nodes of the current wrapper that, when pass"
},
{
"path": "docs/api/ShallowWrapper/find.md",
"chars": 1157,
"preview": "# `.find(selector) => ShallowWrapper`\n\nFinds every node in the render tree of the current wrapper that matches the provi"
},
{
"path": "docs/api/ShallowWrapper/findWhere.md",
"chars": 597,
"preview": "# `.findWhere(fn) => ShallowWrapper`\n\nFinds every node in the render tree that returns true for the provided predicate f"
},
{
"path": "docs/api/ShallowWrapper/first.md",
"chars": 476,
"preview": "# `.first() => ShallowWrapper`\n\nReduce the set of matched nodes to the first in the set, just like `.at(0)`.\n\n\n#### Retu"
},
{
"path": "docs/api/ShallowWrapper/forEach.md",
"chars": 813,
"preview": "# `.forEach(fn) => Self`\n\nIterates through each node of the current wrapper and executes the provided function with a\nwr"
},
{
"path": "docs/api/ShallowWrapper/get.md",
"chars": 497,
"preview": "# `.get(index) => ReactElement`\n\nReturns the node at a given index of the current wrapper.\n\n\n#### Arguments\n\n1. `index` "
},
{
"path": "docs/api/ShallowWrapper/getElement.md",
"chars": 551,
"preview": "# `.getElement() => ReactElement`\n\nReturns the wrapped ReactElement.\n\nIf the current wrapper is wrapping the root compon"
},
{
"path": "docs/api/ShallowWrapper/getElements.md",
"chars": 609,
"preview": "# `.getElements() => Array<ReactElement>`\n\nReturns the wrapped ReactElements\n\nIf the current wrapper is wrapping the roo"
},
{
"path": "docs/api/ShallowWrapper/getWrappingComponent.md",
"chars": 1089,
"preview": "# `.getWrappingComponent() => ShallowWrapper`\n\nIf a `wrappingComponent` was passed in `options`, this methods returns a "
},
{
"path": "docs/api/ShallowWrapper/hasClass.md",
"chars": 843,
"preview": "# `.hasClass(className) => Boolean`\n\nReturns whether or not the wrapped node has a `className` prop including the passed"
},
{
"path": "docs/api/ShallowWrapper/hostNodes.md",
"chars": 669,
"preview": "# `.hostNodes() => ShallowWrapper`\n\nReturns a new wrapper with only host nodes.\nWhen using `react-dom`, host nodes are H"
},
{
"path": "docs/api/ShallowWrapper/html.md",
"chars": 985,
"preview": "# `.html() => String`\n\nReturns a string of the rendered HTML markup of the entire current render tree (not just the shal"
},
{
"path": "docs/api/ShallowWrapper/instance.md",
"chars": 1450,
"preview": "# `.instance() => ReactComponent`\n\nReturns the single-node wrapper's node's underlying class instance; `this` in its met"
},
{
"path": "docs/api/ShallowWrapper/invoke.md",
"chars": 750,
"preview": "# `.invoke(invokePropName)(...args) => Any`\n\nInvokes a function prop.\n\n#### Arguments\n\n1. `propName` (`String`): The fun"
},
{
"path": "docs/api/ShallowWrapper/is.md",
"chars": 472,
"preview": "# `.is(selector) => Boolean`\n\nReturns whether or not the single wrapped node matches the provided selector. It must be a"
},
{
"path": "docs/api/ShallowWrapper/isEmpty.md",
"chars": 338,
"preview": "# `.isEmpty() => Boolean`\n**Deprecated**: Use [`.exists()`](exists.md) instead.\n\nReturns whether or not the wrapper is e"
},
{
"path": "docs/api/ShallowWrapper/isEmptyRender.md",
"chars": 339,
"preview": "# `.isEmptyRender() => Boolean`\n\nReturns whether or not the wrapper would ultimately render only the allowed falsy value"
},
{
"path": "docs/api/ShallowWrapper/key.md",
"chars": 342,
"preview": "# `.key() => String`\n\nReturns the key value for the node of the current wrapper. It must be a single-node wrapper.\n\n####"
},
{
"path": "docs/api/ShallowWrapper/last.md",
"chars": 477,
"preview": "# `.last() => ShallowWrapper`\n\nReduce the set of matched nodes to the last in the set, just like `.at(length - 1)`.\n\n\n##"
},
{
"path": "docs/api/ShallowWrapper/length.md",
"chars": 253,
"preview": "# `.length => number`\n\nReturns the number of React nodes enclosed in this wrapper.\n\n\n\n#### Returns\n\n`Number`: count of n"
},
{
"path": "docs/api/ShallowWrapper/map.md",
"chars": 1037,
"preview": "# `.map(fn) => Array<Any>`\n\nMaps the current array of nodes to another array. Each node is passed in as a `ShallowWrappe"
},
{
"path": "docs/api/ShallowWrapper/matchesElement.md",
"chars": 2065,
"preview": "# `.matchesElement(patternNode) => Boolean`\n\nReturns whether or not a given react element `patternNode` matches the wrap"
},
{
"path": "docs/api/ShallowWrapper/name.md",
"chars": 959,
"preview": "# `.name() => String|null`\n\nReturns the name of the current node of this wrapper. If it's a composite component, this wi"
},
{
"path": "docs/api/ShallowWrapper/not.md",
"chars": 667,
"preview": "# `.not(selector) => ShallowWrapper`\n\nReturns a new wrapper with only the nodes of the current wrapper that don't match "
},
{
"path": "docs/api/ShallowWrapper/parent.md",
"chars": 513,
"preview": "# `.parent() => ShallowWrapper`\n\nReturns a wrapper with the direct parent of the node in the current wrapper.\n\n\n#### Ret"
},
{
"path": "docs/api/ShallowWrapper/parents.md",
"chars": 796,
"preview": "# `.parents([selector]) => ShallowWrapper`\n\nReturns a wrapper around all of the parents/ancestors of the single node in "
},
{
"path": "docs/api/ShallowWrapper/prop.md",
"chars": 2403,
"preview": "# `.prop(key) => Any`\n\nReturns the prop value for the root node of the wrapper with the provided key. It must be a singl"
},
{
"path": "docs/api/ShallowWrapper/props.md",
"chars": 1668,
"preview": "# `.props() => Object`\n\nReturns the props object for the root node of the wrapper. It must be a single-node wrapper.\n\nNO"
},
{
"path": "docs/api/ShallowWrapper/reduce.md",
"chars": 1408,
"preview": "# `.reduce(fn[, initialValue]) => Any`\n\nApplies the provided reducing function to every node in the wrapper to reduce to"
},
{
"path": "docs/api/ShallowWrapper/reduceRight.md",
"chars": 1420,
"preview": "# `.reduceRight(fn[, initialValue]) => Any`\n\nApplies the provided reducing function to every node in the wrapper to redu"
},
{
"path": "docs/api/ShallowWrapper/render.md",
"chars": 558,
"preview": "# `.render() => CheerioWrapper`\n\nReturns a CheerioWrapper around the rendered HTML of the single node's subtree.\nIt must"
},
{
"path": "docs/api/ShallowWrapper/renderProp.md",
"chars": 1694,
"preview": "# `.renderProp(propName)(...args) => ShallowWrapper`\n\nReturns a function that, when called with arguments `args`, will r"
},
{
"path": "docs/api/ShallowWrapper/setContext.md",
"chars": 1402,
"preview": "# `.setContext(context) => Self`\n\nA method that sets the context of the root component, and re-renders. Useful for when "
},
{
"path": "docs/api/ShallowWrapper/setProps.md",
"chars": 1696,
"preview": "# `.setProps(nextProps[, callback]) => Self`\n\nA method that sets the props of the root component, and re-renders. Useful"
},
{
"path": "docs/api/ShallowWrapper/setState.md",
"chars": 1579,
"preview": "# `.setState(nextState[, callback]) => Self`\n\nA method to invoke `setState()` on the root component instance, similar to"
},
{
"path": "docs/api/ShallowWrapper/shallow.md",
"chars": 1095,
"preview": "# `.shallow([options]) => ShallowWrapper`\n\nShallow renders the root node and returns a shallow wrapper around it.\nIt mus"
},
{
"path": "docs/api/ShallowWrapper/simulate.md",
"chars": 2771,
"preview": "# `.simulate(event[, ...args]) => Self`\n\nSimulate events on the root node in the wrapper. It must be a single-node wrapp"
},
{
"path": "docs/api/ShallowWrapper/simulateError.md",
"chars": 1589,
"preview": "# `.simulateError(error) => Self`\n\nSimulate a component throwing an error as part of its rendering lifecycle.\n\nThis is p"
},
{
"path": "docs/api/ShallowWrapper/slice.md",
"chars": 1202,
"preview": "# `.slice([begin[, end]]) => ShallowWrapper`\n\nReturns a new wrapper with a subset of the nodes of the original wrapper, "
},
{
"path": "docs/api/ShallowWrapper/some.md",
"chars": 847,
"preview": "# `.some(selector) => Boolean`\n\nReturns whether or not any of the nodes in the wrapper match the provided selector.\n\n\n##"
},
{
"path": "docs/api/ShallowWrapper/someWhere.md",
"chars": 925,
"preview": "# `.someWhere(fn) => Boolean`\n\nReturns whether or not any of the nodes in the wrapper pass the provided predicate functi"
},
{
"path": "docs/api/ShallowWrapper/state.md",
"chars": 581,
"preview": "# `.state([key]) => Any`\n\nReturns the state hash for the root node of the wrapper. Optionally pass in a prop name and it"
},
{
"path": "docs/api/ShallowWrapper/tap.md",
"chars": 501,
"preview": "# `.tap(intercepter) => Self`\n\nInvokes intercepter and returns itself. intercepter is called with itself.\nThis is helpfu"
},
{
"path": "docs/api/ShallowWrapper/text.md",
"chars": 708,
"preview": "# `.text() => String`\n\nReturns a string of the rendered text of the current render tree. This function should be\nlooked "
},
{
"path": "docs/api/ShallowWrapper/type.md",
"chars": 958,
"preview": "# `.type() => String | Function | null`\n\nReturns the type of the only node of this wrapper.\nIf it's a React component, t"
},
{
"path": "docs/api/ShallowWrapper/unmount.md",
"chars": 764,
"preview": "# `.unmount() => Self`\n\nA method that unmounts the component. This can be used to simulate a component going through\nan "
},
{
"path": "docs/api/ShallowWrapper/update.md",
"chars": 1222,
"preview": "# `.update() => Self`\n\nSyncs the enzyme component tree snapshot with the react component tree. Useful to run before chec"
},
{
"path": "docs/api/mount.md",
"chars": 11167,
"preview": "# Full Rendering API (`mount(...)`)\n\nFull DOM rendering is ideal for use cases where you have components that may intera"
},
{
"path": "docs/api/render.md",
"chars": 1807,
"preview": "# Static Rendering API\n\nUse enzyme's `render` function to generate HTML from your React tree, and analyze the resulting "
},
{
"path": "docs/api/selector.md",
"chars": 3934,
"preview": "# enzyme Selectors\n\nMany methods in enzyme’s API accept a *selector* as an argument.\nYou can select several different wa"
},
{
"path": "docs/api/shallow.md",
"chars": 11205,
"preview": "# Shallow Rendering API\n\nShallow rendering is useful to constrain yourself to testing a component as a unit, and to ensu"
},
{
"path": "docs/common-issues.md",
"chars": 3225,
"preview": "# Common Issues\n\nThis list aims to be comprehensive. If you find an issue that has been frequently brought up in GitHub "
},
{
"path": "docs/future.md",
"chars": 923,
"preview": "# Future Work\n\nDiscussion of additional features and support for enzyme should be initiated by opening a\n[GitHub issue]("
},
{
"path": "docs/guides/browserify.md",
"chars": 506,
"preview": "# Using enzyme with Browserify\n\nIf you are using a test runner that runs code in a browser-based environment, you may be"
},
{
"path": "docs/guides/jest.md",
"chars": 1986,
"preview": "# Using enzyme with Jest\n\n## Configure with Jest\n\nTo run the setup file to configure Enzyme and the Adapter (as shown in"
},
{
"path": "docs/guides/jsdom.md",
"chars": 3862,
"preview": "# Using enzyme with JSDOM\n\n[JSDOM](https://github.com/jsdom/jsdom) is a JavaScript based headless browser that can be us"
},
{
"path": "docs/guides/karma.md",
"chars": 1837,
"preview": "# Using enzyme with Karma\n\nKarma is a popular test runner that can run tests in multiple browser environments. Depending"
},
{
"path": "docs/guides/lab.md",
"chars": 949,
"preview": "# Using enzyme with Lab and Code\n\n[Lab](https://github.com/hapijs/lab) is a simple test utility for node & part of the ["
},
{
"path": "docs/guides/migration-from-2-to-3.md",
"chars": 22050,
"preview": "# 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 prev"
},
{
"path": "docs/guides/mocha.md",
"chars": 616,
"preview": "# Using enzyme with Mocha\n\nenzyme was originally designed to work with Mocha, so getting it up and running with Mocha sh"
},
{
"path": "docs/guides/react-native.md",
"chars": 6988,
"preview": "# Using enzyme to Test Components in React Native\n\nAs of v0.18, React Native uses React as a dependency rather than a fo"
},
{
"path": "docs/guides/systemjs.md",
"chars": 480,
"preview": "# Using enzyme with SystemJS\n\nIf you are using a test runner that runs code in a browser-based environment,\nyou may be u"
},
{
"path": "docs/guides/tape-ava.md",
"chars": 1437,
"preview": "# Using enzyme with Tape and AVA\n\nenzyme works well with [Tape](https://github.com/substack/tape) and [AVA](https://gith"
},
{
"path": "docs/guides/webpack.md",
"chars": 501,
"preview": "# Using enzyme with Webpack\n\nIf you are using a test runner that runs code in a browser-based environment, you may be us"
},
{
"path": "docs/guides.md",
"chars": 472,
"preview": "# enzyme Guides\n\n- [*Using enzyme with Browserify*](guides/browserify.md)\n- [*Using enzyme with Webpack*](guides/webpack"
},
{
"path": "docs/installation/README.md",
"chars": 459,
"preview": "# Installation\n\nenzyme should be installed using npm:\n\n```bash\nnpm i --save-dev enzyme\n```\n\nenzyme can be used with your"
},
{
"path": "docs/installation/react-013.md",
"chars": 972,
"preview": "# 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"
},
{
"path": "docs/installation/react-014.md",
"chars": 1141,
"preview": "# 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"
},
{
"path": "docs/installation/react-15.md",
"chars": 1109,
"preview": "# 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\ni"
},
{
"path": "docs/installation/react-16.md",
"chars": 991,
"preview": "# 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\ni"
},
{
"path": "env.js",
"chars": 5014,
"preview": "'use strict';\n\nconst path = require('path');\nconst fs = require('fs');\nconst spawn = require('child_process').spawn;\ncon"
},
{
"path": "install-relevant-react.sh",
"chars": 214,
"preview": "#!/bin/sh\n\nREACT=\"${REACT:-${1:-16}}\"\n\necho \"installing React $REACT\"\n\nif [ \"$REACT\" = \"0.13\" ]; then\n npm run env: -- "
},
{
"path": "karma.conf.js",
"chars": 3291,
"preview": "/* eslint-disable no-var,prefer-arrow-callback,vars-on-top, import/no-extraneous-dependencies */\n\n'use strict';\n\nrequire"
},
{
"path": "lerna.json",
"chars": 112,
"preview": "{\n \"lerna\": \"2.0.0\",\n \"packages\": [\n \"packages/*\"\n ],\n \"version\": \"independent\",\n \"independent\": true\n}\n"
},
{
"path": "package.json",
"chars": 4531,
"preview": "{\n \"name\": \"enzyme\",\n \"private\": true,\n \"version\": \"0.0.1\",\n \"description\": \"JavaScript Testing utilities for React\""
},
{
"path": "packages/enzyme/.babelrc",
"chars": 224,
"preview": "{\n \"presets\": [\n [\"airbnb\", { \"transformRuntime\": false }],\n ],\n \"plugins\": [\n [\"transform-replace-object-assig"
},
{
"path": "packages/enzyme/.eslintrc",
"chars": 784,
"preview": "{\n \"extends\": \"airbnb\",\n \"parser\": \"@babel/eslint-parser\",\n \"root\": true,\n \"ignorePatterns\": [\"build/\"],\n \"env\": {\n"
},
{
"path": "packages/enzyme/ReactWrapper.js",
"chars": 50,
"preview": "module.exports = require('./build/ReactWrapper');\n"
},
{
"path": "packages/enzyme/ShallowWrapper.js",
"chars": 52,
"preview": "module.exports = require('./build/ShallowWrapper');\n"
},
{
"path": "packages/enzyme/mount.js",
"chars": 43,
"preview": "module.exports = require('./build/mount');\n"
},
{
"path": "packages/enzyme/package.json",
"chars": 2617,
"preview": "{\n \"name\": \"enzyme\",\n \"version\": \"3.11.0\",\n \"description\": \"JavaScript Testing utilities for React\",\n \"homepage\": \"h"
},
{
"path": "packages/enzyme/render.js",
"chars": 44,
"preview": "module.exports = require('./build/render');\n"
},
{
"path": "packages/enzyme/shallow.js",
"chars": 45,
"preview": "module.exports = require('./build/shallow');\n"
},
{
"path": "packages/enzyme/src/Debug.js",
"chars": 3251,
"preview": "import escape from 'lodash.escape';\nimport functionName from 'function.prototype.name';\nimport isString from 'is-string'"
},
{
"path": "packages/enzyme/src/EnzymeAdapter.js",
"chars": 1778,
"preview": "function unimplementedError(methodName, classname) {\n return new Error(`${methodName} is a required method of ${classna"
},
{
"path": "packages/enzyme/src/RSTTraversal.js",
"chars": 5266,
"preview": "import flat from 'array.prototype.flat';\nimport entries from 'object.entries';\nimport fromEntries from 'object.fromentri"
},
{
"path": "packages/enzyme/src/ReactWrapper.js",
"chars": 39333,
"preview": "import flat from 'array.prototype.flat';\nimport hasOwn from 'hasown';\nimport trim from 'string.prototype.trim';\n\nimport "
},
{
"path": "packages/enzyme/src/ShallowWrapper.js",
"chars": 60649,
"preview": "import flat from 'array.prototype.flat';\nimport hasOwn from 'hasown';\nimport shallowEqual from 'enzyme-shallow-equal';\ni"
},
{
"path": "packages/enzyme/src/Utils.js",
"chars": 12173,
"preview": "/* eslint no-use-before-define: 0 */\nimport isEqual from 'lodash.isequal';\nimport is from 'object-is';\nimport entries fr"
},
{
"path": "packages/enzyme/src/configuration.js",
"chars": 369,
"preview": "import validateAdapter from './validateAdapter';\n\nlet configuration = {};\n\nexport function get() {\n return { ...configu"
},
{
"path": "packages/enzyme/src/getAdapter.js",
"chars": 312,
"preview": "import validateAdapter from './validateAdapter';\nimport { get } from './configuration';\n\nexport default function getAdap"
},
{
"path": "packages/enzyme/src/index.js",
"chars": 373,
"preview": "export { default as ReactWrapper } from './ReactWrapper';\nexport { default as ShallowWrapper } from './ShallowWrapper';\n"
},
{
"path": "packages/enzyme/src/mount.js",
"chars": 294,
"preview": "import ReactWrapper from './ReactWrapper';\n\n/**\n * Mounts and renders a react component into the document and provides a"
},
{
"path": "packages/enzyme/src/render.js",
"chars": 933,
"preview": "import getAdapter from './getAdapter';\nimport { loadCheerioRoot } from './Utils';\n\n/**\n * Renders a react component into"
},
{
"path": "packages/enzyme/src/selectors.js",
"chars": 15582,
"preview": "import { createParser } from 'rst-selector-parser';\nimport values from 'object.values';\nimport flat from 'array.prototyp"
},
{
"path": "packages/enzyme/src/shallow.js",
"chars": 283,
"preview": "import ShallowWrapper from './ShallowWrapper';\n\n/**\n * Shallow renders a react component and provides a testing wrapper "
}
]
// ... and 203 more files (download for full content)
About this extraction
This page contains the full source code of the enzymejs/enzyme GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 403 files (1.3 MB), approximately 335.6k tokens, and a symbol index with 1170 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.