Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
lelandrichardson authored Dec 22, 2017
2 parents 3c49e21 + 2acab0e commit c5f608f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
11 changes: 11 additions & 0 deletions docs/api/ShallowWrapper/contains.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,17 @@ expect(wrapper.contains([
])).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

Expand Down
4 changes: 1 addition & 3 deletions docs/api/mount.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Full Rendering API (`mount(...)`)

Full DOM rendering is ideal for use cases where you have components that may interact with DOM APIs,
or may require the full lifecycle in order to fully test the component (i.e., `componentDidMount`
etc.)
Full DOM rendering is ideal for use cases where you have components that may interact with DOM APIs or need to test components that are wrapped in higher order components.

Full DOM rendering requires that a full DOM API be available at the global scope. This means that
it must be run in an environment that at least “looks like” a browser environment. If you do not
Expand Down
2 changes: 2 additions & 0 deletions docs/api/shallow.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
Shallow rendering is useful to constrain yourself to testing a component as a unit, and to ensure
that your tests aren't indirectly asserting on behavior of child components.

As of Enzyme v3, the `shallow` API does call React lifecycle methods such as `componentDidMount` and `componentDidUpdate`. You can read more about this in the [version 3 migration guide](../guides/migration-from-2-to-3.md#lifecycle-methods).

```jsx
import { shallow } from 'enzyme';
import sinon from 'sinon';
Expand Down

0 comments on commit c5f608f

Please sign in to comment.