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

Invoke() api #1856

Merged
merged 3 commits into from
Apr 6, 2019
Merged

Invoke() api #1856

merged 3 commits into from
Apr 6, 2019

Conversation

koba04
Copy link
Contributor

@koba04 koba04 commented Oct 8, 2018

This PR is to pick up from #945
If @milesj is still working on #945, feel free to close this!

@milesj
Copy link
Contributor

milesj commented Oct 9, 2018

I haven't had time to work on my PR, so thanks for this!

@koba04
Copy link
Contributor Author

koba04 commented Oct 19, 2018

@woutervanvliet Thank you for your reviews! I've fixed them.

Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

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

This will need a full rebase - not just a merge - on latest master.

docs/api/ShallowWrapper/invoke.md Outdated Show resolved Hide resolved
@ljharb
Copy link
Member

ljharb commented Mar 7, 2019

@koba04 ping, still interested in this?

@koba04
Copy link
Contributor Author

koba04 commented Mar 7, 2019

@ljharb OK, I'll work on it again!

@koba04
Copy link
Contributor Author

koba04 commented Mar 7, 2019

I've recreated the branch from master.
Next, I'll adress #1856 (comment)

@koba04 koba04 force-pushed the invoke-api branch 2 times, most recently from 1eecdaf to 5e28ce4 Compare March 9, 2019 14:59
@koba04
Copy link
Contributor Author

koba04 commented Mar 10, 2019

@ljharb I’ve addressed you comment and rebased this!

docs/api/ReactWrapper/invoke.md Outdated Show resolved Hide resolved
docs/api/ShallowWrapper/invoke.md Outdated Show resolved Hide resolved
docs/api/mount.md Show resolved Hide resolved
docs/api/shallow.md Show resolved Hide resolved
packages/enzyme-test-suite/test/ReactWrapper-spec.jsx Outdated Show resolved Hide resolved
packages/enzyme/src/ReactWrapper.js Outdated Show resolved Hide resolved
}
return (...args) => {
const response = handler.apply(this, args);
this[ROOT].update();
Copy link
Member

Choose a reason for hiding this comment

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

why is this needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ljharb
The purpose is to reflect the updates into the ShallowWrapper instance if the handler calls setState.

It's the same as what simulate() is doing.

https://github.com/airbnb/enzyme/blob/master/packages/enzyme/src/ShallowWrapper.js#L999

But I've covered the most case by this PR so this might be unnecessary.

#1499

packages/enzyme/src/ShallowWrapper.js Outdated Show resolved Hide resolved
packages/enzyme/src/ShallowWrapper.js Outdated Show resolved Hide resolved
}
return (...args) => {
const response = handler.apply(this, args);
this[ROOT].update();
Copy link
Member

Choose a reason for hiding this comment

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

ditto

@ljharb
Copy link
Member

ljharb commented Apr 6, 2019

I'm not sure what's going on with coverage there; I'm going to merge anyways.

@ljharb ljharb merged commit 31c33e5 into enzymejs:master Apr 6, 2019
@koba04 koba04 deleted the invoke-api branch April 8, 2019 14:38
@koba04
Copy link
Contributor Author

koba04 commented Apr 8, 2019

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants