Skip to content

Commit 159a9ed

Browse files
fix: add test pages for hash hover scroll test
1 parent c3b1c0d commit 159a9ed

7 files changed

Lines changed: 194 additions & 9 deletions

File tree

e2e/react-router/basic-file-based/src/routeTree.gen.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { Route as rootRouteImport } from './routes/__root'
1212
import { Route as RemountDepsRouteImport } from './routes/remountDeps'
1313
import { Route as PostsRouteImport } from './routes/posts'
1414
import { Route as NotRemountDepsRouteImport } from './routes/notRemountDeps'
15+
import { Route as LazyPageRouteImport } from './routes/lazy-page'
1516
import { Route as EditingBRouteImport } from './routes/editing-b'
1617
import { Route as EditingARouteImport } from './routes/editing-a'
1718
import { Route as ComponentTypesTestRouteImport } from './routes/component-types-test'
@@ -31,6 +32,7 @@ import { Route as SearchParamsDefaultRouteImport } from './routes/search-params/
3132
import { Route as RedirectTargetRouteImport } from './routes/redirect/$target'
3233
import { Route as PostsPostIdRouteImport } from './routes/posts.$postId'
3334
import { Route as LayoutLayout2RouteImport } from './routes/_layout/_layout-2'
35+
import { Route as testsNormalPageRouteImport } from './routes/(tests)/normal-page'
3436
import { Route as groupLazyinsideRouteImport } from './routes/(group)/lazyinside'
3537
import { Route as groupInsideRouteImport } from './routes/(group)/inside'
3638
import { Route as groupLayoutRouteImport } from './routes/(group)/_layout'
@@ -125,6 +127,11 @@ const NotRemountDepsRoute = NotRemountDepsRouteImport.update({
125127
path: '/notRemountDeps',
126128
getParentRoute: () => rootRouteImport,
127129
} as any)
130+
const LazyPageRoute = LazyPageRouteImport.update({
131+
id: '/lazy-page',
132+
path: '/lazy-page',
133+
getParentRoute: () => rootRouteImport,
134+
} as any)
128135
const EditingBRoute = EditingBRouteImport.update({
129136
id: '/editing-b',
130137
path: '/editing-b',
@@ -220,6 +227,11 @@ const LayoutLayout2Route = LayoutLayout2RouteImport.update({
220227
id: '/_layout-2',
221228
getParentRoute: () => LayoutRoute,
222229
} as any)
230+
const testsNormalPageRoute = testsNormalPageRouteImport.update({
231+
id: '/(tests)/normal-page',
232+
path: '/normal-page',
233+
getParentRoute: () => rootRouteImport,
234+
} as any)
223235
const groupLazyinsideRoute = groupLazyinsideRouteImport
224236
.update({
225237
id: '/(group)/lazyinside',
@@ -659,6 +671,7 @@ export interface FileRoutesByFullPath {
659671
'/component-types-test': typeof ComponentTypesTestRoute
660672
'/editing-a': typeof EditingARoute
661673
'/editing-b': typeof EditingBRoute
674+
'/lazy-page': typeof LazyPageRoute
662675
'/notRemountDeps': typeof NotRemountDepsRoute
663676
'/posts': typeof PostsRouteWithChildren
664677
'/remountDeps': typeof RemountDepsRoute
@@ -673,6 +686,7 @@ export interface FileRoutesByFullPath {
673686
'/onlyrouteinside': typeof anotherGroupOnlyrouteinsideRoute
674687
'/inside': typeof groupInsideRoute
675688
'/lazyinside': typeof groupLazyinsideRoute
689+
'/normal-page': typeof testsNormalPageRoute
676690
'/posts/$postId': typeof PostsPostIdRoute
677691
'/redirect/$target': typeof RedirectTargetRouteWithChildren
678692
'/search-params/default': typeof SearchParamsDefaultRoute
@@ -757,6 +771,7 @@ export interface FileRoutesByTo {
757771
'/component-types-test': typeof ComponentTypesTestRoute
758772
'/editing-a': typeof EditingARoute
759773
'/editing-b': typeof EditingBRoute
774+
'/lazy-page': typeof LazyPageRoute
760775
'/notRemountDeps': typeof NotRemountDepsRoute
761776
'/remountDeps': typeof RemountDepsRoute
762777
'/non-nested/deep': typeof NonNestedDeepRouteRouteWithChildren
@@ -770,6 +785,7 @@ export interface FileRoutesByTo {
770785
'/onlyrouteinside': typeof anotherGroupOnlyrouteinsideRoute
771786
'/inside': typeof groupInsideRoute
772787
'/lazyinside': typeof groupLazyinsideRoute
788+
'/normal-page': typeof testsNormalPageRoute
773789
'/posts/$postId': typeof PostsPostIdRoute
774790
'/search-params/default': typeof SearchParamsDefaultRoute
775791
'/structural-sharing/$enabled': typeof StructuralSharingEnabledRoute
@@ -849,6 +865,7 @@ export interface FileRoutesById {
849865
'/component-types-test': typeof ComponentTypesTestRoute
850866
'/editing-a': typeof EditingARoute
851867
'/editing-b': typeof EditingBRoute
868+
'/lazy-page': typeof LazyPageRoute
852869
'/notRemountDeps': typeof NotRemountDepsRoute
853870
'/posts': typeof PostsRouteWithChildren
854871
'/remountDeps': typeof RemountDepsRoute
@@ -864,6 +881,7 @@ export interface FileRoutesById {
864881
'/(group)/_layout': typeof groupLayoutRouteWithChildren
865882
'/(group)/inside': typeof groupInsideRoute
866883
'/(group)/lazyinside': typeof groupLazyinsideRoute
884+
'/(tests)/normal-page': typeof testsNormalPageRoute
867885
'/_layout/_layout-2': typeof LayoutLayout2RouteWithChildren
868886
'/posts/$postId': typeof PostsPostIdRoute
869887
'/redirect/$target': typeof RedirectTargetRouteWithChildren
@@ -952,6 +970,7 @@ export interface FileRouteTypes {
952970
| '/component-types-test'
953971
| '/editing-a'
954972
| '/editing-b'
973+
| '/lazy-page'
955974
| '/notRemountDeps'
956975
| '/posts'
957976
| '/remountDeps'
@@ -966,6 +985,7 @@ export interface FileRouteTypes {
966985
| '/onlyrouteinside'
967986
| '/inside'
968987
| '/lazyinside'
988+
| '/normal-page'
969989
| '/posts/$postId'
970990
| '/redirect/$target'
971991
| '/search-params/default'
@@ -1050,6 +1070,7 @@ export interface FileRouteTypes {
10501070
| '/component-types-test'
10511071
| '/editing-a'
10521072
| '/editing-b'
1073+
| '/lazy-page'
10531074
| '/notRemountDeps'
10541075
| '/remountDeps'
10551076
| '/non-nested/deep'
@@ -1063,6 +1084,7 @@ export interface FileRouteTypes {
10631084
| '/onlyrouteinside'
10641085
| '/inside'
10651086
| '/lazyinside'
1087+
| '/normal-page'
10661088
| '/posts/$postId'
10671089
| '/search-params/default'
10681090
| '/structural-sharing/$enabled'
@@ -1141,6 +1163,7 @@ export interface FileRouteTypes {
11411163
| '/component-types-test'
11421164
| '/editing-a'
11431165
| '/editing-b'
1166+
| '/lazy-page'
11441167
| '/notRemountDeps'
11451168
| '/posts'
11461169
| '/remountDeps'
@@ -1156,6 +1179,7 @@ export interface FileRouteTypes {
11561179
| '/(group)/_layout'
11571180
| '/(group)/inside'
11581181
| '/(group)/lazyinside'
1182+
| '/(tests)/normal-page'
11591183
| '/_layout/_layout-2'
11601184
| '/posts/$postId'
11611185
| '/redirect/$target'
@@ -1244,6 +1268,7 @@ export interface RootRouteChildren {
12441268
ComponentTypesTestRoute: typeof ComponentTypesTestRoute
12451269
EditingARoute: typeof EditingARoute
12461270
EditingBRoute: typeof EditingBRoute
1271+
LazyPageRoute: typeof LazyPageRoute
12471272
NotRemountDepsRoute: typeof NotRemountDepsRoute
12481273
PostsRoute: typeof PostsRouteWithChildren
12491274
RemountDepsRoute: typeof RemountDepsRoute
@@ -1254,6 +1279,7 @@ export interface RootRouteChildren {
12541279
groupLayoutRoute: typeof groupLayoutRouteWithChildren
12551280
groupInsideRoute: typeof groupInsideRoute
12561281
groupLazyinsideRoute: typeof groupLazyinsideRoute
1282+
testsNormalPageRoute: typeof testsNormalPageRoute
12571283
RedirectTargetRoute: typeof RedirectTargetRouteWithChildren
12581284
StructuralSharingEnabledRoute: typeof StructuralSharingEnabledRoute
12591285
ParamsPsIndexRoute: typeof ParamsPsIndexRoute
@@ -1300,6 +1326,13 @@ declare module '@tanstack/react-router' {
13001326
preLoaderRoute: typeof NotRemountDepsRouteImport
13011327
parentRoute: typeof rootRouteImport
13021328
}
1329+
'/lazy-page': {
1330+
id: '/lazy-page'
1331+
path: '/lazy-page'
1332+
fullPath: '/lazy-page'
1333+
preLoaderRoute: typeof LazyPageRouteImport
1334+
parentRoute: typeof rootRouteImport
1335+
}
13031336
'/editing-b': {
13041337
id: '/editing-b'
13051338
path: '/editing-b'
@@ -1433,6 +1466,13 @@ declare module '@tanstack/react-router' {
14331466
preLoaderRoute: typeof LayoutLayout2RouteImport
14341467
parentRoute: typeof LayoutRoute
14351468
}
1469+
'/(tests)/normal-page': {
1470+
id: '/(tests)/normal-page'
1471+
path: '/normal-page'
1472+
fullPath: '/normal-page'
1473+
preLoaderRoute: typeof testsNormalPageRouteImport
1474+
parentRoute: typeof rootRouteImport
1475+
}
14361476
'/(group)/lazyinside': {
14371477
id: '/(group)/lazyinside'
14381478
path: '/lazyinside'
@@ -2402,6 +2442,7 @@ const rootRouteChildren: RootRouteChildren = {
24022442
ComponentTypesTestRoute: ComponentTypesTestRoute,
24032443
EditingARoute: EditingARoute,
24042444
EditingBRoute: EditingBRoute,
2445+
LazyPageRoute: LazyPageRoute,
24052446
NotRemountDepsRoute: NotRemountDepsRoute,
24062447
PostsRoute: PostsRouteWithChildren,
24072448
RemountDepsRoute: RemountDepsRoute,
@@ -2412,6 +2453,7 @@ const rootRouteChildren: RootRouteChildren = {
24122453
groupLayoutRoute: groupLayoutRouteWithChildren,
24132454
groupInsideRoute: groupInsideRoute,
24142455
groupLazyinsideRoute: groupLazyinsideRoute,
2456+
testsNormalPageRoute: testsNormalPageRoute,
24152457
RedirectTargetRoute: RedirectTargetRouteWithChildren,
24162458
StructuralSharingEnabledRoute: StructuralSharingEnabledRoute,
24172459
ParamsPsIndexRoute: ParamsPsIndexRoute,
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import { createFileRoute, Link } from '@tanstack/react-router'
2+
3+
export const Route = createFileRoute('/(tests)/normal-page')({
4+
component: NormalPage,
5+
})
6+
7+
function NormalPage() {
8+
return (
9+
<div className="p-2">
10+
<h3>Normal Page</h3>
11+
12+
{/* Add the link that the test is looking for */}
13+
<div style={{ marginBottom: '1rem' }}>
14+
<Link to="/lazy-page" className="header-link">
15+
Head-/lazy-page
16+
</Link>
17+
</div>
18+
19+
<div style={{ height: '200vh' }}>
20+
Scroll down to see the target element
21+
</div>
22+
23+
<div
24+
id="at-the-bottom"
25+
data-testid="at-the-bottom"
26+
style={{
27+
height: '100px',
28+
background: '#f0f0f0',
29+
border: '1px solid #ccc',
30+
padding: '1rem',
31+
marginTop: '2rem'
32+
}}
33+
>
34+
This is the target element at the bottom of the page
35+
</div>
36+
</div>
37+
)
38+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { createFileRoute } from '@tanstack/react-router'
2+
3+
export const Route = createFileRoute('/lazy-page')({
4+
component: LazyPage,
5+
})
6+
7+
function LazyPage() {
8+
return (
9+
<div className="p-2">
10+
<h3>Lazy Loaded Page</h3>
11+
<p>This page was loaded lazily.</p>
12+
</div>
13+
)
14+
}

0 commit comments

Comments
 (0)