@@ -1506,14 +1506,7 @@ function testDomRouter(
1506
1506
function Comp ( ) {
1507
1507
let location = useLocation ( ) ;
1508
1508
return (
1509
- < Form
1510
- onSubmit = { ( e ) => {
1511
- // jsdom doesn't handle submitter so we add it here
1512
- // See https://github.com/jsdom/jsdom/issues/3117
1513
- // @ts -expect-error
1514
- e . nativeEvent . submitter = e . currentTarget . querySelector ( "button" ) ;
1515
- } }
1516
- >
1509
+ < Form >
1517
1510
< p > { location . pathname + location . search } </ p >
1518
1511
< input name = "a" defaultValue = "1" />
1519
1512
< button type = "submit" name = "b" value = "2" >
@@ -1587,15 +1580,7 @@ function testDomRouter(
1587
1580
let location = useLocation ( ) ;
1588
1581
let data = useActionData ( ) as string | undefined ;
1589
1582
return (
1590
- < Form
1591
- method = "post"
1592
- onSubmit = { ( e ) => {
1593
- // jsdom doesn't handle submitter so we add it here
1594
- // See https://github.com/jsdom/jsdom/issues/3117
1595
- // @ts -expect-error
1596
- e . nativeEvent . submitter = e . currentTarget . querySelector ( "button" ) ;
1597
- } }
1598
- >
1583
+ < Form method = "post" >
1599
1584
< p > { location . pathname + location . search } </ p >
1600
1585
{ data && < p > { data } </ p > }
1601
1586
< input name = "a" defaultValue = "1" />
@@ -1683,16 +1668,7 @@ function testDomRouter(
1683
1668
let navigation = useNavigation ( ) ;
1684
1669
return (
1685
1670
< div >
1686
- < Form
1687
- method = "post"
1688
- onSubmit = { ( e ) => {
1689
- // jsdom doesn't handle submitter so we add it here
1690
- // See https://github.com/jsdom/jsdom/issues/3117
1691
- // @ts -expect-error
1692
- e . nativeEvent . submitter =
1693
- e . currentTarget . querySelector ( "button" ) ;
1694
- } }
1695
- >
1671
+ < Form method = "post" >
1696
1672
< input name = "test" value = "value" />
1697
1673
< button type = "submit" formMethod = "get" >
1698
1674
Submit Form
@@ -2501,16 +2477,7 @@ function testDomRouter(
2501
2477
2502
2478
function FormPage ( ) {
2503
2479
return (
2504
- < Form
2505
- method = "post"
2506
- onSubmit = { ( e ) => {
2507
- // jsdom doesn't handle submitter so we add it here
2508
- // See https://github.com/jsdom/jsdom/issues/3117
2509
- // @ts -expect-error
2510
- e . nativeEvent . submitter =
2511
- e . currentTarget . querySelector ( "button" ) ;
2512
- } }
2513
- >
2480
+ < Form method = "post" >
2514
2481
< input name = "a" defaultValue = "1" />
2515
2482
< input name = "b" defaultValue = "2" />
2516
2483
< button name = "c" value = "3" type = "submit" >
@@ -2538,16 +2505,7 @@ function testDomRouter(
2538
2505
function FormPage ( ) {
2539
2506
let submit = useSubmit ( ) ;
2540
2507
return (
2541
- < Form
2542
- method = "post"
2543
- onSubmit = { ( e ) => {
2544
- // jsdom doesn't handle submitter so we add it here
2545
- // See https://github.com/jsdom/jsdom/issues/3117
2546
- // @ts -expect-error
2547
- e . nativeEvent . submitter =
2548
- e . currentTarget . querySelector ( "button" ) ;
2549
- } }
2550
- >
2508
+ < Form method = "post" >
2551
2509
< input name = "a" defaultValue = "1" />
2552
2510
< input name = "b" defaultValue = "2" />
2553
2511
< button
@@ -2581,16 +2539,7 @@ function testDomRouter(
2581
2539
2582
2540
function FormPage ( ) {
2583
2541
return (
2584
- < Form
2585
- method = "post"
2586
- onSubmit = { ( e ) => {
2587
- // jsdom doesn't handle submitter so we add it here
2588
- // See https://github.com/jsdom/jsdom/issues/3117
2589
- // @ts -expect-error
2590
- e . nativeEvent . submitter =
2591
- e . currentTarget . querySelector ( "button" ) ;
2592
- } }
2593
- >
2542
+ < Form method = "post" >
2594
2543
< input name = "a" defaultValue = "1" />
2595
2544
< input name = "b" defaultValue = "2" />
2596
2545
< button name = "b" value = "3" type = "submit" >
@@ -2617,16 +2566,7 @@ function testDomRouter(
2617
2566
function FormPage ( ) {
2618
2567
let submit = useSubmit ( ) ;
2619
2568
return (
2620
- < Form
2621
- method = "post"
2622
- onSubmit = { ( e ) => {
2623
- // jsdom doesn't handle submitter so we add it here
2624
- // See https://github.com/jsdom/jsdom/issues/3117
2625
- // @ts -expect-error
2626
- e . nativeEvent . submitter =
2627
- e . currentTarget . querySelector ( "button" ) ;
2628
- } }
2629
- >
2569
+ < Form method = "post" >
2630
2570
< input name = "a" defaultValue = "1" />
2631
2571
< input name = "b" defaultValue = "2" />
2632
2572
< button
@@ -3104,9 +3044,6 @@ function testDomRouter(
3104
3044
</ TestDataRouter >
3105
3045
) ;
3106
3046
3107
- // Note: jsdom doesn't properly attach event.submitter for
3108
- // <button type="submit"> clicks, so we have to use an input to drive
3109
- // this. See https://github.com/jsdom/jsdom/issues/3117
3110
3047
function Comp ( ) {
3111
3048
let fetcher = useFetcher ( ) ;
3112
3049
return (
0 commit comments