A few quick searches discovered that I\'m obviously not the first person to have the thought \"Can I unit test my CSS?\".
I\'m wondering if anyone
We’ve set up unit tests on a large, UI-heavy project and it worked wonderfully! It was also way easier than it looks.
Take simple tools like getBoundingClientRect or getComputedStyle, pair it with hyperscript to create quick temporary DOM trees and you’re good to go. We’ve written tape-css to reduce boilerplate when testing with tape, but the stack will be similar in any test setup.
Yesterday I published a detailed blog post with a simple tutorial and live examples about our new workflow and how it boosted our productivity: How CSS unit tests helped us move fast.