test: add test for parallel routes hmr (#67392)
### What? A test for #67222
This commit is contained in:
parent
18c2fa85ab
commit
a22858d6e7
5 changed files with 56 additions and 0 deletions
|
@ -0,0 +1,3 @@
|
||||||
|
export default function BarPage() {
|
||||||
|
return <div id="bar">Bar Page</div>
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
export default function FooPage() {
|
||||||
|
return <div id="foo">Foo Page</div>
|
||||||
|
}
|
14
test/development/app-dir/hmr-parallel-routes/app/layout.tsx
Normal file
14
test/development/app-dir/hmr-parallel-routes/app/layout.tsx
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
import { ReactNode } from 'react'
|
||||||
|
|
||||||
|
function Layout(props: { foo: ReactNode; bar: ReactNode }) {
|
||||||
|
return (
|
||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
{props.foo}
|
||||||
|
{props.bar}
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Layout
|
|
@ -0,0 +1,30 @@
|
||||||
|
import { nextTestSetup } from 'e2e-utils'
|
||||||
|
import { assertNoRedbox } from 'next-test-utils'
|
||||||
|
|
||||||
|
describe('hmr-parallel-routes', () => {
|
||||||
|
const { next } = nextTestSetup({
|
||||||
|
files: __dirname,
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should update parallel routes via HMR', async () => {
|
||||||
|
const browser = await next.browser('/')
|
||||||
|
expect(await browser.elementByCss('#bar').text()).toBe('Bar Page')
|
||||||
|
expect(await browser.elementByCss('#foo').text()).toBe('Foo Page')
|
||||||
|
|
||||||
|
await next.patchFile('app/@bar/page.tsx', (content) =>
|
||||||
|
content.replace('Bar Page', 'Bar Page Updated')
|
||||||
|
)
|
||||||
|
|
||||||
|
await assertNoRedbox(browser)
|
||||||
|
|
||||||
|
expect(await browser.elementByCss('#bar').text()).toBe('Bar Page Updated')
|
||||||
|
|
||||||
|
await next.patchFile('app/@foo/page.tsx', (content) =>
|
||||||
|
content.replace('Foo Page', 'Foo Page Updated')
|
||||||
|
)
|
||||||
|
|
||||||
|
await assertNoRedbox(browser)
|
||||||
|
|
||||||
|
expect(await browser.elementByCss('#foo').text()).toBe('Foo Page Updated')
|
||||||
|
})
|
||||||
|
})
|
|
@ -0,0 +1,6 @@
|
||||||
|
/**
|
||||||
|
* @type {import('next').NextConfig}
|
||||||
|
*/
|
||||||
|
const nextConfig = {}
|
||||||
|
|
||||||
|
module.exports = nextConfig
|
Loading…
Reference in a new issue