Unverified Commit f2603289 authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

BREAKING CHANGE: Enable newNextLinkBehavior (#41459)

- Enable newNextLinkBehavior. See #36436 
- Run next/link codemod on test suite

Note that from when this lands on apps trying canary will need to run
the new-link codemod in order to upgrade.
Ideally we have to detect `<a>` while rendering the new link and warn
for it.
Co-authored-by: 's avatarSteven <steven@ceriously.com>
parent f5cb7bd8
......@@ -19,6 +19,30 @@ Codemods are transformations that run on your codebase programmatically. This al
## Next.js 13
### `new-link`
Safely removes `<a>` from `next/link` or adds `legacyBehavior` prop.
For example:
```jsx
export default function Page() {
return (
<Link href="/about">
<a>About Us</a>
</Link>
)
}
```
Transforms into:
```jsx
export default function Page() {
return <Link href="/about">About Us</Link>
}
```
### `next-image-to-legacy-image`
Safely migrates existing Next.js 10, 11, 12 applications importing `next/image` to the renamed `next/legacy/image` import in Next.js 13.
......
......@@ -233,7 +233,7 @@ import Link from 'next/link'
export default function IndexPage(props) {
return (
<Link href="/another" locale="fr">
<a>To /fr/another</a>
To /fr/another
</Link>
)
}
......@@ -279,7 +279,7 @@ import Link from 'next/link'
export default function IndexPage(props) {
return (
<Link href="/fr/another" locale={false}>
<a>To /fr/another</a>
To /fr/another
</Link>
)
}
......
......@@ -35,9 +35,7 @@ For example, using `/about` will automatically become `/docs/about` when `basePa
export default function HomePage() {
return (
<>
<Link href="/about">
<a>About Page</a>
</Link>
<Link href="/about">About Page</Link>
</>
)
}
......
......@@ -31,19 +31,13 @@ function Home() {
return (
<ul>
<li>
<Link href="/">
<a>Home</a>
</Link>
<Link href="/">Home</Link>
</li>
<li>
<Link href="/about">
<a>About Us</a>
</Link>
<Link href="/about">About Us</Link>
</li>
<li>
<Link href="/blog/hello-world">
<a>Blog Post</a>
</Link>
<Link href="/blog/hello-world">Blog Post</Link>
</li>
</ul>
)
......@@ -56,6 +50,7 @@ export default Home
- `href` - The path or URL to navigate to. This is the only required prop. It can also be an object, see [example here](/docs/api-reference/next/link.md#with-url-object)
- `as` - Optional decorator for the path that will be shown in the browser URL bar. Before Next.js 9.5.3 this was used for dynamic routes, check our [previous docs](https://nextjs.org/docs/tag/v9.5.2/api-reference/next/link#dynamic-routes) to see how it worked. Note: when this path differs from the one provided in `href` the previous `href`/`as` behavior is used as shown in the [previous docs](https://nextjs.org/docs/tag/v9.5.2/api-reference/next/link#dynamic-routes).
- [`legacyBehavior`](#if-the-child-is-a-tag) - Changes behavior so that child must be `<a>`. Defaults to `false`.
- [`passHref`](#if-the-child-is-a-custom-component-that-wraps-an-a-tag) - Forces `Link` to send the `href` property to its child. Defaults to `false`
- `prefetch` - Prefetch the page in the background. Defaults to `true`. Any `<Link />` that is in the viewport (initially or through scroll) will be preloaded. Prefetch can be disabled by passing `prefetch={false}`. When `prefetch` is set to `false`, prefetching will still occur on hover. Pages using [Static Generation](/docs/basic-features/data-fetching/get-static-props.md) will preload `JSON` files with the data for faster page transitions. Prefetching is only enabled in production.
- [`replace`](#replace-the-url-instead-of-push) - Replace the current `history` state instead of adding a new url into the stack. Defaults to `false`
......@@ -78,7 +73,7 @@ function Posts({ posts }) {
{posts.map((post) => (
<li key={post.id}>
<Link href={`/blog/${encodeURIComponent(post.slug)}`}>
<a>{post.title}</a>
{post.title}
</Link>
</li>
))}
......@@ -89,6 +84,22 @@ function Posts({ posts }) {
export default Posts
```
## If the child is `<a>` tag
```jsx
import Link from 'next/link'
function Legacy() {
return (
<Link href="/about" legacyBehavior>
<a>About Us</a>
</Link>
)
}
export default Legacy
```
## If the child is a custom component that wraps an `<a>` tag
If the child of `Link` is a custom component that wraps an `<a>` tag, you must add `passHref` to `Link`. This is necessary if you’re using libraries like [styled-components](https://styled-components.com/). Without this, the `<a>` tag will not have the `href` attribute, which hurts your site's accessibility and might affect SEO. If you're using [ESLint](/docs/basic-features/eslint.md#eslint-plugin), there is a built-in rule `next/link-passhref` to ensure correct usage of `passHref`.
......@@ -103,9 +114,8 @@ const RedLink = styled.a`
`
function NavLink({ href, name }) {
// Must add passHref to Link
return (
<Link href={href} passHref>
<Link href={href} passHref legacyBehavior>
<RedLink>{name}</RedLink>
</Link>
)
......@@ -119,7 +129,7 @@ export default NavLink
## If the child is a functional component
If the child of `Link` is a functional component, in addition to using `passHref`, you must wrap the component in [`React.forwardRef`](https://reactjs.org/docs/react-api.html#reactforwardref):
If the child of `Link` is a functional component, in addition to using `passHref` and `legacyBehavior`, you must wrap the component in [`React.forwardRef`](https://reactjs.org/docs/react-api.html#reactforwardref):
```jsx
import Link from 'next/link'
......@@ -136,7 +146,7 @@ const MyButton = React.forwardRef(({ onClick, href }, ref) => {
function Home() {
return (
<Link href="/about" passHref>
<Link href="/about" passHref legacyBehavior>
<MyButton />
</Link>
)
......@@ -162,7 +172,7 @@ function Home() {
query: { name: 'test' },
}}
>
<a>About us</a>
About us
</Link>
</li>
<li>
......@@ -172,7 +182,7 @@ function Home() {
query: { slug: 'my-post' },
}}
>
<a>Blog Post</a>
Blog Post
</Link>
</li>
</ul>
......@@ -195,7 +205,7 @@ The default behavior of the `Link` component is to `push` a new URL into the `hi
```jsx
<Link href="/about" replace>
<a>About us</a>
About us
</Link>
```
......@@ -205,6 +215,6 @@ The default behavior of `Link` is to scroll to the top of the page. When there i
```jsx
<Link href="/#hashid" scroll={false}>
<a>Disables scrolling to the top</a>
Disables scrolling to the top
</Link>
```
......@@ -156,11 +156,7 @@ export default function Page(props) {
<h1>Page: {router.query.slug}</h1>
<p>Count: {count}</p>
<button onClick={() => setCount(count + 1)}>Increase count</button>
<Link href="/one">
<a>one</a>
</Link> <Link href="/two">
<a>two</a>
</Link>
<Link href="/one">one</Link> <Link href="/two">two</Link>
</div>
)
}
......
......@@ -78,15 +78,11 @@ export default function Home() {
import Link from 'next/link'
export default function Home() {
return (
<Link href="/blog">
<a>blog</a>
</Link>
)
return <Link href="/blog">blog</Link>
}
```
Update any import statements, switch `to` to `href`, and add an `<a>` tag as a child of the element.
Update any import statements, switch `to` to `href`.
## Data Fetching
......
......@@ -34,7 +34,7 @@ import Link from 'next/link'
export default function App() {
return (
<Link href="/about">
<a>About</a>
About
</Link>
)
}
......
......@@ -63,18 +63,14 @@ function Home() {
return (
<ul>
<li>
<Link href="/post/abc">
<a>Go to pages/post/[pid].js</a>
</Link>
<Link href="/post/abc">Go to pages/post/[pid].js</Link>
</li>
<li>
<Link href="/post/abc?foo=bar">
<a>Also goes to pages/post/[pid].js</a>
</Link>
<Link href="/post/abc?foo=bar">Also goes to pages/post/[pid].js</Link>
</li>
<li>
<Link href="/post/abc/a-comment">
<a>Go to pages/post/[pid]/[comment].js</a>
Go to pages/post/[pid]/[comment].js
</Link>
</li>
</ul>
......
......@@ -47,19 +47,13 @@ function Home() {
return (
<ul>
<li>
<Link href="/">
<a>Home</a>
</Link>
<Link href="/">Home</Link>
</li>
<li>
<Link href="/about">
<a>About Us</a>
</Link>
<Link href="/about">About Us</Link>
</li>
<li>
<Link href="/blog/hello-world">
<a>Blog Post</a>
</Link>
<Link href="/blog/hello-world">Blog Post</Link>
</li>
</ul>
)
......@@ -89,7 +83,7 @@ function Posts({ posts }) {
{posts.map((post) => (
<li key={post.id}>
<Link href={`/blog/${encodeURIComponent(post.slug)}`}>
<a>{post.title}</a>
{post.title}
</Link>
</li>
))}
......@@ -118,7 +112,7 @@ function Posts({ posts }) {
query: { slug: post.slug },
}}
>
<a>{post.title}</a>
{post.title}
</Link>
</li>
))}
......
......@@ -66,9 +66,7 @@ import Link from 'next/link'
export default function Home() {
return (
<nav>
<Link href="/about">
<a>About</a>
</Link>
<Link href="/about">About</Link>
</nav>
)
}
......@@ -183,9 +181,7 @@ import Link from 'next/link'
export default function Home() {
return (
<nav>
<Link href="/about">
<a>About</a>
</Link>
<Link href="/about">About</Link>
</nav>
)
}
......
......@@ -11,6 +11,8 @@ The minimum Node.js version has been bumped from 12.22.0 to 14.0.0, since 12.x h
The `next/image` import was renamed to `next/legacy/image`. The `next/future/image` import was renamed to `next/image`.
A [codemod is available](/docs/advanced-features/codemods.md#next-image-to-legacy-image) to safely and automatically rename your imports.
The `next/link` child can no longer be `<a>`. Add the `legacyBehavior` prop to use the legacy behavior or remove the `<a>` to upgrade. A [codemod is available](/docs/advanced-features/codemods.md#new-link) to automatically upgrade your code.
## Upgrading to 12.2
If you were using Middleware prior to `12.2`, please see the [upgrade guide](https://nextjs.org/docs/messages/middleware-upgrade-guide) for more information.
......
import { loadEnvConfig } from '@next/env'
import { resolve, join } from 'path'
import loadConfig from '../../server/config'
import { NextConfigComplete } from '../../server/config-shared'
import type { NextConfigComplete } from '../../server/config-shared'
import { PHASE_TEST } from '../../shared/lib/constants'
import loadJsConfig from '../load-jsconfig'
import * as Log from '../output/log'
......
......@@ -556,8 +556,7 @@ export const defaultConfig: NextConfig = {
// TODO: change default in next major release (current v12.1.5)
legacyBrowsers: true,
browsersListForSwc: false,
// TODO: change default in next major release (current v12.1.5)
newNextLinkBehavior: false,
newNextLinkBehavior: true,
cpus: Math.max(
1,
(Number(process.env.CIRCLE_NODE_TOTAL) ||
......
......@@ -2,8 +2,8 @@ import Link from 'next/link'
export default () => (
<div>
<Link href="/hmr/error-in-gip">
<a id="error-in-gip-link">Bad Page</a>
<Link href="/hmr/error-in-gip" id="error-in-gip-link">
Bad Page
</Link>
</div>
)
......@@ -4,7 +4,7 @@ export default function IndexPage() {
return (
<div>
<Link href="/about" prefetch>
<a>To About Page</a>
To About Page
</Link>
</div>
)
......
......@@ -3,9 +3,7 @@ import Link from 'next/link'
export default function NoPrefetchPage() {
return (
<div>
<Link href="/about">
<a>No prefetch</a>
</Link>
<Link href="/about">No prefetch</Link>
</div>
)
}
......@@ -4,7 +4,7 @@ export default function PrefetchFalsePage() {
return (
<div>
<Link href="/about" prefetch={false}>
<a>Prefetch set to false</a>
Prefetch set to false
</Link>
</div>
)
......
......@@ -2,8 +2,6 @@ import Link from 'next/link'
export default () => (
<div>
<Link href="/dynamic/no-chunk">
<a>No Chunk</a>
</Link>
<Link href="/dynamic/no-chunk">No Chunk</Link>
</div>
)
......@@ -2,8 +2,8 @@ import Link from 'next/link'
export default () => (
<div>
<Link href="/hmr/error-in-gip">
<a id="error-in-gip-link">Bad Page</a>
<Link href="/hmr/error-in-gip" id="error-in-gip-link">
Bad Page
</Link>
</div>
)
......@@ -4,7 +4,7 @@ export default function IndexPage() {
return (
<div>
<Link href="/about" prefetch>
<a>To About Page</a>
To About Page
</Link>
</div>
)
......
......@@ -3,9 +3,7 @@ import Link from 'next/link'
export default function NoPrefetchPage() {
return (
<div>
<Link href="/about">
<a>No prefetch</a>
</Link>
<Link href="/about">No prefetch</Link>
</div>
)
}
......@@ -4,7 +4,7 @@ export default function PrefetchFalsePage() {
return (
<div>
<Link href="/about" prefetch={false}>
<a>Prefetch set to false</a>
Prefetch set to false
</Link>
</div>
)
......
......@@ -2,8 +2,6 @@ import Link from 'next/link'
export default () => (
<div>
<Link href="/dynamic/no-chunk">
<a>No Chunk</a>
</Link>
<Link href="/dynamic/no-chunk">No Chunk</Link>
</div>
)
......@@ -2,8 +2,8 @@ import Link from 'next/link'
export default function HomePage() {
return (
<>
<Link href="/dashboard">
<a id="to-dashboard">To Dashboard</a>
<Link href="/dashboard" id="to-dashboard">
To Dashboard
</Link>
</>
)
......
......@@ -10,34 +10,34 @@ export default function Page({ params }) {
<p id="page">/blog/[author]</p>
<p id="params">{JSON.stringify(params)}</p>
<p id="date">{Date.now()}</p>
<Link href="/blog/tim">
<a id="author-1">/blog/tim</a>
<Link href="/blog/tim" id="author-1">
/blog/tim
</Link>
<br />
<Link href="/blog/seb">
<a id="author-2">/blog/seb</a>
<Link href="/blog/seb" id="author-2">
/blog/seb
</Link>
<br />
<Link href="/blog/styfle">
<a id="author-3">/blog/styfle</a>
<Link href="/blog/styfle" id="author-3">
/blog/styfle
</Link>
<br />
<Link href="/blog/tim/first-post">
<a id="author-1-post-1">/blog/tim/first-post</a>
<Link href="/blog/tim/first-post" id="author-1-post-1">
/blog/tim/first-post
</Link>
<br />
<Link href="/blog/seb/second-post">
<a id="author-2-post-1">/blog/seb/second-post</a>
<Link href="/blog/seb/second-post" id="author-2-post-1">
/blog/seb/second-post
</Link>
<br />
<Link href="/blog/styfle/first-post">
<a id="author-3-post-1">/blog/styfle/first-post</a>
<Link href="/blog/styfle/first-post" id="author-3-post-1">
/blog/styfle/first-post
</Link>
<br />
<Link href="/dynamic-no-gen-params/first">
<a id="dynamic-no-params">/dynamic-no-gen-params/first</a>
<Link href="/dynamic-no-gen-params/first" id="dynamic-no-params">
/dynamic-no-gen-params/first
</Link>
<br />
</>
......
......@@ -6,13 +6,13 @@ export default function Page({ params }) {
<p id="page">/dynamic-no-gen-params</p>
<p id="params">{JSON.stringify(params)}</p>
<Link href="/dynamic-no-gen-params/second">
<a id="dynamic-no-params-again">/dynamic-no-gen-params/second</a>
<Link href="/dynamic-no-gen-params/second" id="dynamic-no-params-again">
/dynamic-no-gen-params/second
</Link>
<br />
<Link href="/blog/styfle">
<a id="to-blog">/blog/styfle</a>
<Link href="/blog/styfle" id="to-blog">
/blog/styfle
</Link>
<br />
</>
......
......@@ -4,13 +4,16 @@ export default function Page() {
return (
<>
<div>
<Link href="/catch-all/this/is/a/test">
<a id="to-catch-all">To catch-all</a>
<Link href="/catch-all/this/is/a/test" id="to-catch-all">
To catch-all
</Link>
</div>
<div>
<Link href="/catch-all-optional/this/is/a/test">
<a id="to-catch-all-optional">To optional catch-all</a>
<Link
href="/catch-all-optional/this/is/a/test"
id="to-catch-all-optional"
>
To optional catch-all
</Link>
</div>
</>
......
......@@ -4,13 +4,13 @@ export default function Page() {
return (
<div>
<div>
<Link href="/internal/test/rewrite">
<a id="navigate-rewrite">Navigate Rewrite</a>
<Link href="/internal/test/rewrite" id="navigate-rewrite">
Navigate Rewrite
</Link>
</div>
<div>
<Link href="/internal/test/redirect">
<a id="navigate-redirect">Navigate Redirect</a>
<Link href="/internal/test/redirect" id="navigate-redirect">
Navigate Redirect
</Link>
</div>
</div>
......
......@@ -6,8 +6,8 @@ export default function Page({ params }) {
return (
<>
<h1 id={`render-id-${params.id}`}>{nanoid()}</h1>{' '}
<Link href={`/link-hard-push/${other}`}>
<a id="link">To {other}</a>
<Link href={`/link-hard-push/${other}`} id="link">
To{other}
</Link>
</>
)
......
......@@ -6,8 +6,8 @@ export default function Page({ params }) {
return (
<>
<h1 id={`render-id-${params.id}`}>{nanoid()}</h1>{' '}
<Link href={`/link-hard-replace/${other}`} replace>
<a id="link">To {other}</a>
<Link href={`/link-hard-replace/${other}`} replace id="link">
To{other}
</Link>
</>
)
......
......@@ -5,11 +5,11 @@ export default function Page() {
return (
<>
<h1 id="render-id">{nanoid()}</h1>
<Link href="/link-hard-replace" replace>
<a id="self-link">Self Link</a>
<Link href="/link-hard-replace" replace id="self-link">
Self Link
</Link>
<Link href="/link-hard-replace/subpage" replace>
<a id="subpage-link">Subpage</a>
<Link href="/link-hard-replace/subpage" replace id="subpage-link">
Subpage
</Link>
</>
)
......
......@@ -2,8 +2,8 @@ import Link from 'next/link'
export default function Page() {
return (
<Link href="/link-hard-replace" replace>
<a id="back-link">Self Link</a>
<Link href="/link-hard-replace" replace id="back-link">
Self Link
</Link>
)
}
......@@ -2,8 +2,8 @@ import Link from 'next/link'
export default function Page() {
return (
<Link href="/with-id">
<a id="link">With ID</a>
<Link href="/with-id" id="link">
With ID
</Link>
)
}
......@@ -5,11 +5,11 @@ export default function Page() {
return (
<>
<h1 id="render-id">{nanoid()}</h1>
<Link href="/link-soft-replace" replace>
<a id="self-link">Self Link</a>
<Link href="/link-soft-replace" replace id="self-link">
Self Link
</Link>
<Link href="/link-soft-replace/subpage" replace>
<a id="subpage-link">Subpage</a>
<Link href="/link-soft-replace/subpage" replace id="subpage-link">
Subpage
</Link>
</>
)
......
......@@ -2,8 +2,8 @@ import Link from 'next/link'
export default function Page() {
return (
<Link href="/link-soft-replace" replace>
<a id="back-link">Self Link</a>
<Link href="/link-soft-replace" replace id="back-link">
Self Link
</Link>
)
}
......@@ -6,8 +6,9 @@ export default function Page() {
<Link
href="/dashboard/deployments/info/[id]"
as="/dashboard/deployments/info/123"
id="link-to-info-123"
>
<a id="link-to-info-123">To info 123</a>
To info 123
</Link>
</>
)
......
......@@ -2,8 +2,8 @@ import Link from 'next/link'
export const TabNavItem = ({ children, href }) => {
return (
<Link href={href}>
<a style={{ margin: '10px', display: 'block' }}>{children}</a>
<Link href={href} style={{ margin: '10px', display: 'block' }}>
{children}
</Link>
)
}
......@@ -2,8 +2,8 @@ import Link from 'next/link'
export default function Page(props) {
return (
<Link href="/app-linking">
<a id="app-link">To Pages Page</a>
<Link href="/app-linking" id="app-link">
To Pages Page
</Link>
)
}
......@@ -3,8 +3,8 @@ import Link from 'next/link'
export default function Page() {
return (
<>
<Link href="/redirect/a">
<a id="redirect-a">To Dashboard through /redirect/a</a>
<Link href="/redirect/a" id="redirect-a">
To Dashboard through /redirect/a
</Link>
</>
)
......
......@@ -3,8 +3,8 @@ import Link from 'next/link'
export default function Page() {
return (
<>
<Link href="/redirect-middleware-to-dashboard">
<a id="redirect-middleware">To Dashboard through /redirect/a</a>
<Link href="/redirect-middleware-to-dashboard" id="redirect-middleware">
To Dashboard through /redirect/a
</Link>
</>
)
......
......@@ -2,8 +2,8 @@ import Link from 'next/link'
export default function Page() {
return (
<Link href="/rewritten-to-dashboard">
<a id="link">To Dashboard Rewritten</a>
<Link href="/rewritten-to-dashboard" id="link">
To Dashboard Rewritten
</Link>
)
}
......@@ -4,8 +4,8 @@ export default function Page() {
return (
<>
<h1 id="first-page">hello from same-layout/first</h1>
<Link href="/same-layout/second">
<a id="link">To Second</a>
<Link href="/same-layout/second" id="link">
To Second
</Link>
</>
)
......
......@@ -4,8 +4,8 @@ export default function Page() {
return (
<>
<h1 id="second-page">hello from same-layout/second</h1>
<Link href="/same-layout/first">
<a id="link">To First</a>
<Link href="/same-layout/first" id="link">
To First
</Link>
</>
)
......
......@@ -3,8 +3,8 @@ export default function Page() {
return (
<>
<p id="other-page">Other Page</p>
<Link href="/template/clientcomponent">
<a id="link">To Page</a>
<Link href="/template/clientcomponent" id="link">
To Page
</Link>
</>
)
......
......@@ -4,8 +4,8 @@ export default function Page() {
return (
<>
<p id="page">Page</p>
<Link href="/template/clientcomponent/other">
<a id="link">To Other</a>
<Link href="/template/clientcomponent/other" id="link">
To Other
</Link>
</>
)
......
......@@ -3,8 +3,8 @@ export default function Page() {
return (
<>
<p id="other-page">Other Page</p>
<Link href="/template/servercomponent">
<a id="link">To Page</a>
<Link href="/template/servercomponent" id="link">
To Page
</Link>
</>
)
......
......@@ -4,8 +4,8 @@ export default function Page() {
return (
<>
<p id="page">Page</p>
<Link href="/template/servercomponent/other">
<a id="link">To Other</a>
<Link href="/template/servercomponent/other" id="link">
To Other
</Link>
</>
)
......
......@@ -5,8 +5,8 @@ export default function Page() {
return (
<>
<h1 id="render-id">{nanoid()}</h1>
<Link href="/navigation">
<a id="link">To Navigation</a>
<Link href="/navigation" id="link">
To Navigation
</Link>
</>
)
......
......@@ -2,8 +2,8 @@ import Link from 'next/link'
export default function Page(props) {
return (
<Link href="/pages-linking">
<a id="pages-link">To App Page</a>
<Link href="/pages-linking" id="pages-link">
To App Page
</Link>
)
}
......@@ -3,8 +3,8 @@ import Link from 'next/link'
export default function Page(props) {
return (
<>
<Link href="/exists-but-not-routed">
<a id="link-to-rewritten-path">Exists but not routed</a>
<Link href="/exists-but-not-routed" id="link-to-rewritten-path">
Exists but not routed
</Link>
</>
)
......
......@@ -3,8 +3,8 @@ export default function HomePage() {
return (
<>
<p>
<Link href="/a/">
<a id="to-a-trailing-slash">To a with trailing slash</a>
<Link href="/a/" id="to-a-trailing-slash">
To a with trailing slash
</Link>
</p>
</>
......
......@@ -8,8 +8,8 @@ export default function LinkPage({ searchParams }) {
<>
<h3 id="query">query:{id}</h3>
<div>
<Link href={`/next-api/link?id=${id + 1}`}>
<a id="next_id">next id</a>
<Link href={`/next-api/link?id=${id + 1}`} id="next_id">
next id
</Link>
</div>
<Nav />
......
......@@ -4,18 +4,18 @@ export default function Nav() {
return (
<>
<div>
<Link href={'/next-api/link'}>
<a id="goto-next-link">next link</a>
<Link href={'/next-api/link'} id="goto-next-link">
next link
</Link>
</div>
<div>
<Link href={'/streaming-rsc'}>
<a id="goto-streaming-rsc">streaming rsc</a>
<Link href={'/streaming-rsc'} id="goto-streaming-rsc">
streaming rsc
</Link>
</div>
<div>
<Link href={'/root'}>
<a id="goto-home">home</a>
<Link href={'/root'} id="goto-home">
home
</Link>
</div>
</>
......
......@@ -3,8 +3,8 @@ export default function HomePage() {
return (
<>
<p>
<Link href="/a/">
<a id="to-a-trailing-slash">To a with trailing slash</a>
<Link href="/a/" id="to-a-trailing-slash">
To a with trailing slash
</Link>
</p>
</>
......
......@@ -13,11 +13,12 @@ export default function Page({ port }) {
const router = useRouter()
return (
<>
<Link href={`http://localhost:${port}${router.basePath}/something-else`}>
<a id="absolute-link">
http://localhost:{port}
{router.basePath}/something-else
</a>
<Link
href={`http://localhost:${port}${router.basePath}/something-else`}
id="absolute-link"
>
http://localhost:{port}
{router.basePath}/something-else
</Link>
</>
)
......
......@@ -11,8 +11,11 @@ export async function getServerSideProps({ query: { port } }) {
export default function Page({ port }) {
return (
<>
<Link href={`http://localhost:${port}/rewrite-no-basepath`}>
<a id="absolute-link">http://localhost:{port}/rewrite-no-basepath</a>
<Link
href={`http://localhost:${port}/rewrite-no-basepath`}
id="absolute-link"
>
http://localhost:{port}/rewrite-no-basepath
</Link>
</>
)
......
......@@ -4,12 +4,12 @@ import Link from 'next/link'
export default function Page() {
return (
<>
<Link href="https://vercel.com/">
<a id="absolute-link">https://vercel.com/</a>
<Link href="https://vercel.com/" id="absolute-link">
https://vercel.com/
</Link>
<br />
<Link href="mailto:idk@idk.com">
<a id="mailto-link">mailto:idk@idk.com</a>
<Link href="mailto:idk@idk.com" id="mailto-link">
mailto:idk@idk.com
</Link>
</>
)
......
......@@ -3,49 +3,39 @@ import { useRouter } from 'next/router'
const Page = () => (
<>
<Link href="/other-page">
<a id="other-page-link">
<h1>Hello World</h1>
</a>
<Link href="/other-page" id="other-page-link">
<h1>Hello World</h1>
</Link>
<br />
<Link href="/gsp">
<a id="gsp-link">
<h1>getStaticProps</h1>
</a>
<Link href="/gsp" id="gsp-link">
<h1>getStaticProps</h1>
</Link>
<br />
<Link href="/gssp">
<a id="gssp-link">
<h1>getServerSideProps</h1>
</a>
<Link href="/gssp" id="gssp-link">
<h1>getServerSideProps</h1>
</Link>
<br />
<Link href="/[slug]" as="/first">
<a id="dynamic-link">
<h1>dynamic page</h1>
</a>
<Link href="/[slug]" as="/first" id="dynamic-link">
<h1>dynamic page</h1>
</Link>
<br />
<Link href="/catchall/[...parts]" as="/catchall/hello/world">
<a id="catchall-link">
<h1>catchall page</h1>
</a>
<Link
href="/catchall/[...parts]"
as="/catchall/hello/world"
id="catchall-link"
>
<h1>catchall page</h1>
</Link>
<br />
<Link href="/">
<a id="index-gsp">
<h1>index getStaticProps</h1>
</a>
<Link href="/" id="index-gsp">
<h1>index getStaticProps</h1>
</Link>
<br />
<Link href="/index">
<a id="nested-index-gsp">
<h1>nested index getStaticProps</h1>
</a>
<Link href="/index" id="nested-index-gsp">
<h1>nested index getStaticProps</h1>
</Link>
<Link href="#hashlink">
<a id="hashlink">Hash Link</a>
<Link href="#hashlink" id="hashlink">
Hash Link
</Link>
<br />
<div id="base-path">{useRouter().basePath}</div>
......@@ -60,23 +50,17 @@ const Page = () => (
</div>
<br />
<div id="as-path">{useRouter().asPath}</div>
<Link href="/slow-route">
<a id="slow-route">
<h1>Slow route</h1>
</a>
<Link href="/slow-route" id="slow-route">
<h1>Slow route</h1>
</Link>
<Link href="/error-route">
<a id="error-route">
<h1>Error route</h1>
</a>
<Link href="/error-route" id="error-route">
<h1>Error route</h1>
</Link>
<Link href="/hello#some-hash">
<a id="hash-change">
<h1>Hash change</h1>
</a>
<Link href="/hello#some-hash" id="hash-change">
<h1>Hash change</h1>
</Link>
<Link href="/something-else" as="/hello">
<a id="something-else-link">to something else</a>
<Link href="/something-else" as="/hello" id="something-else-link">
to something else
</Link>
</>
)
......
......@@ -20,8 +20,8 @@ export default function Index({ hello, nested }) {
<p id="query">{JSON.stringify(query)}</p>
<p id="pathname">{pathname}</p>
<p id="as-path">{asPath}</p>
<Link href="/hello">
<a id="hello-link">to /hello</a>
<Link href="/hello" id="hello-link">
to /hello
</Link>
</>
)
......
......@@ -3,10 +3,8 @@ import { useRouter } from 'next/router'
const Page = () => (
<>
<Link href={`${useRouter().basePath}/other-page`}>
<a id="other-page-link">
<h1>Hello World</h1>
</a>
<Link href={`${useRouter().basePath}/other-page`} id="other-page-link">
<h1>Hello World</h1>
</Link>
</>
)
......
......@@ -3,8 +3,8 @@ import Link from 'next/link'
export default function Page() {
return (
<>
<Link href="/">
<a id="link-back">back</a>
<Link href="/" id="link-back">
back
</Link>
</>
)
......
......@@ -23,8 +23,8 @@ describe('Dynamic Route Interpolation', () => {
return (
<>
<p id="slug">{props.slug}</p>
<Link href={router.asPath}>
<a id="now">{props.now}</a>
<Link id="now" href={router.asPath}>
{props.now}
</Link>
</>
)
......
......@@ -19,12 +19,12 @@ export default ({ world, time }) => (
<>
<p>hello {world}</p>
<span id="anotherTime">time: {time}</span>
<Link href="/">
<a id="home">to home</a>
<Link href="/" id="home">
to home
</Link>
<br />
<Link href="/something">
<a id="something">to something</a>
<Link href="/something" id="something">
to something
</Link>
</>
)
......@@ -17,8 +17,8 @@ export default ({ post, comment, time }) => {
<p>Post: {post}</p>
<p>Comment: {comment}</p>
<span>time: {time}</span>
<Link href="/">
<a id="home">to home</a>
<Link href="/" id="home">
to home
</Link>
</>
)
......
......@@ -36,8 +36,8 @@ export default ({ post, time, params, appProps, resolvedUrl }) => {
<div id="app-url">{appProps.url}</div>
<div id="resolved-url">{resolvedUrl}</div>
<div id="as-path">{router.asPath}</div>
<Link href="/">
<a id="home">to home</a>
<Link href="/" id="home">
to home
</Link>
</>
)
......
......@@ -15,8 +15,8 @@ export default ({ slugs, time }) => {
<>
<p>Posts: {JSON.stringify(slugs)}</p>
<span>time: {time}</span>
<Link href="/">
<a id="home">to home</a>
<Link href="/" id="home">
to home
</Link>
</>
)
......
......@@ -21,12 +21,12 @@ export default ({ world, time, params, random }) => {
<div id="random">{random}</div>
<div id="params">{JSON.stringify(params)}</div>
<div id="query">{JSON.stringify(useRouter().query)}</div>
<Link href="/">
<a id="home">to home</a>
<Link href="/" id="home">
to home
</Link>
<br />
<Link href="/another">
<a id="another">to another</a>
<Link href="/another" id="another">
to another
</Link>
</>
)
......
......@@ -13,12 +13,12 @@ export default ({ world, time }) => (
<>
<p>hello {world}</p>
<span>time: {time}</span>
<Link href="/">
<a id="home">to home</a>
<Link href="/" id="home">
to home
</Link>
<br />
<Link href="/something">
<a id="something">to something</a>
<Link href="/something" id="something">
to something
</Link>
</>
)
......@@ -56,38 +56,42 @@ const Page = ({ world, time, url }) => {
<>
<p>hello {world}</p>
<span>time: {time}</span>
<Link href="/non-json">
<a id="non-json">to non-json</a>
<Link href="/non-json" id="non-json">
to non-json
</Link>
<br />
<Link href="/another">
<a id="another">to another</a>
<Link href="/another" id="another">
to another
</Link>
<br />
<Link href="/something">
<a id="something">to something</a>
<Link href="/something" id="something">
to something
</Link>
<br />
<Link href="/normal">
<a id="normal">to normal</a>
<Link href="/normal" id="normal">
to normal
</Link>
<br />
<Link href="/slow">
<a id="slow">to slow</a>
<Link href="/slow" id="slow">
to slow
</Link>
<br />
<Link href="/blog/[post]" as="/blog/post-1">
<a id="post-1">to dynamic</a>
<Link href="/blog/[post]" as="/blog/post-1" id="post-1">
to dynamic
</Link>
<Link href="/blog/[post]" as="/blog/post-100">
<a id="broken-post">to broken</a>
<Link href="/blog/[post]" as="/blog/post-100" id="broken-post">
to broken
</Link>
<br />
<Link href="/blog/[post]/[comment]" as="/blog/post-1/comment-1">
<a id="comment-1">to another dynamic</a>
<Link
href="/blog/[post]/[comment]"
as="/blog/post-1/comment-1"
id="comment-1"
>
to another dynamic
</Link>
<Link href="/something?another=thing">
<a id="something-query">to something?another=thing</a>
<Link href="/something?another=thing" id="something-query">
to something?another=thing
</Link>
</>
)
......
......@@ -21,12 +21,12 @@ export default ({ world, time, params, random, query }) => {
<div id="params">{JSON.stringify(params)}</div>
<div id="initial-query">{JSON.stringify(query)}</div>
<div id="query">{JSON.stringify(useRouter().query)}</div>
<Link href="/">
<a id="home">to home</a>
<Link href="/" id="home">
to home
</Link>
<br />
<Link href="/another">
<a id="another">to another</a>
<Link href="/another" id="another">
to another
</Link>
</>
)
......
......@@ -11,8 +11,8 @@ export default function Page(props) {
<p id="router-query">{JSON.stringify(router.query)}</p>
<p id="router-pathname">{router.pathname}</p>
<p id="router-as-path">{router.asPath}</p>
<Link href="/">
<a id="to-index">to /</a>
<Link href="/" id="to-index">
to /
</Link>
<br />
</>
......
......@@ -11,8 +11,8 @@ export default function Page(props) {
<p id="router-query">{JSON.stringify(router.query)}</p>
<p id="router-pathname">{router.pathname}</p>
<p id="router-as-path">{router.asPath}</p>
<Link href="/">
<a id="to-index">to /</a>
<Link href="/" id="to-index">
to /
</Link>
<br />
</>
......
......@@ -15,12 +15,12 @@ export default ({ count }) => (
<>
<p>a slow page</p>
<p id="hit">hit: {count}</p>
<Link href="/">
<a id="home">to home</a>
<Link href="/" id="home">
to home
</Link>
<br />
<Link href="/something">
<a id="something">to something</a>
<Link href="/something" id="something">
to something
</Link>
</>
)
......@@ -38,12 +38,12 @@ export default ({
<div id="app-url">{appProps.url}</div>
<div id="resolved-url">{resolvedUrl}</div>
<div id="as-path">{router.asPath}</div>
<Link href="/">
<a id="home">to home</a>
<Link href="/" id="home">
to home
</Link>
<br />
<Link href="/another">
<a id="another">to another</a>
<Link href="/another" id="another">
to another
</Link>
</>
)
......
......@@ -15,8 +15,8 @@ export default ({ user, time }) => {
<>
<p>User: {user}</p>
<span>time: {time}</span>
<Link href="/">
<a id="home">to home</a>
<Link href="/" id="home">
to home
</Link>
</>
)
......
......@@ -3,38 +3,40 @@ import Link from 'next/link'
export default function Component() {
return (
<>
<Link href="/gssp-redirect/en">
<a id="to-gssp-redirect-en">to /gssp-redirect/en"</a>
<Link href="/gssp-redirect/en" id="to-gssp-redirect-en">
to /gssp-redirect/en"
</Link>
<Link href="/gssp-redirect/sv">
<a id="to-gssp-redirect-sv">to /gssp-redirect/sv"</a>
<Link href="/gssp-redirect/sv" id="to-gssp-redirect-sv">
to /gssp-redirect/sv"
</Link>
<Link href="/gssp-redirect/from-ctx">
<a id="to-gssp-redirect-from-ctx">to /gssp-redirect/from-ctx</a>
<Link href="/gssp-redirect/from-ctx" id="to-gssp-redirect-from-ctx">
to /gssp-redirect/from-ctx
</Link>
<Link href="/gsp-blocking-redirect/en">
<a id="to-gsp-blocking-redirect-en">to /gsp-blocking-redirect/en"</a>
<Link href="/gsp-blocking-redirect/en" id="to-gsp-blocking-redirect-en">
to /gsp-blocking-redirect/en"
</Link>
<Link href="/gsp-blocking-redirect/sv">
<a id="to-gsp-blocking-redirect-sv">to /gsp-blocking-redirect/sv"</a>
<Link href="/gsp-blocking-redirect/sv" id="to-gsp-blocking-redirect-sv">
to /gsp-blocking-redirect/sv"
</Link>
<Link href="/gsp-blocking-redirect/from-ctx">
<a id="to-gsp-blocking-redirect-from-ctx">
to /gsp-blocking-redirect/from-ctx
</a>
<Link
href="/gsp-blocking-redirect/from-ctx"
id="to-gsp-blocking-redirect-from-ctx"
>
to /gsp-blocking-redirect/from-ctx
</Link>
<Link href="/gsp-fallback-redirect/en">
<a id="to-gsp-fallback-redirect-en">to /gsp-fallback-redirect/en"</a>
<Link href="/gsp-fallback-redirect/en" id="to-gsp-fallback-redirect-en">
to /gsp-fallback-redirect/en"
</Link>
<Link href="/gsp-fallback-redirect/sv">
<a id="to-gsp-fallback-redirect-sv">to /gsp-fallback-redirect/sv"</a>
<Link href="/gsp-fallback-redirect/sv" id="to-gsp-fallback-redirect-sv">
to /gsp-fallback-redirect/sv"
</Link>
<Link href="/gsp-fallback-redirect/from-ctx">
<a id="to-gsp-fallback-redirect-from-ctx">
to /gsp-fallback-redirect/from-ctx
</a>
<Link
href="/gsp-fallback-redirect/from-ctx"
id="to-gsp-fallback-redirect-from-ctx"
>
to /gsp-fallback-redirect/from-ctx
</Link>
</>
)
......
......@@ -3,11 +3,11 @@ import Link from 'next/link'
export default function Page() {
return (
<div>
<Link href="/some/route/for?json=true">
<a id="rewrite">to /some/route/for?json=true</a>
<Link href="/some/route/for?json=true" id="rewrite">
to /some/route/for?json=true
</Link>
<Link href="/api/json">
<a id="direct">to /api/json</a>
<Link href="/api/json" id="direct">
to /api/json
</Link>
</div>
)
......
......@@ -27,13 +27,13 @@ export default function Page(props) {
)}
</p>
<Link href="/">
<a id="to-index">to /index</a>
<Link href="/" id="to-index">
to /index
</Link>
<br />
<Link href="/dynamic/first">
<a id="to-dynamic">to /dynamic/first</a>
<Link href="/dynamic/first" id="to-dynamic">
to /dynamic/first
</Link>
<br />
</>
......
......@@ -27,13 +27,13 @@ export default function Page(props) {
)}
</p>
<Link href="/">
<a id="to-index">to /index</a>
<Link href="/" id="to-index">
to /index
</Link>
<br />
<Link href="/dynamic/second">
<a id="to-dynamic">to /dynamic/second</a>
<Link href="/dynamic/second" id="to-dynamic">
to /dynamic/second
</Link>
<br />
</>
......
......@@ -27,13 +27,13 @@ export default function Page(props) {
)}
</p>
<Link href="/another">
<a id="to-another">to /another</a>
<Link href="/another" id="to-another">
to /another
</Link>
<br />
<Link href="/dynamic/first">
<a id="to-dynamic">to /dynamic/first</a>
<Link href="/dynamic/first" id="to-dynamic">
to /dynamic/first
</Link>
<br />
</>
......
......@@ -6,30 +6,29 @@ export default function Main({ message }) {
<h1 className="title">Hello {message}</h1>
<ul>
<li>
<Link href="/stream-response">
<a>Stream a response</a>
</Link>
<Link href="/stream-response">Stream a response</Link>
</li>
<li>
<Link href="/rewrite-me-to-about?message=refreshed">
<a id="link-with-rewritten-url" className={message}>
Rewrite me to about
</a>
<Link
href="/rewrite-me-to-about?message=refreshed"
id="link-with-rewritten-url"
className={message}
>
Rewrite me to about
</Link>
</li>
<li>
<Link href="/rewrite-me-to-vercel">
<a>Rewrite me to Vercel</a>
</Link>
<Link href="/rewrite-me-to-vercel">Rewrite me to Vercel</Link>
</li>
<li>
<Link href="/redirect-me-to-about">
<a>redirect me to about</a>
</Link>
<Link href="/redirect-me-to-about">redirect me to about</Link>
</li>
<li>
<Link href="/dynamic-routes/hello-world">
<a id="go-to-hello-world-anchor">Hello World</a>
<Link
href="/dynamic-routes/hello-world"
id="go-to-hello-world-anchor"
>
Hello World
</Link>
</li>
</ul>
......
......@@ -3,8 +3,8 @@ import Link from 'next/link'
export default (props) => (
<ul>
<li>
<Link href="/hello">
<a id="hello">/hello</a>
<Link href="/hello" id="hello">
/hello
</Link>
</li>
</ul>
......
......@@ -3,23 +3,23 @@ import Link from 'next/link'
export default (props) => (
<ul>
<li>
<Link href="/hello">
<a id="hello">/hello</a>
<Link href="/hello" id="hello">
/hello
</Link>
</li>
<li>
<Link href="/en/hello">
<a id="en_hello">/en/hello</a>
<Link href="/en/hello" id="en_hello">
/en/hello
</Link>
</li>
<li>
<Link href="/nl-NL/hello">
<a id="nl-NL_hello">/nl-NL/hello</a>
<Link href="/nl-NL/hello" id="nl-NL_hello">
/nl-NL/hello
</Link>
</li>
<li>
<Link href="/nl-NL/about">
<a id="nl-NL_about">/nl-NL/about</a>
<Link href="/nl-NL/about" id="nl-NL_about">
/nl-NL/about
</Link>
</li>
</ul>
......
......@@ -3,13 +3,13 @@ import Link from 'next/link'
export default (props) => (
<ul>
<li>
<Link href="/has-match-2?my-query=hellooo">
<a id="has-match-2">has-match-2</a>
<Link href="/has-match-2?my-query=hellooo" id="has-match-2">
has-match-2
</Link>
</li>
<li>
<Link href="/has-match-3">
<a id="has-match-3">has-match-3</a>
<Link href="/has-match-3" id="has-match-3">
has-match-3
</Link>
</li>
</ul>
......
......@@ -3,8 +3,8 @@ import Link from 'next/link'
export default function Errors() {
return (
<div>
<Link href="/error-throw?message=refreshed">
<a id="throw-on-data">Throw on data</a>
<Link href="/error-throw?message=refreshed" id="throw-on-data">
Throw on data
</Link>
</div>
)
......
......@@ -8,13 +8,13 @@ export default function Shallow({ message }) {
<ul>
<li id="message-contents">{message}</li>
<li>
<Link href="/sha?hello=world" shallow>
<a id="shallow-link">Shallow link to ?hello=world</a>
<Link href="/sha?hello=world" shallow id="shallow-link">
Shallow link to ?hello=world
</Link>
</li>
<li>
<Link href="/sha?hello=goodbye">
<a id="deep-link">Deep link to ?hello=goodbye</a>
<Link href="/sha?hello=goodbye" id="deep-link">
Deep link to ?hello=goodbye
</Link>
</li>
<li>
......
......@@ -5,8 +5,8 @@ export default function Page(props) {
<div>
<p id="another-middleware">This should also run the middleware</p>
<p id="props">{JSON.stringify(props)}</p>
<Link href="/">
<a id="to-index">to /</a>
<Link href="/" id="to-index">
to /
</Link>
<br />
</div>
......
......@@ -5,12 +5,12 @@ export default function Page(props) {
<div>
<p id="blog">This should not run the middleware</p>
<p id="props">{JSON.stringify(props)}</p>
<Link href="/another-middleware">
<a id="to-another-middleware">to /another-middleware</a>
<Link href="/another-middleware" id="to-another-middleware">
to /another-middleware
</Link>
<br />
<Link href="/blog/slug-2">
<a id="to-blog-slug-2">to /blog/slug-2</a>
<Link href="/blog/slug-2" id="to-blog-slug-2">
to /blog/slug-2
</Link>
<br />
</div>
......
......@@ -5,12 +5,12 @@ export default function Page(props) {
<div>
<p id="index">root page</p>
<p id="props">{JSON.stringify(props)}</p>
<Link href="/another-middleware">
<a id="to-another-middleware">to /another-middleware</a>
<Link href="/another-middleware" id="to-another-middleware">
to /another-middleware
</Link>
<br />
<Link href="/blog/slug-1">
<a id="to-blog-slug-1">to /blog/slug-1</a>
<Link href="/blog/slug-1" id="to-blog-slug-1">
to /blog/slug-1
</Link>
<br />
</div>
......
......@@ -4,42 +4,38 @@ export default function Home() {
return (
<div>
<p className="title">Home Page</p>
<Link href="/old-home">
<a id="old-home">Redirect me to a new version of a page</a>
<Link href="/old-home" id="old-home">
Redirect me to a new version of a page
</Link>
<div />
<Link href="/old-home?override=external">
<a id="old-home-external">Redirect me to an external site</a>
<Link href="/old-home?override=external" id="old-home-external">
Redirect me to an external site
</Link>
<div />
<Link href="/blank-page?foo=bar">
<a>Redirect me with URL params intact</a>
</Link>
<Link href="/blank-page?foo=bar">Redirect me with URL params intact</Link>
<div />
<Link href="/redirect-to-google">
<a>Redirect me to Google (with no body response)</a>
Redirect me to Google (with no body response)
</Link>
<div />
<Link href="/redirect-to-google">
<a>Redirect me to Google (with no stream response)</a>
Redirect me to Google (with no stream response)
</Link>
<div />
<Link href="/redirect-me-alot">
<a>Redirect me alot (chained requests)</a>
</Link>
<Link href="/redirect-me-alot">Redirect me alot (chained requests)</Link>
<div />
<Link href="/infinite-loop">
<a>Redirect me alot (infinite loop)</a>
</Link>
<Link href="/infinite-loop">Redirect me alot (infinite loop)</Link>
<div />
<Link href="/to?pathname=/api/ok" locale="nl">
<a id="link-to-api-with-locale">Redirect me to api with locale</a>
<Link
href="/to?pathname=/api/ok"
locale="nl"
id="link-to-api-with-locale"
>
Redirect me to api with locale
</Link>
<div />
<Link href="/to?pathname=/old-home">
<a id="link-to-to-old-home">
Redirect me to a redirecting page of new version of page
</a>
<Link href="/to?pathname=/old-home" id="link-to-to-old-home">
Redirect me to a redirecting page of new version of page
</Link>
<div />
</div>
......
......@@ -4,60 +4,40 @@ export default function Home({ message }) {
return (
<div>
<p className="title">Hello {message}</p>
<Link href="/stream-a-response">
<a>Stream a response</a>
</Link>
<Link href="/stream-a-response">Stream a response</Link>
<div />
<Link href="/stream-long">
<a>Stream a long response</a>
</Link>
<Link href="/stream-end-stream">
<a>Test streaming after response ends</a>
</Link>
<Link href="/stream-long">Stream a long response</Link>
<Link href="/stream-end-stream">Test streaming after response ends</Link>
<div />
<Link href="/stream-header-end">
<a>Attempt to add a header after stream ends</a>
Attempt to add a header after stream ends
</Link>
<div />
<Link href="/redirect-stream">
<a>Redirect to Google and attempt to stream after</a>
Redirect to Google and attempt to stream after
</Link>
<div />
<Link href="/header">
<a>Respond with a header</a>
</Link>
<Link href="/header">Respond with a header</Link>
<div />
<Link href="/header?nested-header=true">
<a>Respond with 2 headers (nested middleware effect)</a>
Respond with 2 headers (nested middleware effect)
</Link>
<div />
<Link href="/body-end-header">
<a>Respond with body, end, set a header</a>
</Link>
<Link href="/body-end-header">Respond with body, end, set a header</Link>
<div />
<Link href="/body-end-body">
<a>Respond with body, end, send another body</a>
Respond with body, end, send another body
</Link>
<div />
<Link href="/send-response">
<a>Respond with body</a>
</Link>
<Link href="/send-response">Respond with body</Link>
<div />
<Link href="/redirect-body">
<a>Redirect and then send a body</a>
</Link>
<Link href="/redirect-body">Redirect and then send a body</Link>
<div />
<Link href="/react">
<a>Send React component as a body</a>
</Link>
<Link href="/react">Send React component as a body</Link>
<div />
<Link href="/react-stream">
<a>Stream React component</a>
</Link>
<Link href="/react-stream">Stream React component</Link>
<div />
<Link href="/bad-status">
<a>404</a>
</Link>
<Link href="/bad-status">404</Link>
<div />
</div>
)
......
......@@ -9,12 +9,16 @@ export default function Page(props) {
return (
<>
<p id="props">{JSON.stringify(props)}</p>
<Link href="/fallback-true-blog/first?hello=world" shallow>
<a id="to-query-shallow">to /fallback-true-blog/first?hello=world</a>
<Link
href="/fallback-true-blog/first?hello=world"
shallow
id="to-query-shallow"
>
to /fallback-true-blog/first?hello=world
</Link>
<br />
<Link href="/fallback-true-blog/second" shallow>
<a id="to-no-query-shallow">to /fallback-true-blog/second</a>
<Link href="/fallback-true-blog/second" shallow id="to-no-query-shallow">
to /fallback-true-blog/second
</Link>
<br />
</>
......
......@@ -6,28 +6,28 @@ export default function Home({ locale }) {
<div className={locale}>{locale}</div>
<ul>
<li>
<Link href="/i18n" locale="en">
<a id="link-en">Go to en</a>
<Link href="/i18n" locale="en" id="link-en">
Go to en
</Link>
</li>
<li>
<Link href="/en/i18n" locale={false}>
<a id="link-en2">Go to en2</a>
<Link href="/en/i18n" locale={false} id="link-en2">
Go to en2
</Link>
</li>
<li>
<Link href="/i18n" locale="ja">
<a id="link-ja">Go to ja</a>
<Link href="/i18n" locale="ja" id="link-ja">
Go to ja
</Link>
</li>
<li>
<Link href="/ja/i18n" locale={false}>
<a id="link-ja2">Go to ja2</a>
<Link href="/ja/i18n" locale={false} id="link-ja2">
Go to ja2
</Link>
</li>
<li>
<Link href="/i18n" locale="fr">
<a id="link-fr">Go to fr</a>
<Link href="/i18n" locale="fr" id="link-fr">
Go to fr
</Link>
</li>
</ul>
......
......@@ -7,48 +7,52 @@ export default function Home() {
<div>
<p className="title">Home Page</p>
<div />
<Link href="/rewrite-to-ab-test">
<a>A/B test homepage</a>
</Link>
<Link href="/rewrite-to-ab-test">A/B test homepage</Link>
<div />
<Link href="/rewrite-me-to-about?override=internal">
<a id="rewrite-me-to-about">Rewrite me to about</a>
<Link
href="/rewrite-me-to-about?override=internal"
id="rewrite-me-to-about"
>
Rewrite me to about
</Link>
<div />
<Link href="/rewrite-to-beforefiles-rewrite">
<a id="rewrite-to-beforefiles-rewrite">
Rewrite me to beforeFiles Rewrite
</a>
<Link
href="/rewrite-to-beforefiles-rewrite"
id="rewrite-to-beforefiles-rewrite"
>
Rewrite me to beforeFiles Rewrite
</Link>
<div />
<Link href="/rewrite-to-afterfiles-rewrite">
<a id="rewrite-to-afterfiles-rewrite">
Rewrite me to afterFiles Rewrite
</a>
<Link
href="/rewrite-to-afterfiles-rewrite"
id="rewrite-to-afterfiles-rewrite"
>
Rewrite me to afterFiles Rewrite
</Link>
<div />
<Link href="/rewrite-me-to-vercel">
<a>Rewrite me to Vercel</a>
</Link>
<Link href="/rewrite-me-to-vercel">Rewrite me to Vercel</Link>
<div />
<Link href="/rewrite-me-external-twice">
<a>Redirect me to Vercel (but with double reroutes)</a>
Redirect me to Vercel (but with double reroutes)
</Link>
<div />
<Link href="/rewrite-me-without-hard-navigation?message=refreshed">
<a id="link-with-rewritten-url">Rewrite me without a hard navigation</a>
<Link
href="/rewrite-me-without-hard-navigation?message=refreshed"
id="link-with-rewritten-url"
>
Rewrite me without a hard navigation
</Link>
<div />
<Link href="/about?override=external">
<a id="override-with-external-rewrite">Rewrite me to external site</a>
<Link href="/about?override=external" id="override-with-external-rewrite">
Rewrite me to external site
</Link>
<div />
<Link href="/about?override=internal">
<a id="override-with-internal-rewrite">Rewrite me to internal path</a>
<Link href="/about?override=internal" id="override-with-internal-rewrite">
Rewrite me to internal path
</Link>
<div />
<Link href="/ssg">
<a id="normal-ssg-link">normal SSG link</a>
<Link href="/ssg" id="normal-ssg-link">
normal SSG link
</Link>
<div />
<a
......
......@@ -3,8 +3,8 @@ import Link from 'next/link'
export default function Errors() {
return (
<div>
<Link href="/error-throw?message=refreshed">
<a id="throw-on-data">Throw on data</a>
<Link href="/error-throw?message=refreshed" id="throw-on-data">
Throw on data
</Link>
</div>
)
......
......@@ -8,13 +8,13 @@ export default function Shallow({ message }) {
<ul>
<li id="message-contents">{message}</li>
<li>
<Link href="/sha?hello=world" shallow>
<a id="shallow-link">Shallow link to ?hello=world</a>
<Link href="/sha?hello=world" shallow id="shallow-link">
Shallow link to ?hello=world
</Link>
</li>
<li>
<Link href="/sha?hello=goodbye">
<a id="deep-link">Deep link to ?hello=goodbye</a>
<Link href="/sha?hello=goodbye" id="deep-link">
Deep link to ?hello=goodbye
</Link>
</li>
<li>
......
module.exports = {
experimental: {
newNextLinkBehavior: true,
},
}
module.exports = {}
module.exports = {
reactStrictMode: true,
experimental: {
newNextLinkBehavior: true,
},
}
module.exports = {
reactStrictMode: true,
experimental: {
newNextLinkBehavior: true,
},
}
module.exports = {
reactStrictMode: true,
experimental: {
newNextLinkBehavior: true,
},
}
......@@ -3,8 +3,8 @@ import { roboto } from '../fonts'
export default function Roboto() {
return (
<Link href="/inter">
<a className={roboto.className}>To inter</a>
<Link href="/inter" className={roboto.className}>
To inter
</Link>
)
}
......@@ -3,8 +3,8 @@ import { inter } from '../fonts'
export default function Inter() {
return (
<Link href="/roboto">
<a className={inter.className}>To roboto</a>
<Link href="/roboto" className={inter.className}>
To roboto
</Link>
)
}
......@@ -19,12 +19,12 @@ export default ({ world, time }) => (
<>
<p>hello {world}</p>
<span id="anotherTime">time: {time}</span>
<Link href="/">
<a id="home">to home</a>
<Link href="/" id="home">
to home
</Link>
<br />
<Link href="/something">
<a id="something">to something</a>
<Link href="/something" id="something">
to something
</Link>
</>
)
......@@ -47,8 +47,8 @@ export default ({ post, time, params }) => {
<span id="time">time: {time}</span>
<div id="params">{JSON.stringify(params)}</div>
<div id="query">{JSON.stringify(useRouter().query)}</div>
<Link href="/">
<a id="home">to home</a>
<Link href="/" id="home">
to home
</Link>
</>
)
......
......@@ -35,8 +35,8 @@ export default ({ post, time, params }) => {
<span>time: {time}</span>
<div id="params">{JSON.stringify(params)}</div>
<div id="query">{JSON.stringify(useRouter().query)}</div>
<Link href="/">
<a id="home">to home</a>
<Link href="/" id="home">
to home
</Link>
</>
)
......
......@@ -64,8 +64,8 @@ export default ({ post, time, params }) => {
<span id="time">time: {time}</span>
<div id="params">{JSON.stringify(params)}</div>
<div id="query">{JSON.stringify(useRouter().query)}</div>
<Link href="/">
<a id="home">to home</a>
<Link href="/" id="home">
to home
</Link>
</>
)
......
......@@ -33,8 +33,8 @@ export default ({ post, comment, time }) => {
<p>Post: {post}</p>
<p>Comment: {comment}</p>
<span>time: {time}</span>
<Link href="/">
<a id="home">to home</a>
<Link href="/" id="home">
to home
</Link>
</>
)
......
......@@ -53,8 +53,8 @@ export default ({ post, time, params }) => {
<span>time: {time}</span>
<div id="params">{JSON.stringify(params)}</div>
<div id="query">{JSON.stringify(useRouter().query)}</div>
<Link href="/">
<a id="home">to home</a>
<Link href="/" id="home">
to home
</Link>
</>
)
......
......@@ -16,8 +16,8 @@ export default ({ slugs, time }) => {
<>
<p>Posts: {JSON.stringify(slugs)}</p>
<span>time: {time}</span>
<Link href="/">
<a id="home">to home</a>
<Link href="/" id="home">
to home
</Link>
</>
)
......
......@@ -35,8 +35,8 @@ export default function Page({ slug, time }) {
<>
<p id="catchall">Hi {slug.join(' ')}</p>
<p id="time">time: {time}</p>
<Link href="/">
<a id="home">to home</a>
<Link href="/" id="home">
to home
</Link>
</>
)
......
......@@ -21,8 +21,8 @@ export default ({ slug }) => {
return (
<>
<p id="catchall">Catch all: [{slug.join(', ')}]</p>
<Link href="/">
<a id="home">to home</a>
<Link href="/" id="home">
to home
</Link>
</>
)
......
......@@ -13,12 +13,12 @@ export default ({ world, time }) => (
<>
<p>hello {world}</p>
<span>time: {time}</span>
<Link href="/">
<a id="home">to home</a>
<Link href="/" id="home">
to home
</Link>
<br />
<Link href="/something">
<a id="something">to something</a>
<Link href="/something" id="something">
to something
</Link>
</>
)
......@@ -19,8 +19,8 @@ export default ({ slug }) => {
return (
<>
<p id="param">Hi {slug}!</p>{' '}
<Link href="/">
<a id="home">to home</a>
<Link href="/" id="home">
to home
</Link>
</>
)
......
......@@ -35,8 +35,8 @@ export default ({ post, time, params }) => {
<span>time: {time}</span>
<div id="params">{JSON.stringify(params)}</div>
<div id="query">{JSON.stringify(useRouter().query)}</div>
<Link href="/">
<a id="home">to home</a>
<Link href="/" id="home">
to home
</Link>
</>
)
......
......@@ -15,76 +15,91 @@ const Page = ({ world, time }) => {
{/* <div id='after-change'>idk</div> */}
<p>hello {world}</p>
<span>time: {time}</span>
<Link href="/non-json/[p]" as="/non-json/1">
<a id="non-json">to non-json</a>
<Link href="/non-json/[p]" as="/non-json/1" id="non-json">
to non-json
</Link>
<br />
<Link href="/another?hello=world" as="/another/?hello=world">
<a id="another">to another</a>
<Link href="/another?hello=world" as="/another/?hello=world" id="another">
to another
</Link>
<br />
<Link href="/something">
<a id="something">to something</a>
<Link href="/something" id="something">
to something
</Link>
<br />
<Link href="/normal">
<a id="normal">to normal</a>
<Link href="/normal" id="normal">
to normal
</Link>
<br />
<Link href="/blog/[post]" as="/blog/post-1">
<a id="post-1">to dynamic</a>
<Link href="/blog/[post]" as="/blog/post-1" id="post-1">
to dynamic
</Link>
<Link href="/blog/[post]" as="/blog/post-100">
<a id="broken-post">to broken</a>
<Link href="/blog/[post]" as="/blog/post-100" id="broken-post">
to broken
</Link>
<Link href="/blog/[post]" as="/blog/post-999" prefetch={false}>
<a id="broken-at-first-post">to broken at first</a>
<Link
href="/blog/[post]"
as="/blog/post-999"
prefetch={false}
id="broken-at-first-post"
>
to broken at first
</Link>
<br />
<Link href="/blog/[post]/[comment]" as="/blog/post-1/comment-1">
<a id="comment-1">to another dynamic</a>
<Link
href="/blog/[post]/[comment]"
as="/blog/post-1/comment-1"
id="comment-1"
>
to another dynamic
</Link>
<Link href="/catchall/[...slug]" as="/catchall/first">
<a id="to-catchall">to catchall</a>
<Link href="/catchall/[...slug]" as="/catchall/first" id="to-catchall">
to catchall
</Link>
<br />
<Link href="/index">
<a id="to-nested-index">to nested index</a>
<Link href="/index" id="to-nested-index">
to nested index
</Link>
<br />
<Link href="/lang/[lang]/about?lang=en" as="/about">
<a id="to-rewritten-ssg">to rewritten static path page</a>
<Link href="/lang/[lang]/about?lang=en" as="/about" id="to-rewritten-ssg">
to rewritten static path page
</Link>
<br />
<Link href="/catchall-optional/[[...slug]]" as="/catchall-optional">
<a id="catchall-optional-root">to optional catchall root</a>
<Link
href="/catchall-optional/[[...slug]]"
as="/catchall-optional"
id="catchall-optional-root"
>
to optional catchall root
</Link>
<Link href="/catchall-optional/[[...slug]]" as="/catchall-optional/value">
<a id="catchall-optional-value">to optional catchall page /value</a>
<Link
href="/catchall-optional/[[...slug]]"
as="/catchall-optional/value"
id="catchall-optional-value"
>
to optional catchall page /value
</Link>
<br />
<Link href="/dynamic/[slug]" as="/dynamic/[first]">
<a id="dynamic-first">to dynamic [first] page</a>
<Link href="/dynamic/[slug]" as="/dynamic/[first]" id="dynamic-first">
to dynamic [first] page
</Link>
<Link href="/dynamic/[slug]" as="/dynamic/[second]">
<a id="dynamic-second">to dynamic [second] page</a>
<Link href="/dynamic/[slug]" as="/dynamic/[second]" id="dynamic-second">
to dynamic [second] page
</Link>
<br />
<Link
href="/catchall-explicit/[...slug]"
as="/catchall-explicit/[first]/[second]"
id="catchall-explicit-string"
>
<a id="catchall-explicit-string">
to catchall-explicit [first]/[second] page
</a>
to catchall-explicit [first]/[second] page
</Link>
<Link
href="/catchall-explicit/[...slug]"
as="/catchall-explicit/[third]/[fourth]"
id="catchall-explicit-object"
>
<a id="catchall-explicit-object">
to catchall-explicit [third]/[fourth] page
</a>
to catchall-explicit [third]/[fourth] page
</Link>
</>
)
......
......@@ -14,12 +14,12 @@ export default (props) => {
return (
<>
<p>lots of data returned</p>
<Link href="/">
<a id="home">to home</a>
<Link href="/" id="home">
to home
</Link>
<br />
<Link href="/another">
<a id="another">to another</a>
<Link href="/another" id="another">
to another
</Link>
</>
)
......
......@@ -22,12 +22,12 @@ export default ({ world, time, params, random }) => {
<div id="random">{random}</div>
<div id="params">{JSON.stringify(params)}</div>
<div id="query">{JSON.stringify(useRouter().query)}</div>
<Link href="/">
<a id="home">to home</a>
<Link href="/" id="home">
to home
</Link>
<br />
<Link href="/another">
<a id="another">to another</a>
<Link href="/another" id="another">
to another
</Link>
</>
)
......
......@@ -20,8 +20,8 @@ export default ({ user, time }) => {
<>
<p>User: {user}</p>
<span>time: {time}</span>
<Link href="/">
<a id="home">to home</a>
<Link href="/" id="home">
to home
</Link>
</>
)
......
......@@ -21,17 +21,16 @@ const Page = ({ id }) => {
}}
/>
<p>{ready ? 'routeChangeComplete' : 'loading'}</p>
<Link href={`/${id + 1}`}>
<a
id="link"
style={{
marginLeft: 5000,
width: 95000,
display: 'block',
}}
>
next page
</a>
<Link
href={`/${id + 1}`}
id="link"
style={{
marginLeft: 5000,
width: 95000,
display: 'block',
}}
>
next page
</Link>
<div id="end-el">hello, world</div>
</>
......
......@@ -4,8 +4,8 @@ export default function Page(props) {
return (
<>
<p id="another">another page</p>
<Link href="/">
<a id="to-index">to index</a>
<Link href="/" id="to-index">
to index
</Link>
<br />
</>
......
......@@ -4,8 +4,8 @@ export default function Page(props) {
return (
<>
<p id="blog">blog page</p>
<Link href="/">
<a id="to-index">to index</a>
<Link href="/" id="to-index">
to index
</Link>
<br />
</>
......
......@@ -4,12 +4,12 @@ export default function Page(props) {
return (
<>
<p id="index">index page</p>
<Link href="/another">
<a id="to-another">to another</a>
<Link href="/another" id="to-another">
to another
</Link>
<br />
<Link href="/blog/first">
<a id="to-blog-first">to /blog/first</a>
<Link href="/blog/first" id="to-blog-first">
to /blog/first
</Link>
<br />
</>
......
......@@ -4,9 +4,7 @@ export default function Page() {
return (
<div>
<p>hello nextjs</p>
<Link href="/">
<a>home</a>
</Link>
<Link href="/">home</Link>
</div>
)
}
......
......@@ -12,28 +12,28 @@ export default function Page() {
<br />
<Time />
<br />
<Link href="/node-rsc">
<a id="link-node-rsc">to /node-rsc</a>
<Link href="/node-rsc" id="link-node-rsc">
to /node-rsc
</Link>
<br />
<Link href="/node-rsc-ssg">
<a id="link-node-rsc-ssg">to /node-rsc-ssg</a>
<Link href="/node-rsc-ssg" id="link-node-rsc-ssg">
to /node-rsc-ssg
</Link>
<br />
<Link href="/node-rsc-ssr">
<a id="link-node-rsc-ssr">to /node-rsc-ssr</a>
<Link href="/node-rsc-ssr" id="link-node-rsc-ssr">
to /node-rsc-ssr
</Link>
<br />
<Link href="/node-rsc-isr">
<a id="link-node-rsc-isr">to /node-rsc-isr</a>
<Link href="/node-rsc-isr" id="link-node-rsc-isr">
to /node-rsc-isr
</Link>
<br />
<Link href="/node-ssg">
<a id="link-node-ssg">to /node-ssg</a>
<Link href="/node-ssg" id="link-node-ssg">
to /node-ssg
</Link>
<br />
<Link href="/node-ssr">
<a id="link-node-ssr">to /node-ssr</a>
<Link href="/node-ssr" id="link-node-ssr">
to /node-ssr
</Link>
</div>
)
......
......@@ -37,8 +37,8 @@ describe('Type module interop', () => {
<p>hello world</p>
<Dynamic />
<p id="isAmp">isAmp: {isAmp ? 'yes' : 'false'}</p>
<Link href="/modules">
<a id="link-to-module">link to module</a>
<Link href="/modules" id="link-to-module">
link to module
</Link>
</>
)
......@@ -51,8 +51,8 @@ describe('Type module interop', () => {
export default function Modules() {
return (
<>
<Link href="/">
<a id="link-to-home">link to home</a>
<Link href="/" id="link-to-home">
link to home
</Link>
<Image src="/static/image.png" width="100" height="100" />
</>
......
......@@ -3,20 +3,28 @@ import Link from 'next/link'
export default function Page() {
return (
<>
<Link href="/about">
<a id="about-link">getStaticProps</a>
<Link href="/about" id="about-link">
getStaticProps
</Link>
<br />
<Link href="/gsp-fallback/[slug]" as="/gsp-fallback/prerendered">
<a id="gsp-prerender-link">getStaticPaths prerendered</a>
<Link
href="/gsp-fallback/[slug]"
as="/gsp-fallback/prerendered"
id="gsp-prerender-link"
>
getStaticPaths prerendered
</Link>
<br />
<Link href="/gsp-fallback/[slug]" as="/gsp-fallback/fallback">
<a id="gsp-fallback-link">getStaticPaths fallback</a>
<Link
href="/gsp-fallback/[slug]"
as="/gsp-fallback/fallback"
id="gsp-fallback-link"
>
getStaticPaths fallback
</Link>
<br />
<Link href="/gssp?prop=foo">
<a id="gssp-link">getServerSideProps</a>
<Link href="/gssp?prop=foo" id="gssp-link">
getServerSideProps
</Link>
</>
)
......
......@@ -8,13 +8,13 @@ export default function Nav() {
return (
<ul>
<li>
<Link href="/only-amp">
<a id="only-amp-link">AMP First Page</a>
<Link href="/only-amp" id="only-amp-link">
AMP First Page
</Link>
</li>
<li>
<Link href="/var-before-export">
<a id="var-before-export-link">Another AMP First Page</a>
<Link href="/var-before-export" id="var-before-export-link">
Another AMP First Page
</Link>
</li>
</ul>
......
......@@ -3,8 +3,8 @@ import Link from 'next/link'
export default () => (
<div>
<p>No AMP for me...</p>
<Link href="/only-amp">
<a id="to-amp">To AMP page!</a>
<Link href="/only-amp" id="to-amp">
To AMP page!
</Link>
</div>
)
......@@ -3,8 +3,8 @@ import Link from 'next/link'
export default () => (
<div>
<div className="page-about">about</div>
<Link href="/">
<a id="home-link">home</a>
<Link href="/" id="home-link">
home
</Link>
</div>
)
......@@ -3,8 +3,8 @@ export default () => (
<div>
<div className="page-index">index</div>
<span className="css-in-js-class" />
<Link href="/about">
<a id="about-link">about</a>
<Link href="/about" id="about-link">
about
</Link>
<span className="css-in-js-class" />
</div>
......
......@@ -38,8 +38,8 @@ export default class MyApp extends App<{ html: string }> {
html && router.pathname !== '/hello' ? (
<>
<div dangerouslySetInnerHTML={{ __html: html }} />
<Link href={href}>
<a id={href === '/' ? 'home' : 'another'}>to {href}</a>
<Link href={href} id={href === '/' ? 'home' : 'another'}>
to{href}
</Link>
</>
) : (
......
import Link from 'next/link'
export default () => (
<Link href="/[...parts]" as="/root/catch-all">
<a id="root-catchall-link">root catch-all</a>
<Link href="/[...parts]" as="/root/catch-all" id="root-catchall-link">
root catch-all
</Link>
)
......@@ -3,11 +3,11 @@ import Link from 'next/link'
export default function Page() {
return (
<>
<Link href="/a">
<a id="to-a">Go to a</a>
<Link href="/a" id="to-a">
Go to a
</Link>
<Link href="/b">
<a id="to-b">Go to b</a>
<Link href="/b" id="to-b">
Go to b
</Link>
</>
)
......
......@@ -7,8 +7,8 @@ const Page = () => {
return (
<div>
<h2>Page3</h2>
<Link href="/page2">
<a id="page2-link">Page2</a>
<Link href="/page2" id="page2-link">
Page2
</Link>
</div>
)
......
......@@ -13,8 +13,8 @@ export default class Error extends React.Component {
<div>
<div id="errorStatusCode">{this.props.statusCode || 'unknown'}</div>
<p>
<Link href="/">
<a id="errorGoHome">go home</a>
<Link href="/" id="errorGoHome">
go home
</Link>
</p>
</div>
......
import Link from 'next/link'
export default () => (
<Link href="/[id]/non-existent" as="/another/non-existent">
<a id="to-nonexistent">to 404</a>
<Link
href="/[id]/non-existent"
as="/another/non-existent"
id="to-nonexistent"
>
to 404
</Link>
)
import Link from 'next/link'
export default () => (
<Link href="/missing">
<a id="to-missing">to 404</a>
<Link href="/missing" id="to-missing">
to 404
</Link>
)
......@@ -2,26 +2,20 @@ import Link from 'next/link'
export default () => (
<div id="page-container">
<Link href="/page-with-h1-and-title">
<a id="page-with-h1-and-title-link">
Go to a page with a title and an h1
</a>
<Link href="/page-with-h1-and-title" id="page-with-h1-and-title-link">
Go to a page with a title and an h1
</Link>
<Link href="/page-with-h1">
<a id="page-with-h1-link">Go to a page without a title but with an h1</a>
<Link href="/page-with-h1" id="page-with-h1-link">
Go to a page without a title but with an h1
</Link>
<Link href="/page-with-title">
<a id="page-with-title-link">
Go to a page without an h1, but with a title
</a>
<Link href="/page-with-title" id="page-with-title-link">
Go to a page without an h1, but with a title
</Link>
<Link href="/page-without-h1-or-title">
<a id="page-without-h1-or-title-link">
Go to a page without an h1 or a title
</a>
<Link href="/page-without-h1-or-title" id="page-without-h1-or-title-link">
Go to a page without an h1 or a title
</Link>
</div>
)
......@@ -15,8 +15,8 @@ export default function Page({ port }) {
return (
<>
<Link href="https://vercel.com/">
<a id="absolute-link">https://vercel.com/</a>
<Link href="https://vercel.com/" id="absolute-link">
https://vercel.com/
</Link>
<br />
<button
......@@ -33,17 +33,19 @@ export default function Page({ port }) {
replace https://vercel.com/
</button>
<br />
<Link href={`http://localhost:${port}/nav/about`}>
<a id="absolute-local-link">http://localhost:{port}/nav/about</a>
<Link
href={`http://localhost:${port}/nav/about`}
id="absolute-local-link"
>
http://localhost:{port}/nav/about
</Link>
<br />
<Link
href={`http://localhost:${port}/dynamic/[slug]/route`}
as={`http://localhost:${port}/dynamic/hello/route`}
id="absolute-local-dynamic-link"
>
<a id="absolute-local-dynamic-link">
http://localhost:{port}/dynamic/hello/route
</a>
http://localhost:{port}/dynamic/hello/route
</Link>
<br />
<button
......@@ -60,19 +62,18 @@ export default function Page({ port }) {
replace http://localhost:{port}/nav/about
</button>
<br />
<Link href="mailto:idk@idk.com">
<a id="mailto-link">mailto:idk@idk.com</a>
<Link href="mailto:idk@idk.com" id="mailto-link">
mailto:idk@idk.com
</Link>
<br />
<Link href="https://vercel.com/">
<a
id="absolute-link-mouse-events"
data-hover={hover}
onMouseEnter={() => setHover(true)}
onMouseLeave={() => setHover(false)}
>
https://vercel.com/
</a>
<Link
href="https://vercel.com/"
id="absolute-link-mouse-events"
data-hover={hover}
onMouseEnter={() => setHover(true)}
onMouseLeave={() => setHover(false)}
>
https://vercel.com/
</Link>
</>
)
......
......@@ -27,7 +27,7 @@ export default function Page(props) {
return (
<>
<p id="errors">{errorCount}</p>
<Link href="/nav" passHref>
<Link href="/nav" passHref legacyBehavior>
<Button />
</Link>
</>
......
......@@ -4,7 +4,7 @@ import Link from 'next/link'
export default function Page() {
return (
<div>
Hello World. <Link href="/about"></Link>
Hello World. <Link href="/about" legacyBehavior></Link>
</div>
)
}
......@@ -4,7 +4,10 @@ import Link from 'next/link'
export default function Page() {
return (
<div>
Hello World. <Link href="/about">{1000}</Link>
Hello World.{' '}
<Link href="/about" legacyBehavior>
{1000}
</Link>
</div>
)
}
......@@ -2,9 +2,6 @@ import React from 'react'
import Link from 'next/link'
export default () => (
<div>
Hello World.{' '}
<Link href="/about">
<a>About</a>
</Link>
Hello World. <Link href="/about">About</Link>
</div>
)
......@@ -2,8 +2,8 @@ import Link from 'next/link'
export default () => (
<div className="nav-about">
<Link href="/nav">
<a id="home-link">Go Back</a>
<Link href="/nav" id="home-link">
Go Back
</Link>
<p>This is the about page.</p>
......
......@@ -9,26 +9,32 @@ export default withRouter(({ router: { asPath, query } }) => {
<Link
href="/nav/as-path-pushstate?something=hello"
as="/something/hello"
id="hello"
>
<a id="hello">hello</a>
hello
</Link>
</div>
<div>
<Link href="/nav/as-path-pushstate" as="/something/else">
<a id="else">else</a>
<Link href="/nav/as-path-pushstate" as="/something/else" id="else">
else
</Link>
</div>
<div>
<Link href="/nav/as-path-pushstate" as="/nav/as-path-pushstate">
<a id="hello2">normal hello</a>
<Link
href="/nav/as-path-pushstate"
as="/nav/as-path-pushstate"
id="hello2"
>
normal hello
</Link>
</div>
{query.something === 'hello' && (
<Link
href="/nav/as-path-pushstate?something=hello"
as="/something/same-query"
id="same-query"
>
<a id="same-query">same query</a>
same query
</Link>
)}
</div>
......
......@@ -15,16 +15,18 @@ export default withRouter(({ router: { asPath, query } }) => {
<Link
href="/nav/as-path-query?something=hello"
as="/something/hello?something=hello"
id="hello"
>
<a id="hello">hello</a>
hello
</Link>
</div>
<div>
<Link
href="/nav/as-path-query?something=else"
as="/something/hello?something=else"
id="hello2"
>
<a id="hello2">hello</a>
hello
</Link>
</div>
</div>
......
......@@ -9,31 +9,33 @@ const HashChanges = ({ count }) => {
return (
<div id="hash-changes-page">
<Link href="#via-link">
<a id="via-link">Via Link</a>
<Link href="#via-link" id="via-link">
Via Link
</Link>
<a href="#via-a" id="via-a">
Via A
</a>
<Link href="/nav/hash-changes">
<a id="page-url">Page URL</a>
<Link href="/nav/hash-changes" id="page-url">
Page URL
</Link>
<Link href="#">
<a id="via-empty-hash">Via Empty Hash</a>
<Link href="#" id="via-empty-hash">
Via Empty Hash
</Link>
<Link href="#item-400">
<a id="scroll-to-item-400">Go to item 400</a>
<Link href="#item-400" id="scroll-to-item-400">
Go to item 400
</Link>
<Link href="#name-item-400">
<a id="scroll-to-name-item-400">Go to name item 400</a>
<Link href="#name-item-400" id="scroll-to-name-item-400">
Go to name item 400
</Link>
<Link href="#name-item-400" scroll={false}>
<a id="scroll-to-name-item-400-no-scroll">
Go to name item 400 (no scroll)
</a>
<Link
href="#name-item-400"
scroll={false}
id="scroll-to-name-item-400-no-scroll"
>
Go to name item 400 (no scroll)
</Link>
<Link href="#中文">
<a id="scroll-to-cjk-anchor">Go to CJK anchor</a>
<Link href="#中文" id="scroll-to-cjk-anchor">
Go to CJK anchor
</Link>
<p>COUNT: {count}</p>
{Array.from({ length: 500 }, (x, i) => i + 1).map((i) => {
......@@ -50,8 +52,8 @@ const HashChanges = ({ count }) => {
</div>
)
})}
<Link href="#top">
<a id="via-top-hash">Via Top Hash</a>
<Link href="#top" id="via-top-hash">
Via Top Hash
</Link>
<div id="asPath">ASPATH: {router.asPath}</div>
<div id="pathname">PATHNAME: {router.pathname}</div>
......
......@@ -8,11 +8,11 @@ export default (props) => (
<meta name="description" content="Head One" />
<title>this is head-1</title>
</Head>
<Link href="/nav/head-2">
<a id="to-head-2">to head 2</a>
<Link href="/nav/head-2" id="to-head-2">
to head 2
</Link>
<Link href="/nav/head-3">
<a id="to-head-3">to head 3</a>
<Link href="/nav/head-3" id="to-head-3">
to head 3
</Link>
</div>
)
......@@ -8,8 +8,8 @@ export default (props) => (
<meta name="description" content="Head Two" />
<title>this is head-2</title>
</Head>
<Link href="/nav/head-1">
<a id="to-head-1">to head 1</a>
<Link href="/nav/head-1" id="to-head-1">
to head 1
</Link>
</div>
)
......@@ -8,8 +8,8 @@ export default (props) => (
<meta name="description" content="Head Three" />
<title></title>
</Head>
<Link href="/nav/head-1">
<a id="to-head-1">to head 1</a>
<Link href="/nav/head-1" id="to-head-1">
to head 1
</Link>
</div>
)
......@@ -23,68 +23,68 @@ export default class extends Component {
render() {
return (
<div className="nav-home">
<Link href="/nav/about">
<a id="about-link" style={linkStyle}>
About
</a>
<Link href="/nav/about" id="about-link" style={linkStyle}>
About
</Link>
<Link href="/empty-get-initial-props">
<a id="empty-props" style={linkStyle}>
Empty Props
</a>
<Link
href="/empty-get-initial-props"
id="empty-props"
style={linkStyle}
>
Empty Props
</Link>
<Link href="/nav/self-reload">
<a id="self-reload-link" style={linkStyle}>
Self Reload
</a>
<Link href="/nav/self-reload" id="self-reload-link" style={linkStyle}>
Self Reload
</Link>
<Link href="/nav/shallow-routing">
<a id="shallow-routing-link" style={linkStyle}>
Shallow Routing
</a>
<Link
href="/nav/shallow-routing"
id="shallow-routing-link"
style={linkStyle}
>
Shallow Routing
</Link>
<Link href="/nav/redirect">
<a id="redirect-link" style={linkStyle}>
Redirect
</a>
<Link href="/nav/redirect" id="redirect-link" style={linkStyle}>
Redirect
</Link>
<Link
href={{ pathname: '/nav/querystring', query: { id: 10 } }}
as={{ pathname: '/nav/querystring/10', hash: '10' }}
id="query-string-link"
style={linkStyle}
>
<a id="query-string-link" style={linkStyle}>
QueryString
</a>
QueryString
</Link>
<Link href="/nav/about" replace>
<a id="about-replace-link" style={linkStyle}>
Replace state
</a>
<Link
href="/nav/about"
replace
id="about-replace-link"
style={linkStyle}
>
Replace state
</Link>
<Link href="/nav/as-path" as="/as/path">
<a id="as-path-link" style={linkStyle}>
As Path
</a>
<Link
href="/nav/as-path"
as="/as/path"
id="as-path-link"
style={linkStyle}
>
As Path
</Link>
<Link href="/nav/as-path">
<a id="as-path-link-no-as" style={linkStyle}>
As Path (No as)
</a>
<Link href="/nav/as-path" id="as-path-link-no-as" style={linkStyle}>
As Path (No as)
</Link>
<Link href="/nav/as-path-using-router">
<a id="as-path-using-router-link" style={linkStyle}>
As Path (Using Router)
</a>
<Link
href="/nav/as-path-using-router"
id="as-path-using-router-link"
style={linkStyle}
>
As Path (Using Router)
</Link>
<Link href="/nav/on-click?count=1">
<a id="on-click-link" style={linkStyle}>
An element with onClick
</a>
<Link href="/nav/on-click?count=1" id="on-click-link" style={linkStyle}>
An element with onClick
</Link>
<Link href="/nav/about">
<a id="target-link" target="_blank">
An element with target
</a>
<Link href="/nav/about" id="target-link" target="_blank">
An element with target
</Link>
<svg
......@@ -93,15 +93,13 @@ export default class extends Component {
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<Link href="/nav/about">
<a id="in-svg-link" style={{ display: 'block' }}>
<path
fillRule="evenodd"
clipRule="evenodd"
d="M12 0C5.373 0 0 5.373 0 12s5.373 12 12 12 12-5.373 12-12S18.627 0 12 0Zm4.5 18a4 4 0 1 0 0-8 4 4 0 0 0 0 8Z"
fill="#335BF1"
/>
</a>
<Link href="/nav/about" id="in-svg-link" style={{ display: 'block' }}>
<path
fillRule="evenodd"
clipRule="evenodd"
d="M12 0C5.373 0 0 5.373 0 12s5.373 12 12 12 12-5.373 12-12S18.627 0 12 0Zm4.5 18a4 4 0 1 0 0-8 4 4 0 0 0 0 8Z"
fill="#335BF1"
/>
</Link>
</svg>
......@@ -118,11 +116,11 @@ export default class extends Component {
<button id="increase" onClick={() => this.increase()}>
Increase
</button>
<Link href="/nav/hash-changes#item-400">
<a id="scroll-to-hash">Scroll to hash</a>
<Link href="/nav/hash-changes#item-400" id="scroll-to-hash">
Scroll to hash
</Link>
<Link href="/nav/hash-changes#中文">
<a id="scroll-to-cjk-hash">Scroll to CJK hash</a>
<Link href="/nav/hash-changes#中文" id="scroll-to-cjk-hash">
Scroll to CJK hash
</Link>
</div>
)
......
......@@ -6,8 +6,8 @@ const LongPageToSnapScroll = () => {
const router = useRouter()
return (
<div id="long-page-to-snap-scroll">
<Link href="#item-400">
<a id="scroll-to-item-400">Go to item 400</a>
<Link href="#item-400" id="scroll-to-item-400">
Go to item 400
</Link>
{Array.from({ length: 500 }, (x, i) => i + 1).map((i) => {
......@@ -18,8 +18,8 @@ const LongPageToSnapScroll = () => {
)
})}
<Link href="/snap-scroll-position">
<a id="goto-snap-scroll-position">Go to snap scroll declarative</a>
<Link href="/snap-scroll-position" id="goto-snap-scroll-position">
Go to snap scroll declarative
</Link>
<div
id="goto-snap-scroll-position-imperative"
......
......@@ -15,24 +15,23 @@ export default class OnClick extends Component {
const { count } = this.props
return (
<div id="on-click-page">
<Link href={`/nav/on-click?count=${count + 1}`} replace>
<a
id="on-click-link"
onClick={() => this.setState({ stateCounter: stateCounter + 1 })}
>
Self Reload
</a>
<Link
href={`/nav/on-click?count=${count + 1}`}
replace
id="on-click-link"
onClick={() => this.setState({ stateCounter: stateCounter + 1 })}
>
Self Reload
</Link>
<Link href="/nav/on-click">
<a
id="on-click-link-prevent-default"
onClick={(e) => {
e.preventDefault()
this.setState({ stateCounter: stateCounter + 1 })
}}
>
Self Reload
</a>
<Link
href="/nav/on-click"
id="on-click-link-prevent-default"
onClick={(e) => {
e.preventDefault()
this.setState({ stateCounter: stateCounter + 1 })
}}
>
Self Reload
</Link>
<p id="query-count">QUERY COUNT: {count}</p>
<p id="state-count">STATE COUNT: {stateCounter}</p>
......
......@@ -14,11 +14,11 @@ const FakeA = UnexpectedNestedA()
export default () => (
<div className="nav-pass-href-prop">
<Link href="/nav" passHref>
<Link href="/nav" passHref legacyBehavior>
<FakeA id="with-href">Will redirect as an `a` tag</FakeA>
</Link>
<Link href="/nav">
<Link href="/nav" legacyBehavior>
<FakeA id="without-href">Will not redirect as an `a` tag</FakeA>
</Link>
......
......@@ -10,8 +10,8 @@ export default function Page({ prop }) {
return (
<>
<div id="prop">{prop}</div>
<Link href="?prop=foo">
<a id="link">Click me</a>
<Link href="?prop=foo" id="link">
Click me
</Link>
<button id="router-push" onClick={() => router.push('?prop=bar')}>
Push me
......
......@@ -9,11 +9,14 @@ export default class AsyncProps extends React.Component {
render() {
return (
<div className="nav-querystring">
<Link href={`/nav/querystring?id=${parseInt(this.props.id) + 1}`}>
<a id="next-id-link">Click here</a>
<Link
href={`/nav/querystring?id=${parseInt(this.props.id) + 1}`}
id="next-id-link"
>
Click here
</Link>
<Link href="/nav/querystring">
<a id="main-page">Click here</a>
<Link href="/nav/querystring" id="main-page">
Click here
</Link>
<p className={`nav-id-${this.props.id}`}>{this.props.id}</p>
</div>
......
......@@ -3,10 +3,7 @@ import Link from 'next/link'
export default function Relative1() {
return (
<div id="relative-1">
On relative 1
<Link href="./relative-2">
<a>To relative 2</a>
</Link>
On relative 1<Link href="./relative-2">To relative 2</Link>
</div>
)
}
......@@ -14,8 +14,8 @@ export default class SelfReload extends Component {
render() {
return (
<div id="self-reload-page">
<Link href="/nav/self-reload">
<a id="self-reload-link">Self Reload</a>
<Link href="/nav/self-reload" id="self-reload-link">
Self Reload
</Link>
<p>COUNT: {this.props.count}</p>
</div>
......
......@@ -42,10 +42,8 @@ export default withRouter(
render() {
return (
<div className="shallow-routing">
<Link href="/nav">
<a id="home-link" style={linkStyle}>
Home
</a>
<Link href="/nav" id="home-link" style={linkStyle}>
Home
</Link>
<div id="counter" style={{ marginBottom: 4000 }}>
Counter: {this.getCurrentCounter()}
......
......@@ -4,16 +4,16 @@ export default function Page(props) {
return (
<>
<p id="props">{JSON.stringify(props)}</p>
<Link href="/first?a=b" shallow>
<a id="add-query-shallow">add query shallow</a>
<Link href="/first?a=b" shallow id="add-query-shallow">
add query shallow
</Link>
<br />
<Link href="/first" shallow>
<a id="remove-query-shallow">remove query shallow</a>
<Link href="/first" shallow id="remove-query-shallow">
remove query shallow
</Link>
<br />
<Link href="/another">
<a id="to-another">to /another non-shallow</a>
<Link href="/another" id="to-another">
to /another non-shallow
</Link>
</>
)
......
......@@ -44,13 +44,13 @@ describe('Config Experimental Warning', () => {
module.exports = {
target: 'server',
experimental: {
newNextLinkBehavior: true
workerThreads: true
}
}
`)
const { stderr } = await nextBuild(appDir, [], { stderr: true })
expect(stderr).toMatch(
'You have enabled experimental feature (newNextLinkBehavior) in next.config.js.'
'You have enabled experimental feature (workerThreads) in next.config.js.'
)
})
......@@ -59,13 +59,13 @@ describe('Config Experimental Warning', () => {
module.exports = (phase) => ({
target: 'server',
experimental: {
newNextLinkBehavior: true
workerThreads: true
}
})
`)
const { stderr } = await nextBuild(appDir, [], { stderr: true })
expect(stderr).toMatch(
'You have enabled experimental feature (newNextLinkBehavior) in next.config.js.'
'You have enabled experimental feature (workerThreads) in next.config.js.'
)
})
......@@ -74,13 +74,13 @@ describe('Config Experimental Warning', () => {
module.exports = (phase) => ({
target: 'server',
experimental: {
newNextLinkBehavior: false
workerThreads: false
}
})
`)
const { stderr } = await nextBuild(appDir, [], { stderr: true })
expect(stderr).not.toMatch(
'You have enabled experimental feature (newNextLinkBehavior) in next.config.js.'
'You have enabled experimental feature (workerThreads) in next.config.js.'
)
})
......@@ -88,14 +88,14 @@ describe('Config Experimental Warning', () => {
configFile.write(`
module.exports = {
experimental: {
newNextLinkBehavior: true,
workerThreads: true,
legacyBrowsers: false,
}
}
`)
const { stderr } = await nextBuild(appDir, [], { stderr: true })
expect(stderr).toMatch(
'You have enabled experimental features (newNextLinkBehavior, legacyBrowsers) in next.config.js.'
'You have enabled experimental features (workerThreads, legacyBrowsers) in next.config.js.'
)
})
......@@ -103,14 +103,14 @@ describe('Config Experimental Warning', () => {
configFileMjs.write(`
const config = {
experimental: {
newNextLinkBehavior: true,
workerThreads: true,
}
}
export default config
`)
const { stderr } = await nextBuild(appDir, [], { stderr: true })
expect(stderr).toMatch(
'You have enabled experimental feature (newNextLinkBehavior) in next.config.mjs.'
'You have enabled experimental feature (workerThreads) in next.config.mjs.'
)
})
})
......@@ -4,8 +4,8 @@ import css from './index.module.css'
export default function Home() {
return (
<main>
<Link href="/other" prefetch={false}>
<a id="link-other">other</a>
<Link href="/other" prefetch={false} id="link-other">
other
</Link>
<br />
<h1 id="black-title" className={css.header}>
......
......@@ -4,8 +4,8 @@ import css from './other.module.css'
export default function Other() {
return (
<main>
<Link href="/">
<a id="link-index">index page</a>
<Link href="/" id="link-index">
index page
</Link>
<br />
<h1 id="red-title" className={css.root}>
......
......@@ -4,8 +4,8 @@ import css from './index.module.css'
export default function Home() {
return (
<main>
<Link href="/other" prefetch={false}>
<a id="link-other">other page</a>
<Link href="/other" prefetch={false} id="link-other">
other page
</Link>
<h1 id="green-title" className={css.green}>
Green
......
......@@ -4,8 +4,8 @@ import css from './other.module.css'
export default function Other() {
return (
<main>
<Link href="/">
<a id="link-index">index page</a>
<Link href="/" id="link-index">
index page
</Link>
<br />
<h1 id="blue-title" className={css.blue}>
......
......@@ -13,8 +13,8 @@ export default function Home() {
Black
</h1>
<p>{state}</p>
<Link href="/client">
<a id="link-client">To /client</a>
<Link href="/client" id="link-client">
To /client
</Link>
</main>
)
......
......@@ -8,12 +8,12 @@ export default function Blue() {
This text should be blue.
</div>
<br />
<Link href="/red" prefetch>
<a id="link-red">Red</a>
<Link href="/red" prefetch id="link-red">
Red
</Link>
<br />
<Link href="/none" prefetch={false}>
<a id="link-none">None</a>
<Link href="/none" prefetch={false} id="link-none">
None
</Link>
</>
)
......
......@@ -7,12 +7,12 @@ export default function None() {
This text should be black.
</div>
<br />
<Link href="/red" prefetch={false}>
<a id="link-red">Red</a>
<Link href="/red" prefetch={false} id="link-red">
Red
</Link>
<br />
<Link href="/blue" prefetch={false}>
<a id="link-blue">Blue</a>
<Link href="/blue" prefetch={false} id="link-blue">
Blue
</Link>
</>
)
......
......@@ -8,12 +8,12 @@ export default function Red() {
This text should be red.
</div>
<br />
<Link href="/blue" prefetch={false}>
<a id="link-blue">Blue</a>
<Link href="/blue" prefetch={false} id="link-blue">
Blue
</Link>
<br />
<Link href="/none" prefetch={false}>
<a id="link-none">None</a>
<Link href="/none" prefetch={false} id="link-none">
None
</Link>
</>
)
......
......@@ -6,9 +6,7 @@ export default function Page1() {
<br />
<input key={'' + Math.random()} id="text-input" type="text" />
<br />
<Link href="/page2">
<a>Switch page</a>
</Link>
<Link href="/page2">Switch page</Link>
</>
)
}
......@@ -6,9 +6,7 @@ export default function Page2() {
<br />
<input key={'' + Math.random()} id="text-input" type="text" />
<br />
<Link href="/page1">
<a>Switch page</a>
</Link>
<Link href="/page1">Switch page</Link>
</>
)
}
......@@ -5,7 +5,7 @@ function AnotherPage() {
return (
<div>
<h1>Another page</h1>
<Link href="/" passHref>
<Link href="/" passHref legacyBehavior>
<Button id="link-index">Another Button instance</Button>
</Link>
</div>
......
......@@ -6,7 +6,7 @@ function HomePage() {
return (
<div>
<h1>Home page</h1>
<Link href="/another-page" passHref>
<Link href="/another-page" passHref legacyBehavior>
<Button id="link-other" className={styles.button}>
Another page
</Button>
......
......@@ -4,8 +4,8 @@ import css from './index.module.css'
export default function Home() {
return (
<main>
<Link href="/other">
<a id="link-other">other</a>
<Link href="/other" id="link-other">
other
</Link>
<br />
<h1 id="black-title" className={css.header}>
......
......@@ -3,8 +3,8 @@ import Link from 'next/link'
export default function Home() {
return (
<main>
<Link href="/other" prefetch={false}>
<a id="link-other">other</a>
<Link href="/other" prefetch={false} id="link-other">
other
</Link>
</main>
)
......
......@@ -21,8 +21,8 @@ export default class Other extends React.Component {
render() {
return (
<main>
<Link href="/" prefetch={false}>
<a id="link-index">index page</a>
<Link href="/" prefetch={false} id="link-index">
index page
</Link>
<br />
<h1 id="red-title" className={css.root} ref={this.ref}>
......
......@@ -4,8 +4,8 @@ import css from './index.module.css'
export default function Home() {
return (
<main>
<Link href="/other" prefetch={false}>
<a id="link-other">other</a>
<Link href="/other" prefetch={false} id="link-other">
other
</Link>
<br />
<h1 id="black-title" className={css.header}>
......
......@@ -4,8 +4,8 @@ import css from './other.module.css'
export default function Other() {
return (
<main>
<Link href="/" prefetch={false}>
<a id="link-index">index page</a>
<Link href="/" prefetch={false} id="link-index">
index page
</Link>
<br />
<h1 id="red-title" className={css.root}>
......
......@@ -10,8 +10,8 @@ function Nav() {
<nav>
<ul className="flex justify-between items-center p-8">
<li>
<Link href="/">
<a className="text-blue-500 no-underline">Home</a>
<Link href="/" className="text-blue-500 no-underline">
Home
</Link>
</li>
<ul className="flex justify-between items-center">
......
......@@ -4,8 +4,8 @@ import Link from 'next/link'
function page() {
return (
<Link href="/">
<a id="nav">Client side nav</a>
<Link href="/" id="nav">
Client side nav
</Link>
)
}
......
......@@ -4,23 +4,23 @@ export default function Links() {
return (
<>
<p id="links">Links</p>
<Link href="/">
<a id="to-index">to /</a>
<Link href="/" id="to-index">
to /
</Link>
<br />
<Link href="/about">
<a id="to-about">to /about</a>
<Link href="/about" id="to-about">
to /about
</Link>
<br />
<Link href="/catch-all/hello">
<a id="to-catch-all">to /catch-all/hello</a>
<Link href="/catch-all/hello" id="to-catch-all">
to /catch-all/hello
</Link>
<br />
<Link href="/links">
<a id="to-links">to /links</a>
<Link href="/links" id="to-links">
to /links
</Link>
</>
)
......
......@@ -3,8 +3,8 @@ import Link from 'next/link'
export default () => (
<>
<h3 id="hello-again">Hello again</h3>
<Link href="/nav">
<a id="to-nav">to nav</a>
<Link href="/nav" id="to-nav">
to nav
</Link>
</>
)
......@@ -3,8 +3,8 @@ import Link from 'next/link'
const Page = () => (
<>
<h3 id="hello">Hello</h3>
<Link href="/nav">
<a id="to-nav">to nav</a>
<Link href="/nav" id="to-nav">
to nav
</Link>
</>
)
......
......@@ -3,12 +3,12 @@ import Link from 'next/link'
const Page = () => (
<>
<h3 id="nav">Nav</h3>
<Link href="/hello" as="/first">
<a id="to-hello">to hello</a>
<Link href="/hello" as="/first" id="to-hello">
to hello
</Link>
<br />
<Link href="/hello-again" as="/second">
<a id="to-hello-again">to hello-again</a>
<Link href="/hello-again" as="/second" id="to-hello-again">
to hello-again
</Link>
<br />
<Link
......@@ -20,36 +20,37 @@ const Page = () => (
},
}}
as="/params/1?another=value"
id="to-params-manual"
>
<a id="to-params-manual">to params (manual)</a>
to params (manual)
</Link>
<br />
<Link href="/params/1?another=value">
<a id="to-params">to params</a>
<Link href="/params/1?another=value" id="to-params">
to params
</Link>
<br />
<Link href="/rewriting-to-auto-export">
<a id="to-rewritten-dynamic">to rewritten dynamic</a>
<Link href="/rewriting-to-auto-export" id="to-rewritten-dynamic">
to rewritten dynamic
</Link>
<br />
<Link href="/hello?overrideMe=1">
<a id="to-overridden">to /hello?overrideMe=1</a>
<Link href="/hello?overrideMe=1" id="to-overridden">
to /hello?overrideMe=1
</Link>
<br />
<Link href="/old-blog/about">
<a id="to-old-blog">to /old-blog/post-1</a>
<Link href="/old-blog/about" id="to-old-blog">
to /old-blog/post-1
</Link>
<br />
<Link href="/overridden">
<a id="to-before-files-overridden">to /overridden</a>
<Link href="/overridden" id="to-before-files-overridden">
to /overridden
</Link>
<br />
<Link href="/nfl">
<a id="to-before-files-dynamic">to /nfl</a>
<Link href="/nfl" id="to-before-files-dynamic">
to /nfl
</Link>
<br />
<Link href="/nfl/test">
<a id="to-before-files-dynamic-again">to /nfl/test</a>
<Link href="/nfl/test" id="to-before-files-dynamic-again">
to /nfl/test
</Link>
<br />
</>
......
......@@ -3,8 +3,8 @@ import Link from 'next/link'
export default function Index() {
return (
<div>
<Link href="/asset">
<a id="go-asset">Asset</a>
<Link href="/asset" id="go-asset">
Asset
</Link>
</div>
)
......
import Link from 'next/link'
export default () => (
<Link href="/">
<a>Hello world</a>
</Link>
)
export default () => <Link href="/">Hello world</Link>
......@@ -6,48 +6,55 @@ const Page = () => {
const { query } = router
return (
<>
<Link href="#only-hash">
<a id="dynamic-route-only-hash">Dynamic route only hash</a>
<Link href="#only-hash" id="dynamic-route-only-hash">
Dynamic route only hash
</Link>
<br />
<Link href={{ hash: 'only-hash-obj' }}>
<a id="dynamic-route-only-hash-obj">Dynamic route only hash object</a>
<Link href={{ hash: 'only-hash-obj' }} id="dynamic-route-only-hash-obj">
Dynamic route only hash object
</Link>
<br />
<Link href="?name=post-2">
<a id="dynamic-route-only-query">Dynamic route only query</a>
<Link href="?name=post-2" id="dynamic-route-only-query">
Dynamic route only query
</Link>
<br />
<Link href="?name=post-3&another=value">
<a id="dynamic-route-only-query-extra">
Dynamic route only query extra
</a>
<Link
href="?name=post-3&another=value"
id="dynamic-route-only-query-extra"
>
Dynamic route only query extra
</Link>
<br />
<Link href={{ query: { name: 'post-4' } }}>
<a id="dynamic-route-only-query-obj">Dynamic route only query object</a>
<Link
href={{ query: { name: 'post-4' } }}
id="dynamic-route-only-query-obj"
>
Dynamic route only query object
</Link>
<br />
<Link href={{ query: { name: 'post-5', another: 'value' } }}>
<a id="dynamic-route-only-query-obj-extra">
Dynamic route only query object extra
</a>
<Link
href={{ query: { name: 'post-5', another: 'value' } }}
id="dynamic-route-only-query-obj-extra"
>
Dynamic route only query object extra
</Link>
<br />
<Link href="?name=post-2#hash-too">
<a id="dynamic-route-query-hash">Dynamic route query and hash</a>
<Link href="?name=post-2#hash-too" id="dynamic-route-query-hash">
Dynamic route query and hash
</Link>
<br />
<Link href="?name=post-3&another=value#hash-again">
<a id="dynamic-route-query-extra-hash">
Dynamic route query extra and hash
</a>
<Link
href="?name=post-3&another=value#hash-again"
id="dynamic-route-query-extra-hash"
>
Dynamic route query extra and hash
</Link>
<br />
<Link href={{ query: { name: 'post-4' }, hash: 'hash-too' }}>
<a id="dynamic-route-query-hash-obj">
Dynamic route query and hash object
</a>
<Link
href={{ query: { name: 'post-4' }, hash: 'hash-too' }}
id="dynamic-route-query-hash-obj"
>
Dynamic route query and hash object
</Link>
<br />
<Link
......@@ -55,10 +62,9 @@ const Page = () => {
query: { name: 'post-5', another: 'value' },
hash: 'hash-again',
}}
id="dynamic-route-query-obj-extra-hash"
>
<a id="dynamic-route-query-obj-extra-hash">
Dynamic route query and hash object extra
</a>
Dynamic route query and hash object extra
</Link>
<br />
<p id="asdf">This is {query.name}</p>
......
......@@ -14,20 +14,24 @@ const Page = () => {
return (
<div>
<h3>My blog</h3>
<Link href="/[name]" as="/post-1">
<a id="view-post-1">View post 1</a>
<Link href="/[name]" as="/post-1" id="view-post-1">
View post 1
</Link>
<br />
<Link href="/[name]" as="/post-1#my-hash">
<a id="view-post-1-hash-1">View post 1 (hash)</a>
<Link href="/[name]" as="/post-1#my-hash" id="view-post-1-hash-1">
View post 1 (hash)
</Link>
<br />
<Link href="/post-1#my-hash">
<a id="view-post-1-hash-1-href-only">View post 1 (hash only href)</a>
<Link href="/post-1#my-hash" id="view-post-1-hash-1-href-only">
View post 1 (hash only href)
</Link>
<br />
<Link href="/post-1?hidden=value" as="/post-1">
<a id="view-post-1-hidden-query">View post 1 (href query)</a>
<Link
href="/post-1?hidden=value"
as="/post-1"
id="view-post-1-hidden-query"
>
View post 1 (href query)
</Link>
<br />
<Link
......@@ -36,14 +40,13 @@ const Page = () => {
pathname: '/[name]',
query: { name: 'post-1' },
}}
id="view-post-1-hash-1-interpolated"
>
<a id="view-post-1-hash-1-interpolated">
View post 1 (hash interpolated)
</a>
View post 1 (hash interpolated)
</Link>
<br />
<Link href="/post-1">
<a id="view-post-1-no-as">View post 1 (no as)</a>
<Link href="/post-1" id="view-post-1-no-as">
View post 1 (no as)
</Link>
<br />
<Link
......@@ -51,8 +54,9 @@ const Page = () => {
pathname: '/[name]',
query: { name: 'post-1' },
}}
id="view-post-1-interpolated"
>
<a id="view-post-1-interpolated">View post 1 (interpolated)</a>
View post 1 (interpolated)
</Link>
<br />
<Link
......@@ -60,10 +64,9 @@ const Page = () => {
pathname: '/[name]',
query: { another: 'value' },
}}
id="view-post-1-interpolated-incorrectly"
>
<a id="view-post-1-interpolated-incorrectly">
View post 1 (interpolated incorrectly)
</a>
View post 1 (interpolated incorrectly)
</Link>
<br />
<Link
......@@ -71,22 +74,29 @@ const Page = () => {
pathname: '/[name]',
query: { name: 'post-1', another: 'value' },
}}
id="view-post-1-interpolated-more-query"
>
<a id="view-post-1-interpolated-more-query">
View post 1 (interpolated additional query)
</a>
View post 1 (interpolated additional query)
</Link>
<br />
<Link href="/[name]/comments" as="/post-1/comments">
<a id="view-post-1-comments">View post 1 comments</a>
<Link
href="/[name]/comments"
as="/post-1/comments"
id="view-post-1-comments"
>
View post 1 comments
</Link>
<br />
<Link href="/[name]/[comment]" as="/post-1/comment-1">
<a id="view-post-1-comment-1">View comment 1 on post 1</a>
<Link
href="/[name]/[comment]"
as="/post-1/comment-1"
id="view-post-1-comment-1"
>
View comment 1 on post 1
</Link>
<br />
<Link href="/post-1/comment-1">
<a id="view-post-1-comment-1-no-as">View comment 1 on post 1 (no as)</a>
<Link href="/post-1/comment-1" id="view-post-1-comment-1-no-as">
View comment 1 on post 1 (no as)
</Link>
<br />
<Link
......@@ -94,49 +104,77 @@ const Page = () => {
pathname: '/[name]/[comment]',
query: { name: 'post-1', comment: 'comment-1' },
}}
id="view-post-1-comment-1-interpolated"
>
<a id="view-post-1-comment-1-interpolated">
View comment 1 on post 1 (interpolated)
</a>
View comment 1 on post 1 (interpolated)
</Link>
<br />
<Link href="/added-later/first">
<a id="added-later-link">/added-later/first</a>
<Link href="/added-later/first" id="added-later-link">
/added-later/first
</Link>
<br />
<Link href="/blog/[post]/comment/[id]" as="/blog/321/comment/123">
<a id="view-nested-dynamic-cmnt">View comment 123 on blog post 321</a>
<Link
href="/blog/[post]/comment/[id]"
as="/blog/321/comment/123"
id="view-nested-dynamic-cmnt"
>
View comment 123 on blog post 321
</Link>
<br />
<Link href="/[name]?fromHome=true" as="/post-1?fromHome=true">
<a id="view-post-1-with-query">View post 1 with query</a>
<Link
href="/[name]?fromHome=true"
as="/post-1?fromHome=true"
id="view-post-1-with-query"
>
View post 1 with query
</Link>
<br />
<Link href="/on-mount/[post]" as="/on-mount/test-w-hash#item-400">
<a id="view-dynamic-with-hash">View test with hash</a>
<Link
href="/on-mount/[post]"
as="/on-mount/test-w-hash#item-400"
id="view-dynamic-with-hash"
>
View test with hash
</Link>
<br />
<Link href="/p1/p2/all-ssr/[...rest]" as="/p1/p2/all-ssr/hello">
<a id="catch-all-single">Catch-all route (single)</a>
<Link
href="/p1/p2/all-ssr/[...rest]"
as="/p1/p2/all-ssr/hello"
id="catch-all-single"
>
Catch-all route (single)
</Link>
<br />
<Link href="/p1/p2/all-ssr/[...rest]" as="/p1/p2/all-ssr/hello1/hello2">
<a id="catch-all-multi">Catch-all route (multi)</a>
<Link
href="/p1/p2/all-ssr/[...rest]"
as="/p1/p2/all-ssr/hello1/hello2"
id="catch-all-multi"
>
Catch-all route (multi)
</Link>
<br />
<Link
href="/p1/p2/all-ssr/[...rest]"
as="/p1/p2/all-ssr/hello1%2F/he%2Fllo2"
id="catch-all-enc"
>
<a id="catch-all-enc">Catch-all route (encoded)</a>
Catch-all route (encoded)
</Link>
<br />
<Link href="/p1/p2/all-ssr/[...rest]" as="/p1/p2/all-ssr/:42">
<a id="catch-all-colonnumber">Catch-all route :42</a>
<Link
href="/p1/p2/all-ssr/[...rest]"
as="/p1/p2/all-ssr/:42"
id="catch-all-colonnumber"
>
Catch-all route :42
</Link>
<br />
<Link href="/p1/p2/all-ssg/[...rest]" as="/p1/p2/all-ssg/hello">
<a id="ssg-catch-all-single">Catch-all route (single)</a>
<Link
href="/p1/p2/all-ssg/[...rest]"
as="/p1/p2/all-ssg/hello"
id="ssg-catch-all-single"
>
Catch-all route (single)
</Link>
<br />
<Link
......@@ -144,18 +182,21 @@ const Page = () => {
pathname: '/p1/p2/all-ssg/[...rest]',
query: { rest: ['hello'] },
}}
id="ssg-catch-all-single-interpolated"
>
<a id="ssg-catch-all-single-interpolated">
Catch-all route (single interpolated)
</a>
Catch-all route (single interpolated)
</Link>
<br />
<Link href="/p1/p2/all-ssg/[...rest]" as="/p1/p2/all-ssg/hello1/hello2">
<a id="ssg-catch-all-multi">Catch-all route (multi)</a>
<Link
href="/p1/p2/all-ssg/[...rest]"
as="/p1/p2/all-ssg/hello1/hello2"
id="ssg-catch-all-multi"
>
Catch-all route (multi)
</Link>
<br />
<Link href="/p1/p2/all-ssg/hello1/hello2">
<a id="ssg-catch-all-multi-no-as">Catch-all route (multi)</a>
<Link href="/p1/p2/all-ssg/hello1/hello2" id="ssg-catch-all-multi-no-as">
Catch-all route (multi)
</Link>
<br />
<Link
......@@ -163,28 +204,29 @@ const Page = () => {
pathname: '/p1/p2/all-ssg/[...rest]',
query: { rest: ['hello1', 'hello2'] },
}}
id="ssg-catch-all-multi-interpolated"
>
<a id="ssg-catch-all-multi-interpolated">
Catch-all route (multi interpolated)
</a>
Catch-all route (multi interpolated)
</Link>
<br />
<Link
href="/p1/p2/nested-all-ssg/[...rest]"
as="/p1/p2/nested-all-ssg/hello"
id="nested-ssg-catch-all-single"
>
<a id="nested-ssg-catch-all-single">Nested Catch-all route (single)</a>
Nested Catch-all route (single)
</Link>
<br />
<Link
href="/p1/p2/nested-all-ssg/[...rest]"
as="/p1/p2/nested-all-ssg/hello1/hello2"
id="nested-ssg-catch-all-multi"
>
<a id="nested-ssg-catch-all-multi">Nested Catch-all route (multi)</a>
Nested Catch-all route (multi)
</Link>
<br />
<Link href="/d/dynamic-1">
<a id="dynamic-route-no-as">Dynamic route no as</a>
<Link href="/d/dynamic-1" id="dynamic-route-no-as">
Dynamic route no as
</Link>
<p id="query">{JSON.stringify(Object.keys(useRouter().query))}</p>
</div>
......
......@@ -4,9 +4,7 @@ function Index() {
return (
<>
<h3>Hi 👋</h3>
<Link href="/a-non-existing-page">
<a>a link to no-where</a>
</Link>
<Link href="/a-non-existing-page">a link to no-where</Link>
</>
)
}
......
......@@ -2,8 +2,8 @@ import Link from 'next/link'
export default () => (
<>
<Link href="/broken">
<a id="to-broken">to oops</a>
<Link href="/broken" id="to-broken">
to oops
</Link>
</>
)
......@@ -3,9 +3,7 @@ import Link from 'next/link'
const About = ({ bar }) => (
<div id="about-page">
<div>
<Link href="/">
<a>Go Back</a>
</Link>
<Link href="/">Go Back</Link>
</div>
<p>{`This is the About page foo${bar || ''}`}</p>
</div>
......
......@@ -3,7 +3,7 @@ import Link from 'next/link'
export default () => (
<div id="button-link-page">
<div>
<Link href="/" passHref>
<Link href="/" passHref legacyBehavior>
<button>Go Back</button>
</Link>
</div>
......
......@@ -13,8 +13,8 @@ export default class Counter extends React.Component {
return (
<div id="counter-page">
<div>
<Link href="/">
<a id="go-back">Go Back</a>
<Link href="/" id="go-back">
Go Back
</Link>
</div>
<p>Counter: {counter}</p>
......
......@@ -6,9 +6,7 @@ const DynamicComponent = dynamic(() => import('../components/hello'))
export default () => (
<div id="dynamic-imports-page">
<div>
<Link href="/">
<a>Go Back</a>
</Link>
<Link href="/">Go Back</Link>
</div>
<DynamicComponent />
</div>
......
......@@ -21,9 +21,7 @@ export default class DynamicPage extends React.Component {
return (
<div id="dynamic-page">
<div>
<Link href="/">
<a>Go Back</a>
</Link>
<Link href="/">Go Back</Link>
</div>
<p>{text}</p>
<div id="hash">Hash: {hash}</div>
......
......@@ -9,37 +9,49 @@ function routeToAbout(e) {
export default () => (
<div id="home-page">
<div>
<Link href="/about">
<Link href="/about" legacyBehavior>
<a id="about-via-link">About via Link</a>
</Link>
<a href="#" onClick={routeToAbout} id="about-via-router">
About via Router
</a>
<Link href="/counter">
<Link href="/counter" legacyBehavior>
<a id="counter">Counter</a>
</Link>
<Link href="/dynamic?text=cool+dynamic+text">
<Link href="/dynamic?text=cool+dynamic+text" legacyBehavior>
<a id="get-initial-props">getInitialProps</a>
</Link>
<Link href="/dynamic?text=next+export+is+nice" as="/dynamic/one">
<Link
href="/dynamic?text=next+export+is+nice"
as="/dynamic/one"
legacyBehavior
>
<a id="dynamic-1">Dynamic 1</a>
</Link>
<Link href="/dynamic?text=Vercel+is+awesome" as="/dynamic/two">
<Link
href="/dynamic?text=Vercel+is+awesome"
as="/dynamic/two"
legacyBehavior
>
<a id="dynamic-2">Dynamic 2</a>
</Link>
<Link href="/dynamic?text=Vercel+is+awesome#cool">
<Link href="/dynamic?text=Vercel+is+awesome#cool" legacyBehavior>
<a id="with-hash">With Hash</a>
</Link>
<Link href="/dynamic?text=this+file+has+an+extension" as="/file-name.md">
<Link
href="/dynamic?text=this+file+has+an+extension"
as="/file-name.md"
legacyBehavior
>
<a id="path-with-extension">Path with extension</a>
</Link>
<Link href="/level1">
<Link href="/level1" legacyBehavior>
<a id="level1-home-page">Level1 home page</a>
</Link>
<Link href="/level1/about">
<Link href="/level1/about" legacyBehavior>
<a id="level1-about-page">Level1 about page</a>
</Link>
<Link href="/dynamic-imports">
<Link href="/dynamic-imports" legacyBehavior>
<a id="dynamic-imports-link">Dynamic imports page</a>
</Link>
</div>
......
......@@ -3,9 +3,7 @@ import Link from 'next/link'
export default () => (
<div id="level1-about-page">
<div>
<Link href="/">
<a>Go Back</a>
</Link>
<Link href="/">Go Back</Link>
</div>
<p>This is the Level1 about page</p>
</div>
......
......@@ -3,9 +3,7 @@ import Link from 'next/link'
export default () => (
<div id="level1-home-page">
<div>
<Link href="/">
<a>Go Back</a>
</Link>
<Link href="/">Go Back</Link>
</div>
<p>This is the Level1 home page</p>
</div>
......
......@@ -5,9 +5,7 @@ const { publicRuntimeConfig, serverRuntimeConfig } = getConfig()
const About = ({ bar }) => (
<div id="about-page">
<div>
<Link href="/">
<a>Go Back</a>
</Link>
<Link href="/">Go Back</Link>
</div>
<p>{`This is the About page ${publicRuntimeConfig.foo}${bar || ''}`}</p>
</div>
......
......@@ -3,7 +3,7 @@ import Link from 'next/link'
export default () => (
<div id="button-link-page">
<div>
<Link href="/" passHref>
<Link href="/" passHref legacyBehavior>
<button>Go Back</button>
</Link>
</div>
......
......@@ -13,8 +13,8 @@ export default class Counter extends React.Component {
return (
<div id="counter-page">
<div>
<Link href="/">
<a id="go-back">Go Back</a>
<Link href="/" id="go-back">
Go Back
</Link>
</div>
<p>Counter: {counter}</p>
......
......@@ -6,9 +6,7 @@ const DynamicComponent = dynamic(() => import('../components/hello'))
export default () => (
<div id="dynamic-imports-page">
<div>
<Link href="/">
<a>Go Back</a>
</Link>
<Link href="/">Go Back</Link>
</div>
<DynamicComponent />
</div>
......
......@@ -21,9 +21,7 @@ export default class DynamicPage extends React.Component {
return (
<div id="dynamic-page">
<div>
<Link href="/">
<a>Go Back</a>
</Link>
<Link href="/">Go Back</Link>
</div>
<p>{text}</p>
<div id="hash">Hash: {hash}</div>
......
......@@ -2,8 +2,8 @@ import Link from 'next/link'
export default () => (
<div id="empty-hash-link-page">
<Link href="/hello#">
<a id="empty-hash-link">Empty Hash link</a>
<Link href="/hello#" id="empty-hash-link">
Empty Hash link
</Link>
</div>
)
......@@ -2,8 +2,8 @@ import Link from 'next/link'
export default () => (
<div id="empty-query-link-page">
<Link href="/hello?">
<a id="empty-query-link">Empty Query link</a>
<Link href="/hello?" id="empty-query-link">
Empty Query link
</Link>
</div>
)
......@@ -2,8 +2,8 @@ import Link from 'next/link'
export default () => (
<div id="hash-link-page">
<Link href="#hash">
<a id="hash-link">Hash link</a>
<Link href="#hash" id="hash-link">
Hash link
</Link>
</div>
)
......@@ -9,40 +9,52 @@ function routeToAbout(e) {
export default () => (
<div id="home-page">
<div>
<Link href="/about">
<Link href="/about" legacyBehavior>
<a id="about-via-link">About via Link</a>
</Link>
<a href="#" onClick={routeToAbout} id="about-via-router">
About via Router
</a>
<Link href="/counter">
<Link href="/counter" legacyBehavior>
<a id="counter">Counter</a>
</Link>
<Link href="/dynamic?text=cool+dynamic+text">
<Link href="/dynamic?text=cool+dynamic+text" legacyBehavior>
<a id="get-initial-props">getInitialProps</a>
</Link>
<Link href="/dynamic?text=next+export+is+nice" as="/dynamic/one">
<Link
href="/dynamic?text=next+export+is+nice"
as="/dynamic/one"
legacyBehavior
>
<a id="dynamic-1">Dynamic 1</a>
</Link>
<Link href="/dynamic?text=Vercel+is+awesome" as="/dynamic/two">
<Link
href="/dynamic?text=Vercel+is+awesome"
as="/dynamic/two"
legacyBehavior
>
<a id="dynamic-2">Dynamic 2</a>
</Link>
<Link href="/dynamic?text=Vercel+is+awesome#cool">
<Link href="/dynamic?text=Vercel+is+awesome#cool" legacyBehavior>
<a id="with-hash">With Hash</a>
</Link>
<Link href="/dynamic?text=this+file+has+an+extension" as="/file-name.md">
<Link
href="/dynamic?text=this+file+has+an+extension"
as="/file-name.md"
legacyBehavior
>
<a id="path-with-extension">Path with extension</a>
</Link>
<Link href="/level1">
<Link href="/level1" legacyBehavior>
<a id="level1-home-page">Level1 home page</a>
</Link>
<Link href="/level1/about">
<Link href="/level1/about" legacyBehavior>
<a id="level1-about-page">Level1 about page</a>
</Link>
<Link href="/dynamic-imports">
<Link href="/dynamic-imports" legacyBehavior>
<a id="dynamic-imports-link">Dynamic imports page</a>
</Link>
<Link href="/gsp-notfound">
<Link href="/gsp-notfound" legacyBehavior>
<a id="gsp-notfound-link">GSP notfound page</a>
</Link>
</div>
......
......@@ -3,9 +3,7 @@ import Link from 'next/link'
export default () => (
<div id="level1-about-page">
<div>
<Link href="/">
<a>Go Back</a>
</Link>
<Link href="/">Go Back</Link>
</div>
<p>This is the Level1 about page</p>
</div>
......
......@@ -3,9 +3,7 @@ import Link from 'next/link'
export default () => (
<div id="level1-home-page">
<div>
<Link href="/">
<a>Go Back</a>
</Link>
<Link href="/">Go Back</Link>
</div>
<p>This is the Level1 home page</p>
</div>
......
......@@ -7,8 +7,8 @@ const Page = () => {
Hi!
<br />
<br />
<Link href="/with-font">
<a id="with-font">With font</a>
<Link href="/with-font" id="with-font">
With font
</Link>
</div>
)
......
......@@ -7,8 +7,8 @@ const Page = () => {
Hi!
<br />
<br />
<Link href="/with-font">
<a id="with-font">With font</a>
<Link href="/with-font" id="with-font">
With font
</Link>
</div>
)
......
......@@ -7,8 +7,8 @@ export function getServerSideProps() {
export default function () {
return (
<main>
<Link href="/">
<a id="to-index">To Index</a>
<Link href="/" id="to-index">
To Index
</Link>
</main>
)
......
......@@ -7,22 +7,27 @@ export default function MainContent({ message }) {
<ul>
<li>
<Link href="/redirector?redirect=/alias-to-main-content&message=refreshed">
<a id="link-with-rewritten-url" className={message}>
Link with rewritten target url
</a>
<Link
href="/redirector?redirect=/alias-to-main-content&message=refreshed"
id="link-with-rewritten-url"
className={message}
>
Link with rewritten target url
</Link>
</li>
<li>
<Link href="/redirector?redirect=/main-content&message=refreshWithClientSideNavigation">
<a>Link with client side navigation</a>
Link with client side navigation
</Link>
</li>
<li>
<Link href="/redirector?redirect=/unknown-route">
<a id="link-unknown-url">Link to unknown internal navigation</a>
<Link
href="/redirector?redirect=/unknown-route"
id="link-unknown-url"
>
Link to unknown internal navigation
</Link>
</li>
</ul>
......
......@@ -5,8 +5,8 @@ const Home = () => {
<div>
<h1>Foo!</h1>
<h2>bar!</h2>
<Link href="/other">
<a id="to-other">Other</a>
<Link href="/other" id="to-other">
Other
</Link>
</div>
)
......
......@@ -14,8 +14,8 @@ export default function Page(props) {
<p id="router-query">{JSON.stringify(router.query)}</p>
<p id="router-pathname">{router.pathname}</p>
<p id="router-as-path">{router.asPath}</p>
<Link href="/">
<a id="to-index">to /</a>
<Link href="/" id="to-index">
to /
</Link>
<br />
</>
......
......@@ -14,8 +14,8 @@ export default function Page(props) {
<p id="router-query">{JSON.stringify(router.query)}</p>
<p id="router-pathname">{router.pathname}</p>
<p id="router-as-path">{router.asPath}</p>
<Link href="/">
<a id="to-index">to /</a>
<Link href="/" id="to-index">
to /
</Link>
</>
)
......
......@@ -14,8 +14,8 @@ export default function Page(props) {
<p id="router-query">{JSON.stringify(router.query)}</p>
<p id="router-pathname">{router.pathname}</p>
<p id="router-as-path">{router.asPath}</p>
<Link href="/">
<a id="to-index">to /</a>
<Link href="/" id="to-index">
to /
</Link>
<br />
</>
......
......@@ -13,32 +13,32 @@ export default function Page(props) {
<p id="router-query">{JSON.stringify(router.query)}</p>
<p id="router-pathname">{router.pathname}</p>
<p id="router-as-path">{router.asPath}</p>
<Link href="/another">
<a id="to-another">to /another</a>
<Link href="/another" id="to-another">
to /another
</Link>
<br />
<Link href="/gsp">
<a id="to-gsp">to /gsp</a>
<Link href="/gsp" id="to-gsp">
to /gsp
</Link>
<br />
<Link href="/gsp/fallback/first">
<a id="to-fallback-first">to /gsp/fallback/first</a>
<Link href="/gsp/fallback/first" id="to-fallback-first">
to /gsp/fallback/first
</Link>
<br />
<Link href="/gsp/fallback/hello">
<a id="to-fallback-hello">to /gsp/fallback/hello</a>
<Link href="/gsp/fallback/hello" id="to-fallback-hello">
to /gsp/fallback/hello
</Link>
<br />
<Link href="/gsp/no-fallback/first">
<a id="to-no-fallback-first">to /gsp/no-fallback/first</a>
<Link href="/gsp/no-fallback/first" id="to-no-fallback-first">
to /gsp/no-fallback/first
</Link>
<br />
<Link href="/gssp">
<a id="to-gssp">to /gssp</a>
<Link href="/gssp" id="to-gssp">
to /gssp
</Link>
<br />
<Link href="/gssp/first">
<a id="to-gssp-slug">to /gssp/first</a>
<Link href="/gssp/first" id="to-gssp-slug">
to /gssp/first
</Link>
<br />
</>
......
......@@ -14,32 +14,32 @@ export default function Page(props) {
<p id="router-query">{JSON.stringify(router.query)}</p>
<p id="router-pathname">{router.pathname}</p>
<p id="router-as-path">{router.asPath}</p>
<Link href="/another">
<a id="to-another">to /another</a>
<Link href="/another" id="to-another">
to /another
</Link>
<br />
<Link href="/gsp">
<a id="to-gsp">to /gsp</a>
<Link href="/gsp" id="to-gsp">
to /gsp
</Link>
<br />
<Link href="/gsp/fallback/first">
<a id="to-fallback-first">to /gsp/fallback/first</a>
<Link href="/gsp/fallback/first" id="to-fallback-first">
to /gsp/fallback/first
</Link>
<br />
<Link href="/gsp/fallback/hello">
<a id="to-fallback-hello">to /gsp/fallback/hello</a>
<Link href="/gsp/fallback/hello" id="to-fallback-hello">
to /gsp/fallback/hello
</Link>
<br />
<Link href="/gsp/no-fallback/first">
<a id="to-no-fallback-first">to /gsp/no-fallback/first</a>
<Link href="/gsp/no-fallback/first" id="to-no-fallback-first">
to /gsp/no-fallback/first
</Link>
<br />
<Link href="/gssp">
<a id="to-gssp">to /gssp</a>
<Link href="/gssp" id="to-gssp">
to /gssp
</Link>
<br />
<Link href="/gssp/first">
<a id="to-gssp-slug">to /gssp/first</a>
<Link href="/gssp/first" id="to-gssp-slug">
to /gssp/first
</Link>
<br />
</>
......
......@@ -16,8 +16,8 @@ export default function Page(props) {
<p id="router-query">{JSON.stringify(router.query)}</p>
<p id="router-pathname">{router.pathname}</p>
<p id="router-as-path">{router.asPath}</p>
<Link href="/">
<a id="to-index">to /</a>
<Link href="/" id="to-index">
to /
</Link>
<br />
</>
......
......@@ -14,8 +14,8 @@ export default function Page(props) {
<p id="router-query">{JSON.stringify(router.query)}</p>
<p id="router-pathname">{router.pathname}</p>
<p id="router-as-path">{router.asPath}</p>
<Link href="/">
<a id="to-index">to /</a>
<Link href="/" id="to-index">
to /
</Link>
<br />
</>
......
......@@ -16,8 +16,8 @@ export default function Page(props) {
<p id="router-query">{JSON.stringify(router.query)}</p>
<p id="router-pathname">{router.pathname}</p>
<p id="router-as-path">{router.asPath}</p>
<Link href="/">
<a id="to-index">to /</a>
<Link href="/" id="to-index">
to /
</Link>
<br />
</>
......
......@@ -14,8 +14,8 @@ export default function Page(props) {
<p id="router-query">{JSON.stringify(router.query)}</p>
<p id="router-pathname">{router.pathname}</p>
<p id="router-as-path">{router.asPath}</p>
<Link href="/">
<a id="to-index">to /</a>
<Link href="/" id="to-index">
to /
</Link>
<br />
</>
......
......@@ -14,8 +14,8 @@ export default function Page(props) {
<p id="router-query">{JSON.stringify(router.query)}</p>
<p id="router-pathname">{router.pathname}</p>
<p id="router-as-path">{router.asPath}</p>
<Link href="/">
<a id="to-index">to /</a>
<Link href="/" id="to-index">
to /
</Link>
<br />
</>
......
......@@ -25,40 +25,40 @@ export default function Page(props) {
<p id="router-query">{JSON.stringify(router.query)}</p>
<p id="router-pathname">{router.pathname}</p>
<p id="router-as-path">{asPath}</p>
<Link href="/another">
<a id="to-another">to /another</a>
<Link href="/another" id="to-another">
to /another
</Link>
<br />
<Link href="/dynamic/first">
<a id="to-dynamic">to /dynamic/first</a>
<Link href="/dynamic/first" id="to-dynamic">
to /dynamic/first
</Link>
<br />
<Link href="/gsp">
<a id="to-gsp">to /gsp</a>
<Link href="/gsp" id="to-gsp">
to /gsp
</Link>
<br />
<Link href="/gsp/fallback/first">
<a id="to-fallback-first">to /gsp/fallback/first</a>
<Link href="/gsp/fallback/first" id="to-fallback-first">
to /gsp/fallback/first
</Link>
<br />
<Link href="/gsp/fallback/hello">
<a id="to-fallback-hello">to /gsp/fallback/hello</a>
<Link href="/gsp/fallback/hello" id="to-fallback-hello">
to /gsp/fallback/hello
</Link>
<br />
<Link href="/gsp/no-fallback/first">
<a id="to-no-fallback-first">to /gsp/no-fallback/first</a>
<Link href="/gsp/no-fallback/first" id="to-no-fallback-first">
to /gsp/no-fallback/first
</Link>
<br />
<Link href="/gssp">
<a id="to-gssp">to /gssp</a>
<Link href="/gssp" id="to-gssp">
to /gssp
</Link>
<br />
<Link href="/gssp/first">
<a id="to-gssp-slug">to /gssp/first</a>
<Link href="/gssp/first" id="to-gssp-slug">
to /gssp/first
</Link>
<br />
<Link href="/api/post/asdf">
<a id="to-api-post">to /api/post/[slug]</a>
<Link href="/api/post/asdf" id="to-api-post">
to /api/post/[slug]
</Link>
<br />
</>
......
......@@ -15,32 +15,44 @@ export default function Page(props) {
<p id="router-query">{JSON.stringify(router.query)}</p>
<p id="router-pathname">{router.pathname}</p>
<p id="router-as-path">{router.asPath}</p>
<Link href="/another" locale={nextLocale}>
<a id="to-another">to /another</a>
<Link href="/another" locale={nextLocale} id="to-another">
to /another
</Link>
<br />
<Link href="/gsp" locale={nextLocale}>
<a id="to-gsp">to /gsp</a>
<Link href="/gsp" locale={nextLocale} id="to-gsp">
to /gsp
</Link>
<br />
<Link href="/gsp/fallback/first" locale={nextLocale}>
<a id="to-fallback-first">to /gsp/fallback/first</a>
<Link
href="/gsp/fallback/first"
locale={nextLocale}
id="to-fallback-first"
>
to /gsp/fallback/first
</Link>
<br />
<Link href="/gsp/fallback/hello" locale={nextLocale}>
<a id="to-fallback-hello">to /gsp/fallback/hello</a>
<Link
href="/gsp/fallback/hello"
locale={nextLocale}
id="to-fallback-hello"
>
to /gsp/fallback/hello
</Link>
<br />
<Link href="/gsp/no-fallback/first" locale={nextLocale}>
<a id="to-no-fallback-first">to /gsp/no-fallback/first</a>
<Link
href="/gsp/no-fallback/first"
locale={nextLocale}
id="to-no-fallback-first"
>
to /gsp/no-fallback/first
</Link>
<br />
<Link href="/gssp" locale={nextLocale}>
<a id="to-gssp">to /gssp</a>
<Link href="/gssp" locale={nextLocale} id="to-gssp">
to /gssp
</Link>
<br />
<Link href="/gssp/first" locale={nextLocale}>
<a id="to-gssp-slug">to /gssp/first</a>
<Link href="/gssp/first" locale={nextLocale} id="to-gssp-slug">
to /gssp/first
</Link>
<br />
</>
......
......@@ -14,40 +14,52 @@ export default function Page(props) {
<p id="router-query">{JSON.stringify(router.query)}</p>
<p id="router-pathname">{router.pathname}</p>
<p id="router-as-path">{router.asPath}</p>
<Link href={`/${nextLocale}/another`} locale={false}>
<a id="to-another">to /another</a>
<Link href={`/${nextLocale}/another`} locale={false} id="to-another">
to /another
</Link>
<br />
<Link href={`/${nextLocale}/gsp`} locale={false}>
<a id="to-gsp">to /gsp</a>
<Link href={`/${nextLocale}/gsp`} locale={false} id="to-gsp">
to /gsp
</Link>
<br />
<Link href={`/${nextLocale}/gsp/fallback/first`} locale={false}>
<a id="to-fallback-first">to /gsp/fallback/first</a>
<Link
href={`/${nextLocale}/gsp/fallback/first`}
locale={false}
id="to-fallback-first"
>
to /gsp/fallback/first
</Link>
<br />
<Link href={`/${nextLocale}/gsp/fallback/hello`} locale={false}>
<a id="to-fallback-hello">to /gsp/fallback/hello</a>
<Link
href={`/${nextLocale}/gsp/fallback/hello`}
locale={false}
id="to-fallback-hello"
>
to /gsp/fallback/hello
</Link>
<br />
<Link href={`/${nextLocale}/gsp/no-fallback/first`} locale={false}>
<a id="to-no-fallback-first">to /gsp/no-fallback/first</a>
<Link
href={`/${nextLocale}/gsp/no-fallback/first`}
locale={false}
id="to-no-fallback-first"
>
to /gsp/no-fallback/first
</Link>
<br />
<Link href={`/${nextLocale}/gssp`} locale={false}>
<a id="to-gssp">to /gssp</a>
<Link href={`/${nextLocale}/gssp`} locale={false} id="to-gssp">
to /gssp
</Link>
<br />
<Link href={`/${nextLocale}/gssp/first`} locale={false}>
<a id="to-gssp-slug">to /gssp/first</a>
<Link href={`/${nextLocale}/gssp/first`} locale={false} id="to-gssp-slug">
to /gssp/first
</Link>
<br />
<Link href={`/gssp/first`} locale={false}>
<a id="to-gssp-slug-default">to /gssp/first (default locale)</a>
<Link href={`/gssp/first`} locale={false} id="to-gssp-slug-default">
to /gssp/first (default locale)
</Link>
<br />
<Link href={`/gsp`} locale={false}>
<a id="to-gsp-default">to /gsp (default locale)</a>
<Link href={`/gsp`} locale={false} id="to-gsp-default">
to /gsp (default locale)
</Link>
<br />
</>
......
......@@ -15,23 +15,23 @@ export default function Page(props) {
<p id="router-pathname">{router.pathname}</p>
<p id="router-as-path">{router.asPath}</p>
<Link href="/gsp" locale="en-US">
<a id="to-gsp-en-us">to /gsp</a>
<Link href="/gsp" locale="en-US" id="to-gsp-en-us">
to /gsp
</Link>
<br />
<Link href="/gsp" locale="nl-NL">
<a id="to-gsp-nl-nl">to /gsp</a>
<Link href="/gsp" locale="nl-NL" id="to-gsp-nl-nl">
to /gsp
</Link>
<br />
<Link href="/gsp" locale="fr">
<a id="to-gsp-fr">to /gsp</a>
<Link href="/gsp" locale="fr" id="to-gsp-fr">
to /gsp
</Link>
<br />
<Link href="/" locale="fr">
<a id="to-index-fr">to /</a>
<Link href="/" locale="fr" id="to-index-fr">
to /
</Link>
</>
)
......
......@@ -13,8 +13,8 @@ export default function Page(props) {
<p id="router-query">{JSON.stringify(router.query)}</p>
<p id="router-pathname">{router.pathname}</p>
<p id="router-as-path">{router.asPath}</p>
<Link href="/">
<a id="to-index">to /</a>
<Link href="/" id="to-index">
to /
</Link>
<br />
</>
......
......@@ -15,8 +15,8 @@ export default function Page(props) {
<p id="router-query">{JSON.stringify(router.query)}</p>
<p id="router-pathname">{router.pathname}</p>
<p id="router-as-path">{router.asPath}</p>
<Link href="/">
<a id="to-index">to /</a>
<Link href="/" id="to-index">
to /
</Link>
<br />
</>
......
......@@ -13,8 +13,8 @@ export default function Page(props) {
<p id="router-query">{JSON.stringify(router.query)}</p>
<p id="router-pathname">{router.pathname}</p>
<p id="router-as-path">{router.asPath}</p>
<Link href="/">
<a id="to-index">to /</a>
<Link href="/" id="to-index">
to /
</Link>
<br />
</>
......
......@@ -15,33 +15,33 @@ export default function Page(props) {
<p id="router-pathname">{router.pathname}</p>
<p id="router-as-path">{router.asPath}</p>
<Link href="/" locale="en-US">
<a id="to-def-locale-index">to /</a>
<Link href="/" locale="en-US" id="to-def-locale-index">
to /
</Link>
<br />
<Link href="/another" locale="en-US">
<a id="to-def-locale-another">to /another</a>
<Link href="/another" locale="en-US" id="to-def-locale-another">
to /another
</Link>
<br />
<Link href="/" locale="nl-NL">
<a id="to-locale-index">to /nl-nl</a>
<Link href="/" locale="nl-NL" id="to-locale-index">
to /nl-nl
</Link>
<br />
<Link href="/another" locale="nl-NL">
<a id="to-locale-another">to /nl-nl/another</a>
<Link href="/another" locale="nl-NL" id="to-locale-another">
to /nl-nl/another
</Link>
<br />
<Link href="/fr" locale={false}>
<a id="to-fr-locale-index">to /fr</a>
<Link href="/fr" locale={false} id="to-fr-locale-index">
to /fr
</Link>
<br />
<Link href="/fr/another" locale={false}>
<a id="to-fr-locale-another">to /fr/another</a>
<Link href="/fr/another" locale={false} id="to-fr-locale-another">
to /fr/another
</Link>
<br />
</>
......
......@@ -31,11 +31,12 @@ export default function Page(props) {
<Link
href={{ pathname: router.pathname, query: router.query, hash: '#hash' }}
locale={router.locale === 'fr' ? 'en' : 'fr'}
id="change-locale"
>
<a id="change-locale">Change Locale</a>
Change Locale
</Link>
<Link href={{ hash: '#newhash' }}>
<a id="hash-change">Hash Change</a>
<Link href={{ hash: '#newhash' }} id="hash-change">
Hash Change
</Link>
</>
)
......
......@@ -11,8 +11,9 @@ export default function Page(props) {
<Link
href={{ pathname: router.pathname, query: router.query, hash: '#hash' }}
locale={router.locale === 'fr' ? 'en' : 'fr'}
id="change-locale"
>
<a id="change-locale">Change Locale</a>
Change Locale
</Link>
</>
)
......
......@@ -14,8 +14,8 @@ export default function Page(props) {
<p id="router-query">{JSON.stringify(router.query)}</p>
<p id="router-pathname">{router.pathname}</p>
<p id="router-as-path">{router.asPath}</p>
<Link href="/">
<a id="to-index">to /</a>
<Link href="/" id="to-index">
to /
</Link>
<br />
</>
......
......@@ -14,8 +14,8 @@ export default function Page(props) {
<p id="router-query">{JSON.stringify(router.query)}</p>
<p id="router-pathname">{router.pathname}</p>
<p id="router-as-path">{router.asPath}</p>
<Link href="/">
<a id="to-index">to /</a>
<Link href="/" id="to-index">
to /
</Link>
</>
)
......
......@@ -14,8 +14,8 @@ export default function Page(props) {
<p id="router-query">{JSON.stringify(router.query)}</p>
<p id="router-pathname">{router.pathname}</p>
<p id="router-as-path">{router.asPath}</p>
<Link href="/">
<a id="to-index">to /</a>
<Link href="/" id="to-index">
to /
</Link>
<br />
</>
......
......@@ -13,32 +13,32 @@ export default function Page(props) {
<p id="router-query">{JSON.stringify(router.query)}</p>
<p id="router-pathname">{router.pathname}</p>
<p id="router-as-path">{router.asPath}</p>
<Link href="/another">
<a id="to-another">to /another</a>
<Link href="/another" id="to-another">
to /another
</Link>
<br />
<Link href="/gsp">
<a id="to-gsp">to /gsp</a>
<Link href="/gsp" id="to-gsp">
to /gsp
</Link>
<br />
<Link href="/gsp/fallback/first">
<a id="to-fallback-first">to /gsp/fallback/first</a>
<Link href="/gsp/fallback/first" id="to-fallback-first">
to /gsp/fallback/first
</Link>
<br />
<Link href="/gsp/fallback/hello">
<a id="to-fallback-hello">to /gsp/fallback/hello</a>
<Link href="/gsp/fallback/hello" id="to-fallback-hello">
to /gsp/fallback/hello
</Link>
<br />
<Link href="/gsp/no-fallback/first">
<a id="to-no-fallback-first">to /gsp/no-fallback/first</a>
<Link href="/gsp/no-fallback/first" id="to-no-fallback-first">
to /gsp/no-fallback/first
</Link>
<br />
<Link href="/gssp">
<a id="to-gssp">to /gssp</a>
<Link href="/gssp" id="to-gssp">
to /gssp
</Link>
<br />
<Link href="/gssp/first">
<a id="to-gssp-slug">to /gssp/first</a>
<Link href="/gssp/first" id="to-gssp-slug">
to /gssp/first
</Link>
<br />
</>
......
......@@ -14,32 +14,32 @@ export default function Page(props) {
<p id="router-query">{JSON.stringify(router.query)}</p>
<p id="router-pathname">{router.pathname}</p>
<p id="router-as-path">{router.asPath}</p>
<Link href="/another">
<a id="to-another">to /another</a>
<Link href="/another" id="to-another">
to /another
</Link>
<br />
<Link href="/gsp">
<a id="to-gsp">to /gsp</a>
<Link href="/gsp" id="to-gsp">
to /gsp
</Link>
<br />
<Link href="/gsp/fallback/first">
<a id="to-fallback-first">to /gsp/fallback/first</a>
<Link href="/gsp/fallback/first" id="to-fallback-first">
to /gsp/fallback/first
</Link>
<br />
<Link href="/gsp/fallback/hello">
<a id="to-fallback-hello">to /gsp/fallback/hello</a>
<Link href="/gsp/fallback/hello" id="to-fallback-hello">
to /gsp/fallback/hello
</Link>
<br />
<Link href="/gsp/no-fallback/first">
<a id="to-no-fallback-first">to /gsp/no-fallback/first</a>
<Link href="/gsp/no-fallback/first" id="to-no-fallback-first">
to /gsp/no-fallback/first
</Link>
<br />
<Link href="/gssp">
<a id="to-gssp">to /gssp</a>
<Link href="/gssp" id="to-gssp">
to /gssp
</Link>
<br />
<Link href="/gssp/first">
<a id="to-gssp-slug">to /gssp/first</a>
<Link href="/gssp/first" id="to-gssp-slug">
to /gssp/first
</Link>
<br />
</>
......
......@@ -23,8 +23,8 @@ export default function Page(props) {
<p id="router-query">{JSON.stringify(router.query)}</p>
<p id="router-pathname">{router.pathname}</p>
<p id="router-as-path">{router.asPath}</p>
<Link href="/">
<a id="to-index">to /</a>
<Link href="/" id="to-index">
to /
</Link>
<br />
</>
......
......@@ -14,8 +14,8 @@ export default function Page(props) {
<p id="router-query">{JSON.stringify(router.query)}</p>
<p id="router-pathname">{router.pathname}</p>
<p id="router-as-path">{router.asPath}</p>
<Link href="/">
<a id="to-index">to /</a>
<Link href="/" id="to-index">
to /
</Link>
<br />
</>
......
......@@ -16,8 +16,8 @@ export default function Page(props) {
<p id="router-query">{JSON.stringify(router.query)}</p>
<p id="router-pathname">{router.pathname}</p>
<p id="router-as-path">{router.asPath}</p>
<Link href="/">
<a id="to-index">to /</a>
<Link href="/" id="to-index">
to /
</Link>
<br />
</>
......
......@@ -14,8 +14,8 @@ export default function Page(props) {
<p id="router-query">{JSON.stringify(router.query)}</p>
<p id="router-pathname">{router.pathname}</p>
<p id="router-as-path">{router.asPath}</p>
<Link href="/">
<a id="to-index">to /</a>
<Link href="/" id="to-index">
to /
</Link>
<br />
</>
......
......@@ -14,8 +14,8 @@ export default function Page(props) {
<p id="router-query">{JSON.stringify(router.query)}</p>
<p id="router-pathname">{router.pathname}</p>
<p id="router-as-path">{router.asPath}</p>
<Link href="/">
<a id="to-index">to /</a>
<Link href="/" id="to-index">
to /
</Link>
<br />
</>
......
......@@ -25,40 +25,40 @@ export default function Page(props) {
<p id="router-query">{JSON.stringify(router.query)}</p>
<p id="router-pathname">{router.pathname}</p>
<p id="router-as-path">{asPath}</p>
<Link href="/another">
<a id="to-another">to /another</a>
<Link href="/another" id="to-another">
to /another
</Link>
<br />
<Link href="/dynamic/first">
<a id="to-dynamic">to /dynamic/first</a>
<Link href="/dynamic/first" id="to-dynamic">
to /dynamic/first
</Link>
<br />
<Link href="/gsp">
<a id="to-gsp">to /gsp</a>
<Link href="/gsp" id="to-gsp">
to /gsp
</Link>
<br />
<Link href="/gsp/fallback/first">
<a id="to-fallback-first">to /gsp/fallback/first</a>
<Link href="/gsp/fallback/first" id="to-fallback-first">
to /gsp/fallback/first
</Link>
<br />
<Link href="/gsp/fallback/hello">
<a id="to-fallback-hello">to /gsp/fallback/hello</a>
<Link href="/gsp/fallback/hello" id="to-fallback-hello">
to /gsp/fallback/hello
</Link>
<br />
<Link href="/gsp/no-fallback/first">
<a id="to-no-fallback-first">to /gsp/no-fallback/first</a>
<Link href="/gsp/no-fallback/first" id="to-no-fallback-first">
to /gsp/no-fallback/first
</Link>
<br />
<Link href="/gssp">
<a id="to-gssp">to /gssp</a>
<Link href="/gssp" id="to-gssp">
to /gssp
</Link>
<br />
<Link href="/gssp/first">
<a id="to-gssp-slug">to /gssp/first</a>
<Link href="/gssp/first" id="to-gssp-slug">
to /gssp/first
</Link>
<br />
<Link href="/api/post/asdf">
<a id="to-api-post">to /api/post/[slug]</a>
<Link href="/api/post/asdf" id="to-api-post">
to /api/post/[slug]
</Link>
<br />
</>
......
......@@ -15,32 +15,44 @@ export default function Page(props) {
<p id="router-query">{JSON.stringify(router.query)}</p>
<p id="router-pathname">{router.pathname}</p>
<p id="router-as-path">{router.asPath}</p>
<Link href="/another" locale={nextLocale}>
<a id="to-another">to /another</a>
<Link href="/another" locale={nextLocale} id="to-another">
to /another
</Link>
<br />
<Link href="/gsp" locale={nextLocale}>
<a id="to-gsp">to /gsp</a>
<Link href="/gsp" locale={nextLocale} id="to-gsp">
to /gsp
</Link>
<br />
<Link href="/gsp/fallback/first" locale={nextLocale}>
<a id="to-fallback-first">to /gsp/fallback/first</a>
<Link
href="/gsp/fallback/first"
locale={nextLocale}
id="to-fallback-first"
>
to /gsp/fallback/first
</Link>
<br />
<Link href="/gsp/fallback/hello" locale={nextLocale}>
<a id="to-fallback-hello">to /gsp/fallback/hello</a>
<Link
href="/gsp/fallback/hello"
locale={nextLocale}
id="to-fallback-hello"
>
to /gsp/fallback/hello
</Link>
<br />
<Link href="/gsp/no-fallback/first" locale={nextLocale}>
<a id="to-no-fallback-first">to /gsp/no-fallback/first</a>
<Link
href="/gsp/no-fallback/first"
locale={nextLocale}
id="to-no-fallback-first"
>
to /gsp/no-fallback/first
</Link>
<br />
<Link href="/gssp" locale={nextLocale}>
<a id="to-gssp">to /gssp</a>
<Link href="/gssp" locale={nextLocale} id="to-gssp">
to /gssp
</Link>
<br />
<Link href="/gssp/first" locale={nextLocale}>
<a id="to-gssp-slug">to /gssp/first</a>
<Link href="/gssp/first" locale={nextLocale} id="to-gssp-slug">
to /gssp/first
</Link>
<br />
</>
......
......@@ -14,40 +14,52 @@ export default function Page(props) {
<p id="router-query">{JSON.stringify(router.query)}</p>
<p id="router-pathname">{router.pathname}</p>
<p id="router-as-path">{router.asPath}</p>
<Link href={`/${nextLocale}/another`} locale={false}>
<a id="to-another">to /another</a>
<Link href={`/${nextLocale}/another`} locale={false} id="to-another">
to /another
</Link>
<br />
<Link href={`/${nextLocale}/gsp`} locale={false}>
<a id="to-gsp">to /gsp</a>
<Link href={`/${nextLocale}/gsp`} locale={false} id="to-gsp">
to /gsp
</Link>
<br />
<Link href={`/${nextLocale}/gsp/fallback/first`} locale={false}>
<a id="to-fallback-first">to /gsp/fallback/first</a>
<Link
href={`/${nextLocale}/gsp/fallback/first`}
locale={false}
id="to-fallback-first"
>
to /gsp/fallback/first
</Link>
<br />
<Link href={`/${nextLocale}/gsp/fallback/hello`} locale={false}>
<a id="to-fallback-hello">to /gsp/fallback/hello</a>
<Link
href={`/${nextLocale}/gsp/fallback/hello`}
locale={false}
id="to-fallback-hello"
>
to /gsp/fallback/hello
</Link>
<br />
<Link href={`/${nextLocale}/gsp/no-fallback/first`} locale={false}>
<a id="to-no-fallback-first">to /gsp/no-fallback/first</a>
<Link
href={`/${nextLocale}/gsp/no-fallback/first`}
locale={false}
id="to-no-fallback-first"
>
to /gsp/no-fallback/first
</Link>
<br />
<Link href={`/${nextLocale}/gssp`} locale={false}>
<a id="to-gssp">to /gssp</a>
<Link href={`/${nextLocale}/gssp`} locale={false} id="to-gssp">
to /gssp
</Link>
<br />
<Link href={`/${nextLocale}/gssp/first`} locale={false}>
<a id="to-gssp-slug">to /gssp/first</a>
<Link href={`/${nextLocale}/gssp/first`} locale={false} id="to-gssp-slug">
to /gssp/first
</Link>
<br />
<Link href={`/gssp/first`} locale={false}>
<a id="to-gssp-slug-default">to /gssp/first (default locale)</a>
<Link href={`/gssp/first`} locale={false} id="to-gssp-slug-default">
to /gssp/first (default locale)
</Link>
<br />
<Link href={`/gsp`} locale={false}>
<a id="to-gsp-default">to /gsp (default locale)</a>
<Link href={`/gsp`} locale={false} id="to-gsp-default">
to /gsp (default locale)
</Link>
<br />
</>
......
......@@ -15,23 +15,23 @@ export default function Page(props) {
<p id="router-pathname">{router.pathname}</p>
<p id="router-as-path">{router.asPath}</p>
<Link href="/gsp" locale="en-US">
<a id="to-gsp-en-us">to /gsp</a>
<Link href="/gsp" locale="en-US" id="to-gsp-en-us">
to /gsp
</Link>
<br />
<Link href="/gsp" locale="nl-NL">
<a id="to-gsp-nl-nl">to /gsp</a>
<Link href="/gsp" locale="nl-NL" id="to-gsp-nl-nl">
to /gsp
</Link>
<br />
<Link href="/gsp" locale="fr">
<a id="to-gsp-fr">to /gsp</a>
<Link href="/gsp" locale="fr" id="to-gsp-fr">
to /gsp
</Link>
<br />
<Link href="/" locale="fr">
<a id="to-index-fr">to /</a>
<Link href="/" locale="fr" id="to-index-fr">
to /
</Link>
</>
)
......
......@@ -13,8 +13,8 @@ export default function Page(props) {
<p id="router-query">{JSON.stringify(router.query)}</p>
<p id="router-pathname">{router.pathname}</p>
<p id="router-as-path">{router.asPath}</p>
<Link href="/">
<a id="to-index">to /</a>
<Link href="/" id="to-index">
to /
</Link>
<br />
</>
......
......@@ -15,8 +15,8 @@ export default function Page(props) {
<p id="router-query">{JSON.stringify(router.query)}</p>
<p id="router-pathname">{router.pathname}</p>
<p id="router-as-path">{router.asPath}</p>
<Link href="/">
<a id="to-index">to /</a>
<Link href="/" id="to-index">
to /
</Link>
<br />
</>
......
......@@ -13,8 +13,8 @@ export default function Page(props) {
<p id="router-query">{JSON.stringify(router.query)}</p>
<p id="router-pathname">{router.pathname}</p>
<p id="router-as-path">{router.asPath}</p>
<Link href="/">
<a id="to-index">to /</a>
<Link href="/" id="to-index">
to /
</Link>
<br />
</>
......
......@@ -3,28 +3,28 @@ import Link from 'next/link'
export default function Index() {
return (
<div id="page">
<Link href="/">
<a id="link1">link to /</a>
<Link href="/" id="link1">
link to /
</Link>
{' | '}
<Link href="/index">
<a id="link2">link to /index</a>
<Link href="/index" id="link2">
link to /index
</Link>
{' | '}
<Link href="/index/index">
<a id="link3">link to /index/index</a>
<Link href="/index/index" id="link3">
link to /index/index
</Link>
{' | '}
<Link href="/index/index/index">
<a id="link4">link to /index/index/index</a>
<Link href="/index/index/index" id="link4">
link to /index/index/index
</Link>
{' | '}
<Link href="/index/user">
<a id="link5">link to /index/user</a>
<Link href="/index/user" id="link5">
link to /index/user
</Link>
{' | '}
<Link href="/index/project">
<a id="link6">link to /index/project</a>
<Link href="/index/project" id="link6">
link to /index/project
</Link>
</div>
)
......
......@@ -2,8 +2,8 @@ import Link from 'next/link'
export default function Page() {
return (
<Link href="/[post]?post=post-1" as="/blog/post-1">
<a id="click-me">Click me</a>
<Link href="/[post]?post=post-1" as="/blog/post-1" id="click-me">
Click me
</Link>
)
}
......@@ -2,8 +2,8 @@ import Link from 'next/link'
export default function Page() {
return (
<Link href="/[post]" as="/blog/post-1">
<a id="click-me">Click me</a>
<Link href="/[post]" as="/blog/post-1" id="click-me">
Click me
</Link>
)
}
......@@ -20,8 +20,8 @@ export default function Page() {
) : (
// this should throw an error on load since prefetch
// receives the invalid href
<Link href={invalidLink}>
<a id="click-me">invalid link :o</a>
<Link href={invalidLink} id="click-me">
invalid link :o
</Link>
)
}
......@@ -2,8 +2,8 @@ import Link from 'next/link'
export default function Page() {
return (
<Link href="/second" as="mailto:hello@example.com">
<a id="click-me">email</a>
<Link href="/second" as="mailto:hello@example.com" id="click-me">
email
</Link>
)
}
......@@ -20,8 +20,8 @@ export default function Page() {
) : (
// this should throw an error on load since prefetch
// receives the invalid href
<Link href={invalidLink}>
<a id="click-me">invalid link :o</a>
<Link href={invalidLink} id="click-me">
invalid link :o
</Link>
)
}
......@@ -3,8 +3,8 @@ const invalidLink = 'https://'
export default function Page() {
return (
<Link href={invalidLink}>
<a id="click-me">invalid link :o</a>
<Link href={invalidLink} id="click-me">
invalid link :o
</Link>
)
}
......@@ -11,14 +11,13 @@ export default () => {
})
return (
<Link href="/">
<a
ref={(el) => {
myRef.current = el
}}
>
Click me
</a>
<Link
href="/"
ref={(el) => {
myRef.current = el
}}
>
Click me
</Link>
)
}
......@@ -11,8 +11,8 @@ export default () => {
})
return (
<Link href="/">
<a ref={myRef}>Click me</a>
<Link href="/" ref={myRef}>
Click me
</Link>
)
}
......@@ -8,7 +8,7 @@ class MyLink extends React.Component {
}
export default () => (
<Link href="/" passHref>
<Link href="/" passHref legacyBehavior>
<MyLink />
</Link>
)
......@@ -8,7 +8,7 @@ const MyLink = React.forwardRef((props, ref) => (
))
export default () => (
<Link href="/" passHref>
<Link href="/" passHref legacyBehavior>
<MyLink />
</Link>
)
......@@ -2,37 +2,48 @@ import Link from 'next/link'
const Home = () => (
<div>
<Link href="/single/[slug]" as={encodeURI('/single/hello world ')}>
<a id="single-spaces">Single: Spaces</a>
<Link
href="/single/[slug]"
as={encodeURI('/single/hello world ')}
id="single-spaces"
>
Single: Spaces
</Link>
<br />
<Link href="/single/[slug]" as={encodeURI('/single/hello%world')}>
<a id="single-percent">Single: Percent</a>
<Link
href="/single/[slug]"
as={encodeURI('/single/hello%world')}
id="single-percent"
>
Single: Percent
</Link>
<br />
<Link
href="/single/[slug]"
as={`/single/hello${encodeURIComponent('/')}world`}
id="single-slash"
>
<a id="single-slash">Single: Forward Slash</a>
Single: Forward Slash
</Link>
<br />
<Link
href="/single/[slug]"
as={`/single/hello${encodeURIComponent('"')}world`}
id="single-double-quote"
>
<a id="single-double-quote">Single: "</a>
Single: "
</Link>
<br />
<Link
href="/single/[slug]"
as={`/single/hello${encodeURIComponent(':')}world`}
id="single-colon"
>
<a id="single-colon">Single: :</a>
Single: :
</Link>
<br />
<Link href="/query?id=http://example.com/">
<a id="url-param">Url query param</a>
<Link href="/query?id=http://example.com/" id="url-param">
Url query param
</Link>
</div>
)
......
......@@ -2,9 +2,5 @@ import React from 'react'
import Link from 'next/link'
export default function Hello() {
return (
<Link href="/">
<a>Click me</a>
</Link>
)
return <Link href="/">Click me</Link>
}
......@@ -5,12 +5,12 @@ export default function Home() {
<div>
<p>Home Page</p>
<div />
<Link href="/made-up">
<a id="made-up-link">Madeup Page</a>
<Link href="/made-up" id="made-up-link">
Madeup Page
</Link>
<div />
<Link href="/ssg-page-2">
<a id="ssg-page-2">SSG Page 2 (Redirect)</a>
<Link href="/ssg-page-2" id="ssg-page-2">
SSG Page 2 (Redirect)
</Link>
<div />
</div>
......
......@@ -88,8 +88,8 @@ const ClientSide = () => {
width={300}
height={300}
/>
<Link href="/errors">
<a id="errorslink">Errors</a>
<Link href="/errors" id="errorslink">
Errors
</Link>
</div>
)
......
......@@ -113,11 +113,11 @@ const Page = () => {
width={300}
height={300}
/>
<Link href="/client-side">
<a id="clientlink">Client Side</a>
<Link href="/client-side" id="clientlink">
Client Side
</Link>
<Link href="/lazy">
<a id="lazylink">lazy</a>
<Link href="/lazy" id="lazylink">
lazy
</Link>
<Head>
<link rel="stylesheet" href="styles.css" />
......
......@@ -30,8 +30,8 @@ const Page = () => {
width={300}
height={400}
/>
<Link href="/client-side">
<a id="clientlink">Client Side</a>
<Link href="/client-side" id="clientlink">
Client Side
</Link>
</div>
)
......
......@@ -3,8 +3,8 @@ import Link from 'next/link'
const About = () => {
return (
<div>
<Link href="/no-observer">
<a id="link-no-observer">Test No IntersectionObserver</a>
<Link href="/no-observer" id="link-no-observer">
Test No IntersectionObserver
</Link>
</div>
)
......
......@@ -4,16 +4,16 @@ export default function Index() {
return (
<>
<p id="index">index</p>
<Link href="/gsp">
<a id="to-gsp">to gsp</a>
<Link href="/gsp" id="to-gsp">
to gsp
</Link>
<br />
<Link href="/gssp">
<a id="to-gssp">to gssp</a>
<Link href="/gssp" id="to-gssp">
to gssp
</Link>
<br />
<Link href="/non-existent">
<a id="to-404">to non-existent</a>
<Link href="/non-existent" id="to-404">
to non-existent
</Link>
<br />
</>
......
......@@ -3,8 +3,8 @@ import Link from 'next/link'
export default () => (
<div>
<p>Index Page</p>
<Link href="/about">
<a id="about-link">About Page</a>
<Link href="/about" id="about-link">
About Page
</Link>
</div>
)
......@@ -2,8 +2,8 @@ import Link from 'next/link'
export default () => (
<div>
<Link href="/nav/dynamic">
<a id="to-dynamic">To dynamic import</a>
<Link href="/nav/dynamic" id="to-dynamic">
To dynamic import
</Link>
</div>
)
......@@ -14,8 +14,8 @@ export default () => {
></script>
</Head>
<br />
<Link href="/another">
<a id="link-another">to /another</a>
<Link href="/another" id="link-another">
to /another
</Link>
</div>
)
......
......@@ -3,9 +3,7 @@ import Link from 'next/link'
export default () => {
return (
<p>
<Link href="/first">
<a>to /first</a>
</Link>
<Link href="/first">to /first</Link>
</p>
)
}
......@@ -10,9 +10,7 @@ export default () => {
Scroll to another
</a>
<button onClick={() => setHref('/another')}>Click me</button>
<Link href={href}>
<a>to {href}</a>
</Link>
<Link href={href}>to{href}</Link>
<div
style={{
height: 10000,
......@@ -21,8 +19,8 @@ export default () => {
}}
/>
<p id="scroll-to-me">Hi 👋</p>
<Link href="/another">
<a id="link-another">to /another</a>
<Link href="/another" id="link-another">
to /another
</Link>
</div>
)
......
......@@ -2,8 +2,8 @@ import Link from 'next/link'
export default () => (
<>
<Link href="/something-invalid-oops">
<a id="invalid-link">I'm broken…</a>
<Link href="/something-invalid-oops" id="invalid-link">
I'm broken…
</Link>
</>
)
......@@ -9,7 +9,7 @@ class Button extends React.Component {
export default () => (
<div>
<Link href="/another" passHref>
<Link href="/another" passHref legacyBehavior>
<Button id="btn-link" />
</Link>
</div>
......
......@@ -16,7 +16,7 @@ export default () => {
return (
<div>
<Link prefetch={true} href="/dynamic/[hello]" as={'/dynamic/test'}>
<a>I should only be prefetched once</a>
I should only be prefetched once
</Link>
</div>
)
......
......@@ -4,7 +4,7 @@ export default () => {
return (
<p>
<Link href="/first" as="/first#different">
<a>to /first</a>
to /first
</Link>
</p>
)
......
......@@ -3,7 +3,7 @@ import Link from 'next/link'
export default () => (
<div>
<Link prefetch={false} href="/another">
<a>I'm not pre-fetched..</a>
I'm not pre-fetched..
</Link>
</div>
)
......@@ -4,8 +4,8 @@ export default () => {
return (
<div>
<br />
<Link href="/ssg/basic" prefetch={false}>
<a id="link-ssg">to /ssg/basic</a>
<Link href="/ssg/basic" prefetch={false} id="link-ssg">
to /ssg/basic
</Link>
</div>
)
......
......@@ -4,8 +4,8 @@ export default () => {
return (
<div>
<br />
<Link href="/another" prefetch={false}>
<a id="link-another">to /another</a>
<Link href="/another" prefetch={false} id="link-another">
to /another
</Link>
</div>
)
......
import Link from 'next/link'
export default function Page() {
return (
<Link href="/rewrite-me">
<a>to /rewrite-me</a>
</Link>
)
return <Link href="/rewrite-me">to /rewrite-me</Link>
}
......@@ -4,19 +4,17 @@ export default () => (
<main>
<h1>SSG Data Prefetch Fixtures</h1>
<p>
<Link href="/ssg/basic">
<a>Non-dynamic route</a>
</Link>
: this is a normal Next.js page that does not use dynamic routing.
<Link href="/ssg/basic">Non-dynamic route</Link>: this is a normal Next.js
page that does not use dynamic routing.
</p>
<p>
<Link href="/ssg/dynamic/[slug]" as="/ssg/dynamic/one">
<a>Dynamic Route (one level) — Prerendered</a>
Dynamic Route (one level) — Prerendered
</Link>
: this is a Dynamic Page with a single dynamic segment that{' '}
<strong>was returned</strong> from <code>getStaticPaths</code>.<br />
<Link href="/ssg/dynamic/[slug]" as="/ssg/dynamic/two">
<a>Dynamic Route (one level) — Not Prerendered</a>
Dynamic Route (one level) — Not Prerendered
</Link>
: this is a Dynamic Page with a single dynamic segment that{' '}
<strong>was not returned</strong> from <code>getStaticPaths</code>.
......@@ -26,7 +24,7 @@ export default () => (
href="/ssg/dynamic-nested/[slug1]/[slug2]"
as="/ssg/dynamic-nested/one/two"
>
<a>Multi Dynamic Route (two levels) — Prerendered</a>
Multi Dynamic Route (two levels) — Prerendered
</Link>
: this is a Dynamic Page with two dynamic segments that{' '}
<strong>were returned</strong> from <code>getStaticPaths</code>.<br />
......@@ -34,29 +32,29 @@ export default () => (
href="/ssg/dynamic-nested/[slug1]/[slug2]"
as="/ssg/dynamic-nested/foo/bar"
>
<a>Multi Dynamic Route (two levels) — Not Prerendered</a>
Multi Dynamic Route (two levels) — Not Prerendered
</Link>
: this is a Dynamic Page with two dynamic segments that{' '}
<strong>were not returned</strong> from <code>getStaticPaths</code>.
</p>
<p>
<Link href="/ssg/catch-all/[...slug]" as="/ssg/catch-all/one">
<a>Catch-All Route (one level) — Prerendered</a>
Catch-All Route (one level) — Prerendered
</Link>
: this is a Catch-All Page with one segment that{' '}
<strong>was returned</strong> from <code>getStaticPaths</code>.<br />
<Link href="/ssg/catch-all/[...slug]" as="/ssg/catch-all/foo">
<a>Catch-All Route (one level) — Not Prerendered</a>
Catch-All Route (one level) — Not Prerendered
</Link>
: this is a Catch-All Page with one segment that{' '}
<strong>was not returned</strong> from <code>getStaticPaths</code>.<br />
<Link href="/ssg/catch-all/[...slug]" as="/ssg/catch-all/one/two">
<a>Catch-All Route (two levels) — Prerendered</a>
Catch-All Route (two levels) — Prerendered
</Link>
: this is a Catch-All Page with two segments that{' '}
<strong>were returned</strong> from <code>getStaticPaths</code>.<br />
<Link href="/ssg/catch-all/[...slug]" as="/ssg/catch-all/foo/bar">
<a>Catch-All Route (two levels) — Not Prerendered</a>
Catch-All Route (two levels) — Not Prerendered
</Link>
: this is a Catch-All Page with two segments that{' '}
<strong>were not returned</strong> from <code>getStaticPaths</code>.
......
......@@ -5,12 +5,12 @@ export default () => (
<h1>Mismatched SSG Data Prefetch Fixtures</h1>
<p>
<Link href="/ssg/dynamic/[slug]?slug=one" as="/ssg/fixture/mismatch">
<a>Dynamic Route (one level) — Prerendered</a>
Dynamic Route (one level) — Prerendered
</Link>
: this is a Dynamic Page with a single dynamic segment that{' '}
<strong>was returned</strong> from <code>getStaticPaths</code>.<br />
<Link href="/ssg/dynamic/[slug]?slug=two" as="/ssg/fixture/mismatch">
<a>Dynamic Route (one level) — Not Prerendered</a>
Dynamic Route (one level) — Not Prerendered
</Link>
: this is a Dynamic Page with a single dynamic segment that{' '}
<strong>was not returned</strong> from <code>getStaticPaths</code>.
......@@ -23,7 +23,7 @@ export default () => (
}}
as="/ssg/fixture/mismatch"
>
<a>Multi Dynamic Route (two levels) — Prerendered</a>
Multi Dynamic Route (two levels) — Prerendered
</Link>
: this is a Dynamic Page with two dynamic segments that{' '}
<strong>were returned</strong> from <code>getStaticPaths</code>.<br />
......@@ -34,7 +34,7 @@ export default () => (
}}
as="/ssg/fixture/mismatch"
>
<a>Multi Dynamic Route (two levels) — Not Prerendered</a>
Multi Dynamic Route (two levels) — Not Prerendered
</Link>
: this is a Dynamic Page with two dynamic segments that{' '}
<strong>were not returned</strong> from <code>getStaticPaths</code>.
......@@ -47,7 +47,7 @@ export default () => (
}}
as="/ssg/fixture/mismatch"
>
<a>Catch-All Route (one level) — Prerendered</a>
Catch-All Route (one level) — Prerendered
</Link>
: this is a Catch-All Page with one segment that{' '}
<strong>was returned</strong> from <code>getStaticPaths</code>.<br />
......@@ -58,7 +58,7 @@ export default () => (
}}
as="/ssg/fixture/mismatch"
>
<a>Catch-All Route (one level) — Not Prerendered</a>
Catch-All Route (one level) — Not Prerendered
</Link>
: this is a Catch-All Page with one segment that{' '}
<strong>was not returned</strong> from <code>getStaticPaths</code>.<br />
......@@ -69,7 +69,7 @@ export default () => (
}}
as="/ssg/fixture/mismatch"
>
<a>Catch-All Route (two levels) — Prerendered</a>
Catch-All Route (two levels) — Prerendered
</Link>
: this is a Catch-All Page with two segments that{' '}
<strong>were returned</strong> from <code>getStaticPaths</code>.<br />
......@@ -80,7 +80,7 @@ export default () => (
}}
as="/ssg/fixture/mismatch"
>
<a>Catch-All Route (two levels) — Not Prerendered</a>
Catch-All Route (two levels) — Not Prerendered
</Link>
: this is a Catch-All Page with two segments that{' '}
<strong>were not returned</strong> from <code>getStaticPaths</code>.
......
......@@ -7,8 +7,8 @@ export function getStaticProps() {
export default function () {
return (
<main>
<Link href="/">
<a id="to-index">To Index</a>
<Link href="/" id="to-index">
To Index
</Link>
</main>
)
......
......@@ -19,12 +19,12 @@ export default ({ world, time }) => (
<>
<p>hello {world}</p>
<span id="anotherTime">time: {time}</span>
<Link href="/">
<a id="home">to home</a>
<Link href="/" id="home">
to home
</Link>
<br />
<Link href="/something">
<a id="something">to something</a>
<Link href="/something" id="something">
to something
</Link>
</>
)
......@@ -35,8 +35,8 @@ export default ({ post, time, params }) => {
<span>time: {time}</span>
<div id="params">{JSON.stringify(params)}</div>
<div id="query">{JSON.stringify(useRouter().query)}</div>
<Link href="/">
<a id="home">to home</a>
<Link href="/" id="home">
to home
</Link>
</>
)
......
......@@ -35,8 +35,8 @@ export default ({ post, time, params }) => {
<span>time: {time}</span>
<div id="params">{JSON.stringify(params)}</div>
<div id="query">{JSON.stringify(useRouter().query)}</div>
<Link href="/">
<a id="home">to home</a>
<Link href="/" id="home">
to home
</Link>
</>
)
......
......@@ -35,8 +35,8 @@ export default ({ post, time, params }) => {
<span>time: {time}</span>
<div id="params">{JSON.stringify(params)}</div>
<div id="query">{JSON.stringify(useRouter().query)}</div>
<Link href="/">
<a id="home">to home</a>
<Link href="/" id="home">
to home
</Link>
</>
)
......
......@@ -33,8 +33,8 @@ export default ({ post, comment, time }) => {
<p>Post: {post}</p>
<p>Comment: {comment}</p>
<span>time: {time}</span>
<Link href="/">
<a id="home">to home</a>
<Link href="/" id="home">
to home
</Link>
</>
)
......
......@@ -53,8 +53,8 @@ export default ({ post, time, params }) => {
<span>time: {time}</span>
<div id="params">{JSON.stringify(params)}</div>
<div id="query">{JSON.stringify(useRouter().query)}</div>
<Link href="/">
<a id="home">to home</a>
<Link href="/" id="home">
to home
</Link>
</>
)
......
......@@ -16,8 +16,8 @@ export default ({ slugs, time }) => {
<>
<p>Posts: {JSON.stringify(slugs)}</p>
<span>time: {time}</span>
<Link href="/">
<a id="home">to home</a>
<Link href="/" id="home">
to home
</Link>
</>
)
......
......@@ -33,8 +33,8 @@ export default function Page({ slug }) {
return (
<>
<p id="catchall">Hi {slug.join(' ')}</p>{' '}
<Link href="/">
<a id="home">to home</a>
<Link href="/" id="home">
to home
</Link>
</>
)
......
......@@ -21,8 +21,8 @@ export default ({ slug }) => {
return (
<>
<p id="catchall">Catch all: [{slug.join(', ')}]</p>
<Link href="/">
<a id="home">to home</a>
<Link href="/" id="home">
to home
</Link>
</>
)
......
......@@ -13,12 +13,12 @@ export default ({ world, time }) => (
<>
<p>hello {world}</p>
<span>time: {time}</span>
<Link href="/">
<a id="home">to home</a>
<Link href="/" id="home">
to home
</Link>
<br />
<Link href="/something">
<a id="something">to something</a>
<Link href="/something" id="something">
to something
</Link>
</>
)
......@@ -19,8 +19,8 @@ export default ({ slug }) => {
return (
<>
<p id="param">Hi {slug}!</p>{' '}
<Link href="/">
<a id="home">to home</a>
<Link href="/" id="home">
to home
</Link>
</>
)
......
......@@ -35,8 +35,8 @@ export default ({ post, time, params }) => {
<span>time: {time}</span>
<div id="params">{JSON.stringify(params)}</div>
<div id="query">{JSON.stringify(useRouter().query)}</div>
<Link href="/">
<a id="home">to home</a>
<Link href="/" id="home">
to home
</Link>
</>
)
......
......@@ -15,76 +15,91 @@ const Page = ({ world, time }) => {
{/* <div id='after-change'>idk</div> */}
<p>hello {world}</p>
<span>time: {time}</span>
<Link href="/non-json/[p]" as="/non-json/1">
<a id="non-json">to non-json</a>
<Link href="/non-json/[p]" as="/non-json/1" id="non-json">
to non-json
</Link>
<br />
<Link href="/another?hello=world" as="/another/?hello=world">
<a id="another">to another</a>
<Link href="/another?hello=world" as="/another/?hello=world" id="another">
to another
</Link>
<br />
<Link href="/something">
<a id="something">to something</a>
<Link href="/something" id="something">
to something
</Link>
<br />
<Link href="/normal">
<a id="normal">to normal</a>
<Link href="/normal" id="normal">
to normal
</Link>
<br />
<Link href="/blog/[post]" as="/blog/post-1">
<a id="post-1">to dynamic</a>
<Link href="/blog/[post]" as="/blog/post-1" id="post-1">
to dynamic
</Link>
<Link href="/blog/[post]" as="/blog/post-100">
<a id="broken-post">to broken</a>
<Link href="/blog/[post]" as="/blog/post-100" id="broken-post">
to broken
</Link>
<Link href="/blog/[post]" as="/blog/post-999" prefetch={false}>
<a id="broken-at-first-post">to broken at first</a>
<Link
href="/blog/[post]"
as="/blog/post-999"
prefetch={false}
id="broken-at-first-post"
>
to broken at first
</Link>
<br />
<Link href="/blog/[post]/[comment]" as="/blog/post-1/comment-1">
<a id="comment-1">to another dynamic</a>
<Link
href="/blog/[post]/[comment]"
as="/blog/post-1/comment-1"
id="comment-1"
>
to another dynamic
</Link>
<Link href="/catchall/[...slug]" as="/catchall/first">
<a id="to-catchall">to catchall</a>
<Link href="/catchall/[...slug]" as="/catchall/first" id="to-catchall">
to catchall
</Link>
<br />
<Link href="/index">
<a id="to-nested-index">to nested index</a>
<Link href="/index" id="to-nested-index">
to nested index
</Link>
<br />
<Link href="/lang/[lang]/about?lang=en" as="/about">
<a id="to-rewritten-ssg">to rewritten static path page</a>
<Link href="/lang/[lang]/about?lang=en" as="/about" id="to-rewritten-ssg">
to rewritten static path page
</Link>
<br />
<Link href="/catchall-optional/[[...slug]]" as="/catchall-optional">
<a id="catchall-optional-root">to optional catchall root</a>
<Link
href="/catchall-optional/[[...slug]]"
as="/catchall-optional"
id="catchall-optional-root"
>
to optional catchall root
</Link>
<Link href="/catchall-optional/[[...slug]]" as="/catchall-optional/value">
<a id="catchall-optional-value">to optional catchall page /value</a>
<Link
href="/catchall-optional/[[...slug]]"
as="/catchall-optional/value"
id="catchall-optional-value"
>
to optional catchall page /value
</Link>
<br />
<Link href="/dynamic/[slug]" as="/dynamic/[first]">
<a id="dynamic-first">to dynamic [first] page</a>
<Link href="/dynamic/[slug]" as="/dynamic/[first]" id="dynamic-first">
to dynamic [first] page
</Link>
<Link href="/dynamic/[slug]" as="/dynamic/[second]">
<a id="dynamic-second">to dynamic [second] page</a>
<Link href="/dynamic/[slug]" as="/dynamic/[second]" id="dynamic-second">
to dynamic [second] page
</Link>
<br />
<Link
href="/catchall-explicit/[...slug]"
as="/catchall-explicit/[first]/[second]"
id="catchall-explicit-string"
>
<a id="catchall-explicit-string">
to catchall-explicit [first]/[second] page
</a>
to catchall-explicit [first]/[second] page
</Link>
<Link
href="/catchall-explicit/[...slug]"
as="/catchall-explicit/[third]/[fourth]"
id="catchall-explicit-object"
>
<a id="catchall-explicit-object">
to catchall-explicit [third]/[fourth] page
</a>
to catchall-explicit [third]/[fourth] page
</Link>
</>
)
......
......@@ -10,8 +10,8 @@ export default ({ world }) => {
return (
<>
<p>hello {world}</p>
<Link href="/">
<a id="home">to home</a>
<Link href="/" id="home">
to home
</Link>
</>
)
......
......@@ -22,12 +22,12 @@ export default ({ world, time, params, random }) => {
<div id="random">{random}</div>
<div id="params">{JSON.stringify(params)}</div>
<div id="query">{JSON.stringify(useRouter().query)}</div>
<Link href="/">
<a id="home">to home</a>
<Link href="/" id="home">
to home
</Link>
<br />
<Link href="/another">
<a id="another">to another</a>
<Link href="/another" id="another">
to another
</Link>
</>
)
......
......@@ -20,8 +20,8 @@ export default ({ user, time }) => {
<>
<p>User: {user}</p>
<span>time: {time}</span>
<Link href="/">
<a id="home">to home</a>
<Link href="/" id="home">
to home
</Link>
</>
)
......
......@@ -2,8 +2,8 @@ import Link from 'next/link'
export default () => (
<>
<Link href="/">
<a id="to-index">Index</a>
<Link href="/" id="to-index">
Index
</Link>
</>
)
......@@ -2,8 +2,8 @@ import Link from 'next/link'
export default () => (
<>
<Link href="/another">
<a id="to-another">Another</a>
<Link href="/another" id="to-another">
Another
</Link>
</>
)
......@@ -5,9 +5,7 @@ console.log(url.parse('https://example.com'))
export default () => (
<div>
<Link href="/">
<a>Index Page</a>
</Link>
<Link href="/">Index Page</Link>
<p>Another</p>
</div>
)
......@@ -5,9 +5,7 @@ export default function Page(props) {
return (
<>
<Error title="something went wrong (on purpose)" />
<Link href="/">
<a>to home</a>
</Link>
<Link href="/">to home</Link>
</>
)
}
......@@ -19,12 +19,12 @@ export default class extends Component {
render() {
return (
<div id="counter-page">
<Link href="/no-such-page">
<a id="no-such-page">No Such Page</a>
<Link href="/no-such-page" id="no-such-page">
No Such Page
</Link>
<br />
<Link href="/no-such-page" prefetch>
<a id="no-such-page-prefetch">No Such Page (with prefetch)</a>
<Link href="/no-such-page" prefetch id="no-such-page-prefetch">
No Such Page (with prefetch)
</Link>
<p>This is the home.</p>
<div id="counter">Counter: {counter}</div>
......
......@@ -3,9 +3,7 @@ import Link from 'next/link'
const Page = ({ from }) => (
<div>
<p>{from}</p>
<Link href="/css-modules">
<a>Page with CSS</a>
</Link>
<Link href="/css-modules">Page with CSS</Link>
</div>
)
......
......@@ -4,7 +4,7 @@ export default function IndexPage() {
return (
<div>
<Link href="/about" prefetch>
<a>To About Page</a>
To About Page
</Link>
</div>
)
......
......@@ -2,8 +2,6 @@ import Link from 'next/link'
export default () => (
<div>
<Link href="/dynamic/no-chunk">
<a>No Chunk</a>
</Link>
<Link href="/dynamic/no-chunk">No Chunk</Link>
</div>
)
......@@ -6,9 +6,7 @@ import next from 'next'
export default () => (
<div>
<Link href="/about">
<a>About Page</a>
</Link>
<Link href="/about">About Page</Link>
<p className="index-page">Hello World</p>
</div>
)
......@@ -5,23 +5,23 @@ export default () => {
<div>
<ul>
<li>
<Link href="/" prefetch>
<a id="prefetch-1">index</a>
<Link href="/" prefetch id="prefetch-1">
index
</Link>
</li>
<li>
<Link href="/process-env" prefetch>
<a id="prefetch-2">process env</a>
<Link href="/process-env" prefetch id="prefetch-2">
process env
</Link>
</li>
<li>
<Link href="/counter" prefetch>
<a id="prefetch-3">counter</a>
<Link href="/counter" prefetch id="prefetch-3">
counter
</Link>
</li>
<li>
<Link href="/about" prefetch>
<a id="prefetch-4">about</a>
<Link href="/about" prefetch id="prefetch-4">
about
</Link>
</li>
</ul>
......
......@@ -3,8 +3,8 @@ import Link from 'next/link'
export default function ToNonexistent() {
return (
<div id="blackhole-page">
<Link href="/nonexistent">
<a id="to-nonexistent-page">Nonexistent Page</a>
<Link href="/nonexistent" id="to-nonexistent-page">
Nonexistent Page
</Link>
</div>
)
......
......@@ -3,8 +3,8 @@ import Link from 'next/link'
export default function ToShadowed() {
return (
<div id="shadowed-page-gateway">
<Link href="/shadowed-page">
<a id="to-shadowed-page">Shadowed Page</a>
<Link href="/shadowed-page" id="to-shadowed-page">
Shadowed Page
</Link>
</div>
)
......
......@@ -5,9 +5,7 @@ console.log(url.parse('https://example.com'))
export default () => (
<div>
<Link href="/">
<a>Index Page</a>
</Link>
<Link href="/">Index Page</Link>
<p>Another</p>
</div>
)
......@@ -5,9 +5,7 @@ export default function Page(props) {
return (
<>
<Error title="something went wrong (on purpose)" />
<Link href="/">
<a>to home</a>
</Link>
<Link href="/">to home</Link>
</>
)
}
......@@ -19,12 +19,12 @@ export default class extends Component {
render() {
return (
<div id="counter-page">
<Link href="/no-such-page">
<a id="no-such-page">No Such Page</a>
<Link href="/no-such-page" id="no-such-page">
No Such Page
</Link>
<br />
<Link href="/no-such-page" prefetch>
<a id="no-such-page-prefetch">No Such Page (with prefetch)</a>
<Link href="/no-such-page" prefetch id="no-such-page-prefetch">
No Such Page (with prefetch)
</Link>
<p>This is the home.</p>
<div id="counter">Counter: {counter}</div>
......
......@@ -3,9 +3,7 @@ import Link from 'next/link'
const Page = ({ from }) => (
<div>
<p>{from}</p>
<Link href="/css-modules">
<a>Page with CSS</a>
</Link>
<Link href="/css-modules">Page with CSS</Link>
</div>
)
......
......@@ -4,7 +4,7 @@ export default function IndexPage() {
return (
<div>
<Link href="/about" prefetch>
<a>To About Page</a>
To About Page
</Link>
</div>
)
......
......@@ -2,8 +2,6 @@ import Link from 'next/link'
export default () => (
<div>
<Link href="/dynamic/no-chunk">
<a>No Chunk</a>
</Link>
<Link href="/dynamic/no-chunk">No Chunk</Link>
</div>
)
......@@ -6,9 +6,7 @@ import next from 'next'
export default () => (
<div>
<Link href="/about">
<a>About Page</a>
</Link>
<Link href="/about">About Page</Link>
<p className="index-page">Hello World</p>
</div>
)
......@@ -5,23 +5,23 @@ export default () => {
<div>
<ul>
<li>
<Link href="/" prefetch>
<a id="prefetch-1">index</a>
<Link href="/" prefetch id="prefetch-1">
index
</Link>
</li>
<li>
<Link href="/process-env" prefetch>
<a id="prefetch-2">process env</a>
<Link href="/process-env" prefetch id="prefetch-2">
process env
</Link>
</li>
<li>
<Link href="/counter" prefetch>
<a id="prefetch-3">counter</a>
<Link href="/counter" prefetch id="prefetch-3">
counter
</Link>
</li>
<li>
<Link href="/about" prefetch>
<a id="prefetch-4">about</a>
<Link href="/about" prefetch id="prefetch-4">
about
</Link>
</li>
</ul>
......
......@@ -3,8 +3,8 @@ import Link from 'next/link'
export default function ToNonexistent() {
return (
<div id="blackhole-page">
<Link href="/nonexistent">
<a id="to-nonexistent-page">Nonexistent Page</a>
<Link href="/nonexistent" id="to-nonexistent-page">
Nonexistent Page
</Link>
</div>
)
......
......@@ -3,8 +3,8 @@ import Link from 'next/link'
export default function ToShadowed() {
return (
<div id="shadowed-page-gateway">
<Link href="/shadowed-page">
<a id="to-shadowed-page">Shadowed Page</a>
<Link href="/shadowed-page" id="to-shadowed-page">
Shadowed Page
</Link>
</div>
)
......
......@@ -2,9 +2,7 @@ import Link from 'next/link'
export default () => (
<div>
<Link href="/about">
<a>About Page</a>
</Link>
<Link href="/about">About Page</Link>
<p className="index-page">Hello World</p>
</div>
)
......@@ -2,12 +2,15 @@ import Link from 'next/link'
const Another = () => (
<div>
<Link href="/?another=hello%0A">
<a id="hello-lf">Hello LF</a>
<Link href="/?another=hello%0A" id="hello-lf">
Hello LF
</Link>
<br />
<Link href={{ pathname: '/', query: { complex: 'yes\n' } }}>
<a id="hello-complex">Hello Complex</a>
<Link
href={{ pathname: '/', query: { complex: 'yes\n' } }}
id="hello-complex"
>
Hello Complex
</Link>
</div>
)
......
......@@ -2,12 +2,15 @@ import Link from 'next/link'
const Another = () => (
<div>
<Link href="/?another=hello%25">
<a id="hello-percent">Hello %</a>
<Link href="/?another=hello%25" id="hello-percent">
Hello %
</Link>
<br />
<Link href={{ pathname: '/', query: { complex: 'yes%' } }}>
<a id="hello-complex">Hello Complex</a>
<Link
href={{ pathname: '/', query: { complex: 'yes%' } }}
id="hello-complex"
>
Hello Complex
</Link>
</div>
)
......
......@@ -2,12 +2,15 @@ import Link from 'next/link'
const Another = () => (
<div>
<Link href="/?another=hello%2B">
<a id="hello-plus">Hello +</a>
<Link href="/?another=hello%2B" id="hello-plus">
Hello +
</Link>
<br />
<Link href={{ pathname: '/', query: { complex: 'yes+' } }}>
<a id="hello-complex">Hello Complex</a>
<Link
href={{ pathname: '/', query: { complex: 'yes+' } }}
id="hello-complex"
>
Hello Complex
</Link>
</div>
)
......
......@@ -2,12 +2,15 @@ import Link from 'next/link'
const Another = () => (
<div>
<Link href="/?another=hello%20">
<a id="hello-space">Hello Space</a>
<Link href="/?another=hello%20" id="hello-space">
Hello Space
</Link>
<br />
<Link href={{ pathname: '/', query: { complex: 'yes ' } }}>
<a id="hello-complex">Hello Complex</a>
<Link
href={{ pathname: '/', query: { complex: 'yes ' } }}
id="hello-complex"
>
Hello Complex
</Link>
</div>
)
......
......@@ -14,43 +14,43 @@ export default function Invalid() {
return (
<>
<p id="invalid">invalid page</p>
<Link href="/another" as="//google.com">
<a id="page-with-as-slashes">to /another as //google.com</a>
<Link href="/another" as="//google.com" id="page-with-as-slashes">
to /another as //google.com
</Link>
<br />
<Link href="//google.com">
<a id="href-with-slashes">to //google.com</a>
<Link href="//google.com" id="href-with-slashes">
to //google.com
</Link>
<br />
<Link href="//google.com?hello=1">
<a id="href-with-slashes-query">to //google.com?hello=1</a>
<Link href="//google.com?hello=1" id="href-with-slashes-query">
to //google.com?hello=1
</Link>
<br />
<Link href="//google.com#hello">
<a id="href-with-slashes-hash">to //google.com#hello</a>
<Link href="//google.com#hello" id="href-with-slashes-hash">
to //google.com#hello
</Link>
<br />
<Link href="/another" as="\/\/google.com">
<a id="page-with-as-backslashes">to /another as \\/\\/google.com</a>
<Link href="/another" as="\/\/google.com" id="page-with-as-backslashes">
to /another as \\/\\/google.com
</Link>
<br />
<Link href="\/\/google.com">
<a id="href-with-backslashes">to \\/\\/google.com</a>
<Link href="\/\/google.com" id="href-with-backslashes">
to \\/\\/google.com
</Link>
<br />
<Link href="\/\/google.com?hello=1">
<a id="href-with-backslashes-query">to \\/\\/google.com?hello=1</a>
<Link href="\/\/google.com?hello=1" id="href-with-backslashes-query">
to \\/\\/google.com?hello=1
</Link>
<br />
<Link href="\/\/google.com#hello">
<a id="href-with-backslashes-hash">to \\/\\/google.com#hello</a>
<Link href="\/\/google.com#hello" id="href-with-backslashes-hash">
to \\/\\/google.com#hello
</Link>
<br />
</>
......
......@@ -10,8 +10,8 @@ export default function Page(props) {
<p id="pathname">{router.pathname}</p>
<p id="query">{JSON.stringify(router.query)}</p>
<Link href="/" as="/">
<a id="to-index">Go back to index</a>
<Link href="/" as="/" id="to-index">
Go back to index
</Link>
<br />
</>
......
......@@ -2,24 +2,24 @@ import Link from 'next/link'
export default () => (
<>
<Link href="/product">
<a id="products-link">to /product</a>
<Link href="/product" id="products-link">
to /product
</Link>
<br />
<Link href="/product/first">
<a id="product-link">to /product/first</a>
<Link href="/product/first" id="product-link">
to /product/first
</Link>
<br />
<Link href="/category">
<a id="categories-link">to /category</a>
<Link href="/category" id="categories-link">
to /category
</Link>
<br />
<Link href="/category/first">
<a id="category-link">to /category/first</a>
<Link href="/category/first" id="category-link">
to /category/first
</Link>
<br />
<Link href="/category/hello/world">
<a id="category-link-again">to /category/hello/world</a>
<Link href="/category/hello/world" id="category-link-again">
to /category/hello/world
</Link>
<br />
</>
......
......@@ -4,13 +4,13 @@ export default function Page(props) {
return (
<>
<p id="index">index page</p>
<Link href="/rewrite-simple">
<a id="to-simple">to /rewrite-simple</a>
<Link href="/rewrite-simple" id="to-simple">
to /rewrite-simple
</Link>
<br />
<Link href="/rewrite-with-has?hasQuery=true">
<a id="to-has-rewrite">to /rewrite-with-has?hasQuery=true</a>
<Link href="/rewrite-with-has?hasQuery=true" id="to-has-rewrite">
to /rewrite-with-has?hasQuery=true
</Link>
<br />
</>
......
......@@ -10,13 +10,13 @@ export default function Page(props) {
<p id="pathname">{router.pathname}</p>
<p id="query">{JSON.stringify(router.query)}</p>
<Link href="/?imageId=123" as="/preview/123">
<a id="to-modal">open modal for /preview/123</a>
<Link href="/?imageId=123" as="/preview/123" id="to-modal">
open modal for /preview/123
</Link>
<br />
<Link href="/preview/123">
<a id="to-preview">go to /preview/123</a>
<Link href="/preview/123" id="to-preview">
go to /preview/123
</Link>
<br />
</>
......
......@@ -12,28 +12,28 @@ export default function Page(props) {
{router.query.imageId ? <p id="modal">show modal</p> : null}
<Link href="/?imageId=123" as="/preview/123">
<a id="to-modal">open modal for /preview/123</a>
<Link href="/?imageId=123" as="/preview/123" id="to-modal">
open modal for /preview/123
</Link>
<br />
<Link href="/preview/123">
<a id="to-preview">go to /preview/123</a>
<Link href="/preview/123" id="to-preview">
go to /preview/123
</Link>
<br />
<Link href="/another">
<a id="to-another">go to /another</a>
<Link href="/another" id="to-another">
go to /another
</Link>
<br />
<Link href="/rewrite-me">
<a id="to-rewrite-me">go to /rewrite-me</a>
<Link href="/rewrite-me" id="to-rewrite-me">
go to /rewrite-me
</Link>
<br />
<Link href="/" as="/rewrite-me">
<a id="to-index-as-rewrite">go to / as /rewrite-me</a>
<Link href="/" as="/rewrite-me" id="to-index-as-rewrite">
go to / as /rewrite-me
</Link>
<br />
</>
......
......@@ -27,31 +27,32 @@ export default function Page(props) {
<p id="query">{JSON.stringify(router.query)}</p>
<p id="props">{JSON.stringify(props)}</p>
<Link href="/?imageId=123" as="/preview/123">
<a id="to-modal">open modal for /preview/123</a>
<Link href="/?imageId=123" as="/preview/123" id="to-modal">
open modal for /preview/123
</Link>
<br />
<Link href="/preview/321">
<a id="to-preview">go to /preview/321</a>
<Link href="/preview/321" id="to-preview">
go to /preview/321
</Link>
<br />
<Link href="/another">
<a id="to-another">go to /another</a>
<Link href="/another" id="to-another">
go to /another
</Link>
<br />
<Link href="/rewrite-me">
<a id="to-rewrite-me">go to /rewrite-me</a>
<Link href="/rewrite-me" id="to-rewrite-me">
go to /rewrite-me
</Link>
<br />
<Link
href={{ pathname: '/preview/[slug]', query: { slug: '321' } }}
as="/rewrite-me"
id="to-preview-as-rewrite"
>
<a id="to-preview-as-rewrite">go to /preview/321 as /rewrite-me</a>
go to /preview/321 as /rewrite-me
</Link>
<br />
</>
......
......@@ -15,11 +15,11 @@ export default () => {
}, [router.events])
return (
<>
<Link href="/page1">
<a id="link-1">Page 1</a>
<Link href="/page1" id="link-1">
Page 1
</Link>{' '}
<Link href="/page2">
<a id="link-2">Page 2</a>
<Link href="/page2" id="link-2">
Page 2
</Link>
</>
)
......
......@@ -15,11 +15,11 @@ export default () => {
}, [router.events])
return (
<>
<Link href="/page1">
<a id="link-1">Page 1</a>
<Link href="/page1" id="link-1">
Page 1
</Link>{' '}
<Link href="/page2">
<a id="link-2">Page 2</a>
<Link href="/page2" id="link-2">
Page 2
</Link>
</>
)
......
......@@ -4,11 +4,11 @@ export default function Page() {
return (
<div>
<div style={{ height: '100vh' }} />
<Link href="/">
<a id="top-link">top</a>
<Link href="/" id="top-link">
top
</Link>
<Link href="#section">
<a id="section-link">section link</a>
<Link href="#section" id="section-link">
section link
</Link>
<section id="section">section content</section>
</div>
......
......@@ -4,8 +4,8 @@ export default function Page() {
return (
<>
<p id="another">hi from another</p>
<Link href="/">
<a id="to-index">to index</a>
<Link href="/" id="to-index">
to index
</Link>
</>
)
......
......@@ -2,17 +2,16 @@ import Link from 'next/link'
const Page = ({ loaded }) => {
const link = (
<Link href="/another">
<a
id="to-another"
style={{
marginLeft: 5000,
width: 95000,
display: 'block',
}}
>
to another
</a>
<Link
href="/another"
id="to-another"
style={{
marginLeft: 5000,
width: 95000,
display: 'block',
}}
>
to another
</Link>
)
......
......@@ -3,8 +3,8 @@ import Link from 'next/link'
export default () => (
<>
<p id="another">hi from another</p>
<Link href="/">
<a id="to-index">to index</a>
<Link href="/" id="to-index">
to index
</Link>
</>
)
......@@ -2,17 +2,16 @@ import Link from 'next/link'
const Page = ({ loaded }) => {
const link = (
<Link href="/another">
<a
id="to-another"
style={{
marginLeft: 5000,
width: 95000,
display: 'block',
}}
>
to another
</a>
<Link
href="/another"
id="to-another"
style={{
marginLeft: 5000,
width: 95000,
display: 'block',
}}
>
to another
</Link>
)
......
......@@ -8,12 +8,12 @@ export default function Blue() {
This text should be blue.
</div>
<br />
<Link href="/red" prefetch>
<a id="link-red">Red</a>
<Link href="/red" prefetch id="link-red">
Red
</Link>
<br />
<Link href="/none" prefetch={false}>
<a id="link-none">None</a>
<Link href="/none" prefetch={false} id="link-none">
None
</Link>
</>
)
......
......@@ -7,12 +7,12 @@ export default function None() {
This text should be black.
</div>
<br />
<Link href="/red" prefetch={false}>
<a id="link-red">Red</a>
<Link href="/red" prefetch={false} id="link-red">
Red
</Link>
<br />
<Link href="/blue" prefetch={false}>
<a id="link-blue">Blue</a>
<Link href="/blue" prefetch={false} id="link-blue">
Blue
</Link>
</>
)
......
......@@ -8,12 +8,12 @@ export default function Red() {
This text should be red.
</div>
<br />
<Link href="/blue" prefetch={false}>
<a id="link-blue">Blue</a>
<Link href="/blue" prefetch={false} id="link-blue">
Blue
</Link>
<br />
<Link href="/none" prefetch={false}>
<a id="link-none">None</a>
<Link href="/none" prefetch={false} id="link-none">
None
</Link>
</>
)
......
......@@ -6,9 +6,7 @@ export default function Page1() {
<br />
<input key={'' + Math.random()} id="text-input" type="text" />
<br />
<Link href="/page2">
<a>Switch page</a>
</Link>
<Link href="/page2">Switch page</Link>
</>
)
}
......@@ -6,9 +6,7 @@ export default function Page2() {
<br />
<input key={'' + Math.random()} id="text-input" type="text" />
<br />
<Link href="/page1">
<a>Switch page</a>
</Link>
<Link href="/page1">Switch page</Link>
</>
)
}
......@@ -10,8 +10,8 @@ function Nav() {
<nav>
<ul className="flex justify-between items-center p-8">
<li>
<Link href="/">
<a className="text-blue-500 no-underline">Home</a>
<Link href="/" className="text-blue-500 no-underline">
Home
</Link>
</li>
<ul className="flex justify-between items-center">
......
......@@ -3,8 +3,8 @@ export default () => {
return (
<div>
Hello World
<Link href="/fetch">
<a id="fetchlink">fetch page</a>
<Link href="/fetch" id="fetchlink">
fetch page
</Link>
</div>
)
......
......@@ -3,11 +3,11 @@ export default () => {
return (
<div>
Hello World
<Link href="/fetch">
<a id="fetchlink">fetch page</a>
<Link href="/fetch" id="fetchlink">
fetch page
</Link>
<Link href="/fetch-cjs">
<a id="fetchcjslink">fetch cjs page</a>
<Link href="/fetch-cjs" id="fetchcjslink">
fetch cjs page
</Link>
</div>
)
......
......@@ -3,28 +3,48 @@ import Link from 'next/link'
const Page = () => (
<div>
<h3>My blog</h3>
<Link href="/[post]" as="/post-1">
<a id="view-post-1">View post 1</a>
<Link href="/[post]" as="/post-1" id="view-post-1">
View post 1
</Link>
<br />
<Link href="/[post]/comments" as="/post-1/comments">
<a id="view-post-1-comments">View post 1 comments</a>
<Link
href="/[post]/comments"
as="/post-1/comments"
id="view-post-1-comments"
>
View post 1 comments
</Link>
<br />
<Link href="/[post]/[comment]" as="/post-1/comment-1">
<a id="view-post-1-comment-1">View comment 1 on post 1</a>
<Link
href="/[post]/[comment]"
as="/post-1/comment-1"
id="view-post-1-comment-1"
>
View comment 1 on post 1
</Link>
<br />
<Link href="/blog/[post]/comment/[id]" as="/blog/321/comment/123">
<a id="view-nested-dynamic-cmnt">View comment 123 on blog post 321</a>
<Link
href="/blog/[post]/comment/[id]"
as="/blog/321/comment/123"
id="view-nested-dynamic-cmnt"
>
View comment 123 on blog post 321
</Link>
<br />
<Link href="/[post]?fromHome=true" as="/post-1?fromHome=true">
<a id="view-post-1-with-query">View post 1 with query</a>
<Link
href="/[post]?fromHome=true"
as="/post-1?fromHome=true"
id="view-post-1-with-query"
>
View post 1 with query
</Link>
<br />
<Link href="/on-mount/[post]" as="/on-mount/test-w-hash#item-400">
<a id="view-dynamic-with-hash">View test with hash</a>
<Link
href="/on-mount/[post]"
as="/on-mount/test-w-hash#item-400"
id="view-dynamic-with-hash"
>
View test with hash
</Link>
</div>
)
......
......@@ -3,8 +3,8 @@ import Link from 'next/link'
export default () => (
<>
<h3>Hello</h3>
<Link href="/static">
<a id="to-static">To static</a>
<Link href="/static" id="to-static">
To static
</Link>
</>
)
......@@ -3,32 +3,32 @@ import Link from 'next/link'
export default function Index() {
return (
<>
<Link href="/blog/another/">
<a id="to-blog-another">to /blog/another/</a>
<Link href="/blog/another/" id="to-blog-another">
to /blog/another/
</Link>
<br />
<Link href="/blog/first-post/">
<a id="to-blog-post">to /blog/first-post/</a>
<Link href="/blog/first-post/" id="to-blog-post">
to /blog/first-post/
</Link>
<br />
<Link href="/catch-all/hello/world/">
<a id="to-catch-all-item">to /catch-all/hello/world/</a>
<Link href="/catch-all/hello/world/" id="to-catch-all-item">
to /catch-all/hello/world/
</Link>
<br />
<Link href="/catch-all/first/">
<a id="to-catch-all-first">to /catch-all/first/</a>
<Link href="/catch-all/first/" id="to-catch-all-first">
to /catch-all/first/
</Link>
<br />
<Link href="/another/">
<a id="to-another">to /another/</a>
<Link href="/another/" id="to-another">
to /another/
</Link>
<br />
<Link href="/top-level-slug/">
<a id="to-slug">to /top-level-slug/</a>
<Link href="/top-level-slug/" id="to-slug">
to /top-level-slug/
</Link>
<br />
<Link as="/world" href="/[slug]">
<a id="to-slug-manual">to /world/</a>
<Link as="/world" href="/[slug]" id="to-slug-manual">
to /world/
</Link>
<br />
</>
......
......@@ -14,8 +14,8 @@ export default function ExternalLinker({ href }) {
}
return (
<div>
<Link href={href}>
<a id="link">link to {href}</a>
<Link href={href} id="link">
link to{href}
</Link>
<button id="route-pusher" onClick={pushRoute}>
push route {href}
......
......@@ -14,8 +14,8 @@ export default function Linker({ href }) {
}
return (
<div>
<Link href={href}>
<a id="link">link to {href}</a>
<Link href={href} id="link">
link to{href}
</Link>
<button id="route-pusher" onClick={pushRoute}>
push route {href}
......
......@@ -7,9 +7,5 @@ export default () => {
as: '/as-page',
}
return (
<Link {...props}>
<a>Test</a>
</Link>
)
return <Link {...props}>Test</Link>
}
......@@ -3,8 +3,6 @@ import Link from 'next/link'
export default () => (
<div id="about-page">
<p>This is the about page</p>
<Link href="/">
<a>Go Back</a>
</Link>
<Link href="/">Go Back</Link>
</div>
)
......@@ -9,8 +9,8 @@ function routeToAbout(e) {
export default () => (
<div id="home-page">
<p>This is the home page</p>
<Link href="/about">
<a id="about-via-link">about via Link</a>
<Link href="/about" id="about-via-link">
about via Link
</Link>
<a id="about-via-router" onClick={routeToAbout} href="#">
about via Router
......
......@@ -59,20 +59,21 @@ class HeaderNav extends React.Component {
return (
<nav>
{Object.keys(pages).map((url) => (
<Link href={url} key={url} prefetch>
<a
className={`${this.state.activeURL === url ? 'active' : ''} ${
this.state.activeURLTopLevelRouter === url
? 'active-top-level-router'
: ''
} ${
this.state.activeURLTopLevelRouterDeprecatedBehavior === url
? 'active-top-level-router-deprecated-behavior'
: ''
}`}
>
{pages[url]}
</a>
<Link
href={url}
key={url}
prefetch
className={`${this.state.activeURL === url ? 'active' : ''} ${
this.state.activeURLTopLevelRouter === url
? 'active-top-level-router'
: ''
} ${
this.state.activeURLTopLevelRouterDeprecatedBehavior === url
? 'active-top-level-router-deprecated-behavior'
: ''
}`}
>
{pages[url]}
</Link>
))}
</nav>
......
import { createNext } from 'e2e-utils'
import { NextInstance } from 'test/lib/next-modes/base'
describe('next/jest', () => {
describe('next/jest newLinkBehavior', () => {
let next: NextInstance
if (process.env.NEXT_TEST_REACT_VERSION === '^17') {
......@@ -17,7 +17,7 @@ describe('next/jest', () => {
import Link from 'next/link'
export default function Page() {
return <Link href='https://example.com'><a>Hello World!</a></Link>
return <Link href='https://example.com'><div>Hello World!</div></Link>
}
`,
'test/index.test.jsx': `
......@@ -57,30 +57,7 @@ describe('next/jest', () => {
afterAll(() => next.destroy())
it(`should use normal Link behavior when newNextLinkBehavior is unset`, async () => {
await next.start()
})
it(`should use new link behavior when newNextLinkBehavior is true`, async () => {
await next.stop()
await next.patchFile(
'pages/index.jsx',
`
import Link from 'next/link'
export default function Page() {
return <Link href='https://example.com'><div>Hello World!</div></Link>
}
`
)
await next.patchFile(
'next.config.js',
`
module.exports = { experimental: { newNextLinkBehavior: true } }
`
)
it(`should use new link behavior`, async () => {
await next.start()
})
})
......@@ -5,12 +5,12 @@ export default function Page(props) {
<>
<p id="page">index</p>
<p id="props">{JSON.stringify(props)}</p>
<Link href="/blog/first">
<a id="to-blog-first">/blog/first</a>
<Link href="/blog/first" id="to-blog-first">
/blog/first
</Link>
<br />
<Link href="/blog/second">
<a id="to-blog-second">/blog/second</a>
<Link href="/blog/second" id="to-blog-second">
/blog/second
</Link>
<br />
</>
......
......@@ -30,9 +30,7 @@ export default function Page(props) {
<p id="index">index page</p>
<p id="router">{JSON.stringify(router)}</p>
<p id="props">{JSON.stringify(props)}</p>
<Link href="gsp">
<a>to /gsp</a>
</Link>
<Link href="gsp">to /gsp</Link>
</>
)
}
......@@ -12,9 +12,7 @@ export default function Page() {
return (
<>
<p>hello world</p>
<Link href="/another">
<a>to /another</a>
</Link>
<Link href="/another">to /another</Link>
</>
)
}
......@@ -9,9 +9,7 @@ export default function Page() {
return (
<>
<p>hello world</p>
<Link href="/another">
<a>to /another</a>
</Link>
<Link href="/another">to /another</Link>
</>
)
}
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