Skip to content

Commit ee86bcc

Browse files
fix(curriculum): .trim() to textContent for workshop-accessibility-quiz (freeCodeCamp#62615)
Co-authored-by: Ilenia <[email protected]>
1 parent e1e2292 commit ee86bcc

12 files changed

+28
-26
lines changed

curriculum/challenges/english/blocks/workshop-accessibility-quiz/613e2546d0594208229ada50.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ assert.equal(document.querySelector('img')?.alt, 'freeCodeCamp');
6060
You should give the `h1` element the text `HTML/CSS Quiz`.
6161
6262
```js
63-
assert.include(document.querySelector('h1')?.innerText?.toLowerCase(), 'html/css quiz');
63+
assert.include(document.querySelector('h1')?.innerText.toLowerCase(), 'html/css quiz');
6464
```
6565
6666
# --seed--

curriculum/challenges/english/blocks/workshop-accessibility-quiz/61408f155e798909b6908712.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,19 @@ assert.equal(document.querySelectorAll('nav > ul > li > a')?.length, 3);
3838
You should give the first `a` element the text `INFO`.
3939
4040
```js
41-
assert.equal(document.querySelectorAll('nav > ul > li > a')?.[0]?.textContent, 'INFO');
41+
assert.equal(document.querySelectorAll('nav > ul > li > a')[0]?.textContent.trim(), 'INFO');
4242
```
4343
4444
You should give the second `a` element the text `HTML`.
4545
4646
```js
47-
assert.equal(document.querySelectorAll('nav > ul > li > a')?.[1]?.textContent, 'HTML');
47+
assert.equal(document.querySelectorAll('nav > ul > li > a')[1]?.textContent.trim(), 'HTML');
4848
```
4949
5050
You should give the third `a` element the text `CSS`.
5151
5252
```js
53-
assert.equal(document.querySelectorAll('nav > ul > li > a')?.[2]?.textContent, 'CSS');
53+
assert.equal(document.querySelectorAll('nav > ul > li > a')[2]?.textContent.trim(), 'CSS');
5454
```
5555
5656
# --seed--

curriculum/challenges/english/blocks/workshop-accessibility-quiz/614202874ca576084fca625f.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,19 +76,19 @@ assert.equal(document.querySelectorAll('h2')?.[2]?.id, 'css-questions');
7676
You should give the first `h2` element suitable text content. _Hint: I would have chosen `Student Info`_
7777
7878
```js
79-
assert.isAtLeast(document.querySelectorAll('h2')?.[0]?.textContent?.length, 1);
79+
assert.isNotEmpty(document.querySelectorAll('h2')[0]?.textContent.trim());
8080
```
8181
8282
You should give the second `h2` element suitable text content. _Hint: I would have chosen `HTML`_
8383
8484
```js
85-
assert.isAtLeast(document.querySelectorAll('h2')?.[1]?.textContent?.length, 1);
85+
assert.isNotEmpty(document.querySelectorAll('h2')[1]?.textContent.trim());
8686
```
8787
8888
You should give the third `h2` element suitable text content. _Hint: I would have chosen `CSS`_
8989
9090
```js
91-
assert.isAtLeast(document.querySelectorAll('h2')?.[2]?.textContent?.length, 1);
91+
assert.isNotEmpty(document.querySelectorAll('h2')[2]?.textContent.trim());
9292
```
9393
9494
# --seed--

curriculum/challenges/english/blocks/workshop-accessibility-quiz/6143639d5eddc7094161648c.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,19 @@ assert.isAtLeast(document.querySelectorAll('label')?.[2]?.htmlFor?.length, 1);
3636
You should give the first `label` element an appropriate text content.
3737
3838
```js
39-
assert.isAtLeast(document.querySelectorAll('label')?.[0]?.textContent?.length, 1);
39+
assert.isNotEmpty(document.querySelectorAll('label')[0]?.textContent.trim());
4040
```
4141
4242
You should give the second `label` element an appropriate text content.
4343
4444
```js
45-
assert.isAtLeast(document.querySelectorAll('label')?.[1]?.textContent?.length, 1);
45+
assert.isNotEmpty(document.querySelectorAll('label')[1]?.textContent.trim());
4646
```
4747
4848
You should give the third `label` element an appropriate text content.
4949
5050
```js
51-
assert.isAtLeast(document.querySelectorAll('label')?.[2]?.textContent?.length, 1);
51+
assert.isNotEmpty(document.querySelectorAll('label')[2]?.textContent.trim());
5252
```
5353
5454
You should give the first `input` element an `id` attribute matching the `for` attribute of the first `label`.

curriculum/challenges/english/blocks/workshop-accessibility-quiz/6143931a113bb80c45546287.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ assert.equal(document.querySelectorAll('section:nth-of-type(2) > div.question-bl
4040
You should give the first `h3` element text of `1`.
4141
4242
```js
43-
assert.equal(document.querySelectorAll('section:nth-of-type(2) > div.question-block > h3')?.[0]?.textContent, '1');
43+
assert.equal(document.querySelectorAll('section:nth-of-type(2) > div.question-block > h3')[0]?.textContent.trim(), '1');
4444
```
4545
4646
You should give the second `h3` element text of `2`.
4747
4848
```js
49-
assert.equal(document.querySelectorAll('section:nth-of-type(2) > div.question-block > h3')?.[1]?.textContent, '2');
49+
assert.equal(document.querySelectorAll('section:nth-of-type(2) > div.question-block > h3')[1]?.textContent.trim(), '2');
5050
```
5151
5252
You should nest one `fieldset` element within each `div.question-block` element.

curriculum/challenges/english/blocks/workshop-accessibility-quiz/614394fb41985e0d2012a93e.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ assert.equal(document.querySelectorAll('span')[1]?.className, 'sr-only');
4040
You should add the `span` element before the number 1 within the first `h3` element.
4141
4242
```js
43-
assert.equal(document.querySelector('span')?.nextSibling?.textContent, '1');
43+
assert.equal(document.querySelector('span')?.nextSibling?.textContent.trim(), '1');
4444
```
4545
4646
You should add the `span` element before the number 2 within the second `h3` element.
4747
4848
```js
49-
assert.equal(document.querySelectorAll('span')[1]?.nextSibling?.textContent, '2');
49+
assert.equal(document.querySelectorAll('span')[1]?.nextSibling?.textContent.trim(), '2');
5050
```
5151
5252
# --seed--

curriculum/challenges/english/blocks/workshop-accessibility-quiz/6143956ed76ed60e012faa51.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ In the second `span` element, add the text `Question`.
1616
You should give the first `span` element text of `Question`.
1717

1818
```js
19-
assert.equal(document.querySelector('h3 > span')?.textContent, 'Question');
19+
assert.equal(document.querySelector('h3 > span')?.textContent.trim(), 'Question');
2020
```
2121
2222
You should give the second `span` element text of `Question`.
2323
2424
```js
25-
assert.equal(document.querySelectorAll('h3 > span')?.[1]?.textContent, 'Question');
25+
assert.equal(document.querySelectorAll('h3 > span')[1]?.textContent.trim(), 'Question');
2626
```
2727
2828
# --seed--

curriculum/challenges/english/blocks/workshop-accessibility-quiz/6144e818fd5ea704fe56081d.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,21 @@ assert.equal(document.querySelectorAll('fieldset > ul')?.[1]?.className, 'answer
4040
You should give the first `legend` element text content.
4141
4242
```js
43-
assert.notEmpty(document.querySelectorAll('legend')?.[0]?.textContent);
43+
assert.isNotEmpty(document.querySelectorAll('legend')[0]?.textContent.trim());
4444
```
4545
4646
You should give the second `legend` element text content.
4747
4848
```js
49-
assert.notEmpty(document.querySelectorAll('legend')?.[1]?.textContent);
49+
assert.isNotEmpty(document.querySelectorAll('legend')[1]?.textContent.trim());
5050
```
5151
5252
You should not use the same text content for both `legend` elements.
5353
5454
```js
55-
assert.notEqual(document.querySelectorAll('legend')?.[0]?.textContent, document.querySelectorAll('legend')?.[1]?.textContent);
55+
const legends = document.querySelectorAll('legend');
56+
assert.lengthOf(legends, 2);
57+
assert.notEqual(legends[0]?.textContent.trim(), legends[1]?.textContent.trim());
5658
```
5759
5860
# --seed--

curriculum/challenges/english/blocks/workshop-accessibility-quiz/6145f02240ff8f09f7ec913c.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ assert.exists(document.querySelectorAll('.formrow > .question-block')?.[1]?.quer
2626
You should give the first `label` element text content.
2727
2828
```js
29-
assert.isAtLeast(document.querySelectorAll('.formrow > .question-block')?.[0]?.querySelector('label')?.textContent?.length, 1);
29+
assert.isNotEmpty(document.querySelectorAll('.formrow > .question-block')[0]?.querySelector('label')?.textContent.trim());
3030
```
3131
3232
You should give the second `label` element text content.
3333
3434
```js
35-
assert.isAtLeast(document.querySelectorAll('.formrow > .question-block')?.[1]?.querySelector('label')?.textContent?.length, 1);
35+
assert.isNotEmpty(document.querySelectorAll('.formrow > .question-block')[1]?.querySelector('label')?.textContent.trim());
3636
```
3737
3838
# --seed--

curriculum/challenges/english/blocks/workshop-accessibility-quiz/6145f14f019a4b0adb94b051.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ assert.equal(document.querySelector('div.answer > select > option:nth-child(1)')
3434
You should give the first `option` element a text content of `Select an option`.
3535
3636
```js
37-
assert.equal(document.querySelector('div.answer > select > option:nth-child(1)')?.textContent, 'Select an option');
37+
assert.equal(document.querySelector('div.answer > select > option:nth-child(1)')?.textContent.trim(), 'Select an option');
3838
```
3939
4040
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)')
4646
You should give the second `option` element a text content of `Yes`.
4747
4848
```js
49-
assert.equal(document.querySelector('div.answer > select > option:nth-child(2)')?.textContent, 'Yes');
49+
assert.equal(document.querySelector('div.answer > select > option:nth-child(2)')?.textContent.trim(), 'Yes');
5050
```
5151
5252
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)')
5858
You should give the third `option` element a text content of `No`.
5959
6060
```js
61-
assert.equal(document.querySelector('div.answer > select > option:nth-child(3)')?.textContent, 'No');
61+
assert.equal(document.querySelector('div.answer > select > option:nth-child(3)')?.textContent.trim(), 'No');
6262
```
6363
6464
You should give the `select` an attribute of `required`.

0 commit comments

Comments
 (0)