I wrapped the MDCTextField in a custom web component in order to have a simple and reusable component.
Now I've to write the UI behaviour tests, but it looks like I've some difficulty in distinguishing between behaviour and implementation tests.
What would/should you test in a text field?
I wrote tests to make sure that given a certain property the component renders it correctly (for example label, helper text, placeholder...), to make sure it has or not specific css classes depending on properties input (for example it has mdc-text-field--disabled
class when disabled is true).
You should only be testing things your code is doing, not what MDCTextField
is doing.
Your example of testing if the mdc-text-field--disabled
class has been applied to the MDCTextField
is a good test. Your test should not dig into the MDCTextField looking to see if the <input disabled>
set. That test would belong on MDCTextField
's unit tests.