jeudi 3 septembre 2020

React Testing Library: Test event.validity.valid

Unfortunately I cannot test for validity. In Enzyme I have done the following:

.simulate('change', { target: { value: 'Test value', validity: { valid: false } } });

but this no longer works in the Testing Library. If I do this: fireEvent.change(input, { target: { value: '23', validity: { valid: false } } });, I get the following error: TypeError: Cannot set property validity of [object HTMLInputElement] which has only a getter

Does anyone have any idea what else I could do? Thanks a lot!

Aucun commentaire:

Enregistrer un commentaire