Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5315f91

Browse files
Merge pull request zoltantothcom#24 from zoltantothcom/dev
Refactor themes to use color constants
2 parents ddf11fa + a989220 commit 5315f91

39 files changed

+315
-304
lines changed

‎README.md‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ JavaScript Design Patterns - a game to get familiar with the design patterns, te
1111
- [About](#about)
1212
- [How To Run Locally](#how-to-run-locally)
1313
- [Running the Tests](#running-the-tests)
14-
- [ToDo](#todo)
1514
- [Credits](#credits)
1615
- [License](#license)
1716

@@ -93,12 +92,6 @@ yarn test
9392
yarn test:coverage
9493
```
9594

96-
## ToDo
97-
98-
- Write more unit tests
99-
- Add E2E tests (Cypress)
100-
- Add a «_Reference_» section where the patterns can be viewed
101-
10295
## Credits
10396

10497
- Inpired by the very well-known [JavaScript Guessing Game](https://javascript-game.firebaseapp.com/)

‎__tests__/actions/actions.test.js‎

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,46 @@
11
import { restart } from '../../src/actions/restart';
22
import { submitAnswer } from '../../src/actions/submitAnswer';
33
import { toggle, toggleJS, toggleMode } from '../../src/actions/toggle';
4+
import {
5+
SUBMIT,
6+
TOGGLE,
7+
TOGGLE_JS,
8+
TOGGLE_MODE,
9+
RESTART
10+
} from '../../src/static/constants/actions';
411

512
describe('Action Creators', () => {
613
it('should dispatch RESTART action', () => {
714
expect(restart('restart')).toEqual({
8-
type: 'RESTART',
15+
type: RESTART,
916
payload: 'restart'
1017
});
1118
});
1219

1320
it('should dispatch SUBMIT action', () => {
1421
expect(submitAnswer('submit')).toEqual({
15-
type: 'SUBMIT',
22+
type: SUBMIT,
1623
payload: 'submit'
1724
});
1825
});
1926

2027
it('should dispatch TOGGLE action', () => {
2128
expect(toggle('toggle')).toEqual({
22-
type: 'TOGGLE',
29+
type: TOGGLE,
2330
payload: 'toggle'
2431
});
2532
});
2633

2734
it('should dispatch TOGGLE_JS action', () => {
2835
expect(toggleJS('toggle js')).toEqual({
29-
type: 'TOGGLE_JS',
36+
type: TOGGLE_JS,
3037
payload: 'toggle js'
3138
});
3239
});
3340

3441
it('should dispatch TOGGLE_MODE action', () => {
3542
expect(toggleMode('toggle mode')).toEqual({
36-
type: 'TOGGLE_MODE',
43+
type: TOGGLE_MODE,
3744
payload: 'toggle mode'
3845
});
3946
});

‎__tests__/components/ButtonContainer.test.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import ButtonContainer, {
88
ButtonContainer as NotConnectedButtonContainer
99
} from '../../src/components/ButtonContainer';
1010
import { answers } from '../../src/store';
11+
import { SUBMIT } from '../../src/static/constants/actions';
1112

1213
describe('<ButtonContainer /> connected', () => {
1314
const mockStore = configureMockStore();
@@ -33,7 +34,7 @@ describe('<ButtonContainer /> connected', () => {
3334
.simulate('click');
3435

3536
const actions = store.getActions();
36-
expect(actions).toMatchObject([{ type: 'SUBMIT' }]);
37+
expect(actions).toMatchObject([{ type: SUBMIT }]);
3738
});
3839
});
3940

‎__tests__/components/Toggle.test.js‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { themeLight } from '../../src/styles/themes/theme.light';
88
import { themeDark } from '../../src/styles/themes/theme.dark';
99
import 'jest-styled-components';
1010
import Toggle from '../../src/components/Toggle';
11+
import { TOGGLE } from '../../src/static/constants/actions';
1112

1213
const mockClick = jest.fn();
1314
const mockStore = configureMockStore();
@@ -90,7 +91,7 @@ describe('<Toggle> actions', () => {
9091
toggle.find('button').simulate('click');
9192

9293
const actions = store.getActions();
93-
expect(actions).toMatchObject([{ type: 'TOGGLE', payload: 'mode' }]);
94+
expect(actions).toMatchObject([{ type: TOGGLE, payload: 'mode' }]);
9495
});
9596

9697
it('toggles MODE to DARK', () => {
@@ -111,7 +112,7 @@ describe('<Toggle> actions', () => {
111112
toggle.find('button').simulate('click');
112113

113114
const actions = store.getActions();
114-
expect(actions).toMatchObject([{ type: 'TOGGLE', payload: 'mode' }]);
115+
expect(actions).toMatchObject([{ type: TOGGLE, payload: 'mode' }]);
115116
});
116117

117118
it('toggles JS to ES6', () => {
@@ -132,7 +133,7 @@ describe('<Toggle> actions', () => {
132133
toggle.find('button').simulate('click');
133134

134135
const actions = store.getActions();
135-
expect(actions).toMatchObject([{ type: 'TOGGLE', payload: 'js' }]);
136+
expect(actions).toMatchObject([{ type: TOGGLE, payload: 'js' }]);
136137
});
137138

138139
it('toggles JS to ES5', () => {
@@ -153,6 +154,6 @@ describe('<Toggle> actions', () => {
153154
toggle.find('button').simulate('click');
154155

155156
const actions = store.getActions();
156-
expect(actions).toMatchObject([{ type: 'TOGGLE', payload: 'js' }]);
157+
expect(actions).toMatchObject([{ type: TOGGLE, payload: 'js' }]);
157158
});
158159
});

‎__tests__/components/__snapshots__/Button.test.js.snap‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
exports[`<Button /> component renders with a DARK theme 1`] = `
44
.c0 {
55
background-color: #484848;
6-
border: 1px solid #707070;
6+
border: 1px solid #484848;
77
border-radius: 4px;
88
cursor: pointer;
99
font: 400 1rem 'Karla','sans-serif';
@@ -15,16 +15,16 @@ exports[`<Button /> component renders with a DARK theme 1`] = `
1515
}
1616
1717
.c0 span {
18-
color: #f5f5f5;
18+
color: #F5F5F5;
1919
}
2020
2121
.c0:hover {
2222
background-color: #888888;
23-
border-color: #c4c4c4;
23+
border-color: #888888;
2424
}
2525
2626
.c0:hover span {
27-
color: #ffffff;
27+
color: #FFFFFF;
2828
}
2929
3030
<button
@@ -40,8 +40,8 @@ exports[`<Button /> component renders with a DARK theme 1`] = `
4040

4141
exports[`<Button /> component renders with a LIGHT theme 1`] = `
4242
.c0 {
43-
background-color: #e8e8e8;
44-
border: 1px solid #cccccc;
43+
background-color: #F2E8F2;
44+
border: 1px solid #EDB8ED;
4545
border-radius: 4px;
4646
cursor: pointer;
4747
font: 400 1rem 'Karla','sans-serif';
@@ -53,16 +53,16 @@ exports[`<Button /> component renders with a LIGHT theme 1`] = `
5353
}
5454
5555
.c0 span {
56-
color: #707070;
56+
color: #6F256F;
5757
}
5858
5959
.c0:hover {
60-
background-color: #e22a23;
61-
border-color: #aaaaaa;
60+
background-color: #6F256F;
61+
border-color: #6F256F;
6262
}
6363
6464
.c0:hover span {
65-
color: #ffffff;
65+
color: #FFFFFF;
6666
}
6767
6868
<button

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /