File tree Expand file tree Collapse file tree 5 files changed +31
-1
lines changed Expand file tree Collapse file tree 5 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -129,6 +129,7 @@ export default class Link extends Component {
129
129
// Add the ending slash to the paths. So, we can serve the
130
130
// "<page>/index.html" directly.
131
131
if (
132
+ props . href &&
132
133
typeof __NEXT_DATA__ !== 'undefined' &&
133
134
__NEXT_DATA__ . nextExport
134
135
) {
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ module.exports = {
3
3
return {
4
4
'/' : { page : '/' } ,
5
5
'/about' : { page : '/about' } ,
6
+ '/button-link' : { page : '/button-link' } ,
6
7
'/get-initial-props-with-no-query' : { page : '/get-initial-props-with-no-query' } ,
7
8
'/counter' : { page : '/counter' } ,
8
9
'/dynamic-imports' : { page : '/dynamic-imports' } ,
Original file line number Diff line number Diff line change
1
+ import Link from 'next/link'
2
+
3
+ export default ( ) => (
4
+ < div id = 'button-link-page' >
5
+ < div >
6
+ < Link href = '/' >
7
+ < button > Go Back</ button >
8
+ </ Link >
9
+ </ div >
10
+ < p > This is the About page</ p >
11
+ </ div >
12
+ )
Original file line number Diff line number Diff line change @@ -135,6 +135,18 @@ export default function (context) {
135
135
browser . close ( )
136
136
} )
137
137
138
+ it ( 'should navigate even if used a button inside <Link />' , async ( ) => {
139
+ const browser = await webdriver ( context . port , '/button-link' )
140
+
141
+ const text = await browser
142
+ . elementByCss ( 'button' ) . click ( )
143
+ . waitForElementByCss ( '#home-page' )
144
+ . elementByCss ( '#home-page p' ) . text ( )
145
+
146
+ expect ( text ) . toBe ( 'This is the home page' )
147
+ browser . close ( )
148
+ } )
149
+
138
150
describe ( 'pages in the nested level: level1' , ( ) => {
139
151
it ( 'should render the home page' , async ( ) => {
140
152
const browser = await webdriver ( context . port , '/' )
Original file line number Diff line number Diff line change @@ -5319,7 +5319,11 @@ utils-merge@1.0.0:
5319
5319
version "1.0.0"
5320
5320
resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.0.tgz#0294fb922bb9375153541c4f7096231f287c8af8"
5321
5321
5322
- uuid@3.0.1, uuid@^3.0.0 :
5322
+ uuid@3.1.0 :
5323
+ version "3.1.0"
5324
+ resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04"
5325
+
5326
+ uuid@^3.0.0 :
5323
5327
version "3.0.1"
5324
5328
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.0.1.tgz#6544bba2dfda8c1cf17e629a3a305e2bb1fee6c1"
5325
5329
You can’t perform that action at this time.
0 commit comments