-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
test(solid-router): add params test for basic file based #5642
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| import { createFileRoute, redirect } from '@tanstack/solid-router' | ||
|
|
||
| export const Route = createFileRoute('/params-ps/named/')({ | ||
| beforeLoad: () => { | ||
| throw redirect({ to: '/params-ps' }) | ||
| }, | ||
| }) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import { createFileRoute } from '@tanstack/solid-router' | ||
| export const Route = createFileRoute('/params-ps/named/prefix{$foo}')({ | ||
| component: RouteComponent, | ||
| }) | ||
|
|
||
| function RouteComponent() { | ||
| const p = Route.useParams() | ||
| return ( | ||
| <div> | ||
| <h3>ParamsNamedFooPrefix</h3> | ||
| <div data-testid="params-output">{JSON.stringify(p())}</div> | ||
| </div> | ||
| ) | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,14 @@ | ||||||||||||
| import { createFileRoute } from '@tanstack/solid-router' | ||||||||||||
| export const Route = createFileRoute('/params-ps/named/{$foo}suffix')({ | ||||||||||||
|
Comment on lines
+1
to
+2
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add blank line after import statement. The import statement should be followed by a blank line per project conventions. Apply this diff: import { createFileRoute } from '@tanstack/solid-router'
+
export const Route = createFileRoute('/params-ps/named/{$foo}suffix')({📝 Committable suggestion
Suggested change
🧰 Tools🪛 ESLint[error] 1-1: Expected 1 empty line after import statement not followed by another import. (import/newline-after-import) 🤖 Prompt for AI Agents |
||||||||||||
| component: RouteComponent, | ||||||||||||
| }) | ||||||||||||
|
|
||||||||||||
| function RouteComponent() { | ||||||||||||
| const p = Route.useParams() | ||||||||||||
| return ( | ||||||||||||
| <div> | ||||||||||||
| <h3>ParamsNamedFooSuffix</h3> | ||||||||||||
| <div data-testid="params-output">{JSON.stringify(p())}</div> | ||||||||||||
| </div> | ||||||||||||
| ) | ||||||||||||
| } | ||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| import { createFileRoute } from '@tanstack/solid-router' | ||
|
|
||
| export const Route = createFileRoute('/params-ps/non-nested/$foo_')() | ||
| export const Route = createFileRoute('/params-ps/non-nested/$foo')() |
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,14 @@ | ||||||||||||
| import { createFileRoute } from '@tanstack/solid-router' | ||||||||||||
| export const Route = createFileRoute('/params-ps/wildcard/$')({ | ||||||||||||
|
Comment on lines
+1
to
+2
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add blank line after import statement. The import statement should be followed by a blank line per project conventions. Apply this diff: import { createFileRoute } from '@tanstack/solid-router'
+
export const Route = createFileRoute('/params-ps/wildcard/$')({📝 Committable suggestion
Suggested change
🧰 Tools🪛 ESLint[error] 1-1: Expected 1 empty line after import statement not followed by another import. (import/newline-after-import) 🤖 Prompt for AI Agents |
||||||||||||
| component: RouteComponent, | ||||||||||||
| }) | ||||||||||||
|
|
||||||||||||
| function RouteComponent() { | ||||||||||||
| const p = Route.useParams() | ||||||||||||
| return ( | ||||||||||||
| <div> | ||||||||||||
| <h3>ParamsWildcardSplat</h3> | ||||||||||||
| <div data-testid="params-output">{JSON.stringify(p())}</div> | ||||||||||||
| </div> | ||||||||||||
| ) | ||||||||||||
| } | ||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| import { createFileRoute } from '@tanstack/solid-router' | ||
| import { redirect } from '@tanstack/solid-router' | ||
|
|
||
| export const Route = createFileRoute('/params-ps/wildcard/')({ | ||
| beforeLoad: () => { | ||
| throw redirect({ to: '/params-ps' }) | ||
| }, | ||
| }) |
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,14 @@ | ||||||||||||
| import { createFileRoute } from '@tanstack/solid-router' | ||||||||||||
| export const Route = createFileRoute('/params-ps/wildcard/prefix{$}')({ | ||||||||||||
|
Comment on lines
+1
to
+2
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add blank line after import statement. The import statement should be followed by a blank line per project conventions. Apply this diff: import { createFileRoute } from '@tanstack/solid-router'
+
export const Route = createFileRoute('/params-ps/wildcard/prefix{$}')({📝 Committable suggestion
Suggested change
🧰 Tools🪛 ESLint[error] 1-1: Expected 1 empty line after import statement not followed by another import. (import/newline-after-import) 🤖 Prompt for AI Agents |
||||||||||||
| component: RouteComponent, | ||||||||||||
| }) | ||||||||||||
|
|
||||||||||||
| function RouteComponent() { | ||||||||||||
| const p = Route.useParams() | ||||||||||||
| return ( | ||||||||||||
| <div> | ||||||||||||
| <h3>ParamsWildcardSplatPrefix</h3> | ||||||||||||
| <div data-testid="params-output">{JSON.stringify(p())}</div> | ||||||||||||
| </div> | ||||||||||||
| ) | ||||||||||||
| } | ||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import { createFileRoute } from '@tanstack/solid-router' | ||
| export const Route = createFileRoute('/params-ps/wildcard/{$}suffix')({ | ||
| component: RouteComponent, | ||
| }) | ||
|
|
||
| function RouteComponent() { | ||
| const p = Route.useParams() | ||
| return ( | ||
| <div> | ||
| <h3>ParamsWildcardSplatSuffix</h3> | ||
| <div data-testid="params-output">{JSON.stringify(p())}</div> | ||
| </div> | ||
| ) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add blank line after import statement.
The import statement should be followed by a blank line per project conventions.
Apply this diff:
import { createFileRoute } from '@tanstack/solid-router' + export const Route = createFileRoute('/params-ps/named/prefix{$foo}')({📝 Committable suggestion
🧰 Tools
🪛 ESLint
[error] 1-1: Expected 1 empty line after import statement not followed by another import.
(import/newline-after-import)
🤖 Prompt for AI Agents