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
8277d431
Commit
8277d431
authored
Jun 20, 2017
by
Arunoda Susiripala
Committed by
GitHub
Jun 20, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rewrite url when exporting only if there's a href. (#2316)
parent
7b8a4ea2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
1 deletion
+31
-1
link.js
lib/link.js
+1
-0
next.config.js
test/integration/static/next.config.js
+1
-0
button-link.js
test/integration/static/pages/button-link.js
+12
-0
browser.js
test/integration/static/test/browser.js
+12
-0
yarn.lock
yarn.lock
+5
-1
No files found.
lib/link.js
View file @
8277d431
...
...
@@ -129,6 +129,7 @@ export default class Link extends Component {
// Add the ending slash to the paths. So, we can serve the
// "<page>/index.html" directly.
if
(
props
.
href
&&
typeof
__NEXT_DATA__
!==
'undefined'
&&
__NEXT_DATA__
.
nextExport
)
{
...
...
test/integration/static/next.config.js
View file @
8277d431
...
...
@@ -3,6 +3,7 @@ module.exports = {
return
{
'/'
:
{
page
:
'/'
},
'/about'
:
{
page
:
'/about'
},
'/button-link'
:
{
page
:
'/button-link'
},
'/get-initial-props-with-no-query'
:
{
page
:
'/get-initial-props-with-no-query'
},
'/counter'
:
{
page
:
'/counter'
},
'/dynamic-imports'
:
{
page
:
'/dynamic-imports'
},
...
...
test/integration/static/pages/button-link.js
0 → 100644
View file @
8277d431
import
Link
from
'next/link'
export
default
()
=>
(
<
div
id
=
'button-link-page'
>
<
div
>
<
Link
href
=
'/'
>
<
button
>
Go
Back
<
/button
>
<
/Link
>
<
/div
>
<
p
>
This
is
the
About
page
<
/p
>
<
/div
>
)
test/integration/static/test/browser.js
View file @
8277d431
...
...
@@ -135,6 +135,18 @@ export default function (context) {
browser
.
close
()
})
it
(
'should navigate even if used a button inside <Link />'
,
async
()
=>
{
const
browser
=
await
webdriver
(
context
.
port
,
'/button-link'
)
const
text
=
await
browser
.
elementByCss
(
'button'
).
click
()
.
waitForElementByCss
(
'#home-page'
)
.
elementByCss
(
'#home-page p'
).
text
()
expect
(
text
).
toBe
(
'This is the home page'
)
browser
.
close
()
})
describe
(
'pages in the nested level: level1'
,
()
=>
{
it
(
'should render the home page'
,
async
()
=>
{
const
browser
=
await
webdriver
(
context
.
port
,
'/'
)
...
...
yarn.lock
View file @
8277d431
...
...
@@ -5319,7 +5319,11 @@ utils-merge@1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.0.tgz#0294fb922bb9375153541c4f7096231f287c8af8"
uuid@3.0.1, uuid@^3.0.0:
uuid@3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04"
uuid@^3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.0.1.tgz#6544bba2dfda8c1cf17e629a3a305e2bb1fee6c1"
...
...
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