teslamotors / informed

A lightweight framework and utility for building powerful forms in React applications
https://teslamotors.github.io/informed
MIT License
949 stars 172 forks source link

getFullField appears to be mocked for Jest tests using @testing-library/react #352

Closed luke-denton-aligent closed 3 years ago

luke-denton-aligent commented 3 years ago

The getFullField function from formApi, in Jest tests, is an empty function. In actual fact, it seems that all the functions in formApi are empty; are they all being mocked? Is there a way to disable that mock so we can actually get the functionality?

Here is a code sandbox showing the issue https://codesandbox.io/s/informed-js-getfullfield-empty-function-7g1tf?file=/src/Component

joepuzzo commented 3 years ago

Simple. You are not rendering component in a form. so by default all form functions will be noops.

luke-denton-aligent commented 3 years ago

Simple. You are not rendering component in a form. so by default all form functions will be noops.

:facepalm:

Thank you