File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed
packages/components/src/integrations/react-hook-form/components/Form Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -133,7 +133,10 @@ describe("submission", () => {
133133 const textField = page . getByPlaceholder ( "textfield" ) ;
134134 await userEvent . type ( textField , "hello" ) ;
135135 await userEvent . click ( submitButton ) ;
136- expect ( onSubmit ) . toHaveBeenCalledWith ( { test : "hello" } ) ;
136+ expect ( onSubmit ) . toHaveBeenCalledWith (
137+ { test : "hello" } ,
138+ expect . objectContaining ( { type : "submit" } ) ,
139+ ) ;
137140 } ) ;
138141
139142 test ( "afterSubmit callback is called after successful submission" , async ( ) => {
Original file line number Diff line number Diff line change @@ -66,8 +66,8 @@ export function Form<F extends FieldValues>(props: FormProps<F>) {
6666 const handleSubmit = ( e ?: FormEvent | F ) => {
6767 const formEvent = e && "nativeEvent" in e ? ( e as FormEvent ) : undefined ;
6868 formEvent ?. stopPropagation ( ) ;
69- return form . handleSubmit ( ( e ) => {
70- const submitResult = onSubmit ( e ) ;
69+ return form . handleSubmit ( ( values , event ) => {
70+ const submitResult = onSubmit ( values , event ) ;
7171 if ( submitResult instanceof Promise ) {
7272 return submitResult . then ( handleSubmitResult ) ;
7373 }
You can’t perform that action at this time.
0 commit comments