I'm Kent C. Dodds. I help people make the world better through quality software. Ask me anything!

View original thread
Saravanan Shanmugam's photo

Hi Kent, I have tweeted this question: How to deal with testing UI components where styles have to be verified? I'm completely against checking classes of a DOM node. Would you recommend checking styles instead?

Say a button component is to be tested. Like bootstrap, lets say, there are N variants of button based on the props passed viz. primary, alert, info... How about testing this? Can you please more insights on this?

Kent C. Dodds's photo

Improving the world with quality software 路 Husband, Father, Latter-day Saint, Teacher, OSS, GDE 路 http://testingjavascript.com @eggheadio

Hi Saravanan,

Styles are all about the way the component looks. You can't test that reliably without visual regression testing tools. So if you need confidence that the look of your components remains unchanged, I recommend you take a look Applitools or Percy. Good luck!