@@ -6,32 +6,29 @@ In this challenge, you will write the logic for [THIS WIDGET](https://advanced-r
6
6
7
7
Study its functionality and also inspect the Console, the Network tab and the Elements tab ** in Chrome Dev Tools** :
8
8
9
- - There are two versions of the widget, with identical functionality.
9
+ - There are two versions of the widget with identical functionality: class-based and functional .
10
10
- The input box at the bottom of the page expects a valid email address.
11
11
- Email validation errors arrive from the server, as you can see in the Network tab, under "Preview".
12
12
- The payload sent to the server on form submit can also be seen in the Network tab, under "Payload".
13
+ - One valid email in particular,
` [email protected] ` ,
** results in a "Forbidden" server error
** ❗
13
14
- The origin of coordinates of the grid is on its top-left corner.
14
- - One valid email in particular,
` [email protected] ` ,
** results in a "Forbidden" server error
** .
15
15
16
16
## Requirements
17
17
18
18
### Tools
19
19
20
20
- Node 16.x
21
21
- NPM 8.x (update NPM executing ` npm i -g npm ` )
22
+ - Postman (download [ here] ( https://www.postman.com/downloads/ ) )
22
23
- Chrome >= 96.x
23
24
24
- Other configurations might work but haven't been tested.
25
-
26
- ### Optional Tools
27
-
28
- - Postman (download [ here] ( https://www.postman.com/downloads/ ) )
25
+ Other browser/Node/NPM configurations might work but haven't been tested.
29
26
30
27
## Project Setup
31
28
32
29
- Fork, clone, and ` npm install ` . You won't need to add any extra libraries.
33
30
- Launch the project on a development server executing ` npm run dev ` .
34
- - Visit your widget by navigating to ` http://localhost:3000 ` with Chrome .
31
+ - Visit your widget by navigating Chrome to ` http://localhost:3000 ` .
35
32
- Run tests locally executing ` npm test ` . The test file is ` codegrade_mvp.test.js ` .
36
33
37
34
## API
@@ -55,7 +52,7 @@ Other configurations might work but haven't been tested.
55
52
- The DOM produced by your components must match exactly the DOM in the prototype:
56
53
- The hierarchy of HTML elements, their ids, class names etc must be the same.
57
54
- The current square is marked with a capital B and an "active" class name.
58
- - Submit success and error messages are those returned by the API (see Network tab, "Preview" area ).
55
+ - The submit success and error messages that display on the page come from the API (see Network tab).
59
56
- No frontend form validation code is required.
60
57
- The coordinates of each square of the grid are as follows:
61
58
@@ -71,21 +68,23 @@ Other configurations might work but haven't been tested.
71
68
72
69
### MVP 2, Testing
73
70
74
- - Using ` codegrade_mvp.test.js ` as inspiration, write a few tests inside ` frontend/components/App.test.js ` :
71
+ - Using ` codegrade_mvp.test.js ` as inspiration, write 5 tests inside ` frontend/components/App.test.js ` :
75
72
- From inside the test file, import a component of your choosing, either ` AppClass.js ` or ` AppFunctional.js ` .
76
- - Test that emails over 100 characters long result in a particular server error on the screen.
77
- - Inspect the API with Postman to see what this error actually is .
73
+ - Test that the visible texts in headings, buttons, links... render on the screen.
74
+ - Test that typing on the input results in its value changing to the entered text .
78
75
79
76
### Stretch Goals
80
77
81
78
- Extract some of the stateful logic into a custom hook at the top of ` AppFunctional.js ` .
82
- - Build a stateless component responsible for rendering the markup in the stateful components, so it does not have to be repeated .
83
- - Do not break your MVP by pushing broken stretch goals. You must keep your tests passing at 100%.
79
+ - Build a stateless component responsible for rendering the markup in the stateful components, so this markup does not have to appear twice .
80
+ - Do not break your MVP by pushing broken stretch goals. You must keep your tests passing at 100%❗
84
81
85
82
### Important Notes
86
83
87
84
- Design the state of the app before opening your editor. You might need fewer pieces of state than you think!
88
- - Find the simplest data structure that describes effectively the state of the grid.
85
+ - Booleans can be represented as 1/0, true/false, "on"/"off". In similar way, many types of data structures could represent the grid.
86
+ - Try to find the simplest data structure that describes effectively the state of the grid at any point in time.
87
+ - If the state that drives the grid is simple, it will be easier to update it as the user moves around.
89
88
- "Product" works hard designing the messages: we must reproduce them faithfully, down to the last comma.
90
89
- If you start with Functional, don't switch to Class-Based until Functional is passing all its tests (and vice versa).
91
90
- If the direction of the ` y ` axis surprises you, know that elements in HTML also have their origin of coordinates on their top-left corner.
0 commit comments