-
Notifications
You must be signed in to change notification settings - Fork 42
/
index.html
46 lines (39 loc) · 1.26 KB
/
index.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
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Learn Redux</title>
<link rel="shortcut icon" type="image/png" href="http://www.favicon.cc/logo3d/805435.png"/>
</head>
<body style='margin: 0 1em;'>
<div id='main'>
<p>If you can see this the Redux Script <em>Failed</em> ...</p>
</div>
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/redux/3.0.5/redux.min.js"></script> -->
<script src="redux.min.js"></script>
<script src="https://npmcdn.com/expect/umd/expect.min.js"></script>
<script>
// counter is the reducer (function) that manages state updates:
function counter(state, action) {
if (action.type === 'INCREMENT') {
return state + 1;
} else if (action.type === 'DECREMENT') {
return state - 1;
}
}
expect (
counter(0, { type: 'INCREMENT' })
).toEqual(1);
expect (
counter(1, { type: 'INCREMENT' })
).toEqual(2);
expect (
counter(2, { type: 'DECREMENT' })
).toEqual(1);
expect (
counter(1, { type: 'DECREMENT' })
).toEqual(0);
// Confirm that the test are successful:
console.log('Tests passed!');
</script>
</body>
</html>