Skip to content

Commit 5f836b8

Browse files
committed
5c fixes
1 parent 5f08ac7 commit 5f836b8

File tree

6 files changed

+28
-28
lines changed

6 files changed

+28
-28
lines changed

src/content/5/en/part5b.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -573,14 +573,6 @@ const Blog = ({ blog }) => {
573573

574574
#### 5.8: Blog List Frontend, step 8
575575

576-
We notice that something is wrong. When a new blog is created in the app, the name of the user that added the blog is not shown in its details:
577-
578-
![browser showing missing name underneath like button](../../images/5/59new.png)
579-
580-
When the browser is reloaded, the information of the person is displayed. This is not acceptable, find out where the problem is and make the necessary correction.
581-
582-
#### 5.9: Blog List Frontend, step 9
583-
584576
Implement the functionality for the like button. Likes are increased by making an HTTP _PUT_ request to the unique address of the blog post in the backend.
585577

586578
Since the backend operation replaces the entire blog post, you will have to send all of its fields in the request body. If you wanted to add a like to the following blog post:
@@ -614,7 +606,15 @@ You would have to make an HTTP PUT request to the address <i>/api/blogs/5a43fde2
614606

615607
The backend has to be updated too to handle the user reference.
616608

617-
**One last warning:** if you notice that you are using async/await and the _then_-method in the same code, it is almost certain that you are doing something wrong. Stick to using one or the other, and never use both at the same time "just in case".
609+
#### 5.9: Blog List Frontend, step 9
610+
611+
We notice that something is wrong. When a blog is liked in the app, the name of the user that added the blog is not shown in its details:
612+
613+
![browser showing missing name underneath like button](../../images/5/59put.png)
614+
615+
When the browser is reloaded, the information of the person is displayed. This is not acceptable, find out where the problem is and make the necessary correction.
616+
617+
Of course, it is possible that you have already done everything correctly and the problem does not occur in your code. In that case, you can move on.
618618

619619
#### 5.10: Blog List Frontend, step 10
620620

@@ -768,6 +768,7 @@ Let's create [.eslintignore](https://eslint.org/docs/latest/use/configure/ignore
768768
node_modules
769769
dist
770770
.eslintrc.cjs
771+
vite.config.js
771772
```
772773

773774
Now the directories <em>dist</em> and <em>node_modules</em> will be skipped when linting.

src/content/5/en/part5c.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ const NoteForm = ({ createNote }) => {
510510
event.preventDefault()
511511
createNote({
512512
content: newNote,
513-
important: Math.random() > 0.5,
513+
important: true,
514514
})
515515

516516
setNewNote('')

src/content/5/fi/osa5b.md

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ lang: fi
77

88
<div class="content">
99

10-
### Kirjautumislomakkeen näyttäminen vain tarvittaessa
11-
1210
Muutetaan sovellusta siten, että kirjautumislomaketta ei oletusarvoisesti näytetä:
1311

1412
![Oletusarvoisesti sovellus näytää ainoastaan muistiinpanojen listan sekä napin "log in"](../../images/5/10e.png)
@@ -569,19 +567,9 @@ const Blog = ({ blog }) => {
569567
)}
570568
```
571569

572-
**Huom 1:** Voit tehdä blogin nimestä klikattavan korostetun koodirivin tapaan.
573-
574-
**Huom 2:** Vaikka tämän tehtävän toiminnallisuus on melkein samanlainen kuin komponentin <i>Togglable</i> tarjoama toiminnallisuus, ei Togglable kuitenkaan sovi tarkoitukseen sellaisenaan. Helpoin ratkaisu lienee lisätä blogille tila, joka kontrolloi sitä missä muodossa blogi näytetään.
575-
576-
#### 5.8*: blogilistan frontend, step8
577-
578-
Huomaamme, että jotain on pielessä. Kun sovellukseen lisätään uusi blogi, ei blogin lisääjän nimeä näytetä blogin tarkempien tietojen joukossa:
579-
580-
![](../../images/5/59new.png)
581-
582-
Kun selain uudelleenladataan, lisääjän tieto tulee näkyviin. Tämä ei ole hyväksyttävää, selvitä missä vika on ja tee tarvittava korjaus.
570+
**Huom:** Vaikka tämän tehtävän toiminnallisuus on melkein samanlainen kuin komponentin <i>Togglable</i> tarjoama toiminnallisuus, ei Togglable kuitenkaan sovi tarkoitukseen sellaisenaan. Helpoin ratkaisu lienee lisätä blogille tila, joka kontrolloi sitä missä muodossa blogi näytetään.
583571

584-
#### 5.9: blogilistan frontend, step9
572+
#### 5.8: blogilistan frontend, step8
585573

586574
Toteuta like-painikkeen toiminnallisuus. Like lisätään backendiin blogin yksilöivään urliin tapahtuvalla _PUT_-pyynnöllä.
587575

@@ -614,7 +602,15 @@ tulee palvelimelle tehdä PUT-pyyntö osoitteeseen <i>/api/blogs/5a43fde2cbd20b1
614602
}
615603
```
616604

617-
**Varoitus vielä kerran:** Jos huomaat kirjoittavasi sekaisin async/awaitia ja _then_-kutsuja, on 99.9-prosenttisen varmaa, että teet jotain väärin. Käytä siis jompaa kumpaa tapaa, älä missään tapauksessa "varalta" molempia.
605+
#### 5.9*: blogilistan frontend, step9
606+
607+
Huomaamme, että jotain on pielessä. Kun blogia liketetään, ei blogin lisääjän nimeä näytetä enää blogin tarkempien tietojen joukossa:
608+
609+
![](../../images/5/59put.png)
610+
611+
Kun selain uudelleenladataan, lisääjän tieto tulee näkyviin. Tämä ei ole hyväksyttävää, selvitä missä vika on ja tee tarvittava korjaus.
612+
613+
On toki mahdollista, että olet jo tehnyt kaiken oikein, ja ongelmaa ei koodissasi ilmene. Tässä tapauksessa voit siirtyä eteenpäin.
618614

619615
#### 5.10: blogilistan frontend, step10
620616

@@ -768,6 +764,7 @@ Tehdään projektin juureen tiedosto [.eslintignore](https://eslint.org/docs/use
768764
node_modules
769765
dist
770766
.eslintrc.cjs
767+
vite.config.js
771768
```
772769
773770
Näin ainoastaan sovelluksessa oleva itse kirjoitettu koodi huomioidaan linttauksessa.

