DEV Community

Discussion on: What do you think of React Testing Library?

 
kentcdodds profile image
Kent C. Dodds

Yep, that's what I'd recommend. You could also use the style prop and verify the node.style.width is correct.

Thread Thread
 
kcvgan profile image
kcvgan

Thanks, will try!

Thread Thread
 
acostalima profile image
André Costa Lima

Would that really work in this case, i.e., when width is not specified by a CSS class?

Thread Thread
 
kentcdodds profile image
Kent C. Dodds

With JSDOM, you can't measure layout, but you can verify that the style/class name was applied and trust that in the browser's ability to lay it out properly based on that.

Thread Thread
 
acostalima profile image
André Costa Lima

Got it! Thanks! 😄