vendredi 4 septembre 2015

React Testing: Event handlers in React Shallow Rendering unit tests

Background

React Shallow Rendering tests

I am trying to learn how to use the React Shallow Rendering TestUtil and had the tests passing until I added an onClick event handler to both; It seems that there must be some difference with the Accordion.toggle function I am trying to use in Accordion.test.js vs this.toggle in Accordian.js...but I can't figure it out.

Question

How can I get the two highlighted tests in Accordian.test.js to pass?

Steps to reproduce

  1. Clone http://ift.tt/1imBOoY
  2. npm install
  3. npm run dev - see that component is working when you click "Lorem Ipsum"
  4. npm run test:watch - see that tests are failing

Aucun commentaire:

Enregistrer un commentaire