Skip to content

Commit 6d1ae3e

Browse files
committed
feat: add route for special character pipe in path and corresponding tests
1 parent 95708f2 commit 6d1ae3e

3 files changed

Lines changed: 39 additions & 0 deletions

File tree

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
1010

1111
import { Route as rootRouteImport } from './routes/__root'
12+
import { Route as SpecialChar124pipeRouteImport } from './routes/special|pipe'
1213
import { Route as RemountDepsRouteImport } from './routes/remountDeps'
1314
import { Route as PostsRouteImport } from './routes/posts'
1415
import { Route as NotRemountDepsRouteImport } from './routes/notRemountDeps'
@@ -118,6 +119,11 @@ import { Route as NonNestedDeepBazBarFooRouteRouteImport } from './routes/non-ne
118119
import { Route as NonNestedDeepBazBarFooIndexRouteImport } from './routes/non-nested/deep/$baz_.bar.$foo.index'
119120
import { Route as NonNestedDeepBazBarFooQuxRouteImport } from './routes/non-nested/deep/$baz_.bar.$foo_.qux'
120121

122+
const SpecialChar124pipeRoute = SpecialChar124pipeRouteImport.update({
123+
id: '/special|pipe',
124+
path: '/special|pipe',
125+
getParentRoute: () => rootRouteImport,
126+
} as any)
121127
const RemountDepsRoute = RemountDepsRouteImport.update({
122128
id: '/remountDeps',
123129
path: '/remountDeps',
@@ -715,6 +721,7 @@ export interface FileRoutesByFullPath {
715721
'/notRemountDeps': typeof NotRemountDepsRoute
716722
'/posts': typeof PostsRouteWithChildren
717723
'/remountDeps': typeof RemountDepsRoute
724+
'/special|pipe': typeof SpecialChar124pipeRoute
718725
'/non-nested/deep': typeof NonNestedDeepRouteRouteWithChildren
719726
'/non-nested/named': typeof NonNestedNamedRouteRouteWithChildren
720727
'/non-nested/path': typeof NonNestedPathRouteRouteWithChildren
@@ -819,6 +826,7 @@ export interface FileRoutesByTo {
819826
'/masks': typeof MasksRouteWithChildren
820827
'/notRemountDeps': typeof NotRemountDepsRoute
821828
'/remountDeps': typeof RemountDepsRoute
829+
'/special|pipe': typeof SpecialChar124pipeRoute
822830
'/non-nested/deep': typeof NonNestedDeepRouteRouteWithChildren
823831
'/non-nested/named': typeof NonNestedNamedRouteRouteWithChildren
824832
'/non-nested/path': typeof NonNestedPathRouteRouteWithChildren
@@ -918,6 +926,7 @@ export interface FileRoutesById {
918926
'/notRemountDeps': typeof NotRemountDepsRoute
919927
'/posts': typeof PostsRouteWithChildren
920928
'/remountDeps': typeof RemountDepsRoute
929+
'/special|pipe': typeof SpecialChar124pipeRoute
921930
'/non-nested/deep': typeof NonNestedDeepRouteRouteWithChildren
922931
'/non-nested/named': typeof NonNestedNamedRouteRouteWithChildren
923932
'/non-nested/path': typeof NonNestedPathRouteRouteWithChildren
@@ -1029,6 +1038,7 @@ export interface FileRouteTypes {
10291038
| '/notRemountDeps'
10301039
| '/posts'
10311040
| '/remountDeps'
1041+
| '/special|pipe'
10321042
| '/non-nested/deep'
10331043
| '/non-nested/named'
10341044
| '/non-nested/path'
@@ -1133,6 +1143,7 @@ export interface FileRouteTypes {
11331143
| '/masks'
11341144
| '/notRemountDeps'
11351145
| '/remountDeps'
1146+
| '/special|pipe'
11361147
| '/non-nested/deep'
11371148
| '/non-nested/named'
11381149
| '/non-nested/path'
@@ -1231,6 +1242,7 @@ export interface FileRouteTypes {
12311242
| '/notRemountDeps'
12321243
| '/posts'
12331244
| '/remountDeps'
1245+
| '/special|pipe'
12341246
| '/non-nested/deep'
12351247
| '/non-nested/named'
12361248
| '/non-nested/path'
@@ -1342,6 +1354,7 @@ export interface RootRouteChildren {
13421354
NotRemountDepsRoute: typeof NotRemountDepsRoute
13431355
PostsRoute: typeof PostsRouteWithChildren
13441356
RemountDepsRoute: typeof RemountDepsRoute
1357+
SpecialChar124pipeRoute: typeof SpecialChar124pipeRoute
13451358
ParamsPsNonNestedRouteRoute: typeof ParamsPsNonNestedRouteRouteWithChildren
13461359
RelativeLinkRouteRoute: typeof RelativeLinkRouteRouteWithChildren
13471360
RelativeUseNavigateRouteRoute: typeof RelativeUseNavigateRouteRouteWithChildren
@@ -1374,6 +1387,13 @@ export interface RootRouteChildren {
13741387

13751388
declare module '@tanstack/react-router' {
13761389
interface FileRoutesByPath {
1390+
'/special|pipe': {
1391+
id: '/special|pipe'
1392+
path: '/special|pipe'
1393+
fullPath: '/special|pipe'
1394+
preLoaderRoute: typeof SpecialChar124pipeRouteImport
1395+
parentRoute: typeof rootRouteImport
1396+
}
13771397
'/remountDeps': {
13781398
id: '/remountDeps'
13791399
path: '/remountDeps'
@@ -2598,6 +2618,7 @@ const rootRouteChildren: RootRouteChildren = {
25982618
NotRemountDepsRoute: NotRemountDepsRoute,
25992619
PostsRoute: PostsRouteWithChildren,
26002620
RemountDepsRoute: RemountDepsRoute,
2621+
SpecialChar124pipeRoute: SpecialChar124pipeRoute,
26012622
ParamsPsNonNestedRouteRoute: ParamsPsNonNestedRouteRouteWithChildren,
26022623
RelativeLinkRouteRoute: RelativeLinkRouteRouteWithChildren,
26032624
RelativeUseNavigateRouteRoute: RelativeUseNavigateRouteRouteWithChildren,
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { createFileRoute } from '@tanstack/react-router'
2+
3+
export const Route = createFileRoute('/special|pipe')({
4+
component: () => <div>Hello /special|pipe!</div>,
5+
})

‎e2e/react-router/basic-file-based/tests/app.spec.ts‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,3 +394,16 @@ test.describe('Pathless layout routes', () => {
394394
await expect(page.locator('body')).toContainText('Not Found')
395395
})
396396
})
397+
398+
test.describe('Special characters in route paths', () => {
399+
test('should render route with pipe character in path', async ({
400+
page,
401+
baseURL,
402+
}) => {
403+
await page.goto('/special|pipe')
404+
405+
await expect(page.locator('body')).toContainText('Hello /special|pipe!')
406+
407+
expect(page.url()).toBe(`${baseURL}/special%7Cpipe`)
408+
})
409+
})

0 commit comments

Comments
 (0)