rsnext/test/integration/basic/pages/nav
tangye ad5431b4ae
should not change method to replaceState unless asPath is the same (#6033)
original code in `/lib/router/router.js`
```
  urlIsNew (pathname, query) {
    return this.pathname !== pathname || !shallowEquals(query, this.query)
  }
```
the urlIsNew compare `this.pathname` to an argument `pathname`
the invokers:
```
    // If asked to change the current URL we should reload the current page
    // (not location.reload() but reload getInitialProps and other Next.js stuffs)
    // We also need to set the method = replaceState always
    // as this should not go into the history (That's how browsers work)
    if (!this.urlIsNew(asPathname, asQuery)) {
      method = 'replaceState'
    }
```
the parameter here is `asPathname` destructured from `asPath`

so here is a problem when we reuse a single page rendered in two asPaths

pages/a.js
```
<>
  <Link href='/a'><a>goto a</a></Link>
  <Link href='/a' as='/b'><a>goto b</a></Link>
</>
```
If we navigate to page /a, then click 'goto b', actually the history is replaced, not pushed.
It is expected that history could be correctly pushed and popped as long as the browser url is changed.
2019-01-11 15:44:25 -06:00
..
about.js Make sure lastAppProps always have some value. (#829) 2017-01-20 11:33:46 -08:00
as-path-pushstate.js should not change method to replaceState unless asPath is the same (#6033) 2019-01-11 15:44:25 -06:00
as-path-using-router.js Introduce "asPath" into router and getInitialProps (#1857) 2017-05-03 09:40:09 -07:00
as-path.js Introduce "asPath" into router and getInitialProps (#1857) 2017-05-03 09:40:09 -07:00
hash-changes.js Scroll to name when hash is provided (#5019) 2018-08-23 20:20:45 +02:00
head-1.js Remove old UNSAFE_ lifecycle methods (#5020) 2018-08-25 17:26:11 +02:00
head-2.js Remove old UNSAFE_ lifecycle methods (#5020) 2018-08-25 17:26:11 +02:00
index.js Make onClick Link tests more consistent (#4954) 2018-08-15 12:42:56 -07:00
on-click.js Make onClick Link tests more consistent (#4954) 2018-08-15 12:42:56 -07:00
pass-href-prop.js fix: Forces Link to expose the href to the child using passHref property. (#2503) 2017-07-09 10:39:02 +05:30
querystring.js Add support for URL objects in Link and Router (#1345) 2017-03-12 09:27:51 +05:30
redirect.js Add test cases for getInitialProps based redirect logic. (#1578) 2017-03-31 11:35:45 -03:00
self-reload.js Reload the page if asked to change the current URL (#1159) 2017-02-15 19:27:41 +01:00
shallow-routing.js Run method sorting codemod (#4909) 2018-08-06 20:53:06 -07:00
url-prop-change.js Remove UNSAFE_ lifecycles from tests (#5031) 2018-08-25 20:09:20 +02:00
with-hoc.js Add asPath on the server (#3149) 2017-10-22 12:00:31 -07:00