Commit beff2f40 authored by Josh Story's avatar Josh Story

--no commit message

--no commit message
parent fb3ebba6
export default async function Page({
params,
}: {
params: Promise<{ catchall?: string[] }>
}) {
const { catchall } = await params
return (
<nav className="breadcrumbs-content">
<h3>Breadcrumbs</h3>
<p>Path: /{catchall ? catchall.join('/') : ''}</p>
</nav>
)
}
export default function Page() {
return (
<div>
<h2>Slot With Optional Catchall Page</h2>
<p>
The @breadcrumbs slot uses [[...catchall]] which matches all routes
including the root. No default.tsx should be required.
</p>
</div>
)
}
export default function Layout({
children,
breadcrumbs,
}: {
children: React.ReactNode
breadcrumbs: React.ReactNode
}) {
return (
<div className="optional-catchall-container">
<div className="breadcrumbs">{breadcrumbs}</div>
<div className="main">{children}</div>
</div>
)
}
export default function Page() {
return (
<div>
<h2>Nested Page</h2>
<p>A child route to ensure this is not a leaf segment.</p>
</div>
)
}
......@@ -67,6 +67,22 @@ describe('parallel-routes-leaf-segments-no-build-error', () => {
})
})
describe('parallel slot with optional catchall', () => {
it('should not require default.tsx when slot contains [[...catchall]]', async () => {
const $ = await next.render$('/slot-with-optional-catchall')
expect($('h2').text()).toBe('Slot With Optional Catchall Page')
expect($('.breadcrumbs-content h3').text()).toBe('Breadcrumbs')
})
it('should render the optional catchall slot for nested routes', async () => {
const $ = await next.render$('/slot-with-optional-catchall/nested')
expect($('h2').text()).toBe('Nested Page')
expect($('.breadcrumbs-content h3').text()).toBe('Breadcrumbs')
})
})
describe('no children slot', () => {
it('should render the no children slot', async () => {
const $ = await next.render$('/no-children/other')
......
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