Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
08d9847a
Commit
08d9847a
authored
Mar 06, 2017
by
Arunoda Susiripala
Committed by
Guillermo Rauch
Mar 06, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Shallow routing changes (#1363)
* Fix a typo in a test suite. * Add old props.url API with warn for all tags.
parent
bbd1a97a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
3 deletions
+30
-3
app.js
lib/app.js
+28
-1
client-navigation.js
test/integration/basic/test/client-navigation.js
+2
-2
No files found.
lib/app.js
View file @
08d9847a
import
React
,
{
Component
,
PropTypes
}
from
'react'
import
{
AppContainer
}
from
'react-hot-loader'
import
shallowEquals
from
'./shallow-equals'
import
{
warn
}
from
'./utils'
const
ErrorDebug
=
process
.
env
.
NODE_ENV
===
'production'
?
null
:
require
(
'./error-debug'
).
default
...
...
@@ -65,6 +66,32 @@ class Container extends Component {
function
createUrl
(
router
)
{
return
{
query
:
router
.
query
,
pathname
:
router
.
pathname
pathname
:
router
.
pathname
,
back
:
()
=>
{
warn
(
`Warning: 'url.back()' is deprecated. Use "window.history.back()"`
)
router
.
back
()
},
push
:
(
url
,
as
)
=>
{
warn
(
`Warning: 'url.push()' is deprecated. Use "next/router" APIs.`
)
return
router
.
push
(
url
,
as
)
},
pushTo
:
(
href
,
as
)
=>
{
warn
(
`Warning: 'url.pushTo()' is deprecated. Use "next/router" APIs.`
)
const
pushRoute
=
as
?
href
:
null
const
pushUrl
=
as
||
href
return
router
.
push
(
pushRoute
,
pushUrl
)
},
replace
:
(
url
,
as
)
=>
{
warn
(
`Warning: 'url.replace()' is deprecated. Use "next/router" APIs.`
)
return
router
.
replace
(
url
,
as
)
},
replaceTo
:
(
href
,
as
)
=>
{
warn
(
`Warning: 'url.replaceTo()' is deprecated. Use "next/router" APIs.`
)
const
replaceRoute
=
as
?
href
:
null
const
replaceUrl
=
as
||
href
return
router
.
replace
(
replaceRoute
,
replaceUrl
)
}
}
}
test/integration/basic/test/client-navigation.js
View file @
08d9847a
...
...
@@ -181,7 +181,7 @@ export default (context, render) => {
})
describe
(
'with shallow routing'
,
()
=>
{
it
(
'should
not
update the url without running getInitialProps'
,
async
()
=>
{
it
(
'should update the url without running getInitialProps'
,
async
()
=>
{
const
browser
=
await
webdriver
(
context
.
appPort
,
'/nav/shallow-routing'
)
const
counter
=
await
browser
.
elementByCss
(
'#increase'
).
click
()
...
...
@@ -196,7 +196,7 @@ export default (context, render) => {
await
browser
.
close
()
})
it
(
'should handle back button and should not run getInitialProps'
,
async
()
=>
{
it
(
'should handle
the
back button and should not run getInitialProps'
,
async
()
=>
{
const
browser
=
await
webdriver
(
context
.
appPort
,
'/nav/shallow-routing'
)
let
counter
=
await
browser
.
elementByCss
(
'#increase'
).
click
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment