Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access CSS class name after renderIntoDocument() #3666

Closed
binarykitchen opened this issue Apr 14, 2015 · 3 comments
Closed

Access CSS class name after renderIntoDocument() #3666

binarykitchen opened this issue Apr 14, 2015 · 3 comments

Comments

@binarykitchen
Copy link

In my jest tests I'd like to verify the class names of the rendered elements. How can I do this best?

When I do TestUtils.renderIntoDocument(...), I get the react element in the dom. And then what? How can I access the CSS class from there?

@quantizor
Copy link
Contributor

React.findDOMNode(element).className?

@zpao
Copy link
Member

zpao commented Apr 14, 2015

What @yaycmyk said should work.

@zpao zpao closed this as completed Apr 14, 2015
@binarykitchen
Copy link
Author

ah, works, thanks - wish this example was documented somewhere along Jest / TestUtils ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants