mardi 3 novembre 2015

How can I unit test parent react components that call methods on children

Under 'Tips' in the react documentation they describe a pattern for communicating between components where a parent component calls a method on the child (via a ref).

See http://ift.tt/1NcxQqT

I am using a third party react component that requires me to use this approach.

I would like to unit test my component and check that it calls the child's method (with the right parameters) under the right circumstances, but I'm having trouble figuring out how...

For the example in the Facebook documentation, how would I write a test that checks Todos calls animate on the last Todo when it should?

Aucun commentaire:

Enregistrer un commentaire