Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update docs to note future deprecation of .simulate #2182

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion book.json
@@ -1,5 +1,5 @@
{
"gitbook": "3.2.2",
"gitbook": "3.2.3",
Copy link
Author

Choose a reason for hiding this comment

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

this was needed to get the docs working, looks like they updated the latest version.

"title": "Enzyme",
"description": "React Testing",
"plugins": [
Expand Down
1 change: 1 addition & 0 deletions docs/api/ReactWrapper/simulate.md
Expand Up @@ -50,4 +50,5 @@ expect(wrapper.find('.clicks-1').length).to.equal(1);
#### 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.
- One important thing to know is that the simulate function does not faithfully **simulate anything** - all it does is transform the event name to a prop name, and invoke the function provided prop.

1 change: 1 addition & 0 deletions docs/api/ShallowWrapper/simulate.md
Expand Up @@ -55,3 +55,4 @@ the event handler set.
target the component's prop based on the event you give it. For example, `.simulate('click')` will
actually get the `onClick` prop and call it.
- As noted in the function signature above passing a mock event is optional. Keep in mind that if the code you are testing uses the event for something like, calling `event.preventDefault()` or accessing any of its properties you must provide a mock event object with the properties your code requires.
- One important thing to know is that the simulate function does not faithfully **simulate anything** - all it does is transform the event name to a prop name, and invoke the function provided prop.
3 changes: 3 additions & 0 deletions docs/api/mount.md
Expand Up @@ -170,6 +170,9 @@ Returns the key of the root component.
#### [`.simulate(event[, mock]) => ReactWrapper`](ReactWrapper/simulate.md)
Simulates an event on the current node.

*Deprecated:* Will be removed in later versions of Enzyme. [Click here for more information.](https://github.com/airbnb/enzyme/issues/2173#issuecomment-505551552)


#### [`.setState(nextState) => ReactWrapper`](ReactWrapper/setState.md)
Manually sets state of the root component.

Expand Down
2 changes: 2 additions & 0 deletions docs/api/shallow.md
Expand Up @@ -184,6 +184,8 @@ Invokes a prop function on the current node and returns the function's return va
#### [`.simulate(event[, data]) => ShallowWrapper`](ShallowWrapper/simulate.md)
Simulates an event on the current node.

*Deprecated:* Will be removed in later versions of Enzyme. [Click here for more information.](https://github.com/airbnb/enzyme/issues/2173#issuecomment-505551552)

#### [`.setState(nextState) => ShallowWrapper`](ShallowWrapper/setState.md)
Manually sets state of the root component.

Expand Down