mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
In https://github.com/vercel/next.js/pull/83003, `legacyBehavior` and `passHref` were removed from `<Link>`. However, this turned out to be a bit premature—despite most usage being covered by the newer `<Link>` APIs, there's some use cases we don't yet have good alternatives for. We expect to solve this with an API that uses Fragment Refs once they're available in React. For now, we're re-enabling these flags. --------- Co-authored-by: JJ Kasper <[email protected]>
27 lines
942 B
TypeScript
27 lines
942 B
TypeScript
import { nextTestSetup } from 'e2e-utils'
|
|
|
|
// NOTE: this test is checking for a bug in prefetching code,
|
|
// so we only enable it in production
|
|
|
|
describe('Link with legacyBehavior - handles buggy userspace ref merging', () => {
|
|
const { next } = nextTestSetup({
|
|
files: __dirname,
|
|
})
|
|
|
|
it('does not crash when Link unmounts', async () => {
|
|
const browser = await next.browser('/')
|
|
expect(await browser.elementByCss('h1').text()).toEqual('Home')
|
|
expect(await browser.hasElementByCssSelector('#test-link')).toBe(true)
|
|
|
|
// hide the link, unmounting it
|
|
await browser.elementByCss('button').click()
|
|
expect(await browser.hasElementByCssSelector('#test-link')).toBe(false)
|
|
|
|
// shouldn't cause a crash
|
|
expect(await browser.elementByCss('h1').text()).toEqual('Home')
|
|
expect(await browser.elementByCss('body').text()).not.toContain(
|
|
'Application error: a client-side exception has occurred'
|
|
)
|
|
})
|
|
})
|