From ee86bccdc7723820ce4036b1d1cb084c47eb132c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Giftea=20=E2=98=95?= Date: Thu, 9 Oct 2025 11:54:10 +0100 Subject: [PATCH] fix(curriculum): .trim() to textContent for workshop-accessibility-quiz (#62615) Co-authored-by: Ilenia <26656284+ilenia-magoni@users.noreply.github.com> --- .../613e2546d0594208229ada50.md | 2 +- .../61408f155e798909b6908712.md | 6 +++--- .../614202874ca576084fca625f.md | 6 +++--- .../6143639d5eddc7094161648c.md | 6 +++--- .../6143931a113bb80c45546287.md | 4 ++-- .../614394fb41985e0d2012a93e.md | 4 ++-- .../6143956ed76ed60e012faa51.md | 4 ++-- .../6144e818fd5ea704fe56081d.md | 8 +++++--- .../6145f02240ff8f09f7ec913c.md | 4 ++-- .../6145f14f019a4b0adb94b051.md | 6 +++--- .../6145f685797bd30df9784e8c.md | 2 +- .../6145f8f8bcd4370f6509078e.md | 2 +- 12 files changed, 28 insertions(+), 26 deletions(-) diff --git a/curriculum/challenges/english/blocks/workshop-accessibility-quiz/613e2546d0594208229ada50.md b/curriculum/challenges/english/blocks/workshop-accessibility-quiz/613e2546d0594208229ada50.md index 75eebf05943..71c512308c4 100644 --- a/curriculum/challenges/english/blocks/workshop-accessibility-quiz/613e2546d0594208229ada50.md +++ b/curriculum/challenges/english/blocks/workshop-accessibility-quiz/613e2546d0594208229ada50.md @@ -60,7 +60,7 @@ assert.equal(document.querySelector('img')?.alt, 'freeCodeCamp'); You should give the `h1` element the text `HTML/CSS Quiz`. ```js -assert.include(document.querySelector('h1')?.innerText?.toLowerCase(), 'html/css quiz'); +assert.include(document.querySelector('h1')?.innerText.toLowerCase(), 'html/css quiz'); ``` # --seed-- diff --git a/curriculum/challenges/english/blocks/workshop-accessibility-quiz/61408f155e798909b6908712.md b/curriculum/challenges/english/blocks/workshop-accessibility-quiz/61408f155e798909b6908712.md index 041cfb518f6..c6e58e75a22 100644 --- a/curriculum/challenges/english/blocks/workshop-accessibility-quiz/61408f155e798909b6908712.md +++ b/curriculum/challenges/english/blocks/workshop-accessibility-quiz/61408f155e798909b6908712.md @@ -38,19 +38,19 @@ assert.equal(document.querySelectorAll('nav > ul > li > a')?.length, 3); You should give the first `a` element the text `INFO`. ```js -assert.equal(document.querySelectorAll('nav > ul > li > a')?.[0]?.textContent, 'INFO'); +assert.equal(document.querySelectorAll('nav > ul > li > a')[0]?.textContent.trim(), 'INFO'); ``` You should give the second `a` element the text `HTML`. ```js -assert.equal(document.querySelectorAll('nav > ul > li > a')?.[1]?.textContent, 'HTML'); +assert.equal(document.querySelectorAll('nav > ul > li > a')[1]?.textContent.trim(), 'HTML'); ``` You should give the third `a` element the text `CSS`. ```js -assert.equal(document.querySelectorAll('nav > ul > li > a')?.[2]?.textContent, 'CSS'); +assert.equal(document.querySelectorAll('nav > ul > li > a')[2]?.textContent.trim(), 'CSS'); ``` # --seed-- diff --git a/curriculum/challenges/english/blocks/workshop-accessibility-quiz/614202874ca576084fca625f.md b/curriculum/challenges/english/blocks/workshop-accessibility-quiz/614202874ca576084fca625f.md index e864b1363ec..466e3428694 100644 --- a/curriculum/challenges/english/blocks/workshop-accessibility-quiz/614202874ca576084fca625f.md +++ b/curriculum/challenges/english/blocks/workshop-accessibility-quiz/614202874ca576084fca625f.md @@ -76,19 +76,19 @@ assert.equal(document.querySelectorAll('h2')?.[2]?.id, 'css-questions'); You should give the first `h2` element suitable text content. _Hint: I would have chosen `Student Info`_ ```js -assert.isAtLeast(document.querySelectorAll('h2')?.[0]?.textContent?.length, 1); +assert.isNotEmpty(document.querySelectorAll('h2')[0]?.textContent.trim()); ``` You should give the second `h2` element suitable text content. _Hint: I would have chosen `HTML`_ ```js -assert.isAtLeast(document.querySelectorAll('h2')?.[1]?.textContent?.length, 1); +assert.isNotEmpty(document.querySelectorAll('h2')[1]?.textContent.trim()); ``` You should give the third `h2` element suitable text content. _Hint: I would have chosen `CSS`_ ```js -assert.isAtLeast(document.querySelectorAll('h2')?.[2]?.textContent?.length, 1); +assert.isNotEmpty(document.querySelectorAll('h2')[2]?.textContent.trim()); ``` # --seed-- diff --git a/curriculum/challenges/english/blocks/workshop-accessibility-quiz/6143639d5eddc7094161648c.md b/curriculum/challenges/english/blocks/workshop-accessibility-quiz/6143639d5eddc7094161648c.md index e448afca673..1d305b05590 100644 --- a/curriculum/challenges/english/blocks/workshop-accessibility-quiz/6143639d5eddc7094161648c.md +++ b/curriculum/challenges/english/blocks/workshop-accessibility-quiz/6143639d5eddc7094161648c.md @@ -36,19 +36,19 @@ assert.isAtLeast(document.querySelectorAll('label')?.[2]?.htmlFor?.length, 1); You should give the first `label` element an appropriate text content. ```js -assert.isAtLeast(document.querySelectorAll('label')?.[0]?.textContent?.length, 1); +assert.isNotEmpty(document.querySelectorAll('label')[0]?.textContent.trim()); ``` You should give the second `label` element an appropriate text content. ```js -assert.isAtLeast(document.querySelectorAll('label')?.[1]?.textContent?.length, 1); +assert.isNotEmpty(document.querySelectorAll('label')[1]?.textContent.trim()); ``` You should give the third `label` element an appropriate text content. ```js -assert.isAtLeast(document.querySelectorAll('label')?.[2]?.textContent?.length, 1); +assert.isNotEmpty(document.querySelectorAll('label')[2]?.textContent.trim()); ``` You should give the first `input` element an `id` attribute matching the `for` attribute of the first `label`. diff --git a/curriculum/challenges/english/blocks/workshop-accessibility-quiz/6143931a113bb80c45546287.md b/curriculum/challenges/english/blocks/workshop-accessibility-quiz/6143931a113bb80c45546287.md index ab24556c873..1c2e66ddfc4 100644 --- a/curriculum/challenges/english/blocks/workshop-accessibility-quiz/6143931a113bb80c45546287.md +++ b/curriculum/challenges/english/blocks/workshop-accessibility-quiz/6143931a113bb80c45546287.md @@ -40,13 +40,13 @@ assert.equal(document.querySelectorAll('section:nth-of-type(2) > div.question-bl You should give the first `h3` element text of `1`. ```js -assert.equal(document.querySelectorAll('section:nth-of-type(2) > div.question-block > h3')?.[0]?.textContent, '1'); +assert.equal(document.querySelectorAll('section:nth-of-type(2) > div.question-block > h3')[0]?.textContent.trim(), '1'); ``` You should give the second `h3` element text of `2`. ```js -assert.equal(document.querySelectorAll('section:nth-of-type(2) > div.question-block > h3')?.[1]?.textContent, '2'); +assert.equal(document.querySelectorAll('section:nth-of-type(2) > div.question-block > h3')[1]?.textContent.trim(), '2'); ``` You should nest one `fieldset` element within each `div.question-block` element. diff --git a/curriculum/challenges/english/blocks/workshop-accessibility-quiz/614394fb41985e0d2012a93e.md b/curriculum/challenges/english/blocks/workshop-accessibility-quiz/614394fb41985e0d2012a93e.md index c9da5a14149..743f0ca7497 100644 --- a/curriculum/challenges/english/blocks/workshop-accessibility-quiz/614394fb41985e0d2012a93e.md +++ b/curriculum/challenges/english/blocks/workshop-accessibility-quiz/614394fb41985e0d2012a93e.md @@ -40,13 +40,13 @@ assert.equal(document.querySelectorAll('span')[1]?.className, 'sr-only'); You should add the `span` element before the number 1 within the first `h3` element. ```js -assert.equal(document.querySelector('span')?.nextSibling?.textContent, '1'); +assert.equal(document.querySelector('span')?.nextSibling?.textContent.trim(), '1'); ``` You should add the `span` element before the number 2 within the second `h3` element. ```js -assert.equal(document.querySelectorAll('span')[1]?.nextSibling?.textContent, '2'); +assert.equal(document.querySelectorAll('span')[1]?.nextSibling?.textContent.trim(), '2'); ``` # --seed-- diff --git a/curriculum/challenges/english/blocks/workshop-accessibility-quiz/6143956ed76ed60e012faa51.md b/curriculum/challenges/english/blocks/workshop-accessibility-quiz/6143956ed76ed60e012faa51.md index 0b23f7a7b79..3a405992996 100644 --- a/curriculum/challenges/english/blocks/workshop-accessibility-quiz/6143956ed76ed60e012faa51.md +++ b/curriculum/challenges/english/blocks/workshop-accessibility-quiz/6143956ed76ed60e012faa51.md @@ -16,13 +16,13 @@ In the second `span` element, add the text `Question`. You should give the first `span` element text of `Question`. ```js -assert.equal(document.querySelector('h3 > span')?.textContent, 'Question'); +assert.equal(document.querySelector('h3 > span')?.textContent.trim(), 'Question'); ``` You should give the second `span` element text of `Question`. ```js -assert.equal(document.querySelectorAll('h3 > span')?.[1]?.textContent, 'Question'); +assert.equal(document.querySelectorAll('h3 > span')[1]?.textContent.trim(), 'Question'); ``` # --seed-- diff --git a/curriculum/challenges/english/blocks/workshop-accessibility-quiz/6144e818fd5ea704fe56081d.md b/curriculum/challenges/english/blocks/workshop-accessibility-quiz/6144e818fd5ea704fe56081d.md index ab16b2a43be..713d0a02d28 100644 --- a/curriculum/challenges/english/blocks/workshop-accessibility-quiz/6144e818fd5ea704fe56081d.md +++ b/curriculum/challenges/english/blocks/workshop-accessibility-quiz/6144e818fd5ea704fe56081d.md @@ -40,19 +40,21 @@ assert.equal(document.querySelectorAll('fieldset > ul')?.[1]?.className, 'answer You should give the first `legend` element text content. ```js -assert.notEmpty(document.querySelectorAll('legend')?.[0]?.textContent); +assert.isNotEmpty(document.querySelectorAll('legend')[0]?.textContent.trim()); ``` You should give the second `legend` element text content. ```js -assert.notEmpty(document.querySelectorAll('legend')?.[1]?.textContent); +assert.isNotEmpty(document.querySelectorAll('legend')[1]?.textContent.trim()); ``` You should not use the same text content for both `legend` elements. ```js -assert.notEqual(document.querySelectorAll('legend')?.[0]?.textContent, document.querySelectorAll('legend')?.[1]?.textContent); +const legends = document.querySelectorAll('legend'); +assert.lengthOf(legends, 2); +assert.notEqual(legends[0]?.textContent.trim(), legends[1]?.textContent.trim()); ``` # --seed-- diff --git a/curriculum/challenges/english/blocks/workshop-accessibility-quiz/6145f02240ff8f09f7ec913c.md b/curriculum/challenges/english/blocks/workshop-accessibility-quiz/6145f02240ff8f09f7ec913c.md index cd3f58403c0..cbcf53d050f 100644 --- a/curriculum/challenges/english/blocks/workshop-accessibility-quiz/6145f02240ff8f09f7ec913c.md +++ b/curriculum/challenges/english/blocks/workshop-accessibility-quiz/6145f02240ff8f09f7ec913c.md @@ -26,13 +26,13 @@ assert.exists(document.querySelectorAll('.formrow > .question-block')?.[1]?.quer You should give the first `label` element text content. ```js -assert.isAtLeast(document.querySelectorAll('.formrow > .question-block')?.[0]?.querySelector('label')?.textContent?.length, 1); +assert.isNotEmpty(document.querySelectorAll('.formrow > .question-block')[0]?.querySelector('label')?.textContent.trim()); ``` You should give the second `label` element text content. ```js -assert.isAtLeast(document.querySelectorAll('.formrow > .question-block')?.[1]?.querySelector('label')?.textContent?.length, 1); +assert.isNotEmpty(document.querySelectorAll('.formrow > .question-block')[1]?.querySelector('label')?.textContent.trim()); ``` # --seed-- diff --git a/curriculum/challenges/english/blocks/workshop-accessibility-quiz/6145f14f019a4b0adb94b051.md b/curriculum/challenges/english/blocks/workshop-accessibility-quiz/6145f14f019a4b0adb94b051.md index 6f8ccaa6fb2..b73ef691481 100644 --- a/curriculum/challenges/english/blocks/workshop-accessibility-quiz/6145f14f019a4b0adb94b051.md +++ b/curriculum/challenges/english/blocks/workshop-accessibility-quiz/6145f14f019a4b0adb94b051.md @@ -34,7 +34,7 @@ assert.equal(document.querySelector('div.answer > select > option:nth-child(1)') You should give the first `option` element a text content of `Select an option`. ```js -assert.equal(document.querySelector('div.answer > select > option:nth-child(1)')?.textContent, 'Select an option'); +assert.equal(document.querySelector('div.answer > select > option:nth-child(1)')?.textContent.trim(), 'Select an option'); ``` You should give the second `option` element a `value` of `yes`. @@ -46,7 +46,7 @@ assert.equal(document.querySelector('div.answer > select > option:nth-child(2)') You should give the second `option` element a text content of `Yes`. ```js -assert.equal(document.querySelector('div.answer > select > option:nth-child(2)')?.textContent, 'Yes'); +assert.equal(document.querySelector('div.answer > select > option:nth-child(2)')?.textContent.trim(), 'Yes'); ``` You should give the third `option` element a `value` of `no`. @@ -58,7 +58,7 @@ assert.equal(document.querySelector('div.answer > select > option:nth-child(3)') You should give the third `option` element a text content of `No`. ```js -assert.equal(document.querySelector('div.answer > select > option:nth-child(3)')?.textContent, 'No'); +assert.equal(document.querySelector('div.answer > select > option:nth-child(3)')?.textContent.trim(), 'No'); ``` You should give the `select` an attribute of `required`. diff --git a/curriculum/challenges/english/blocks/workshop-accessibility-quiz/6145f685797bd30df9784e8c.md b/curriculum/challenges/english/blocks/workshop-accessibility-quiz/6145f685797bd30df9784e8c.md index 354d340735c..1aca11f5869 100644 --- a/curriculum/challenges/english/blocks/workshop-accessibility-quiz/6145f685797bd30df9784e8c.md +++ b/curriculum/challenges/english/blocks/workshop-accessibility-quiz/6145f685797bd30df9784e8c.md @@ -38,7 +38,7 @@ assert.exists(document.querySelector('button[type="submit"]') || document.queryS The submit button should display the text `Send`. ```js -assert.equal(document.querySelector('button[type="submit"]')?.textContent ?? document.querySelector('input[type="submit"]')?.value, 'Send'); +assert.equal(document.querySelector('button[type="submit"]')?.textContent.trim() ?? document.querySelector('input[type="submit"]')?.value, 'Send'); ``` # --seed-- diff --git a/curriculum/challenges/english/blocks/workshop-accessibility-quiz/6145f8f8bcd4370f6509078e.md b/curriculum/challenges/english/blocks/workshop-accessibility-quiz/6145f8f8bcd4370f6509078e.md index 6d156838629..8d11c8361cc 100644 --- a/curriculum/challenges/english/blocks/workshop-accessibility-quiz/6145f8f8bcd4370f6509078e.md +++ b/curriculum/challenges/english/blocks/workshop-accessibility-quiz/6145f8f8bcd4370f6509078e.md @@ -23,7 +23,7 @@ The `br` tags will allow each part of the address to be on its own line and are You should add the above text including the `
` tags to the `address` element. ```js -assert.equal(document.querySelector('address')?.innerText, 'freeCodeCamp\nSan Francisco\nCalifornia\nUSA'); +assert.equal(document.querySelector('address')?.innerText.trim(), 'freeCodeCamp\nSan Francisco\nCalifornia\nUSA'); ``` # --seed--