src/content/5/fi/osa5c.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ const NoteForm = ({ createNote }) => {
514514
event.preventDefault()
515515
createNote({
516516
content: newNote,
517-
important: Math.random() > 0.5,
517+
important: true,
518518
})
519519

520520
setNewNote('')
@@ -726,7 +726,7 @@ const input = container.querySelector('#note-input')
726726

727727
Jätämme koodiin placeholderiin perustuvan ratkaisun.
728728

729-
Vielä muutama tärkeä huomio. Jos komponentti renderöisi samaan HTML-elementtiin tekstiä seuraavasti:
729+
Vielä muutama tärkeä huomio. Oletetaan että komponentti renderöisi samaan HTML-elementtiin tekstiä seuraavasti:
730730

731731
```js
732732
const Note = ({ note, toggleImportance }) => {
@@ -744,7 +744,7 @@ const Note = ({ note, toggleImportance }) => {
744744
export default Note
745745
```
746746

747-
Ei testissä käyttämämme _getByText_ löydä elementtiä:
747+
Nyt testissä käyttämämme _getByText_ ei löydä elementtiä:
748748

749749
```js
750750
test('renders content', () => {

src/content/5/fi/osa5e.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ lang: fi
1111

1212
Kirjastojen vertailuista on kirjoitettu monia blojeja, esim. [tämä](https://www.lambdatest.com/blog/cypress-vs-playwright/) ja [tämä](https://www.browserstack.com/guide/playwright-vs-cypress).
1313

14+
On vaikea sanoa kumpi kirjastoista on parempi. Eräs Playwrightin etu on sen selaintuki, Playwright tukee Chromea, Firefoxia ja Webkit-pohjaisia selaimia kuten Safaria. Nykyisin Cypress sisältää tuen kaikkiin näihin selaimiin, Webkit-tuki on tosin vasta kokeellinen ja ei tue kaikkia Cypressin ominaisuuksia.
15+
1416
Tutustutaan nyt Playwrightin käyttöön.
1517

1618
### Testien alustaminen

src/content/images/5/59put.png

83.1 KB
Loading

0 commit comments

Comments
 (0)