Commit 98aaf5c6 authored by Jimmy Lai's avatar Jimmy Lai

test: add failing test for #62656 - dynamic parallel route doesn't match static route

parent daca04d0
export default function ParallelDefault() {
return <p>Parallel: Default Fallback</p>
}
export default async function ParallelTestParamPage({
params,
}: {
params: Promise<{ testParam: string }>
}) {
const { testParam } = await params
return <p>Parallel: {testParam}</p>
}
export default function Default() {
return null
}
export default function RootLayout({
children,
parallel,
}: {
children: React.ReactNode
parallel: React.ReactNode
}) {
return (
<html>
<body>
<div id="children">{children}</div>
<div id="parallel">{parallel}</div>
</body>
</html>
)
}
export default function Home() {
return <p>Home</p>
}
export default async function TestParamPage({
params,
}: {
params: Promise<{ testParam: string }>
}) {
const { testParam } = await params
return <p>Children: {testParam}</p>
}
export default function StaticPage() {
return <p>Children: Static Page</p>
}
/**
* @type {import('next').NextConfig}
*/
const nextConfig = {}
module.exports = nextConfig
import { nextTestSetup } from 'e2e-utils'
describe('parallel-routes-dynamic-static-match', () => {
const { next } = nextTestSetup({
files: __dirname,
})
it('should match dynamic parallel route for dynamic path', async () => {
const browser = await next.browser('/test/dynamic-val')
// The children slot should render the dynamic [testParam] page
expect(await browser.elementById('children').text()).toContain(
'Children: dynamic-val'
)
// The parallel slot should also match via [testParam]
expect(await browser.elementById('parallel').text()).toContain(
'Parallel: dynamic-val'
)
})
it('should match dynamic parallel route for static path', async () => {
const browser = await next.browser('/test/static')
// The children slot should render the static page
expect(await browser.elementById('children').text()).toContain(
'Children: Static Page'
)
// The parallel slot should match via [testParam] with value "static",
// NOT fall back to the default.
// Bug #62656: this currently shows "Parallel: Default Fallback" instead.
expect(await browser.elementById('parallel').text()).toContain(
'Parallel: static'
)
})
})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment