I
I
Ilya2019-09-29 15:09:32
Unit testing
Ilya, 2019-09-29 15:09:32

Why does the state not change during testing after filling out the form?

Sandbox
I have an App component with a state of { isCardAdded: false }.
If isCardAddedfalse, the form is shown. The form consists of one field and a button.
If you fill out the form correctly, it isCardAddedwill become correct and the message "Card added" will be displayed.
I am testing a component.
Initially there was a problem that I was simulating events on other elements. So I rewrote the test with React-testing-library to dig into the right nodes.
Now I don’t understand why after filling out the form correctly, the message “Card added” is not displayed. Help me please.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question