-
Notifications
You must be signed in to change notification settings - Fork 27.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update next/link default legacyBehavior (#42623)
## Bug Fixes #42621 - [x] Related issues linked using `fixes #number` - [x] Integration tests added - [ ] Errors have a helpful link attached, see `contributing.md` Co-authored-by: JJ Kasper <[email protected]>
- Loading branch information
Showing
3 changed files
with
33 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
test/integration/link-with-multiple-child/test/index.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** | ||
* @jest-environment jsdom | ||
*/ | ||
import { render, screen } from '@testing-library/react' | ||
import Link from 'next/link' | ||
|
||
test('single child', () => { | ||
render(<Link href="https://nextjs.org/blog/next-13">Hello world</Link>) | ||
expect(screen.getByRole('link')).not.toBeNull() | ||
}) | ||
|
||
test('multiple child with default legacyBehavior', () => { | ||
render( | ||
<Link href="https://nextjs.org/blog/next-13"> | ||
<span>Hello world</span> | ||
<span>!</span> | ||
</Link> | ||
) | ||
expect(screen.getByRole('link')).not.toBeNull() | ||
}) | ||
|
||
test('multiple child with forced legacyBehavior=false', () => { | ||
render( | ||
<Link href="https://nextjs.org/blog/next-13" legacyBehavior={false}> | ||
<span>Hello world</span> | ||
<span>!</span> | ||
</Link> | ||
) | ||
expect(screen.getByRole('link')).not.toBeNull() | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters