CSS Unit Testing

前端 未结 9 1738
面向向阳花
面向向阳花 2020-12-24 05:35

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

9条回答
  •  盖世英雄少女心
    2020-12-24 06:12

    I don't understand why we couldn't or shouldn't unit test CSS. Here's the scenario I have in mind :

    I have a CSS framework that is made of multiple modular CSS files and that drive 5 of my sites.

    Ex : base.css / form.css / article.css etc.
    

    Imagine I make a change to base.css for a requirement applying to Site #1 only => I may break Site #2 styling without.

    CSS unit test would be even more pertinent if my CSS framework is build on top of LESS or SASS : a change in a macro could break all the styling. .

提交回复
热议问题