I have a form that I am trying to test that has multiple inputs. The inputs save on blur and then the form is validated and checks to see if any of the fields are dirty and it saves.
The problem is that no matter what I try, I can't get the form to appear as dirty in the test. I've tried
element.querySelector('#id').value = 'Text';
and I've tried updating the actual object that the form gets its data from (updating the model I think this is) with no dice.
I saw there was a dispatchEvent method in the angular2 repostiory that allows you to send input to an element, but that is in angular2/testing_internals so it isn't importable in external projects. Any ideas of how I can trick the form into thinking that it is receiving input in the unit test?
On another note, the documentation for ng2 unit testing is really poor when I search on google. Is there any good sites you know of?
Aucun commentaire:
Enregistrer un commentaire