Skip to content

Commit f97b40e

Browse files
authored
Revert "feat: upgrade to react 18 (openedx#1663)"
This reverts commit 515c3cf.
1 parent 6d1bc0b commit f97b40e

13 files changed

Lines changed: 3443 additions & 4643 deletions

File tree

package-lock.json

Lines changed: 3294 additions & 4171 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"@edx/frontend-lib-special-exams": "^3.5.0",
4242
"@edx/frontend-platform": "^8.3.1",
4343
"@edx/openedx-atlas": "^0.6.0",
44-
"@edx/react-unit-test-utils": "^4.0.0",
44+
"@edx/react-unit-test-utils": "3.1.0",
4545
"@fortawesome/free-brands-svg-icons": "5.15.4",
4646
"@fortawesome/free-regular-svg-icons": "5.15.4",
4747
"@fortawesome/free-solid-svg-icons": "5.15.4",
@@ -63,8 +63,8 @@
6363
"postcss-loader": "^8.1.1",
6464
"prop-types": "15.8.1",
6565
"query-string": "^7.1.3",
66-
"react": "^18.3.1",
67-
"react-dom": "^18.3.1",
66+
"react": "17.0.2",
67+
"react-dom": "17.0.2",
6868
"react-helmet": "6.1.0",
6969
"react-redux": "7.2.9",
7070
"react-router": "6.15.0",
@@ -80,8 +80,9 @@
8080
"devDependencies": {
8181
"@edx/reactifex": "2.2.0",
8282
"@pact-foundation/pact": "^13.0.0",
83-
"@testing-library/jest-dom": "^6.6.3",
84-
"@testing-library/react": "^16.2.0",
83+
"@testing-library/jest-dom": "5.17.0",
84+
"@testing-library/react": "12.1.5",
85+
"@testing-library/react-hooks": "^8.0.1",
8586
"@testing-library/user-event": "14.6.1",
8687
"axios-mock-adapter": "2.1.0",
8788
"bundlewatch": "^0.4.0",
@@ -95,7 +96,7 @@
9596
"files": [
9697
{
9798
"path": "dist/*.js",
98-
"maxSize": "1450kB"
99+
"maxSize": "1400kB"
99100
}
100101
],
101102
"normalizeFilenames": "^.+?(\\..+?)\\.\\w+$"

src/__snapshots__/index.test.jsx.snap

Lines changed: 0 additions & 224 deletions
This file was deleted.

src/course-home/courseware-search/hooks.test.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { renderHook, act, waitFor } from '@testing-library/react';
1+
import { renderHook, act } from '@testing-library/react-hooks';
22
import { useParams, useSearchParams } from 'react-router-dom';
33
import { useSelector } from 'react-redux';
44
import { fetchCoursewareSearchSettings } from '../data/thunks';
@@ -38,13 +38,13 @@ describe('CoursewareSearch Hooks', () => {
3838

3939
it('should return true if feature is enabled', async () => {
4040
const hook = await renderTestHook();
41-
await waitFor(() => expect(fetchCoursewareSearchSettings).toBeCalledTimes(1));
41+
await hook.waitFor(() => expect(fetchCoursewareSearchSettings).toBeCalledTimes(1));
4242
expect(hook.result.current).toBe(true);
4343
});
4444

4545
it('should return false if feature is disabled', async () => {
4646
const hook = await renderTestHook(false);
47-
await waitFor(() => expect(fetchCoursewareSearchSettings).toBeCalledTimes(1));
47+
await hook.waitFor(() => expect(fetchCoursewareSearchSettings).toBeCalledTimes(1));
4848
expect(hook.result.current).toBe(false);
4949
});
5050
});
@@ -125,7 +125,7 @@ describe('CoursewareSearch Hooks', () => {
125125
it('should return the element bounding box', async () => {
126126
const hook = await renderTestHook({ elementId: 'test', mockedInfo });
127127

128-
await waitFor(() => expect(getBoundingClientRectSpy).toHaveBeenCalled());
128+
hook.waitFor(() => expect(getBoundingClientRectSpy).toHaveBeenCalled());
129129

130130
expect(hook.result.current).toEqual(mockedInfo);
131131
});

src/courseware/CoursewareContainer.test.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { getConfig, history } from '@edx/frontend-platform';
22
import { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth';
33
import { AppProvider } from '@edx/frontend-platform/react';
44
import { waitForElementToBeRemoved, fireEvent } from '@testing-library/dom';
5-
import '@testing-library/jest-dom';
5+
import '@testing-library/jest-dom/extend-expect';
66
import { render, screen } from '@testing-library/react';
77
import React from 'react';
88
import {

src/courseware/course/Course.test.jsx

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,7 @@ describe('Course', () => {
5050
global.innerWidth = breakpoints.extraLarge.minWidth;
5151
});
5252

53-
// This was passing when it shouldn't have been because of improper
54-
// waitFor use. With the React 18 upgrade it no longer improperly passes
55-
// so we are skipping it. See https://github.com/openedx/frontend-app-learning/issues/1669
56-
// for details.
57-
it.skip('loads learning sequence', () => {
53+
it('loads learning sequence', async () => {
5854
render(<Course {...mockData} />, { wrapWithRouter: true });
5955
expect(screen.queryByRole('navigation', { name: 'breadcrumb' })).not.toBeInTheDocument();
6056
waitFor(() => {
@@ -98,11 +94,7 @@ describe('Course', () => {
9894
expect(screen.queryByRole('navigation', { name: 'breadcrumb' })).not.toBeInTheDocument();
9995
});
10096

101-
// This was passing when it shouldn't have been because of improper
102-
// waitFor use. With the React 18 upgrade it no longer improperly passes
103-
// so we are skipping it. See https://github.com/openedx/frontend-app-learning/issues/1669
104-
// for details.
105-
it.skip('displays first section celebration modal', async () => {
97+
it('displays first section celebration modal', async () => {
10698
const courseHomeMetadata = Factory.build('courseHomeMetadata', { celebrations: { firstSection: true } });
10799
const testStore = await initializeTestStore({ courseHomeMetadata }, false);
108100
const { courseware, models } = testStore.getState();
@@ -124,11 +116,7 @@ describe('Course', () => {
124116
});
125117
});
126118

127-
// This was passing when it shouldn't have been because of improper
128-
// waitFor use. With the React 18 upgrade it no longer improperly passes
129-
// so we are skipping it. See https://github.com/openedx/frontend-app-learning/issues/1669
130-
// for details.
131-
it.skip('displays weekly goal celebration modal', async () => {
119+
it('displays weekly goal celebration modal', async () => {
132120
const courseHomeMetadata = Factory.build('courseHomeMetadata', { celebrations: { weeklyGoal: true } });
133121
const testStore = await initializeTestStore({ courseHomeMetadata }, false);
134122
const { courseware, models } = testStore.getState();

src/courseware/course/content-tools/calculator/Calculator.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ class Calculator extends Component {
341341
<li>arccsch(4x+y)</li>
342342
</ul>
343343
</td>
344+
<td dir="auto" />
344345
</tr>
345346
<tr>
346347
<th scope="row">

0 commit comments

Comments
 (0)