4 ms·
Do people generally write tests for these components? I'm wondering how the marrying of presentation and logic affects that.
by philbo 12y ago
Do people generally write tests for these components? I'm wondering how the marrying of presentation and logic affects that.
- masklinn 12y ago> Do people generally write tests for these components? Sure. React even ships with testing utilities to make that easier: http://facebook.github.io/react/docs/test-utils.html http://facebook.github.io/react/docs/test-utils.html > I'm wondering how the marrying of presentation and logic affects that. Depends on the exact component. For pure components as part of bigger applications it's really quite easy, just render the component with a known dataset and see if it's got everything where things should be. Then again, that's similar to testing templates… most people don't really test their templates. For self-contained "widget" components things are a bit harder, it's similar to testing DOM-based widgets really.