From dddfe99200ebc48f0f7ecf6e99a6652d1c0c02c4 Mon Sep 17 00:00:00 2001 From: Anna Date: Thu, 22 May 2025 12:18:17 -0400 Subject: [PATCH] chore(curriculum): add extra h1 tests to camperbot lab (#60478) Co-authored-by: Jessica Wilkins <67210629+jdwilkin4@users.noreply.github.com> Co-authored-by: moT01 <20648924+moT01@users.noreply.github.com> --- .../6823f9df49cc206af5471a30.md | 65 ++++++++----------- 1 file changed, 28 insertions(+), 37 deletions(-) diff --git a/curriculum/challenges/english/25-front-end-development/lab-debug-camperbots-profile-page/6823f9df49cc206af5471a30.md b/curriculum/challenges/english/25-front-end-development/lab-debug-camperbots-profile-page/6823f9df49cc206af5471a30.md index c402e603966..fdbb18aec13 100644 --- a/curriculum/challenges/english/25-front-end-development/lab-debug-camperbots-profile-page/6823f9df49cc206af5471a30.md +++ b/curriculum/challenges/english/25-front-end-development/lab-debug-camperbots-profile-page/6823f9df49cc206af5471a30.md @@ -8,83 +8,76 @@ dashedName: lab-debug-camperbots-profile-page # --description-- -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. +Camperbot is trying to build a profile page. They asked a friend to look over their code and they said it has some errors. -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. +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. **User Stories:** -1. Camperbot is not following best practices and has multiple `h1` elements on the page. Remove all `h1` elements except for the first one. -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. -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. -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. +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. +2. Camperbot is trying to add two paragraphs with `pp`, but those don't exist either. Fix them so they use correct paragraph tags. +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. # --hints-- -You should only have one `h1` on the page. +You should have exactly one `h1` element on the page. ```js assert.lengthOf(document.querySelectorAll("h1"), 1); ``` -You should not remove the `

Hello from Camperbot!

` from the page. +You should not remove the `

Hello from Camperbot!

` element from the page. ```js -assert.strictEqual(document.querySelector("h1:first-of-type")?.innerText, "Hello from Camperbot!"); +assert.match(code, /\\s*Hello\s*from\s*Camperbot\s*!\s*\<\/h1\s*\>/i); ``` -You should have a valid `h2` element on the page. +You should have exactly one `h2` element on the page. ```js -assert.exists(document.querySelector("h2")); +assert.lengthOf(document.querySelectorAll("h2"), 1); ``` -You should not change the `About` text for the `h2` element. +You should have an `h2` element with the text `About`. Here's an example: `

Text here

` ```js -assert.strictEqual(document.querySelector("h2")?.innerText, "About"); +assert.match(code, /\\s*About\s*\<\/h2\s*\>/i); ``` -Your first paragraph element should have a valid opening tag. Remember that `p` elements have opening tags using this syntax: ``. +You should have a paragraph element with the text `My name is Camperbot and I love learning new things.` Here's an example: `

Text here

` ```js -assert.match(code, /

\s*My\s+name/); +assert.match(code, /\\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); ``` -Your first paragraph element should have a valid closing tag. Remember that `p` elements have closing tags using this syntax: ``. +You should have a paragraph element with the text `I enjoy solving puzzles.` Here's an example: `

Text here

` ```js -assert.match(code, /new\s+things\.<\/p>/); +assert.match(code, /\\s*I\s*enjoy\s*solving\s*puzzles\s*\.\s*\<\/p\s*\>/i); ``` -Your second paragraph element should have a valid opening tag. Remember that `p` elements have opening tags using this syntax: ``. +You should have exactly two paragraph elements on the page. ```js -assert.match(code, /

\s*I\s+enjoy/); +assert.lengthOf(document.querySelectorAll("p"), 2); ``` -Your second paragraph element should have a valid closing tag. Remember that `p` elements have closing tags using this syntax: ``. +You should have exactly one `h3` element on the page. ```js -assert.match(code, /solving\s+puzzles\.<\/p>/); +assert.lengthOf(document.querySelectorAll("h3"), 1); ``` -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. +You should have an `h3` element with the text `Background and Interests`. Here's an example: `

Text here

` ```js -assert.strictEqual(document.querySelector("p:first-of-type")?.innerText, "My name is Camperbot and I love reading and learning new things."); +assert.match(code, /\\s*Background\s*and\s*Interests\s*\<\/h3\s*\>/i); ``` -Your `h3` element should have a valid closing tag. Remember that `h3` elements have closing tags using this syntax: `
`. +You should have exactly five total elements on the page. ```js -assert.match(code, /<\/h3\>/); -``` - -Your second valid paragraph element should have the text `I enjoy solving puzzles.`. Double check your spelling. - -```js -assert.strictEqual(document.querySelector("h3 + p")?.innerText, "I enjoy solving puzzles."); +assert.lengthOf(document.querySelectorAll("body *:not(script)"), 5); ``` # --seed-- @@ -94,14 +87,12 @@ assert.strictEqual(document.querySelector("h3 + p")?.innerText, "I enjoy solving ```html

Hello from Camperbot!

-

Welcome!

- About -My name is Camperbot and I love reading and learning new things. +My name is Camperbot and I love learning new things. -

Background and Interests

-I enjoy solving puzzles. +

Background and Interests

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

About

-

My name is Camperbot and I love reading and learning new things.

+

My name is Camperbot and I love learning new things.

Background and Interests

I enjoy solving puzzles.