Skip to content

Commit

Permalink
Updated change and added trial test
Browse files Browse the repository at this point in the history
  • Loading branch information
dijs committed Feb 19, 2020
1 parent 4be2b2d commit e104aef
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/next/next-server/lib/router/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,8 @@ export default class Router implements BaseRouter {
if (
e.state &&
this.isSsr &&
// Remove the query portion of the URL when checking paths
e.state.url.replace(/\?(.)+/, '') === this.pathname &&
e.state.as === this.asPath
e.state.as === this.asPath &&
parse(e.state.url).pathname === this.pathname
) {
return
}
Expand Down
15 changes: 15 additions & 0 deletions test/integration/production/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,21 @@ describe('Production Usage', () => {
expect(newText).toBe('server')
})

it('should navigate back then forward', async () => {
const browser = await webdriver(appPort, '/external-and-back')
const initialText = await browser.elementByCss('p').text()
expect(initialText).toBe('server')

await browser
.elementByCss('a')
.click()
.waitForElementByCss('input')
.back()
.waitForElementByCss('p')
.forward()
.waitForElementByCss('input')
})

it('should change query correctly', async () => {
const browser = await webdriver(appPort, '/query?id=0')
let id = await browser.elementByCss('#q0').text()
Expand Down

0 comments on commit e104aef

Please sign in to comment.