143 lines
4.2 KiB
Markdown
143 lines
4.2 KiB
Markdown
|
---
|
||
|
id: 61fd78621573aa5e8b512f5e
|
||
|
title: Step 15
|
||
|
challengeType: 0
|
||
|
dashedName: step-15
|
||
|
---
|
||
|
|
||
|
# --description--
|
||
|
|
||
|
Nel tuo terzo elemento `tr`, aggiungi un elemento `th` con il testo `Savings Funds set aside for emergencies.`. Manda a capo il testo, ad eccezione dei `Savings`, all'interno di un elemento `span` con la `class` impostata a `description`.
|
||
|
|
||
|
In seguito, aggiungi tre elementi `td` con il seguente testo (in ordine): `$500`, `$650`, `$728`. Dai al terzo elemento `td` una `class` impostata a `current`.
|
||
|
|
||
|
# --hints--
|
||
|
|
||
|
Il tuo terzo `tr` dovrebbe avere un elemento `th`.
|
||
|
|
||
|
```js
|
||
|
assert(document.querySelector('tbody')?.querySelectorAll('tr')?.[2]?.querySelector('th'));
|
||
|
```
|
||
|
|
||
|
Il tuo elemento `th` dovrebbe avere il testo `Savings Funds set aside for emergencies.`.
|
||
|
|
||
|
```js
|
||
|
assert(document.querySelector('tbody')?.querySelectorAll('tr')?.[2]?.querySelector('th')?.innerText === 'Savings Funds set aside for emergencies.');
|
||
|
```
|
||
|
|
||
|
Dovresti mandare a capo il testo `Funds set aside for emergencies.` in un elemento `span`.
|
||
|
|
||
|
```js
|
||
|
assert(document.querySelector('tbody')?.querySelectorAll('tr')?.[2]?.querySelector('th > span')?.textContent === 'Funds set aside for emergencies.');
|
||
|
```
|
||
|
|
||
|
Il tuo elemento `span` dovrebbe avere l'attributo `class` impostato a `description`.
|
||
|
|
||
|
```js
|
||
|
assert(document.querySelector('tbody')?.querySelectorAll('tr')?.[2]?.querySelector('th > span')?.classList?.contains('description'));
|
||
|
```
|
||
|
|
||
|
Dovresti avere tre elementi di `td`.
|
||
|
|
||
|
```js
|
||
|
assert(document.querySelector('tbody')?.querySelectorAll('tr')?.[2]?.querySelectorAll('td').length === 3);
|
||
|
```
|
||
|
|
||
|
Il tuo primo elemento `td` dovrebbe avere il testo `$500`.
|
||
|
|
||
|
```js
|
||
|
assert(document.querySelector('tbody')?.querySelectorAll('tr')?.[2]?.querySelectorAll('td')?.[0]?.textContent === '$500');
|
||
|
```
|
||
|
|
||
|
Il secondo elemento `td` dovrebbe avere il testo `$650`.
|
||
|
|
||
|
```js
|
||
|
assert(document.querySelector('tbody')?.querySelectorAll('tr')?.[2]?.querySelectorAll('td')?.[1]?.textContent === '$650');
|
||
|
```
|
||
|
|
||
|
Il tuo terzo elemento `td` dovrebbe avvere il testo `$728`.
|
||
|
|
||
|
```js
|
||
|
assert(document.querySelector('tbody')?.querySelectorAll('tr')?.[2]?.querySelectorAll('td')?.[2]?.textContent === '$728');
|
||
|
```
|
||
|
|
||
|
Il tuo terzo elemento `td` dovrebbe avere la `class` impostata su `current`.
|
||
|
|
||
|
```js
|
||
|
assert(document.querySelector('tbody')?.querySelectorAll('tr')?.[2]?.querySelectorAll('td')?.[2]?.classList?.contains('current'));
|
||
|
```
|
||
|
|
||
|
# --seed--
|
||
|
|
||
|
## --seed-contents--
|
||
|
|
||
|
```html
|
||
|
<!DOCTYPE html>
|
||
|
<html>
|
||
|
<head>
|
||
|
<meta charset="UTF-8">
|
||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
|
<title>Balance Sheet</title>
|
||
|
<link rel="stylesheet" type="text/css" href="./styles.css">
|
||
|
</head>
|
||
|
<body>
|
||
|
<main>
|
||
|
<section>
|
||
|
<h1>
|
||
|
<span class="flex">
|
||
|
<span>AcmeWidgetCorp</span>
|
||
|
<span>Balance Sheet</span>
|
||
|
</span>
|
||
|
</h1>
|
||
|
<div id="years" aria-hidden="true">
|
||
|
<span class="year">2019</span>
|
||
|
<span class="year">2020</span>
|
||
|
<span class="year">2021</span>
|
||
|
</div>
|
||
|
<div class="table-wrap">
|
||
|
<table>
|
||
|
<caption>Assets</caption>
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<td></td>
|
||
|
<th><span class="sr-only year">2019</span></th>
|
||
|
<th><span class="sr-only year">2020</span></th>
|
||
|
<th class="current"><span class="sr-only year">2021</span></th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<tr class="data">
|
||
|
<th>Cash <span class="description">This is the cash we currently have on hand.</span></th>
|
||
|
<td>$25</td>
|
||
|
<td>$30</td>
|
||
|
<td class="current">$28</td>
|
||
|
</tr>
|
||
|
<tr class="data">
|
||
|
<th>Checking <span class="description">Our primary transactional account.</span></th>
|
||
|
<td>$54</td>
|
||
|
<td>$56</td>
|
||
|
<td class="current">$53</td>
|
||
|
</tr>
|
||
|
--fcc-editable-region--
|
||
|
<tr class="data">
|
||
|
</tr>
|
||
|
--fcc-editable-region--
|
||
|
<tr class="total">
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
<table>
|
||
|
</table>
|
||
|
<table>
|
||
|
</table>
|
||
|
</div>
|
||
|
</section>
|
||
|
</main>
|
||
|
</body>
|
||
|
</html>
|
||
|
```
|
||
|
|
||
|
```css
|
||
|
|
||
|
```
|