Most articles about CSS refactoring focus on specific refactoring techniques. They rarely even mention testing as a safety net for changes. Those that do describe ad-hoc manual testing or visual regression testing using image diff tools such as Wraith, PhantomCSS or BackstopJS. These tools take a little setting up, but they can quickly tell you if a page or component differs from an expected ‘reference’ image. You can use visual regression tests if you want to refactor code to produce the same result that you already have.