Unverified Commit 4bd6a53e authored by Joe Haddad's avatar Joe Haddad Committed by GitHub

Test Query String with + Sign (#10186)

parent bea488f0
import Link from 'next/link'
const Another = () => (
<div>
<Link href="/?another=hello%2B">
<a id="hello-plus">Hello +</a>
</Link>
<br />
<Link href={{ pathname: '/', query: { complex: 'yes+' } }}>
<a id="hello-complex">Hello Complex</a>
</Link>
</div>
)
export default Another
......@@ -190,4 +190,57 @@ describe('Query String with Encoding', () => {
}
})
})
describe('plus', () => {
it('should have correct query on SSR', async () => {
const browser = await webdriver(appPort, '/?test=abc%2B')
try {
const text = await browser.elementByCss('#query-content').text()
expect(text).toBe('{"test":"abc+"}')
} finally {
await browser.close()
}
})
it('should have correct query on Router#push', async () => {
const browser = await webdriver(appPort, '/')
try {
await waitFor(2000)
await browser.eval(
`window.next.router.push({pathname:'/',query:{abc:'def+'}})`
)
await waitFor(1000)
const text = await browser.elementByCss('#query-content').text()
expect(text).toBe('{"abc":"def+"}')
} finally {
await browser.close()
}
})
it('should have correct query on simple client-side <Link>', async () => {
const browser = await webdriver(appPort, '/plus')
try {
await waitFor(2000)
await browser.elementByCss('#hello-plus').click()
await waitFor(1000)
const text = await browser.elementByCss('#query-content').text()
expect(text).toBe('{"another":"hello+"}')
} finally {
await browser.close()
}
})
it('should have correct query on complex client-side <Link>', async () => {
const browser = await webdriver(appPort, '/plus')
try {
await waitFor(2000)
await browser.elementByCss('#hello-complex').click()
await waitFor(1000)
const text = await browser.elementByCss('#query-content').text()
expect(text).toBe('{"complex":"yes+"}')
} 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