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
880eb4ca
Commit
880eb4ca
authored
May 11, 2017
by
Arunoda Susiripala
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a test case for client side routing for next export.
parent
b18ecc92
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
10 deletions
+30
-10
counter.js
test/integration/static/pages/counter.js
+6
-10
browser.js
test/integration/static/test/browser.js
+24
-0
No files found.
test/integration/static/pages/counter.js
View file @
880eb4ca
import
React
from
'react'
import
Link
from
'next/link'
export
default
class
Counter
extends
React
.
Component
{
constructor
(...
args
)
{
super
(...
args
)
this
.
state
=
{
count
:
0
}
}
let
counter
=
0
export
default
class
Counter
extends
React
.
Component
{
increaseCounter
()
{
co
nst
{
count
}
=
this
.
state
this
.
setState
({
count
:
count
+
1
}
)
co
unter
++
this
.
forceUpdate
(
)
}
render
()
{
const
{
count
}
=
this
.
state
return
(
<
div
id
=
'counter-page'
>
<
div
>
<
Link
href
=
'/'
>
<
a
>
Go
Back
<
/a
>
<
a
id
=
'go-back'
>
Go
Back
<
/a
>
<
/Link
>
<
/div
>
<
p
>
Counter
:
{
count
}
<
/p
>
<
p
>
Counter
:
{
count
er
}
<
/p
>
<
button
id
=
'counter-increase'
onClick
=
{()
=>
this
.
increaseCounter
()}
...
...
test/integration/static/test/browser.js
View file @
880eb4ca
...
...
@@ -68,5 +68,29 @@ export default function (context) {
expect
(
text
).
toBe
(
'next export is nice'
)
browser
.
close
()
})
it
(
'should support client side naviagtion'
,
async
()
=>
{
const
browser
=
await
webdriver
(
context
.
port
,
'/'
)
const
text
=
await
browser
.
elementByCss
(
'#counter'
).
click
()
.
waitForElementByCss
(
'#counter-page'
)
.
elementByCss
(
'#counter-increase'
).
click
()
.
elementByCss
(
'#counter-increase'
).
click
()
.
elementByCss
(
'#counter-page p'
).
text
()
expect
(
text
).
toBe
(
'Counter: 2'
)
// let's go back and come again to this page:
const
textNow
=
await
browser
.
elementByCss
(
'#go-back'
).
click
()
.
waitForElementByCss
(
'#home-page'
)
.
elementByCss
(
'#counter'
).
click
()
.
waitForElementByCss
(
'#counter-page'
)
.
elementByCss
(
'#counter-page p'
).
text
()
expect
(
textNow
).
toBe
(
'Counter: 2'
)
browser
.
close
()
})
})
}
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