Material-ui: How to test a TextField material UI element whit React Jest?

Created on 11 Apr 2017  路  4Comments  路  Source: mui-org/material-ui

Problem description

I built up an app with material-ui, but I'm facing problems to test material components with Jest and enzyme.

Link to minimal working code that reproduces the issue

Please, visit my repo and my test attempt. I'm actually trying to test if my TextField component is empty.

I'm also posted a question on stackoverflow

Versions

  • Material-UI: 0.17.1
  • React: 15.5.0
  • Browser: Chrome 54.0.2840.71 (64-bit)

Appreciate any help

v0.x

Most helpful comment

I know how to test my code, I just wanted a hint of how to test "Material UI" elements, because a "testing" elements sample is missing in documentation. But, no worries. thanks for the support.

All 4 comments

Sorry, but "please help me test my code" is not an issue.

I know how to test my code, I just wanted a hint of how to test "Material UI" elements, because a "testing" elements sample is missing in documentation. But, no worries. thanks for the support.

"testing" [...] is missing in documentation

That's a fair point, and if you open an issue for that, we might be able to address it on the `next' branch. (Edit: https://material-ui-next.com/guides/testing/ #7101)

In the meantime, you might find this discussion helpful: https://github.com/callemall/material-ui/issues/4664, and can have a look at the source to see how the components are being tested.

For those still confused, please remember that GitHub issues is not a support forum. This is explained in the README, and in SUPPORT.md which is flashed when you open a new issue.

To be clear, we want users to be successful with Material-UI, but time spent answering specific users' support requests, particularly those requiring an understanding of their particular build or test stack, is time not spent moving the project forward for everyone's benefit. This is an unfortunate but necessary tradeoff in any large open source project that is maintained by a small number of volunteers.

We've since added a 'support' tag that will automatically close issues such as this with standard wording, but please try to use the appropriate forum to begin with - even triaging support requests takes time.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

FranBran picture FranBran  路  3Comments

ericraffin picture ericraffin  路  3Comments

rbozan picture rbozan  路  3Comments

zabojad picture zabojad  路  3Comments

sys13 picture sys13  路  3Comments