forked from facebook/react
-
Notifications
You must be signed in to change notification settings - Fork 0
/
act-dom.html
62 lines (57 loc) · 1.84 KB
/
act-dom.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<!DOCTYPE html>
<html>
<head>
<title>sanity test for ReactTestUtils.act</title>
</head>
<body>
this page tests whether act runs properly in a browser.
<br />
your console should say "5"
<div id='app'/>
<script src="scheduler-unstable_mock.development.js"></script>
<script src="react.development.js"></script>
<script type="text/javascript">
window.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler =
window.SchedulerMock;
</script>
<script src="react-dom.development.js"></script>
<script src="react-dom-test-utils.development.js"></script>
<script>
// from ReactTestUtilsAct-test.js
// function App() {
// let [state, setState] = React.useState(0);
// async function ticker() {
// await null;
// setState(x => x + 1);
// }
// React.useEffect(() => {
// ticker();
// }, [Math.min(state, 4)]);
// return state;
// }
// async function testAsyncAct() {
// const el = document.createElement("div");
// await ReactTestUtils.act(async () => {
// ReactDOM.render(React.createElement(App), el);
// });
// // all 5 ticks present and accounted for
// console.log(el.innerHTML);
// }
// testAsyncAct();
class App extends React.Component{
componentWillMount(){}
UNSAFE_componentWillMount(){}
componentWillReceiveProps(){}
UNSAFE_componentWillReceiveProps(){}
componentWillUpdate(){}
UNSAFE_componentWillUpdate(){}
render(){
return 123
}
}
ReactDOM.unstable_createRoot(window.app).render(React.createElement(App))
// ReactDOM.render(React.createElement(App), window.app)
SchedulerMock.unstable_flushAll()
</script>
</body>
</html>