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
db5ac0ae
Unverified
Commit
db5ac0ae
authored
May 10, 2020
by
Joe Haddad
Committed by
GitHub
May 10, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Fast Refresh] Add additional test case (#12674)
parent
cf0b1d94
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
77 additions
and
0 deletions
+77
-0
ReactRefreshLogBox.test.js
test/acceptance/ReactRefreshLogBox.test.js
+77
-0
No files found.
test/acceptance/ReactRefreshLogBox.test.js
View file @
db5ac0ae
...
@@ -605,3 +605,80 @@ test('unterminated JSX', async () => {
...
@@ -605,3 +605,80 @@ test('unterminated JSX', async () => {
await
cleanup
()
await
cleanup
()
})
})
test
.
only
(
'conversion to class component (1)'
,
async
()
=>
{
const
[
session
,
cleanup
]
=
await
sandbox
()
await
session
.
write
(
'Child.js'
,
`
export default function ClickCount() {
return <p>hello</p>
}
`
)
await
session
.
patch
(
'index.js'
,
`
import Child from './Child';
export default function Home() {
return (
<div>
<Child />
</div>
)
}
`
)
expect
(
await
session
.
hasRedbox
()).
toBe
(
false
)
expect
(
await
session
.
evaluate
(()
=>
document
.
querySelector
(
'p'
).
textContent
)
).
toBe
(
'hello'
)
await
session
.
patch
(
'Child.js'
,
`
import { Component } from 'react';
export default class ClickCount extends Component {
render() {
throw new Error()
}
}
`
)
expect
(
await
session
.
hasRedbox
(
true
)).
toBe
(
true
)
expect
(
await
session
.
getRedboxSource
()).
toMatchInlineSnapshot
(
`
"Child.js (5:16) @ ClickCount.render
3 | export default class ClickCount extends Component {
4 | render() {
> 5 | throw new Error()
| ^
6 | }
7 | }
8 | "
`
)
await
session
.
patch
(
'Child.js'
,
`
import { Component } from 'react';
export default class ClickCount extends Component {
render() {
return <p>hello new</p>
}
}
`
)
expect
(
await
session
.
hasRedbox
()).
toBe
(
false
)
expect
(
await
session
.
evaluate
(()
=>
document
.
querySelector
(
'p'
).
textContent
)
).
toBe
(
'hello new'
)
await
cleanup
()
})
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