As far as I understand your question, here I take it upon myself -
Unit test should test the functionality of a particular source code.
The following methods are available for performing unit testing for a function.
- Pass the input to the function and test the output
- Pass the input and check everything (steps) it takes to control that input
- Check to see if it calls any external function to input any input and uses the shaded value as the return object / value from this external function.
If the method in the directive controls css, then it should add and remove the CSS class inside this method, should it? Therefore, in statements it is only necessary to check whether a particular class is present or not. (In most cases I worked on)
A CSS file is an external file and its dependency on the original javascript file, and should be considered as dependencies.
Where e2e testing is integration testing to make sure all integration files work together. Therefore, if we need to check CSS changes, we must check with e2e.
The talk about Unit Testing from Miลกko Hevery is interesting here. This is not related to CSS, but in general Unit Testing and dependency handling (17:50)
source share