chore(curriculum): use specific assert methods in workshop tests steps 2-3-4 (#60955)

This commit is contained in:
manthansubhash01
2025-06-20 23:04:42 +05:30
committed by GitHub
parent 88e685ddca
commit d46dd8a13f
3 changed files with 15 additions and 15 deletions

View File

@@ -20,7 +20,7 @@ assert.exists(document.querySelector('main'));
Your `main` element should be within your `body` element.
```js
assert(document.querySelector('main')?.parentElement?.localName === 'body');
assert.equal(document.querySelector('main')?.parentElement?.localName, 'body');
```
You should have a `section` element.
@@ -32,13 +32,13 @@ assert.exists(document.querySelector('section'));
Your `section` element should be within your `main` element.
```js
assert(document.querySelector('section')?.parentElement?.localName === 'main');
assert.equal(document.querySelector('section')?.parentElement?.localName, 'main');
```
Your `section` element should have the `class` set to `heading`.
```js
assert(document.querySelector('section')?.classList?.contains('heading'));
assert.isTrue(document.querySelector('section')?.classList?.contains('heading'));
```
# --seed--

View File

@@ -26,13 +26,13 @@ assert.exists(document.querySelector('header'));
Your `header` element should be within your `.heading` element.
```js
assert(document.querySelector('header')?.parentElement?.className === 'heading');
assert.equal(document.querySelector('header')?.parentElement?.className, 'heading');
```
Your `header` element should have the `class` set to `hero`.
```js
assert(document.querySelector('header')?.className === 'hero');
assert.equal(document.querySelector('header')?.className, 'hero');
```
You should create an `img` element.
@@ -44,31 +44,31 @@ assert.exists(document.querySelector('img'));
Your `img` element should be within your `header` element.
```js
assert(document.querySelector('img')?.parentElement?.localName === 'header');
assert.equal(document.querySelector('img')?.parentElement?.localName, 'header');
```
Your `img` element should have the `src` set to `https://cdn.freecodecamp.org/platform/universal/fcc_meta_1920X1080-indigo.png`.
```js
assert(document.querySelector('img')?.getAttribute('src') === 'https://cdn.freecodecamp.org/platform/universal/fcc_meta_1920X1080-indigo.png');
assert.equal(document.querySelector('img')?.getAttribute('src'), 'https://cdn.freecodecamp.org/platform/universal/fcc_meta_1920X1080-indigo.png');
```
Your `img` element should have the `alt` set to `freecodecamp logo`.
```js
assert(document.querySelector('img')?.getAttribute('alt') === 'freecodecamp logo');
assert.equal(document.querySelector('img')?.getAttribute('alt'), 'freecodecamp logo');
```
Your `img` element should have the `loading` attribute set to `lazy`.
```js
assert(document.querySelector('img')?.getAttribute('loading') === 'lazy');
assert.equal(document.querySelector('img')?.getAttribute('loading'), 'lazy');
```
Your `img` element should have the `class` set to `hero-img`.
```js
assert(document.querySelector('img')?.className === 'hero-img');
assert.equal(document.querySelector('img')?.className, 'hero-img');
```
# --seed--

View File

@@ -20,19 +20,19 @@ assert.exists(document.querySelector('h1'));
Your `h1` element should come after your `img` element.
```js
assert(document.querySelector('h1')?.previousElementSibling?.localName === 'img');
assert.equal(document.querySelector('h1')?.previousElementSibling?.localName, 'img');
```
Your `h1` element should have the `class` set to `hero-title`.
```js
assert(document.querySelector('h1')?.className === 'hero-title');
assert.equal(document.querySelector('h1')?.className, 'hero-title');
```
Your `h1` element should have the text set to `OUR NEW CURRICULUM`.
```js
assert(document.querySelector('h1')?.textContent === 'OUR NEW CURRICULUM');
assert.equal(document.querySelector('h1')?.textContent, 'OUR NEW CURRICULUM');
```
You should create a new `p` element.
@@ -44,13 +44,13 @@ assert.exists(document.querySelector('p'));
Your `p` element should come after your `h1` element.
```js
assert(document.querySelector('p')?.previousElementSibling?.localName === 'h1');
assert.equal(document.querySelector('p')?.previousElementSibling?.localName, 'h1');
```
Your `p` element should have the `class` set to `hero-subtitle`.
```js
assert(document.querySelector('p')?.className === 'hero-subtitle');
assert.equal(document.querySelector('p')?.className, 'hero-subtitle');
```
Your `p` element should have the text set to `Our efforts to restructure our curriculum with a more project-based focus`.