未验证 提交 103e8226 编写于 作者: R Richard van der Dys 提交者: GitHub

Fixed pathname check in router (#10547)

* Fixed pathname check in router

Remove the query portion of the URL when checking paths

* Updated change and added trial test

* Update test
Co-authored-by: NJJ Kasper <jj@jjsweb.site>
上级 893fb6e9
......@@ -240,8 +240,8 @@ export default class Router implements BaseRouter {
if (
e.state &&
this.isSsr &&
e.state.url === this.pathname &&
e.state.as === this.asPath
e.state.as === this.asPath &&
parse(e.state.url).pathname === this.pathname
) {
return
}
......
......@@ -310,6 +310,23 @@ describe('Production Usage', () => {
expect(newText).toBe('server')
})
it('should navigate to external site and back (with query)', async () => {
const browser = await webdriver(appPort, '/external-and-back?hello=world')
const initialText = await browser.elementByCss('p').text()
expect(initialText).toBe('server')
await browser
.elementByCss('a')
.click()
.waitForElementByCss('input')
.back()
.waitForElementByCss('p')
await waitFor(1000)
const newText = await browser.elementByCss('p').text()
expect(newText).toBe('server')
})
it('should change query correctly', async () => {
const browser = await webdriver(appPort, '/query?id=0')
let id = await browser.elementByCss('#q0').text()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册