-
Notifications
You must be signed in to change notification settings - Fork 0
Testing Design and Layout
The short answer is: you shouldn’t write tests for design and layout. It’s too much like testing a constant, and any tests you write are likely to be brittle.
With that said, the implementation of design and layout involves something quite tricky: CSS and static files. As a result, it is valuable to have some kind of minimal "smoke test" which checks that your static files and CSS are working. As we’ll see in the next chapter, it can help pick up problems when you deploy your code to production.
Similarly, if a particular piece of styling required a lot of client-side JavaScript code to get it to work (dynamic resizing is one I’ve spent a bit of time on), you’ll definitely want some tests for that.
So be aware that this is a dangerous area. Try and write the minimal tests that will give you confidence that your design and layout is working, without testing what it actually is. Try and leave yourself in a position where you can freely make changes to the design and layout, without having to go back and adjust tests all the time.