vendredi 27 décembre 2019

react-testing-library's fireEvent.click not updating result of debug()

So I have created a simple ConnectFour game using React https://github.com/pavilion/ConnectFourTDD

I have created a Board and Cell components. The board is composed of a table of Cells.

The test renders a 4x4 Board and clicks the first element of the first column, so the outcome would be to get a X in the bottom of the first column:

+--------------------+--+--+--+
| Click happens here |  |  |  |
+--------------------+--+--+--+
|                    |  |  |  |
+--------------------+--+--+--+
|                    |  |  |  |
+--------------------+--+--+--+
| X                  |  |  |  |
+--------------------+--+--+--+

However, when I do debug() which basically prints the DOM tree, it doesn't show any "X". Here is the test: https://github.com/pavilion/ConnectFourTDD/blob/testing-library/packages/web/src/tests/App-test.tsx#L19

What am I doing wrong?

Aucun commentaire:

Enregistrer un commentaire