Skip to content

Commit

Permalink
add disableLifecycleMethods to documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
jwbay committed Mar 15, 2017
1 parent e831c22 commit 8eeb0b7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion docs/api/shallow.md
Expand Up @@ -46,7 +46,10 @@ describe('<MyComponent />', () => {

1. `node` (`ReactElement`): The node to render
2. `options` (`Object` [optional]):
- `options.context`: (`Object` [optional]): Context to be passed into the component
- `options.context`: (`Object` [optional]): Context to be passed into the component
- `options.disableLifecycleMethods`: (`Boolean` [optional]): If set to true, `componentDidMount`
and `componentDidUpdate` are not called on the component. Allows `shallow` to be
used when testing components that assume refs or DOM nodes are available during those methods

#### Returns

Expand Down

2 comments on commit 8eeb0b7

@jcarlson
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit confusing since the lifecycle methods don't actually get called unless the lifecycleExperimental option is true. In fact, the ShallowWrapper implementation doesn't appear to do anything with disableLifecycleMethods except validate that it is true or false if given.

@ljharb
Copy link
Member

@ljharb ljharb commented on 8eeb0b7 May 12, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. If you don't want them disabled, that doesn't imply they'll be enabled, it only implies the default behavior.

In a future major version, they will be enabled by default.

Please sign in to comment.