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

WIP: enzyme click bug #48

Conversation

marcelomorgado
Copy link
Contributor

Refs: #12 (comment)

⚠️ It isn't a branch to be merged. ⚠️

I've looked deeply about this issue and Enzyme team will not make "simulate" as an async function. Reasons: here, here and here.

Since calling a component function isn't ideal because the test shouldn't be aware of component internal behavior, I've found a trick to turn around that:

await wrapper.find("Button").find({ title: "Aync" }).prop("onPress")();

They are working on new function called invoke that will do the same as above:

await wrapper.find("Button").find({ title: "Aync" }).invoke("onPress");
await wrapper.find("Button").find({ title: "Aync" }).invoke("press");

@pcowgill pcowgill changed the title Feature/enzyme click bug WIP: enzyme click bug Dec 19, 2018
@pcowgill
Copy link
Member

@marcelomorgado This is all great info. Thanks for looking into this! If we publish a new version of the SDK with the sync version of Account.create(), this problem will go away for now, right? Either way it's good to know our options for when we inevitably will need to use a button with an async function for onPress.

@marcelomorgado
Copy link
Contributor Author

marcelomorgado commented Dec 19, 2018

If we publish a new version of the SDK with the sync version of Account.create(), this problem will go away for now, right?

Yes, It'll should work.

@pcowgill
Copy link
Member

@marcelomorgado If I recall correctly, we're keeping this open until we publish a new version of the SDK and then potentially merging it. Is that right?

@marcelomorgado
Copy link
Contributor Author

No, not really,

This PR isn't to be merged. It's for doc only. I was going to share this on Enzyme/React-native issues but it wasn't necessary.

There are three issues related with tests until now:

simulate('click') on component that has async handler function. It'll be solved with invoke() but this issue stills open: enzymejs/enzyme#1856
For now, we are calling async function directly from test case code.
Should I create an issue to track that?

The issue related with Expo SDK is that: #12 (comment) (Snapshot)
But it stills occur because react-native used on SDK 32.0.0 is v0.57.1 (September)
The fix was introduced on react-native v.0.57.8 (December).

Expo SDK v32.0.0 is based once again on React Native 0.57 “September 2018”, the same major version as SDK 31.

Ref: https://blog.expo.io/expo-sdk-v32-0-0-is-now-available-6b78f92a6c52
Should I create an issue to track that?

jest.preprocessor.js file
We already have an issue: #31

After creation of remain issues I think we could close this PR without merge.

@marcelomorgado
Copy link
Contributor Author

I've updated the issue #43 and created the issue #65.
I think that we could close this PR (without merge).

@pcowgill
Copy link
Member

Thanks for the status update. That all makes sense. Thanks!

@pcowgill pcowgill closed this Jan 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants