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
c1e5b66c
Unverified
Commit
c1e5b66c
authored
Jul 29, 2020
by
Darsh Patel
Committed by
GitHub
Jul 29, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix: space issue in error overlay and add tests (#15617)
parent
3d98171d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
72 additions
and
9 deletions
+72
-9
Errors.tsx
packages/react-dev-overlay/src/internal/container/Errors.tsx
+1
-1
first.js
test/integration/error-is-clickable/pages/first.js
+3
-1
index.test.js
test/integration/error-is-clickable/test/index.test.js
+68
-7
No files found.
packages/react-dev-overlay/src/internal/container/Errors.tsx
View file @
c1e5b66c
...
...
@@ -62,7 +62,7 @@ function makeClickable(text: string): JSX.Element[] | string {
return
(
<>
<
a
href=
{
word
}
>
{
word
}
</
a
>
{
index
===
array
.
length
-
1
?
'
'
:
'
'
}
{
index
===
array
.
length
-
1
?
'
'
:
'
'
}
</>
)
}
...
...
test/integration/error-is-clickable/pages/first.js
View file @
c1e5b66c
export
default
function
Index
()
{
throw
new
Error
(
'This error should be clickable. https://nextjs.org'
)
throw
new
Error
(
'This error should be clickable. https://nextjs.org is the homepage. Visit https://nextjs.org/docs for documentation'
)
}
test/integration/error-is-clickable/test/index.test.js
View file @
c1e5b66c
/* eslint-env jest */
import
{
findPort
,
killApp
,
launchApp
,
hasRedbox
}
from
'next-test-utils'
import
{
findPort
,
killApp
,
launchApp
,
hasRedbox
,
getRedboxHeader
,
evaluate
,
waitFor
,
}
from
'next-test-utils'
import
webdriver
from
'next-webdriver'
import
{
join
}
from
'path'
...
...
@@ -23,14 +31,67 @@ describe('Clickable error link', () => {
await
hasRedbox
(
browser
)
await
browser
.
eval
(
`(function () {
document.querySelector("nextjs-portal")
.shadowRoot
.querySelector("#nextjs__container_errors_desc > a").click()
})()
`
)
await
evaluate
(
browser
,
()
=>
{
document
.
querySelector
(
'body > nextjs-portal'
)
.
shadowRoot
.
querySelector
(
'#nextjs__container_errors_desc > a:nth-child(1)'
)
.
click
()
})
await
waitFor
(
1000
)
const
url
=
await
browser
.
url
()
expect
(
url
).
toBe
(
'https://nextjs.org/'
)
})
it
(
'Handles multiple links in error'
,
async
()
=>
{
const
browser
=
await
webdriver
(
appPort
,
'/first'
)
// Open the first link from error
await
hasRedbox
(
browser
)
await
evaluate
(
browser
,
()
=>
{
document
.
querySelector
(
'body > nextjs-portal'
)
.
shadowRoot
.
querySelector
(
'#nextjs__container_errors_desc > a:nth-child(1)'
)
.
click
()
})
await
waitFor
(
1000
)
const
url1
=
await
browser
.
url
()
// Go back to error page
await
browser
.
back
()
// Open the second link from error
await
hasRedbox
(
browser
)
await
evaluate
(
browser
,
()
=>
{
document
.
querySelector
(
'body > nextjs-portal'
)
.
shadowRoot
.
querySelector
(
'#nextjs__container_errors_desc > a:nth-child(2)'
)
.
click
()
})
await
waitFor
(
1000
)
const
url2
=
await
browser
.
url
()
expect
({
url1
,
url2
}).
toEqual
({
url1
:
'https://nextjs.org/'
,
url2
:
'https://nextjs.org/docs'
,
})
})
it
(
'Shows error message correctly'
,
async
()
=>
{
const
browser
=
await
webdriver
(
appPort
,
'/first'
)
await
hasRedbox
(
browser
)
const
headerText
=
await
getRedboxHeader
(
browser
)
expect
(
headerText
).
toMatch
(
/Error: This error should be clickable
\.
https:
\/\/
nextjs
\.
org is the homepage
\.
Visit https:
\/\/
nextjs
\.
org
\/
docs for documentation/
)
})
})
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