@@ -5074,7 +5074,9 @@ describe.each([{ basepath: '' }, { basepath: '/basepath' }])(
5074
5074
return (
5075
5075
< >
5076
5076
< h1 > Param Route</ h1 >
5077
- < Link from = { paramRoute . fullPath } to = "./a" > Link to ./a</ Link >
5077
+ < Link from = { paramRoute . fullPath } to = "./a" >
5078
+ Link to ./a
5079
+ </ Link >
5078
5080
< Link to = "c" unsafeRelative = "path" >
5079
5081
Link to c
5080
5082
</ Link >
@@ -5094,7 +5096,9 @@ describe.each([{ basepath: '' }, { basepath: '/basepath' }])(
5094
5096
return (
5095
5097
< >
5096
5098
< h1 > Param A Route</ h1 >
5097
- < Link from = { paramARoute . fullPath } to = ".." > Link to .. from /param/foo/a</ Link >
5099
+ < Link from = { paramARoute . fullPath } to = ".." >
5100
+ Link to .. from /param/foo/a
5101
+ </ Link >
5098
5102
< Outlet />
5099
5103
</ >
5100
5104
)
@@ -5420,23 +5424,20 @@ describe('relative links to current route', () => {
5420
5424
const IndexComponent = ( ) => {
5421
5425
return (
5422
5426
< >
5423
- < Link
5424
- data-testid = "posts-link"
5425
- to = '/post'
5426
- >
5427
+ < Link data-testid = "posts-link" to = "/post" >
5427
5428
Post
5428
5429
</ Link >
5429
5430
< Link
5430
5431
data-testid = "search-link"
5431
- to = '.'
5432
- search = { { param1 : 'value1' } }
5432
+ to = "."
5433
+ search = { { param1 : 'value1' } }
5433
5434
>
5434
5435
Search
5435
5436
</ Link >
5436
5437
< Link
5437
5438
data-testid = "search2-link"
5438
- to = '.'
5439
- search = { { param1 : 'value2' } }
5439
+ to = "."
5440
+ search = { { param1 : 'value2' } }
5440
5441
>
5441
5442
Search2
5442
5443
</ Link >
@@ -5502,23 +5503,20 @@ describe('relative links to current route', () => {
5502
5503
const IndexComponent = ( ) => {
5503
5504
return (
5504
5505
< >
5505
- < Link
5506
- data-testid = "posts-link"
5507
- to = '/post'
5508
- >
5506
+ < Link data-testid = "posts-link" to = "/post" >
5509
5507
Post
5510
5508
</ Link >
5511
5509
< Link
5512
5510
data-testid = "search-link"
5513
- to = '.'
5514
- search = { { param1 : 'value1' } }
5511
+ to = "."
5512
+ search = { { param1 : 'value1' } }
5515
5513
>
5516
5514
Search
5517
5515
</ Link >
5518
5516
< Link
5519
5517
data-testid = "search2-link"
5520
- to = ' /post'
5521
- search = { { param1 : 'value2' } }
5518
+ to = " /post"
5519
+ search = { { param1 : 'value2' } }
5522
5520
>
5523
5521
Search2
5524
5522
</ Link >
@@ -5582,10 +5580,7 @@ describe('relative links to current route', () => {
5582
5580
return (
5583
5581
< >
5584
5582
< h1 data-testid = "index-heading" > Index</ h1 >
5585
- < Link
5586
- data-testid = "posts-link"
5587
- to = '/posts'
5588
- >
5583
+ < Link data-testid = "posts-link" to = "/posts" >
5589
5584
Posts
5590
5585
</ Link >
5591
5586
</ >
@@ -5617,14 +5612,14 @@ describe('relative links to current route', () => {
5617
5612
< h1 data-testid = "posts-index-heading" > Posts</ h1 >
5618
5613
< Link
5619
5614
data-testid = "first-post-link"
5620
- to = ' $postId'
5615
+ to = " $postId"
5621
5616
params = { { postId : 'id1' } }
5622
5617
>
5623
5618
To first post
5624
5619
</ Link >
5625
5620
< Link
5626
5621
data-testid = "second-post-link"
5627
- to = '.'
5622
+ to = "."
5628
5623
params = { { postId : 'id2' } }
5629
5624
>
5630
5625
To second post
@@ -5671,7 +5666,9 @@ describe('relative links to current route', () => {
5671
5666
5672
5667
await act ( ( ) => fireEvent . click ( postsButton ) )
5673
5668
5674
- expect ( await screen . findByTestId ( 'posts-index-heading' ) ) . toBeInTheDocument ( )
5669
+ expect (
5670
+ await screen . findByTestId ( 'posts-index-heading' ) ,
5671
+ ) . toBeInTheDocument ( )
5675
5672
expect ( window . location . pathname ) . toEqual ( `/posts${ tail } ` )
5676
5673
5677
5674
const firstPostButton = await screen . findByTestId ( 'first-post-link' )
@@ -5702,24 +5699,17 @@ describe('relative links to from route', () => {
5702
5699
const IndexComponent = ( ) => {
5703
5700
return (
5704
5701
< >
5705
- < Link
5706
- data-testid = "posts-link"
5707
- to = '/post'
5708
- >
5702
+ < Link data-testid = "posts-link" to = "/post" >
5709
5703
Post
5710
5704
</ Link >
5711
5705
< Link
5712
5706
data-testid = "search-link"
5713
- to = '.'
5714
- search = { { param1 : 'value1' } }
5707
+ to = "."
5708
+ search = { { param1 : 'value1' } }
5715
5709
>
5716
5710
Search
5717
5711
</ Link >
5718
- < Link
5719
- data-testid = "home-link"
5720
- from = '/'
5721
- to = '.'
5722
- >
5712
+ < Link data-testid = "home-link" from = "/" to = "." >
5723
5713
Go To Home
5724
5714
</ Link >
5725
5715
< Outlet />
@@ -5782,10 +5772,7 @@ describe('relative links to from route', () => {
5782
5772
return (
5783
5773
< >
5784
5774
< h1 data-testid = "index-heading" > Index</ h1 >
5785
- < Link
5786
- data-testid = "posts-link"
5787
- to = '/posts'
5788
- >
5775
+ < Link data-testid = "posts-link" to = "/posts" >
5789
5776
Posts
5790
5777
</ Link >
5791
5778
</ >
@@ -5817,23 +5804,19 @@ describe('relative links to from route', () => {
5817
5804
< h1 data-testid = "posts-index-heading" > Posts</ h1 >
5818
5805
< Link
5819
5806
data-testid = "first-post-link"
5820
- to = ' $postId'
5807
+ to = " $postId"
5821
5808
params = { { postId : '1' } }
5822
5809
>
5823
5810
To first post
5824
5811
</ Link >
5825
5812
< Link
5826
5813
data-testid = "second-post-link"
5827
- to = ' $postId'
5814
+ to = " $postId"
5828
5815
params = { { postId : '2' } }
5829
5816
>
5830
5817
To second post
5831
5818
</ Link >
5832
- < Link
5833
- data-testid = "to-posts-index-link"
5834
- from = '/posts'
5835
- to = '.'
5836
- >
5819
+ < Link data-testid = "to-posts-index-link" from = "/posts" to = "." >
5837
5820
To posts list
5838
5821
</ Link >
5839
5822
< Outlet />
@@ -5845,22 +5828,16 @@ describe('relative links to from route', () => {
5845
5828
return (
5846
5829
< >
5847
5830
< h1 data-testid = "post-detail-index-heading" > Post Detail</ h1 >
5848
- < Link
5849
- data-testid = "post-info-link"
5850
- to = 'info'
5851
- >
5831
+ < Link data-testid = "post-info-link" to = "info" >
5852
5832
To post info
5853
5833
</ Link >
5854
- < Link
5855
- data-testid = "post-notes-link"
5856
- to = 'notes'
5857
- >
5834
+ < Link data-testid = "post-notes-link" to = "notes" >
5858
5835
To post notes
5859
5836
</ Link >
5860
5837
< Link
5861
5838
data-testid = "to-post-detail-index-link"
5862
- from = ' /posts/$postId'
5863
- to = '.'
5839
+ from = " /posts/$postId"
5840
+ to = "."
5864
5841
>
5865
5842
To index detail options
5866
5843
</ Link >
@@ -5912,7 +5889,11 @@ describe('relative links to from route', () => {
5912
5889
const router = createRouter ( {
5913
5890
routeTree : rootRoute . addChildren ( [
5914
5891
indexRoute ,
5915
- layoutRoute . addChildren ( [ postsRoute . addChildren ( [ postDetailRoute . addChildren ( [ postInfoRoute , postNotesRoute ] ) ] ) ] ) ,
5892
+ layoutRoute . addChildren ( [
5893
+ postsRoute . addChildren ( [
5894
+ postDetailRoute . addChildren ( [ postInfoRoute , postNotesRoute ] ) ,
5895
+ ] ) ,
5896
+ ] ) ,
5916
5897
] ) ,
5917
5898
trailingSlash : trailingSlash ? 'always' : 'never' ,
5918
5899
} )
@@ -5923,14 +5904,18 @@ describe('relative links to from route', () => {
5923
5904
5924
5905
fireEvent . click ( postsButton )
5925
5906
5926
- expect ( await screen . findByTestId ( 'posts-index-heading' ) ) . toBeInTheDocument ( )
5907
+ expect (
5908
+ await screen . findByTestId ( 'posts-index-heading' ) ,
5909
+ ) . toBeInTheDocument ( )
5927
5910
expect ( window . location . pathname ) . toEqual ( `/posts${ tail } ` )
5928
5911
5929
5912
const firstPostButton = await screen . findByTestId ( 'first-post-link' )
5930
5913
5931
5914
fireEvent . click ( firstPostButton )
5932
5915
5933
- expect ( await screen . findByTestId ( 'post-detail-index-heading' ) ) . toBeInTheDocument ( )
5916
+ expect (
5917
+ await screen . findByTestId ( 'post-detail-index-heading' ) ,
5918
+ ) . toBeInTheDocument ( )
5934
5919
expect ( window . location . pathname ) . toEqual ( `/posts/1${ tail } ` )
5935
5920
5936
5921
const postInfoButton = await screen . findByTestId ( 'post-info-link' )
@@ -5940,28 +5925,36 @@ describe('relative links to from route', () => {
5940
5925
expect ( await screen . findByTestId ( 'post-info-heading' ) ) . toBeInTheDocument ( )
5941
5926
expect ( window . location . pathname ) . toEqual ( `/posts/1/info${ tail } ` )
5942
5927
5943
- const toPostDetailIndexButton = await screen . findByTestId ( 'to-post-detail-index-link' )
5928
+ const toPostDetailIndexButton = await screen . findByTestId (
5929
+ 'to-post-detail-index-link' ,
5930
+ )
5944
5931
5945
5932
fireEvent . click ( toPostDetailIndexButton )
5946
5933
5947
- expect ( await screen . findByTestId ( 'post-detail-index-heading' ) ) . toBeInTheDocument ( )
5948
5934
expect (
5949
- screen . queryByTestId ( "'post-info-heading" ) ,
5950
- ) . not . toBeInTheDocument ( )
5935
+ await screen . findByTestId ( 'post-detail-index-heading' ) ,
5936
+ ) . toBeInTheDocument ( )
5937
+ expect ( screen . queryByTestId ( "'post-info-heading" ) ) . not . toBeInTheDocument ( )
5951
5938
expect ( window . location . pathname ) . toEqual ( `/posts/1${ tail } ` )
5952
5939
5953
5940
const postNotesButton = await screen . findByTestId ( 'post-notes-link' )
5954
5941
5955
5942
fireEvent . click ( postNotesButton )
5956
5943
5957
- expect ( await screen . findByTestId ( 'post-notes-heading' ) ) . toBeInTheDocument ( )
5944
+ expect (
5945
+ await screen . findByTestId ( 'post-notes-heading' ) ,
5946
+ ) . toBeInTheDocument ( )
5958
5947
expect ( window . location . pathname ) . toEqual ( `/posts/1/notes${ tail } ` )
5959
5948
5960
- const toPostsIndexButton = await screen . findByTestId ( 'to-posts-index-link' )
5949
+ const toPostsIndexButton = await screen . findByTestId (
5950
+ 'to-posts-index-link' ,
5951
+ )
5961
5952
5962
5953
fireEvent . click ( toPostsIndexButton )
5963
5954
5964
- expect ( await screen . findByTestId ( 'posts-index-heading' ) ) . toBeInTheDocument ( )
5955
+ expect (
5956
+ await screen . findByTestId ( 'posts-index-heading' ) ,
5957
+ ) . toBeInTheDocument ( )
5965
5958
expect (
5966
5959
screen . queryByTestId ( "'post-notes-heading" ) ,
5967
5960
) . not . toBeInTheDocument ( )
@@ -5974,7 +5967,9 @@ describe('relative links to from route', () => {
5974
5967
5975
5968
fireEvent . click ( secondPostButton )
5976
5969
5977
- expect ( await screen . findByTestId ( 'post-detail-index-heading' ) ) . toBeInTheDocument ( )
5970
+ expect (
5971
+ await screen . findByTestId ( 'post-detail-index-heading' ) ,
5972
+ ) . toBeInTheDocument ( )
5978
5973
expect ( window . location . pathname ) . toEqual ( `/posts/2${ tail } ` )
5979
5974
} ,
5980
5975
)
@@ -5988,10 +5983,12 @@ describe('when on /posts/$postId and navigating to ../ with default `from` /post
5988
5983
return (
5989
5984
< >
5990
5985
< h1 data-testid = "index-heading" > Index</ h1 >
5991
- < Link data-testid = "posts-link" to = '/posts' > Posts</ Link >
5986
+ < Link data-testid = "posts-link" to = "/posts" >
5987
+ Posts
5988
+ </ Link >
5992
5989
< Link
5993
5990
data-testid = "index-to-first-post-link"
5994
- to = ' /posts/$postId/details'
5991
+ to = " /posts/$postId/details"
5995
5992
params = { { postId : 'id1' } }
5996
5993
>
5997
5994
To first post
@@ -6022,12 +6019,24 @@ describe('when on /posts/$postId and navigating to ../ with default `from` /post
6022
6019
const PostsComponent = ( ) => {
6023
6020
const linkVia = ( ) => {
6024
6021
if ( navigateVia === 'Route' ) {
6025
- return < Link from = { postsRoute . fullPath } to = '../' data-testid = "link-to-home" > To Home</ Link >
6022
+ return (
6023
+ < Link
6024
+ from = { postsRoute . fullPath }
6025
+ to = "../"
6026
+ data-testid = "link-to-home"
6027
+ >
6028
+ To Home
6029
+ </ Link >
6030
+ )
6026
6031
}
6027
6032
6028
6033
const RouteApiLink = getRouteApi ( '/_layout/posts' ) . Link
6029
6034
6030
- return < RouteApiLink to = '../' data-testid = "link-to-home" > To Home</ RouteApiLink >
6035
+ return (
6036
+ < RouteApiLink to = "../" data-testid = "link-to-home" >
6037
+ To Home
6038
+ </ RouteApiLink >
6039
+ )
6031
6040
}
6032
6041
6033
6042
return (
0 commit comments