Skip to content

Commit 3b22e6f

Browse files
committed
class optional
1 parent 238afc7 commit 3b22e6f

File tree

7 files changed

+28
-20
lines changed

7 files changed

+28
-20
lines changed

README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ Study its functionality and also inspect the Console, the Network tab and the El
1717

1818
### Tools
1919

20-
- Node 16.x
21-
- NPM 8.x (update NPM executing `npm i -g npm`)
20+
- Node >= 18.x
21+
- NPM >= 9.x (update NPM executing `npm i -g npm`)
2222
- Unix-like shell (Gitbash/bash/zsh)
2323
- Chrome >= 100.x
2424

@@ -47,10 +47,10 @@ Study its functionality and also inspect the Console, the Network tab and the El
4747
### MVP 1, The Grid
4848

4949
- Replicate the **functionality and DOM** shown in the prototype linked at the top of this README.
50-
- Keep your code inside `frontend/components/AppFunctional.js` and `frontend/components/AppClass.js`.
50+
- Keep your code inside `frontend/components/AppFunctional.js`.
5151
- The component exposed by `AppFunctional.js` must be a stateful functional component.
52-
- The one in `AppClass.js` must be a stateful class-based component.
53-
- The DOM produced by your components must match exactly the DOM in the prototype:
52+
- The component in `AppClass.js` **is optional** but can be tackled if desired. It's not required to pass the sprint.
53+
- The DOM produced by `AppFunctional` must match exactly the DOM in the prototype:
5454
- The hierarchy of HTML elements, their ids, class names etc must be the same.
5555
- The current square is marked with a capital B and an "active" class name.
5656
- The submit success and error messages that display on the page come from the API (see Network tab).
@@ -68,7 +68,7 @@ Study its functionality and also inspect the Console, the Network tab and the El
6868
### MVP 2, Testing
6969

7070
- Using `codegrade_mvp.test.js` as inspiration, write 5 tests inside `frontend/components/App.test.js`:
71-
- From inside the test file, import a component of your choosing, either `AppClass.js` or `AppFunctional.js`.
71+
- From inside the test file, import `AppFunctional.js`.
7272
- Test that the visible texts in headings, buttons, links... render on the screen.
7373
- Test that typing on the input results in its value changing to the entered text.
7474

@@ -94,4 +94,4 @@ Study its functionality and also inspect the Console, the Network tab and the El
9494
```
9595

9696
- "Product" works hard designing the messages: we must reproduce them faithfully, down to the last comma.
97-
- If you start with Functional, don't switch to Class-Based until Functional is passing all its tests (and vice versa).
97+
- ❗ Remember only the functional version is required; the class-based one is recommended but optional.

codegrade_mvp.test.js

+11-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import server from './backend/mock-server'
22
import React from 'react'
33
import AppFunctional from './frontend/components/AppFunctional'
4-
import AppClass from './frontend/components/AppClass'
4+
// ❗ class component is optional, uncomment next line to test
5+
// import AppClass from './frontend/components/AppClass'
56
import { render, fireEvent, screen } from '@testing-library/react'
67
import '@testing-library/jest-dom/extend-expect'
78

@@ -46,15 +47,17 @@ test('AppFunctional is a functional component', () => {
4647
AppFunctional.prototype &&
4748
AppFunctional.prototype.isReactComponent
4849
).not.toBeTruthy()
49-
})
50-
test('AppClass is a class-based component', () => {
51-
expect(
52-
AppClass.prototype &&
53-
AppClass.prototype.isReactComponent
54-
).toBeTruthy()
5550
});
51+
// ❗ class component is optional, uncomment next lines to test
52+
// test('AppClass is a class-based component', () => {
53+
// expect(
54+
// AppClass.prototype &&
55+
// AppClass.prototype.isReactComponent
56+
// ).toBeTruthy()
57+
// });
5658

57-
[AppFunctional, AppClass].forEach((Component, idx) => {
59+
// ❗ class component is optional, uncomment AppClass to test
60+
[AppFunctional, /* AppClass */].forEach((Component, idx) => {
5861
const label = idx === 0 ? 'FUNCTIONAL' : 'CLASS-BASED'
5962

6063
describe(`${label}`, () => {

frontend/components/AppClass.js

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// ❗ OPTIONAL, not required to pass the sprint
2+
// ❗ OPTIONAL, not required to pass the sprint
3+
// ❗ OPTIONAL, not required to pass the sprint
14
import React from 'react'
25

36
// Suggested initial states
@@ -55,6 +58,7 @@ export default class AppClass extends React.Component {
5558
const { className } = this.props
5659
return (
5760
<div id="wrapper" className={className}>
61+
<p>(This component is not required to pass the sprint)</p>
5862
<div className="info">
5963
<h3 id="coordinates">Coordinates (2, 2)</h3>
6064
<h3 id="steps">You moved 0 times</h3>

frontend/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
<body>
1717
<div id="root"></div>
18-
<footer>Bloom Institute of Technology 2022</footer>
18+
<footer>Bloom Institute of Technology 2024</footer>
1919
</body>
2020

2121
</html>

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@
5050
"yup": "0.32.11"
5151
},
5252
"engines": {
53-
"node": ">=16.x",
54-
"npm": ">=8.x"
53+
"node": ">=18.x",
54+
"npm": ">=9.x"
5555
},
5656
"repository": {
5757
"type": "git",

webpack.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ const config = {
4040
historyApiFallback: true,
4141
compress: true,
4242
port: FRONTEND_PORT,
43+
client: { logging: 'none' },
4344
},
4445
module: {
4546
rules: [

0 commit comments

Comments
 (0)