mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-03-02 11:07:15 -05:00
fix(curriculum): updated assert method for steps 8-9 of workshop-magazine to use specific asserts (#61110)
This commit is contained in:
@@ -22,31 +22,31 @@ Add five `a` elements within that new `div`, and give them the following `href`
|
||||
You should create a new `div` element.
|
||||
|
||||
```js
|
||||
assert(document.querySelectorAll('div')?.length === 2);
|
||||
assert.lengthOf(document.querySelectorAll('div'), 2);
|
||||
```
|
||||
|
||||
Your new `div` element should come after your `.author` element.
|
||||
|
||||
```js
|
||||
assert(document.querySelector('.author')?.nextElementSibling?.localName === 'div');
|
||||
assert.equal(document.querySelector('.author')?.nextElementSibling?.localName, 'div');
|
||||
```
|
||||
|
||||
Your new `div` element should have the class `social-icons`.
|
||||
|
||||
```js
|
||||
assert(document.querySelector('.author')?.nextElementSibling?.classList?.contains('social-icons'));
|
||||
assert.isTrue(document.querySelector('.author')?.nextElementSibling?.classList?.contains('social-icons'));
|
||||
```
|
||||
|
||||
Your `.social-icons` element should have five `a` elements.
|
||||
|
||||
```js
|
||||
assert(document.querySelector('.social-icons')?.querySelectorAll('a')?.length === 5);
|
||||
assert.lengthOf(document.querySelector('.social-icons')?.querySelectorAll('a'), 5);
|
||||
```
|
||||
|
||||
Your first `a` element should have an `href` set to `https://www.facebook.com/freecodecamp`.
|
||||
|
||||
```js
|
||||
assert(document.querySelector('.social-icons')?.querySelectorAll('a')?.[0]?.getAttribute('href')?.includes('https://www.facebook.com/freecodecamp'));
|
||||
assert.include(document.querySelector('.social-icons')?.querySelectorAll('a')?.[0]?.getAttribute('href'), 'https://www.facebook.com/freecodecamp');
|
||||
```
|
||||
|
||||
Your second `a` element should have an `href` set to `https://twitter.com/freecodecamp`.
|
||||
|
||||
@@ -20,7 +20,7 @@ Within each of your new `a` elements, add an `i` element and give them the follo
|
||||
You should have five `i` elements.
|
||||
|
||||
```js
|
||||
assert(document.querySelectorAll('i')?.length === 5);
|
||||
assert.lengthOf(document.querySelectorAll('i'), 5);
|
||||
```
|
||||
|
||||
Each `a` element should only have one `i` element.
|
||||
@@ -51,31 +51,31 @@ iiiii?.forEach(
|
||||
The first `i` element should have a `class` attribute which includes `fa-facebook-f`.
|
||||
|
||||
```js
|
||||
assert(document.querySelectorAll('i')?.[0]?.classList?.contains('fa-facebook-f'));
|
||||
assert.isTrue(document.querySelectorAll('i')?.[0]?.classList?.contains('fa-facebook-f'));
|
||||
```
|
||||
|
||||
The second `i` element should have a `class` attribute which includes `fa-twitter`.
|
||||
|
||||
```js
|
||||
assert(document.querySelectorAll('i')?.[1]?.classList?.contains('fa-twitter'));
|
||||
assert.isTrue(document.querySelectorAll('i')?.[1]?.classList?.contains('fa-twitter'));
|
||||
```
|
||||
|
||||
The third `i` element should have a `class` attribute which includes `fa-instagram`.
|
||||
|
||||
```js
|
||||
assert(document.querySelectorAll('i')?.[2]?.classList?.contains('fa-instagram'));
|
||||
assert.isTrue(document.querySelectorAll('i')?.[2]?.classList?.contains('fa-instagram'));
|
||||
```
|
||||
|
||||
The fourth `i` element should have a `class` attribute which includes `fa-linkedin-in`.
|
||||
|
||||
```js
|
||||
assert(document.querySelectorAll('i')?.[3]?.classList?.contains('fa-linkedin-in'));
|
||||
assert.isTrue(document.querySelectorAll('i')?.[3]?.classList?.contains('fa-linkedin-in'));
|
||||
```
|
||||
|
||||
The fifth `i` element should have a `class` attribute which includes `fa-youtube`.
|
||||
|
||||
```js
|
||||
assert(document.querySelectorAll('i')?.[4]?.classList?.contains('fa-youtube'));
|
||||
assert.isTrue(document.querySelectorAll('i')?.[4]?.classList?.contains('fa-youtube'));
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
Reference in New Issue
Block a user