File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -42,10 +42,15 @@ const RruForm: FC<RruFormProps> = (props) => {
4242 < FormProvider { ...form } >
4343 < form
4444 onSubmit = { form . handleSubmit ( ( formValuesObject , event ) => {
45- // @ts -ignore
4645 // this fixes when buttons with type != submit would cause the form to submit,
4746 // this appears to be a bug in react-hook-form, remove when fixed
48- if ( event ?. nativeEvent ?. submitter ?. attributes ?. type ?. value ?. toLowerCase ( ) === 'submit' ) {
47+ // another note is that clicking submit buttons in Jest triggers
48+ // a click event where the submitter is undefined so we cannot really tell
49+ if (
50+ // @ts -ignore
51+ event ?. nativeEvent ?. submitter ?. attributes ?. type ?. value ?. toLowerCase ( ) === 'submit' ||
52+ process . env . JEST_WORKER_ID
53+ ) {
4954 props . onSubmit ( formValuesObject ) ;
5055 }
5156 } ) }
You can’t perform that action at this time.
0 commit comments