Skip to content

Commit 3b091d0

Browse files
authored
test(solid-start): fix basic-solid-query nav tests (#5640)
1 parent 05b4def commit 3b091d0

7 files changed

Lines changed: 175 additions & 2 deletions

File tree

‎e2e/solid-start/basic-solid-query/src/routeTree.gen.ts‎

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,18 @@ import { Route as UsersRouteImport } from './routes/users'
1313
import { Route as SuspenseTransitionRouteImport } from './routes/suspense-transition'
1414
import { Route as PostsRouteImport } from './routes/posts'
1515
import { Route as DeferredRouteImport } from './routes/deferred'
16+
import { Route as LayoutRouteImport } from './routes/_layout'
1617
import { Route as IndexRouteImport } from './routes/index'
1718
import { Route as UsersIndexRouteImport } from './routes/users.index'
1819
import { Route as PostsIndexRouteImport } from './routes/posts.index'
1920
import { Route as UsersUserIdRouteImport } from './routes/users.$userId'
2021
import { Route as PostsPostIdRouteImport } from './routes/posts.$postId'
2122
import { Route as ApiUsersRouteImport } from './routes/api.users'
23+
import { Route as LayoutLayout2RouteImport } from './routes/_layout/_layout-2'
2224
import { Route as PostsPostIdDeepRouteImport } from './routes/posts_.$postId.deep'
2325
import { Route as ApiUsersIdRouteImport } from './routes/api/users.$id'
26+
import { Route as LayoutLayout2LayoutBRouteImport } from './routes/_layout/_layout-2/layout-b'
27+
import { Route as LayoutLayout2LayoutARouteImport } from './routes/_layout/_layout-2/layout-a'
2428

2529
const UsersRoute = UsersRouteImport.update({
2630
id: '/users',
@@ -42,6 +46,10 @@ const DeferredRoute = DeferredRouteImport.update({
4246
path: '/deferred',
4347
getParentRoute: () => rootRouteImport,
4448
} as any)
49+
const LayoutRoute = LayoutRouteImport.update({
50+
id: '/_layout',
51+
getParentRoute: () => rootRouteImport,
52+
} as any)
4553
const IndexRoute = IndexRouteImport.update({
4654
id: '/',
4755
path: '/',
@@ -72,6 +80,10 @@ const ApiUsersRoute = ApiUsersRouteImport.update({
7280
path: '/api/users',
7381
getParentRoute: () => rootRouteImport,
7482
} as any)
83+
const LayoutLayout2Route = LayoutLayout2RouteImport.update({
84+
id: '/_layout-2',
85+
getParentRoute: () => LayoutRoute,
86+
} as any)
7587
const PostsPostIdDeepRoute = PostsPostIdDeepRouteImport.update({
7688
id: '/posts_/$postId/deep',
7789
path: '/posts/$postId/deep',
@@ -82,6 +94,16 @@ const ApiUsersIdRoute = ApiUsersIdRouteImport.update({
8294
path: '/$id',
8395
getParentRoute: () => ApiUsersRoute,
8496
} as any)
97+
const LayoutLayout2LayoutBRoute = LayoutLayout2LayoutBRouteImport.update({
98+
id: '/layout-b',
99+
path: '/layout-b',
100+
getParentRoute: () => LayoutLayout2Route,
101+
} as any)
102+
const LayoutLayout2LayoutARoute = LayoutLayout2LayoutARouteImport.update({
103+
id: '/layout-a',
104+
path: '/layout-a',
105+
getParentRoute: () => LayoutLayout2Route,
106+
} as any)
85107

86108
export interface FileRoutesByFullPath {
87109
'/': typeof IndexRoute
@@ -94,6 +116,8 @@ export interface FileRoutesByFullPath {
94116
'/users/$userId': typeof UsersUserIdRoute
95117
'/posts/': typeof PostsIndexRoute
96118
'/users/': typeof UsersIndexRoute
119+
'/layout-a': typeof LayoutLayout2LayoutARoute
120+
'/layout-b': typeof LayoutLayout2LayoutBRoute
97121
'/api/users/$id': typeof ApiUsersIdRoute
98122
'/posts/$postId/deep': typeof PostsPostIdDeepRoute
99123
}
@@ -106,21 +130,27 @@ export interface FileRoutesByTo {
106130
'/users/$userId': typeof UsersUserIdRoute
107131
'/posts': typeof PostsIndexRoute
108132
'/users': typeof UsersIndexRoute
133+
'/layout-a': typeof LayoutLayout2LayoutARoute
134+
'/layout-b': typeof LayoutLayout2LayoutBRoute
109135
'/api/users/$id': typeof ApiUsersIdRoute
110136
'/posts/$postId/deep': typeof PostsPostIdDeepRoute
111137
}
112138
export interface FileRoutesById {
113139
__root__: typeof rootRouteImport
114140
'/': typeof IndexRoute
141+
'/_layout': typeof LayoutRouteWithChildren
115142
'/deferred': typeof DeferredRoute
116143
'/posts': typeof PostsRouteWithChildren
117144
'/suspense-transition': typeof SuspenseTransitionRoute
118145
'/users': typeof UsersRouteWithChildren
146+
'/_layout/_layout-2': typeof LayoutLayout2RouteWithChildren
119147
'/api/users': typeof ApiUsersRouteWithChildren
120148
'/posts/$postId': typeof PostsPostIdRoute
121149
'/users/$userId': typeof UsersUserIdRoute
122150
'/posts/': typeof PostsIndexRoute
123151
'/users/': typeof UsersIndexRoute
152+
'/_layout/_layout-2/layout-a': typeof LayoutLayout2LayoutARoute
153+
'/_layout/_layout-2/layout-b': typeof LayoutLayout2LayoutBRoute
124154
'/api/users/$id': typeof ApiUsersIdRoute
125155
'/posts_/$postId/deep': typeof PostsPostIdDeepRoute
126156
}
@@ -137,6 +167,8 @@ export interface FileRouteTypes {
137167
| '/users/$userId'
138168
| '/posts/'
139169
| '/users/'
170+
| '/layout-a'
171+
| '/layout-b'
140172
| '/api/users/$id'
141173
| '/posts/$postId/deep'
142174
fileRoutesByTo: FileRoutesByTo
@@ -149,26 +181,33 @@ export interface FileRouteTypes {
149181
| '/users/$userId'
150182
| '/posts'
151183
| '/users'
184+
| '/layout-a'
185+
| '/layout-b'
152186
| '/api/users/$id'
153187
| '/posts/$postId/deep'
154188
id:
155189
| '__root__'
156190
| '/'
191+
| '/_layout'
157192
| '/deferred'
158193
| '/posts'
159194
| '/suspense-transition'
160195
| '/users'
196+
| '/_layout/_layout-2'
161197
| '/api/users'
162198
| '/posts/$postId'
163199
| '/users/$userId'
164200
| '/posts/'
165201
| '/users/'
202+
| '/_layout/_layout-2/layout-a'
203+
| '/_layout/_layout-2/layout-b'
166204
| '/api/users/$id'
167205
| '/posts_/$postId/deep'
168206
fileRoutesById: FileRoutesById
169207
}
170208
export interface RootRouteChildren {
171209
IndexRoute: typeof IndexRoute
210+
LayoutRoute: typeof LayoutRouteWithChildren
172211
DeferredRoute: typeof DeferredRoute
173212
PostsRoute: typeof PostsRouteWithChildren
174213
SuspenseTransitionRoute: typeof SuspenseTransitionRoute
@@ -207,6 +246,13 @@ declare module '@tanstack/solid-router' {
207246
preLoaderRoute: typeof DeferredRouteImport
208247
parentRoute: typeof rootRouteImport
209248
}
249+
'/_layout': {
250+
id: '/_layout'
251+
path: ''
252+
fullPath: ''
253+
preLoaderRoute: typeof LayoutRouteImport
254+
parentRoute: typeof rootRouteImport
255+
}
210256
'/': {
211257
id: '/'
212258
path: '/'
@@ -249,6 +295,13 @@ declare module '@tanstack/solid-router' {
249295
preLoaderRoute: typeof ApiUsersRouteImport
250296
parentRoute: typeof rootRouteImport
251297
}
298+
'/_layout/_layout-2': {
299+
id: '/_layout/_layout-2'
300+
path: ''
301+
fullPath: ''
302+
preLoaderRoute: typeof LayoutLayout2RouteImport
303+
parentRoute: typeof LayoutRoute
304+
}
252305
'/posts_/$postId/deep': {
253306
id: '/posts_/$postId/deep'
254307
path: '/posts/$postId/deep'
@@ -263,9 +316,48 @@ declare module '@tanstack/solid-router' {
263316
preLoaderRoute: typeof ApiUsersIdRouteImport
264317
parentRoute: typeof ApiUsersRoute
265318
}
319+
'/_layout/_layout-2/layout-b': {
320+
id: '/_layout/_layout-2/layout-b'
321+
path: '/layout-b'
322+
fullPath: '/layout-b'
323+
preLoaderRoute: typeof LayoutLayout2LayoutBRouteImport
324+
parentRoute: typeof LayoutLayout2Route
325+
}
326+
'/_layout/_layout-2/layout-a': {
327+
id: '/_layout/_layout-2/layout-a'
328+
path: '/layout-a'
329+
fullPath: '/layout-a'
330+
preLoaderRoute: typeof LayoutLayout2LayoutARouteImport
331+
parentRoute: typeof LayoutLayout2Route
332+
}
266333
}
267334
}
268335

336+
interface LayoutLayout2RouteChildren {
337+
LayoutLayout2LayoutARoute: typeof LayoutLayout2LayoutARoute
338+
LayoutLayout2LayoutBRoute: typeof LayoutLayout2LayoutBRoute
339+
}
340+
341+
const LayoutLayout2RouteChildren: LayoutLayout2RouteChildren = {
342+
LayoutLayout2LayoutARoute: LayoutLayout2LayoutARoute,
343+
LayoutLayout2LayoutBRoute: LayoutLayout2LayoutBRoute,
344+
}
345+
346+
const LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(
347+
LayoutLayout2RouteChildren,
348+
)
349+
350+
interface LayoutRouteChildren {
351+
LayoutLayout2Route: typeof LayoutLayout2RouteWithChildren
352+
}
353+
354+
const LayoutRouteChildren: LayoutRouteChildren = {
355+
LayoutLayout2Route: LayoutLayout2RouteWithChildren,
356+
}
357+
358+
const LayoutRouteWithChildren =
359+
LayoutRoute._addFileChildren(LayoutRouteChildren)
360+
269361
interface PostsRouteChildren {
270362
PostsPostIdRoute: typeof PostsPostIdRoute
271363
PostsIndexRoute: typeof PostsIndexRoute
@@ -304,6 +396,7 @@ const ApiUsersRouteWithChildren = ApiUsersRoute._addFileChildren(
304396

305397
const rootRouteChildren: RootRouteChildren = {
306398
IndexRoute: IndexRoute,
399+
LayoutRoute: LayoutRouteWithChildren,
307400
DeferredRoute: DeferredRoute,
308401
PostsRoute: PostsRouteWithChildren,
309402
SuspenseTransitionRoute: SuspenseTransitionRoute,

‎e2e/solid-start/basic-solid-query/src/routes/__root.tsx‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,27 @@ function RootDocument(props: { children?: any }) {
108108
>
109109
Users
110110
</Link>{' '}
111+
<Link
112+
to="/layout-a"
113+
activeProps={{
114+
class: 'font-bold',
115+
}}
116+
>
117+
Layout
118+
</Link>{' '}
111119
<Link
112120
to="/deferred"
113121
activeProps={{
114122
class: 'font-bold',
115123
}}
116124
>
117125
Deferred
126+
</Link>{' '}
127+
<Link
128+
// @ts-expect-error
129+
to="/this-route-does-not-exist"
130+
>
131+
This Route Does Not Exist
118132
</Link>
119133
</div>
120134
<hr />
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { Outlet, createFileRoute } from '@tanstack/solid-router'
2+
3+
export const Route = createFileRoute('/_layout')({
4+
component: LayoutComponent,
5+
})
6+
7+
function LayoutComponent() {
8+
return (
9+
<div class="p-2">
10+
<div>I'm a layout</div>
11+
<div>
12+
<Outlet />
13+
</div>
14+
</div>
15+
)
16+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { Link, Outlet, createFileRoute } from '@tanstack/solid-router'
2+
3+
export const Route = createFileRoute('/_layout/_layout-2')({
4+
component: LayoutComponent,
5+
})
6+
7+
function LayoutComponent() {
8+
return (
9+
<div>
10+
<div>I'm a nested layout</div>
11+
<div class="flex gap-2">
12+
<Link
13+
to="/layout-a"
14+
activeProps={{
15+
class: 'font-bold',
16+
}}
17+
>
18+
Layout A
19+
</Link>
20+
<Link
21+
to="/layout-b"
22+
activeProps={{
23+
class: 'font-bold',
24+
}}
25+
>
26+
Layout B
27+
</Link>
28+
</div>
29+
<div>
30+
<Outlet />
31+
</div>
32+
</div>
33+
)
34+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { createFileRoute } from '@tanstack/solid-router'
2+
export const Route = createFileRoute('/_layout/_layout-2/layout-a')({
3+
component: LayoutAComponent,
4+
})
5+
6+
function LayoutAComponent() {
7+
return <div>I'm A!</div>
8+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { createFileRoute } from '@tanstack/solid-router'
2+
export const Route = createFileRoute('/_layout/_layout-2/layout-b')({
3+
component: LayoutBComponent,
4+
})
5+
6+
function LayoutBComponent() {
7+
return <div>I'm B!</div>
8+
}

‎e2e/solid-start/basic-solid-query/tests/app.spec.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ test('Navigating to user', async ({ page }) => {
1717
await expect(page.getByRole('heading')).toContainText('Leanne Graham')
1818
})
1919

20-
test.skip('Navigating nested layouts', async ({ page }) => {
20+
test('Navigating nested layouts', async ({ page }) => {
2121
await page.goto('/')
2222

2323
await page.getByRole('link', { name: 'Layout', exact: true }).click()
@@ -27,7 +27,7 @@ test.skip('Navigating nested layouts', async ({ page }) => {
2727
await expect(page.locator('body')).toContainText("I'm B!")
2828
})
2929

30-
test.skip('Navigating to a not-found route', async ({ page }) => {
30+
test('Navigating to a not-found route', async ({ page }) => {
3131
await page.goto('/')
3232

3333
await page.getByRole('link', { name: 'This Route Does Not Exist' }).click()

0 commit comments

Comments
 (0)