TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

TDD in CSS – fad or reality?

4 点作者 sirkarthik超过 7 年前
Do you test-drive your CSS code? What has been your long experience in this? Was this concept of test-driving CSS, an experiment of the past?

5 条评论

sirkarthik超过 7 年前
My primary reason against Tests for CSS, is that CSS is not about business logic. And the other being that the way CSS works is the last run CSS styling over-rides the previous one. Unit-testing eh? The order of CSS styling that is applied depends on the order of inclusion, correct? Now write anaother test for this? All these thoughts, made me laugh at the idea of Testing the CSS back then. All said, I was still curious to know what was the positive/negative experience of those who tried it.
borplk超过 7 年前
How would you even &quot;test&quot; CSS?<p>Look for particular expectations being met in the browser?<p>As a lot of the general TDD stuff I&#x27;d say it&#x27;s a bad idea.<p>It gives you nothing extra of value.<p>Instead you end up multiplying the number of times you declare&#x2F;define&#x2F;write something.<p>I consider this kind of stuff feel good busy work. You want to brag about your CSS test coverage (?!) but you are just wasting time and picking up complexity.<p>Tests at this level of granularity are just not worth it.<p>What&#x27;s next TDD your TDD?
评论 #15173343 未加载
claudiulodro超过 7 年前
IMO CSS doesn&#x27;t really need unit tests because you are QA-ing it as you develop it. You can&#x27;t really write CSS without looking at the page and making sure it looks good. If you&#x27;re already looking at the page to make sure it looks good, what&#x27;s the point of writing tests to do the same thing?
seanwilson超过 7 年前
I&#x27;ve found testing tools that take screenshots very useful. Once you&#x27;re happy with the site, you take screenshots at various screen widths and after you make changes you can view visual diffs of the new screenshots to see if you broke anything.
评论 #15172166 未加载
roryisok超过 7 年前
Never even heard of anyone using TDD for CSS. How does that work?
评论 #15198649 未加载
评论 #15169161 未加载