Unverified Commit e56a6add authored by Jan Potoms's avatar Jan Potoms Committed by GitHub

Add test for query param bug #15233 (#15238)

Fixes https://github.com/vercel/next.js/issues/15233
parent bd9fc12f
...@@ -30,6 +30,10 @@ const Home = () => ( ...@@ -30,6 +30,10 @@ const Home = () => (
> >
<a id="single-colon">Single: :</a> <a id="single-colon">Single: :</a>
</Link> </Link>
<br />
<Link href="/query?id=http://example.com/">
<a id="url-param">Url query param</a>
</Link>
</div> </div>
) )
......
export function getServerSideProps({ query }) {
return { props: query }
}
export default function Single(props) {
return <pre id="query-content">{JSON.stringify(props)}</pre>
}
...@@ -295,5 +295,19 @@ describe('Link Component with Encoding', () => { ...@@ -295,5 +295,19 @@ describe('Link Component with Encoding', () => {
await browser.close() await browser.close()
} }
}) })
it('should have correct parsing of url query params', async () => {
const browser = await webdriver(appPort, '/')
try {
await browser.waitForElementByCss('#url-param').click()
const content = await browser
.waitForElementByCss('#query-content')
.text()
const query = JSON.parse(content)
expect(query).toHaveProperty('id', 'http://example.com/')
} finally {
await browser.close()
}
})
}) })
}) })
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