mardi 3 juillet 2018

Can't set input element value in Enzyme

In my test, I have this:

let fromInput = wrapper.find('#starting-address').getElement();
fromInput.value = 'Foo';

However, I'm getting an error:

TypeError: Cannot add property value, object is not extensible.

I'm trying to test a button I have which, on clicking, should clear the value of the input element (id: 'starting-address'). I was planning on asserting that fromInput.value==='foo' before simulating the click, and fromImput.value==='' after clicking.

Aucun commentaire:

Enregistrer un commentaire