3 ms·
How would you even "test" CSS? Look for particular expectations being met in the browser? As a lot of the general TDD stuff I'd say it's a bad idea. It gives
by borplk 9y ago
How would you even "test" CSS?
Look for particular expectations being met in the browser?
As a lot of the general TDD stuff I'd say it's a bad idea.
It gives you nothing extra of value.
Instead you end up multiplying the number of times you declare/define/write something.
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.
Tests at this level of granularity are just not worth it.
What's next TDD your TDD?
- mbrock 9y agoHere are some kinds of claims I would like to be able to verify on my stylesheets, whether through testing, fuzzing, proving, or magically intuiting via some proprietary black box APIs for $99/month: - The number of columns in the article is 1 on mobile. - On desktop, the sidebar is to the left of the article. - There is no horizontal scrolling. - All paragraphs have a line height equal to the baseline. - All elements are vertically aligned on the baseline grid (the "vertical rhythm" property). - All sidebar icons are 1rem squares. I want to take high level desired properties, specify them as assertions, and then use that to continuously check that the assumptions still hold, especially as I change the code, or switch devices, etc. We seem to need this for CSS styling, because as soon as your website or app reaches a threshold of complexity -- a very low threshold, in my experience -- it starts to happen very easily that a seemingly innocent new stylesheet rule has some detrimental "action at a distance"... it's right there in the name, "cascading". You might be thinking that you can get around this problem through proper abstraction, and I'm interested to hear about that too -- anything that can structurally improve stylesheet quality is urgently necessary. I note that CSS variables are still experimental technology, and that from what I've seen, various CSS preprocessing technologies mostly increase the need for verification (maybe because they tend to encourage even more complex forms of cascading). In practice, for most projects, I would end up conceding that we can't test our CSS beyond things like screenshot diffing (which is a pretty nice technique), just because it would probably require some "original research" into specifying stylesheets. Maybe Google or Facebook could sponsor it. They're both producing frontend development resources because they want web developers to succeed in making cool stuff that they can link to (and surveil). Is there an academic clique somewhere with an interest in formal methods for stylesheets? Or a startup? It seems interdisciplinary enough to be cool, right?