From my perspective, your question relates to the concept of unit testing in software development.
Unit tests are designed to evaluate the functionality of specific sections of source code.
There are various approaches to conducting unit tests for a function:
- Provide input to the function and assess the output
- Supply input and meticulously test each step it takes to manipulate that input
- Verify if the function calls any external functions for input and use predetermined values as return objects/values from those external functions
If a method within a directive is altering CSS properties, it should involve adding and removing CSS classes within the method itself. This implies that during assertions, the focus should be on checking for the presence of specific classes. (This has been my experience in most cases)
A CSS file is an external resource and serves as a dependency for JavaScript source files; hence, it must be treated as such.
In contrast, end-to-end testing resembles integration testing by ensuring seamless coordination among all integration components. Therefore, when examining CSS modifications, e2e testing should be utilized.
For an interesting discussion on Unit Testing, you can watch this video by Miško Hevery. While not focused on CSS specifically, it delves into Unit Testing as a whole and addresses handling dependencies at around 17:50.