Skip to content
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

add explicit test for parallel routes in a root layout #65338

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions test/e2e/app-dir/parallel-routes-root-slot/app/@slot/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function Page() {
return '@slot rendered'
}
16 changes: 16 additions & 0 deletions test/e2e/app-dir/parallel-routes-root-slot/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
export default function Layout({
children,
slot,
}: {
children: React.ReactNode
slot: React.ReactNode
}) {
return (
<html>
<body>
{children}
{slot}
</body>
</html>
)
}
3 changes: 3 additions & 0 deletions test/e2e/app-dir/parallel-routes-root-slot/app/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function Page() {
return <div id="children-slot">@children rendered</div>
}
6 changes: 6 additions & 0 deletions test/e2e/app-dir/parallel-routes-root-slot/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/**
* @type {import('next').NextConfig}
*/
const nextConfig = {}

module.exports = nextConfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { nextTestSetup } from 'e2e-utils'

describe('parallel-routes-root-slot', () => {
const { next } = nextTestSetup({
files: __dirname,
})

it('Should render the root parallel route', async () => {
const browser = await next.browser('/')
// both the page slot (children) and the parallel slot should be rendered at the root layout
expect(await browser.elementByCss('body').text()).toContain(
'@children rendered'
)
expect(await browser.elementByCss('body').text()).toContain(
'@slot rendered'
)
})
})
Loading