@@ -976,7 +976,7 @@ test.describe('Actions', () => {
976
976
}
977
977
} ) ;
978
978
979
- test ( 'use:enhance button with formAction' , async ( { page, app } ) => {
979
+ test ( 'use:enhance button with formAction' , async ( { page } ) => {
980
980
await page . goto ( '/actions/enhance' ) ;
981
981
982
982
expect ( await page . textContent ( 'pre.formdata1' ) ) . toBe ( JSON . stringify ( null ) ) ;
@@ -989,7 +989,7 @@ test.describe('Actions', () => {
989
989
) ;
990
990
} ) ;
991
991
992
- test ( 'use:enhance button with name' , async ( { page, app } ) => {
992
+ test ( 'use:enhance button with name' , async ( { page } ) => {
993
993
await page . goto ( '/actions/enhance' ) ;
994
994
995
995
expect ( await page . textContent ( 'pre.formdata1' ) ) . toBe ( JSON . stringify ( null ) ) ;
@@ -1004,6 +1004,21 @@ test.describe('Actions', () => {
1004
1004
) ;
1005
1005
} ) ;
1006
1006
1007
+ test ( 'use:enhance does not clear form on second submit' , async ( { page } ) => {
1008
+ await page . goto ( '/actions/enhance' ) ;
1009
+
1010
+ await page . locator ( 'input[name="message"]' ) . fill ( 'hello' ) ;
1011
+
1012
+ await page . locator ( '.form3' ) . click ( ) ;
1013
+ await expect ( page . locator ( 'pre.formdata1' ) ) . toHaveText ( JSON . stringify ( { message : 'hello' } ) ) ;
1014
+ await expect ( page . locator ( 'pre.formdata2' ) ) . toHaveText ( JSON . stringify ( { message : 'hello' } ) ) ;
1015
+
1016
+ await page . locator ( '.form3' ) . click ( ) ;
1017
+ await page . waitForTimeout ( 0 ) ; // wait for next tick
1018
+ await expect ( page . locator ( 'pre.formdata1' ) ) . toHaveText ( JSON . stringify ( { message : 'hello' } ) ) ;
1019
+ await expect ( page . locator ( 'pre.formdata2' ) ) . toHaveText ( JSON . stringify ( { message : 'hello' } ) ) ;
1020
+ } ) ;
1021
+
1007
1022
test ( 'redirect' , async ( { page, javaScriptEnabled } ) => {
1008
1023
await page . goto ( '/actions/redirect' ) ;
1009
1024
0 commit comments