mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-06-19 21:09:51 +08:00
chore(curriculum): update magazine workshop steps 22–23 to use specific assert methods (#61154)
This commit is contained in:
parent
b5f2115a79
commit
9418eadfe9
@ -14,37 +14,54 @@ Within your `.image-wrapper` element, give the second `img` element a `src` of `
|
||||
Your second `img` element should have a `src` set to `https://cdn.freecodecamp.org/testable-projects-fcc/images/calc.png`.
|
||||
|
||||
```js
|
||||
assert(document.querySelectorAll('.image-wrapper img')?.[1]?.getAttribute('src') === 'https://cdn.freecodecamp.org/testable-projects-fcc/images/calc.png');
|
||||
assert.equal(
|
||||
document.querySelectorAll('.image-wrapper img')?.[1]?.getAttribute('src'),
|
||||
'https://cdn.freecodecamp.org/testable-projects-fcc/images/calc.png'
|
||||
);
|
||||
```
|
||||
|
||||
Your second `img` element should have an `alt` set to `image of a calculator project`.
|
||||
|
||||
```js
|
||||
assert(document.querySelectorAll('.image-wrapper img')?.[1]?.getAttribute('alt') === 'image of a calculator project');
|
||||
assert.equal(
|
||||
document.querySelectorAll('.image-wrapper img')?.[1]?.getAttribute('alt'),
|
||||
'image of a calculator project'
|
||||
);
|
||||
```
|
||||
|
||||
Your second `img` element should have a `loading` attribute set to `lazy`.
|
||||
|
||||
```js
|
||||
assert(document.querySelectorAll('.image-wrapper img')?.[1]?.getAttribute('loading') === 'lazy');
|
||||
assert.equal(
|
||||
document.querySelectorAll('.image-wrapper img')?.[1]?.getAttribute('loading'),
|
||||
'lazy'
|
||||
);
|
||||
```
|
||||
|
||||
Your second `img` element should have a `class` set to `image-2`.
|
||||
|
||||
```js
|
||||
assert(document.querySelectorAll('.image-wrapper img')?.[1]?.classList?.contains('image-2'));
|
||||
assert.isTrue(
|
||||
document.querySelectorAll('.image-wrapper img')?.[1]?.classList?.contains('image-2')
|
||||
);
|
||||
```
|
||||
|
||||
Your second `img` element should have a `width` set to `400`.
|
||||
|
||||
```js
|
||||
assert(document.querySelectorAll('.image-wrapper img')?.[1]?.getAttribute('width') === '400');
|
||||
assert.equal(
|
||||
document.querySelectorAll('.image-wrapper img')?.[1]?.getAttribute('width'),
|
||||
'400'
|
||||
);
|
||||
```
|
||||
|
||||
Your second `img` element should have a `height` set to `400`.
|
||||
|
||||
```js
|
||||
assert(document.querySelectorAll('.image-wrapper img')?.[1]?.getAttribute('height') === '400');
|
||||
assert.equal(
|
||||
document.querySelectorAll('.image-wrapper img')?.[1]?.getAttribute('height'),
|
||||
'400'
|
||||
);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
@ -14,37 +14,54 @@ Within your `.image-wrapper` element, give your third `img` element a `src` of `
|
||||
Your third `img` element should have a `src` set to `https://cdn.freecodecamp.org/testable-projects-fcc/images/survey-form-background.jpeg`.
|
||||
|
||||
```js
|
||||
assert(document.querySelectorAll('.image-wrapper img')?.[2]?.getAttribute('src') === 'https://cdn.freecodecamp.org/testable-projects-fcc/images/survey-form-background.jpeg');
|
||||
assert.equal(
|
||||
document.querySelectorAll('.image-wrapper img')?.[2]?.getAttribute('src'),
|
||||
'https://cdn.freecodecamp.org/testable-projects-fcc/images/survey-form-background.jpeg'
|
||||
);
|
||||
```
|
||||
|
||||
Your third `img` element should have an `alt` set to `four people working on code`.
|
||||
|
||||
```js
|
||||
assert(document.querySelectorAll('.image-wrapper img')?.[2]?.getAttribute('alt') === 'four people working on code');
|
||||
assert.equal(
|
||||
document.querySelectorAll('.image-wrapper img')?.[2]?.getAttribute('alt'),
|
||||
'four people working on code'
|
||||
);
|
||||
```
|
||||
|
||||
Your third `img` element should have a `loading` attribute set to `lazy`.
|
||||
|
||||
```js
|
||||
assert(document.querySelectorAll('.image-wrapper img')?.[2]?.getAttribute('loading') === 'lazy');
|
||||
assert.equal(
|
||||
document.querySelectorAll('.image-wrapper img')?.[2]?.getAttribute('loading'),
|
||||
'lazy'
|
||||
);
|
||||
```
|
||||
|
||||
Your third `img` element should have a `class` set to `image-3`.
|
||||
|
||||
```js
|
||||
assert(document.querySelectorAll('.image-wrapper img')?.[2]?.classList?.contains('image-3'));
|
||||
assert.isTrue(
|
||||
document.querySelectorAll('.image-wrapper img')?.[2]?.classList?.contains('image-3')
|
||||
);
|
||||
```
|
||||
|
||||
Your third `img` element should have a `width` attribute set to `600`.
|
||||
|
||||
```js
|
||||
assert(document.querySelectorAll('.image-wrapper img')?.[2]?.getAttribute('width') === '600');
|
||||
assert.equal(
|
||||
document.querySelectorAll('.image-wrapper img')?.[2]?.getAttribute('width'),
|
||||
'600'
|
||||
);
|
||||
```
|
||||
|
||||
Your third `img` element should have a `height` attribute set to `400`.
|
||||
|
||||
```js
|
||||
assert(document.querySelectorAll('.image-wrapper img')?.[2]?.getAttribute('height') === '400');
|
||||
assert.equal(
|
||||
document.querySelectorAll('.image-wrapper img')?.[2]?.getAttribute('height'),
|
||||
'400'
|
||||
);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
Loading…
Reference in New Issue
Block a user