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 here has taken on CSS Unit Testing successfully? If you've tried and failed, or just have your own theories, please tell me why it (apparently) hasn't been done yet?
How do I test CSS then? As CSS should not impact the logic of a website, there is no unit to test.
Which Method of CSS is Best for Testing. Automatic CSS testing is the most reliable way of detecting breaking changes after a CMS update, or after updating plug-ins and themes.
Unit testing ensures that all code meets quality standards before it's deployed. This ensures a reliable engineering environment where quality is paramount. Over the course of the product development life cycle, unit testing saves time and money, and helps developers write better code, more efficiently.
You could use Selenium, which is a web testing framework. This way you could assert what styles are to be applied to elements in the DOM etc.
Selenium
Otherwise, not sure what your aim is. Unit testing is, as the name suggests, testing 'Units', and to me, this only makes sense with code, not css.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With