diff --git a/package.json b/package.json index b48118f59b..e88822dc6b 100644 --- a/package.json +++ b/package.json @@ -74,16 +74,16 @@ "phaser": "~3.90.0", "query-string": "^9.0.0", "re-resizable": "^6.9.9", - "react": "^18.3.1", + "react": "^19.1.0", "react-ace": "^14.0.0", "react-copy-to-clipboard": "^5.1.0", "react-debounce-render": "^8.0.2", - "react-dom": "^18.3.1", + "react-dom": "^19.1.0", "react-drag-drop-files": "^3.0.0", "react-draggable": "^4.4.5", "react-dropzone": "^14.2.3", "react-i18next": "^15.0.0", - "react-konva": "^18.2.10", + "react-konva": "^19.0.7", "react-latex-next": "^3.0.0", "react-mde": "^11.5.0", "react-papaparse": "^4.0.2", @@ -138,12 +138,11 @@ "@types/js-cookie": "^3.0.6", "@types/js-yaml": "^4.0.5", "@types/lodash": "^4.14.195", - "@types/react": "^18.3.3", + "@types/react": "^19.1.8", "@types/react-copy-to-clipboard": "^5.0.4", - "@types/react-dom": "^18.3.0", + "@types/react-dom": "^19.1.6", "@types/react-redux": "^7.1.24", "@types/react-syntax-highlighter": "^15.5.7", - "@types/react-test-renderer": "^18.0.0", "@types/redux-mock-store": "^1.0.3", "@types/showdown": "^2.0.1", "@types/xml2js": "^0.4.11", @@ -172,10 +171,10 @@ "prettier": "^3.3.3", "process": "^0.11.10", "react-error-overlay": "^6.0.11", - "react-test-renderer": "^18.2.0", "redux-saga-test-plan": "^4.0.6", "resize-observer-polyfill": "^1.5.1", "sass": "^1.63.6", + "shallow-react-snapshot": "^0.2.2", "stream-browserify": "^3.0.0", "stream-http": "^3.2.0", "timers-browserify": "^2.0.12", diff --git a/src/commons/__tests__/__snapshots__/ContentDisplay.test.tsx.snap b/src/commons/__tests__/__snapshots__/ContentDisplay.test.tsx.snap index c1ce322ba0..444aa9abf1 100644 --- a/src/commons/__tests__/__snapshots__/ContentDisplay.test.tsx.snap +++ b/src/commons/__tests__/__snapshots__/ContentDisplay.test.tsx.snap @@ -1,19 +1,21 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`ContentDisplay page renders correctly 1`] = ` -
+
-
- Test Content +
+
+ Test Content +
-
+
`; diff --git a/src/commons/__tests__/__snapshots__/Markdown.test.tsx.snap b/src/commons/__tests__/__snapshots__/Markdown.test.tsx.snap index b7bf41bfed..5c63273f18 100644 --- a/src/commons/__tests__/__snapshots__/Markdown.test.tsx.snap +++ b/src/commons/__tests__/__snapshots__/Markdown.test.tsx.snap @@ -1,16 +1,75 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`Markdown page renders correctly 1`] = ` -
Welcome to the Source Academy playground!

-

The book Structure and Interpretation of Computer Programs, JavaScript Edition -uses JavaScript sublanguages that we call Source. You have chosen the sublanguage Source §1.

-

In the editor on the left, you can use the Ace keyboard shortcuts -and also the Source Academy keyboard shortcuts.

", - } - } -/> + +
+

+ Welcome to the Source Academy playground! +

+ + +

+ The book + + + Structure and Interpretation of Computer Programs, JavaScript Edition + + + +uses JavaScript sublanguages that we call + + + Source + + + . You have chosen the sublanguage + + + Source §1 + + + . +

+ + +

+ In the editor on the left, you can use the + + + Ace keyboard shortcuts + + + +and also the + + + Source Academy keyboard shortcuts + + + . +

+
+
`; diff --git a/src/commons/controlBar/ControlBarSessionButton.tsx b/src/commons/controlBar/ControlBarSessionButton.tsx index 915f73b174..32c9fda0f2 100644 --- a/src/commons/controlBar/ControlBarSessionButton.tsx +++ b/src/commons/controlBar/ControlBarSessionButton.tsx @@ -45,8 +45,8 @@ export class ControlBarSessionButtons extends React.PureComponent< ControlBarSessionButtonsProps, State > { - private sessionEditingIdInputElem: React.RefObject; - private sessionViewingIdInputElem: React.RefObject; + private sessionEditingIdInputElem: React.RefObject; + private sessionViewingIdInputElem: React.RefObject; constructor(props: ControlBarSessionButtonsProps) { super(props); diff --git a/src/commons/controlBar/ControlBarShareButton.tsx b/src/commons/controlBar/ControlBarShareButton.tsx index 7c3464895a..15945e579f 100644 --- a/src/commons/controlBar/ControlBarShareButton.tsx +++ b/src/commons/controlBar/ControlBarShareButton.tsx @@ -35,7 +35,7 @@ type State = { }; export class ControlBarShareButton extends React.PureComponent { - private shareInputElem: React.RefObject; + private shareInputElem: React.RefObject; constructor(props: ControlBarShareButtonProps) { super(props); diff --git a/src/commons/dropdown/DropdownCourses.tsx b/src/commons/dropdown/DropdownCourses.tsx index 6bc10e5f6c..e47042912c 100644 --- a/src/commons/dropdown/DropdownCourses.tsx +++ b/src/commons/dropdown/DropdownCourses.tsx @@ -13,7 +13,7 @@ type Props = { courseId?: number; }; -const DropdownCourses: React.FC = ({ isOpen, onClose, courses, courseId }) => { +const DropdownCourses = (({ isOpen, onClose, courses, courseId }) => { const navigate = useNavigate(); const options = courses.map(course => ({ @@ -47,6 +47,6 @@ const DropdownCourses: React.FC = ({ isOpen, onClose, courses, courseId } ); -}; +}) satisfies React.FC; export default DropdownCourses; diff --git a/src/commons/dropdown/DropdownCreateCourse.tsx b/src/commons/dropdown/DropdownCreateCourse.tsx index 2d37ce7eb9..54c2bfe3a2 100644 --- a/src/commons/dropdown/DropdownCreateCourse.tsx +++ b/src/commons/dropdown/DropdownCreateCourse.tsx @@ -29,7 +29,7 @@ type Props = { onClose: () => void; }; -const DropdownCreateCourse: React.FC = props => { +const DropdownCreateCourse = (props => { const dispatch = useDispatch(); const [courseConfig, setCourseConfig] = React.useState({ @@ -280,6 +280,6 @@ const DropdownCreateCourse: React.FC = props => { ); -}; +}) satisfies React.FC; export default DropdownCreateCourse; diff --git a/src/commons/editor/__tests__/Editor.test.tsx b/src/commons/editor/__tests__/Editor.test.tsx index a3c04a84f0..d241aeff3a 100644 --- a/src/commons/editor/__tests__/Editor.test.tsx +++ b/src/commons/editor/__tests__/Editor.test.tsx @@ -1,9 +1,11 @@ -import { shallowRender } from 'src/commons/utils/TestUtils'; +import { Provider } from 'react-redux'; +import { renderTree } from 'src/commons/utils/TestUtils'; +import { createStore } from 'src/pages/createStore'; import Editor, { EditorProps } from '../Editor'; import { Position } from '../EditorTypes'; -test('Editor renders correctly', () => { +test('Editor renders correctly', async () => { const props: EditorProps = { editorTabIndex: 0, breakpoints: [], @@ -20,7 +22,11 @@ test('Editor renders correctly', () => { handleUpdateHasUnsavedChanges: hasUnsavedChanges => {}, handlePromptAutocomplete: (row: number, col: number, callback: any) => {} }; - const Element: React.FC = () => ; - const tree = shallowRender(); + const Element: React.FC = () => ( + + + + ); + const tree = await renderTree(); expect(tree).toMatchSnapshot(); }); diff --git a/src/commons/editor/__tests__/__snapshots__/Editor.test.tsx.snap b/src/commons/editor/__tests__/__snapshots__/Editor.test.tsx.snap index d99b0bc4b9..d1108b8903 100644 --- a/src/commons/editor/__tests__/__snapshots__/Editor.test.tsx.snap +++ b/src/commons/editor/__tests__/__snapshots__/Editor.test.tsx.snap @@ -1,20 +1,109 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`Editor renders correctly 1`] = ` - + +
+
+
+