Skip to content

Commit 439a99a

Browse files
authored
Merge pull request #61 from flextremedev/update-dependencies
Update react and more
2 parents 7c597dc + d3f7644 commit 439a99a

File tree

5 files changed

+5110
-3607
lines changed

5 files changed

+5110
-3607
lines changed

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"private": true,
55
"homepage": "https://workout-interval-timer.netlify.com",
66
"dependencies": {
7-
"@testing-library/react": "^9.1.4",
7+
"@testing-library/react": "^11.2.5",
88
"@xstate/react": "^0.8.1",
99
"date-fns": "^2.1.0",
10-
"react": "^16.9.0",
11-
"react-dom": "^16.9.0",
10+
"react": "^17.0.2",
11+
"react-dom": "^17.0.2",
1212
"react-helmet": "^6.1.0",
13-
"react-scripts": "3.1.1",
13+
"react-scripts": "^4.0.3",
1414
"xstate": "^4.11.0"
1515
},
1616
"scripts": {

src/App.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { makeAdvanceDateNowBy } from './utils/test-utils/makeAdvanceDateNowBy';
44
import { renderApp } from './utils/test-utils/renderApp';
55
import { MockWorker } from './__mocks__/Worker';
66

7-
jest.useFakeTimers();
87
const startDate = 1587574443099;
98
const play = jest.fn();
109

@@ -21,6 +20,7 @@ describe('App', () => {
2120
beforeEach(() => {
2221
HTMLMediaElement.prototype.play = play;
2322
window.Worker = MockWorker;
23+
jest.useFakeTimers('modern');
2424
});
2525

2626
it('should run intervals correctly', () => {

src/components/DurationInput/DurationInput.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,18 @@ export function DurationInput({
1515
const formattedSeconds = format(value, 'ss');
1616
const minutesRef = React.useRef(null);
1717
const secondsRef = React.useRef(null);
18+
19+
React.useEffect(() => {
20+
/* istanbul ignore else */
21+
if (secondsRef.current) {
22+
secondsRef.current.setSelectionRange(0, 0);
23+
}
24+
/* istanbul ignore else */
25+
if (minutesRef.current) {
26+
minutesRef.current.setSelectionRange(0, 0);
27+
}
28+
}, []);
29+
1830
const handleChange = e => {
1931
e.stopPropagation();
2032
const { value: targetValue, name } = e.target;

src/components/DurationInput/DurationInput.test.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import React from 'react';
2-
import { render, fireEvent } from '@testing-library/react';
2+
import { render, fireEvent, cleanup } from '@testing-library/react';
33
import { DurationInput } from './DurationInput';
44
describe('DurationInput', () => {
5+
afterEach(() => {
6+
cleanup();
7+
});
58
it('should call onChange when minutes changed', () => {
69
const handleChange = jest.fn();
710
const { getByTestId } = render(

0 commit comments

Comments
 (0)