test: add name re-export from client components as page case (#66760)
### What Add new test case where a named export from client component is being exported as page ### Why We found this case while investigating the errors triggered introduced by #66286 , adding this test to avoid future regression
This commit is contained in:
parent
b5d0a67912
commit
62e8c9dd45
7 changed files with 30 additions and 1 deletions
|
@ -0,0 +1,7 @@
|
|||
export default function RootLayout({ children }) {
|
||||
return (
|
||||
<html>
|
||||
<body>{children}</body>
|
||||
</html>
|
||||
)
|
||||
}
|
9
test/e2e/app-dir/rsc-basic/app/reexport-named/client.js
Normal file
9
test/e2e/app-dir/rsc-basic/app/reexport-named/client.js
Normal file
|
@ -0,0 +1,9 @@
|
|||
'use client'
|
||||
|
||||
export function PageComponent() {
|
||||
return (
|
||||
<div>
|
||||
<h1 id="client-title">Client Title</h1>
|
||||
</div>
|
||||
)
|
||||
}
|
3
test/e2e/app-dir/rsc-basic/app/reexport-named/page.js
Normal file
3
test/e2e/app-dir/rsc-basic/app/reexport-named/page.js
Normal file
|
@ -0,0 +1,3 @@
|
|||
import { PageComponent } from './client'
|
||||
|
||||
export default PageComponent
|
|
@ -1,5 +1,5 @@
|
|||
'use client'
|
||||
|
||||
export function Foo() {
|
||||
return <div>Foo</div>
|
||||
return <div id="foo">Foo</div>
|
||||
}
|
|
@ -109,6 +109,16 @@ describe('app dir - rsc basics', () => {
|
|||
expect($('#return-undefined-layout').html()).toBeEmpty()
|
||||
})
|
||||
|
||||
it('should handle named client components imported as page', async () => {
|
||||
const $ = await next.render$('/reexport-named')
|
||||
expect($('#client-title').text()).toBe('Client Title')
|
||||
})
|
||||
|
||||
it('should handle client components imported as namespace', async () => {
|
||||
const $ = await next.render$('/reexport-namespace')
|
||||
expect($('#foo').text()).toBe('Foo')
|
||||
})
|
||||
|
||||
it('should render server components correctly', async () => {
|
||||
const homeHTML = await next.render('/', null, {
|
||||
headers: {
|
||||
|
|
Loading…
Reference in a new issue