You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What you did:
using the above test, expected the test to succeed
using the waitFor in this instance is necessary because I'm using Formik and otherwise get the act(..) error.
What happened:
failed with this error:
Problem description:
the value is the last character instead of entre string as expected
Suggested solution:
based on reading the thread of #387, may be an issue of nested act() functions
Update
I see now that the suggested way is to wrap the assertion with waitFor, but perhaps this is still a bug worth fixing?
The text was updated successfully, but these errors were encountered:
This is not a bug.
React batches state changes in act. This is intended. waitFor wraps everything in act as a change is expected and therefore the act warning that is supposed to help you detect unexpected state changes is unnecessary.
Because of batching the state changes all iterations inside userEvent.type take place on the previous render result - which has an empty field and therefore the typing result is nothing plus the char that is typed.
// typing 'John' inside act results inact(()=>{// start to batchsetState(''+'J')setState(''+'o')setState(''+'h')setState(''+'n')}// execute state change
this is similar to #387
@testing-library/user-event
version:13.1.9Relevant code or config
What you did:
using the above test, expected the test to succeed
using the waitFor in this instance is necessary because I'm using Formik and otherwise get the
act(..)
error.What happened:
failed with this error:
Reproduction repository:
https://codesandbox.io/s/bold-glitter-u98xb?file=/src/name-edit.spec.js:309-546
Problem description:
the value is the last character instead of entre string as expected
Suggested solution:
based on reading the thread of #387, may be an issue of nested
act()
functionsUpdate
I see now that the suggested way is to wrap the assertion with
waitFor
, but perhaps this is still a bug worth fixing?The text was updated successfully, but these errors were encountered: