129 lines
2.9 KiB
Markdown
129 lines
2.9 KiB
Markdown
---
|
|
id: 5f3c866d5414453fc2d7b480
|
|
title: Passo 32
|
|
challengeType: 0
|
|
dashedName: step-32
|
|
---
|
|
|
|
# --description--
|
|
|
|
Começando abaixo do par café/preço existente, adicione os cafés e preços abaixo usando elementos `article` com dois elementos aninhados dentro de cada `p`. Como antes, o primeiro texto `p` deve conter o sabor do café e o segundo texto `p` deve conter o preço.
|
|
|
|
```bash
|
|
Caramel Macchiato 3.75
|
|
Pumpkin Spice 3.50
|
|
Hazelnut 4.00
|
|
Mocha 4.50
|
|
```
|
|
|
|
# --hints--
|
|
|
|
Você deve ter cinco elementos `article`.
|
|
|
|
```js
|
|
assert($('article').length === 5);
|
|
```
|
|
|
|
Cada elemento `article` deve ter dois elementos `p`.
|
|
|
|
```js
|
|
const articles = $('article');
|
|
assert(articles[0].children.length === 2);
|
|
assert(articles[1].children.length === 2);
|
|
assert(articles[2].children.length === 2);
|
|
assert(articles[3].children.length === 2);
|
|
assert(articles[4].children.length === 2);
|
|
```
|
|
|
|
Seu primeiro elemento `article` deve ter elementos `p` com o texto `French Vanilla` e `3.00`.
|
|
|
|
```js
|
|
const children = $('article')[0].children;
|
|
assert(children[0].innerText.match(/French Vanilla/i));
|
|
assert(children[1].innerText.match(/3\.00/i));
|
|
```
|
|
|
|
Seu segundo elemento `article` deve ter elementos `p` com o texto `Caramel Macchiato` e `3.75`.
|
|
|
|
```js
|
|
const children = $('article')[1].children;
|
|
assert(children[0].innerText.match(/Caramel Macchiato/i));
|
|
assert(children[1].innerText.match(/3\.75/i));
|
|
```
|
|
|
|
Seu terceiro elemento `article` deve ter elementos `p` com o texto `Pumpkin Spice` e `3.50`.
|
|
|
|
```js
|
|
const children = $('article')[2].children;
|
|
assert(children[0].innerText.match(/Pumpkin Spice/i));
|
|
assert(children[1].innerText.match(/3\.50/i));
|
|
```
|
|
|
|
Seu quarto elemento `article` deve ter elementos `p` com o texto `Hazelnut` e `4.00`.
|
|
|
|
```js
|
|
const children = $('article')[3].children;
|
|
assert(children[0].innerText.match(/Hazelnut/i));
|
|
assert(children[1].innerText.match(/4\.00/i));
|
|
```
|
|
|
|
Seu quinto elemento `article` deve ter elementos `p` com o texto `Mocha` e `4.50`.
|
|
|
|
```js
|
|
const children = $('article')[4].children;
|
|
assert(children[0].innerText.match(/Mocha/i));
|
|
assert(children[1].innerText.match(/4\.50/i));
|
|
```
|
|
|
|
# --seed--
|
|
|
|
## --seed-contents--
|
|
|
|
```html
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>Cafe Menu</title>
|
|
<link href="styles.css" rel="stylesheet" type="text/css" />
|
|
</head>
|
|
<body>
|
|
<div class="menu">
|
|
<header>
|
|
<h1>CAMPER CAFE</h1>
|
|
<p>Est. 2020</p>
|
|
</header>
|
|
<main>
|
|
<section>
|
|
<h2>Coffee</h2>
|
|
--fcc-editable-region--
|
|
<article>
|
|
<p>French Vanilla</p>
|
|
<p>3.00</p>
|
|
</article>
|
|
--fcc-editable-region--
|
|
</section>
|
|
</main>
|
|
</div>
|
|
</body>
|
|
<html>
|
|
```
|
|
|
|
```css
|
|
body {
|
|
background-image: url(https://cdn.freecodecamp.org/curriculum/css-cafe/beans.jpg);
|
|
}
|
|
|
|
h1, h2, p {
|
|
text-align: center;
|
|
}
|
|
|
|
.menu {
|
|
width: 80%;
|
|
background-color: burlywood;
|
|
margin-left: auto;
|
|
margin-right: auto;
|
|
}
|
|
```
|