Skip to content

Commit dddfe99

Browse files
a2937jdwilkin4moT01
authored
chore(curriculum): add extra h1 tests to camperbot lab (freeCodeCamp#60478)
Co-authored-by: Jessica Wilkins <67210629+jdwilkin4@users.noreply.github.com> Co-authored-by: moT01 <20648924+moT01@users.noreply.github.com>
1 parent 331005f commit dddfe99

1 file changed

Lines changed: 28 additions & 37 deletions

File tree

curriculum/challenges/english/25-front-end-development/lab-debug-camperbots-profile-page/6823f9df49cc206af5471a30.md

Lines changed: 28 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -8,83 +8,76 @@ dashedName: lab-debug-camperbots-profile-page
88

99
# --description--
1010

11-
Camperbot just started learning how to code and is trying to build a profile page. They asked a friend to look over their code so far and their friend said it had tons of errors.
11+
Camperbot is trying to build a profile page. They asked a friend to look over their code and they said it has some errors.
1212

13-
Your job is to fix all of Camperbot's errors so they can continue to build their profile page. Complete the items in the user stories below and click "Run the Tests" to see if you fixed all the errors.
13+
Your job is to fix all of Camperbot's errors so they can continue building their profile page. Complete the items in the user stories below and click "Run the Tests" to see if you fixed all the errors.
1414

1515
**User Stories:**
1616

17-
1. Camperbot is not following best practices and has multiple `h1` elements on the page. Remove all `h1` elements except for the first one.
18-
2. Camperbot is trying to use a `heading2` element. But that element does not exist in HTML. Fix that mistake so it uses the correct second level heading element.
19-
3. Camperbot is trying to add some paragraphs but is using the wrong element. Fix these errors to use the correct HTML element for paragraphs.
20-
4. Camperbot is using an `h3` element for the `Background and Interests` subheading but it has a syntax error. Spot the issue and resolve it.
17+
1. Camperbot is trying to use a `heading2` element, but that element does not exist. Fix those tags so it uses a correct second-level heading element.
18+
2. Camperbot is trying to add two paragraphs with `pp`, but those don't exist either. Fix them so they use correct paragraph tags.
19+
3. Camperbot is using an `h3` element for the `Background and Interests` subheading but it has a syntax error. Spot the issue and resolve it.
2120

2221
# --hints--
2322

24-
You should only have one `h1` on the page.
23+
You should have exactly one `h1` element on the page.
2524

2625
```js
2726
assert.lengthOf(document.querySelectorAll("h1"), 1);
2827
```
2928

30-
You should not remove the `<h1>Hello from Camperbot!</h1>` from the page.
29+
You should not remove the `<h1>Hello from Camperbot!</h1>` element from the page.
3130

3231
```js
33-
assert.strictEqual(document.querySelector("h1:first-of-type")?.innerText, "Hello from Camperbot!");
32+
assert.match(code, /\<h1\s*\>\s*Hello\s*from\s*Camperbot\s*!\s*\<\/h1\s*\>/i);
3433
```
3534

36-
You should have a valid `h2` element on the page.
35+
You should have exactly one `h2` element on the page.
3736

3837
```js
39-
assert.exists(document.querySelector("h2"));
38+
assert.lengthOf(document.querySelectorAll("h2"), 1);
4039
```
4140

42-
You should not change the `About` text for the `h2` element.
41+
You should have an `h2` element with the text `About`. Here's an example: `<h2>Text here</h2>`
4342

4443
```js
45-
assert.strictEqual(document.querySelector("h2")?.innerText, "About");
44+
assert.match(code, /\<h2\s*\>\s*About\s*\<\/h2\s*\>/i);
4645
```
4746

48-
Your first paragraph element should have a valid opening tag. Remember that `p` elements have opening tags using this syntax: `<elementName>`.
47+
You should have a paragraph element with the text `My name is Camperbot and I love learning new things.` Here's an example: `<p>Text here</p>`
4948

5049
```js
51-
assert.match(code, /<p>\s*My\s+name/);
50+
assert.match(code, /\<p\s*\>\s*My\s*name\s*is\s*camperbot\s*and\s*I\s*love\s*learning\s*new\s*things\s*\.\s*\<\/p\s*\>/i);
5251
```
5352

54-
Your first paragraph element should have a valid closing tag. Remember that `p` elements have closing tags using this syntax: `</elementName>`.
53+
You should have a paragraph element with the text `I enjoy solving puzzles.` Here's an example: `<p>Text here</p>`
5554

5655
```js
57-
assert.match(code, /new\s+things\.<\/p>/);
56+
assert.match(code, /\<p\s*\>\s*I\s*enjoy\s*solving\s*puzzles\s*\.\s*\<\/p\s*\>/i);
5857
```
5958

60-
Your second paragraph element should have a valid opening tag. Remember that `p` elements have opening tags using this syntax: `<elementName>`.
59+
You should have exactly two paragraph elements on the page.
6160

6261
```js
63-
assert.match(code, /<p>\s*I\s+enjoy/);
62+
assert.lengthOf(document.querySelectorAll("p"), 2);
6463
```
6564

66-
Your second paragraph element should have a valid closing tag. Remember that `p` elements have closing tags using this syntax: `</elementName>`.
65+
You should have exactly one `h3` element on the page.
6766

6867
```js
69-
assert.match(code, /solving\s+puzzles\.<\/p>/);
68+
assert.lengthOf(document.querySelectorAll("h3"), 1);
7069
```
7170

72-
Your first valid paragraph element should have the text `My name is Camperbot and I love reading and learning new things.`. Double check your spelling.
71+
You should have an `h3` element with the text `Background and Interests`. Here's an example: `<h3>Text here</h3>`
7372

7473
```js
75-
assert.strictEqual(document.querySelector("p:first-of-type")?.innerText, "My name is Camperbot and I love reading and learning new things.");
74+
assert.match(code, /\<h3\s*\>\s*Background\s*and\s*Interests\s*\<\/h3\s*\>/i);
7675
```
7776

78-
Your `h3` element should have a valid closing tag. Remember that `h3` elements have closing tags using this syntax: `</elementName>`.
77+
You should have exactly five total elements on the page.
7978

8079
```js
81-
assert.match(code, /<\/h3\>/);
82-
```
83-
84-
Your second valid paragraph element should have the text `I enjoy solving puzzles.`. Double check your spelling.
85-
86-
```js
87-
assert.strictEqual(document.querySelector("h3 + p")?.innerText, "I enjoy solving puzzles.");
80+
assert.lengthOf(document.querySelectorAll("body *:not(script)"), 5);
8881
```
8982

9083
# --seed--
@@ -94,14 +87,12 @@ assert.strictEqual(document.querySelector("h3 + p")?.innerText, "I enjoy solving
9487
```html
9588
<h1>Hello from Camperbot!</h1>
9689

97-
<h1>Welcome!</h1>
98-
9990
<heading2>About</heading2>
10091

101-
<pp>My name is Camperbot and I love reading and learning new things.<pp>
92+
<pp>My name is Camperbot and I love learning new things.</pp>
10293

103-
<h3>Background and Interests<h3>
104-
<pp>I enjoy solving puzzles.<pp>
94+
<h3>Background and Interests<h3/>
95+
<pp>I enjoy solving puzzles.</pp>
10596
```
10697

10798
# --solutions--
@@ -111,7 +102,7 @@ assert.strictEqual(document.querySelector("h3 + p")?.innerText, "I enjoy solving
111102

112103
<h2>About</h2>
113104

114-
<p>My name is Camperbot and I love reading and learning new things.</p>
105+
<p>My name is Camperbot and I love learning new things.</p>
115106

116107
<h3>Background and Interests</h3>
117108
<p>I enjoy solving puzzles.</p>

0 commit comments

Comments
 (0)