Skip to content

Commit 59027fc

Browse files
fix(curriculum): update test case in cat photo app (freeCodeCamp#58401)
Co-authored-by: Ilenia <26656284+ilenia-magoni@users.noreply.github.com>
1 parent 266899a commit 59027fc

File tree

2 files changed

+11
-16
lines changed

2 files changed

+11
-16
lines changed

curriculum/challenges/english/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dfb6250eacea3f48c6300b2.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,37 +20,34 @@ And its `alt` attribute value to:
2020
There should be an `img` element right after the closing `</ul>` tag.
2121

2222
```js
23-
assert.equal(document.querySelectorAll('section')?.[1]?.lastElementChild?.nodeName, 'IMG');
23+
assert.equal(document.querySelectorAll('section')[1].querySelector('ul').nextElementSibling?.nodeName, 'IMG');
2424
```
2525
2626
The new image does not have an `alt` attribute. Check that there is a space after the opening tag's name and/or there are spaces before all attribute names.
2727
2828
```js
29-
assert.isTrue(document.querySelectorAll('section')?.[1]?.lastElementChild?.hasAttribute('alt'));
29+
assert.isTrue(document.querySelectorAll('section')[1].querySelector('ul').nextElementSibling?.hasAttribute('alt'));
3030
```
3131
3232
The new image should have an `alt` value of `A slice of lasagna on a plate.` Make sure the `alt` attribute's value is surrounded with quotation marks.
3333
3434
```js
35-
assert(
36-
document.querySelectorAll('section')?.[1]
37-
?.lastElementChild?.getAttribute('alt')
38-
.replace(/\s+/g, ' ')
39-
.match(/^A slice of lasagna on a plate\.?$/i)
35+
assert.match(
36+
document.querySelectorAll('section')[1].querySelector('ul').nextElementSibling?.getAttribute('alt')?.replace(/\s+/g, ' '), /^A slice of lasagna on a plate\.?$/i
4037
);
4138
```
4239
4340
The new image does not have a `src` attribute. Check that there is a space after the opening tag's name and/or there are spaces before all attribute names.
4441
4542
```js
46-
assert.isTrue(document.querySelectorAll('section')?.[1]?.lastElementChild?.hasAttribute('src'));
43+
assert.isTrue(document.querySelectorAll('section')[1].querySelector('ul').nextElementSibling?.hasAttribute('src'));
4744
```
4845
4946
The new image should have a `src` value of `https://cdn.freecodecamp.org/curriculum/cat-photo-app/lasagna.jpg`. Make sure the `src` attribute's value is surrounded with quotation marks.
5047

5148
```js
5249
assert.strictEqual(
53-
document.querySelectorAll('section')?.[1]?.lastElementChild?.getAttribute('src'),
50+
document.querySelectorAll('section')[1].querySelector('ul').nextElementSibling?.getAttribute('src'),
5451
'https://cdn.freecodecamp.org/curriculum/cat-photo-app/lasagna.jpg'
5552
);
5653
```

curriculum/challenges/english/25-front-end-development/workshop-cat-photo-app/5dfb6250eacea3f48c6300b2.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,36 +20,34 @@ And its `alt` attribute value to:
2020
There should be an `img` element right after the closing `</ul>` tag.
2121

2222
```js
23-
assert.equal(document.querySelectorAll('section')[1].lastElementChild.nodeName, 'IMG');
23+
assert.equal(document.querySelectorAll('section')[1].querySelector('ul').nextElementSibling.nodeName, 'IMG');
2424
```
2525

2626
The new image does not have an `alt` attribute. Check that there is a space after the opening tag's name and/or there are spaces before all attribute names.
2727

2828
```js
29-
assert.isTrue(document.querySelectorAll('section')[1].lastElementChild.hasAttribute('alt'));
29+
assert.isTrue(document.querySelectorAll('section')[1].querySelector('ul').nextElementSibling.hasAttribute('alt'));
3030
```
3131

3232
The new image should have an `alt` value of `A slice of lasagna on a plate.` Make sure the `alt` attribute's value is surrounded with quotation marks.
3333

3434
```js
3535
assert.match(
36-
document.querySelectorAll('section')[1]
37-
.lastElementChild.getAttribute('alt')
38-
.replace(/\s+/g, ' '), /^A slice of lasagna on a plate\.?$/i
36+
document.querySelectorAll('section')[1].querySelector('ul').nextElementSibling?.getAttribute('alt')?.replace(/\s+/g, ' '), /^A slice of lasagna on a plate\.?$/i
3937
);
4038
```
4139
4240
The new image does not have a `src` attribute. Check that there is a space after the opening tag's name and/or there are spaces before all attribute names.
4341
4442
```js
45-
assert.isTrue(document.querySelectorAll('section')[1].lastElementChild.hasAttribute('src'));
43+
assert.isTrue(document.querySelectorAll('section')[1].querySelector('ul').nextElementSibling.hasAttribute('src'));
4644
```
4745
4846
The new image should have a `src` value of `https://cdn.freecodecamp.org/curriculum/cat-photo-app/lasagna.jpg`. Make sure the `src` attribute's value is surrounded with quotation marks.
4947

5048
```js
5149
assert.equal(
52-
document.querySelectorAll('section')[1].lastElementChild.getAttribute('src'),
50+
document.querySelectorAll('section')[1].querySelector('ul').nextElementSibling?.getAttribute('src'),
5351
'https://cdn.freecodecamp.org/curriculum/cat-photo-app/lasagna.jpg'
5452
);
5553
```

0 commit comments

Comments
 (0)