Unverified Commit 1dc8da96 authored by Jan Kaifer's avatar Jan Kaifer Committed by GitHub

Test navigation between multiple root layouts (#43762)

Co-authored-by: 's avatarTim Neutkens <tim@timneutkens.nl>
Co-authored-by: 's avatarkodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
parent ef2672d6
import React from 'react'
export default function Layout({ children }) {
return (
<html>
<head></head>
<body>
<div id="root-a">{children}</div>
</body>
</html>
)
}
import React from 'react'
import Link from 'next/link'
export default function Page() {
return (
<Link href="../root-layout-b" id="link-to-b">
To b
</Link>
)
}
import React from 'react'
export default function Layout({ children }) {
return (
<html>
<head></head>
<body>
<div id="root-b">{children}</div>
</body>
</html>
)
}
import React from 'react'
import Link from 'next/link'
export default function Page() {
return (
<Link href="../root-layout-a" id="link-to-a">
To a
</Link>
)
}
......@@ -194,5 +194,17 @@ createNextDescribe(
expect(await browser.eval('window.__TEST_NO_RELOAD')).toBeUndefined()
})
})
it('should correctly handle navigation between multiple root layouts', async () => {
const browser = await next.browser('/root-layout-a')
await browser.waitForElementByCss('#root-a')
expect(await browser.hasElementByCssSelector('#root-b')).toBeFalse()
await browser
.elementById('link-to-b')
.click()
.waitForElementByCss('#root-b')
expect(await browser.hasElementByCssSelector('#root-a')).toBeFalse()
})
}
)
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