mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-03-18 07:03:01 -04:00
fix(curriculum): add .trim() to innerText assertions (#62806)
This commit is contained in:
@@ -35,7 +35,7 @@ demoType: onClick
|
||||
You should have an `h1` element with the text `Book Inventory`.
|
||||
|
||||
```js
|
||||
assert.equal(document.querySelector('h1')?.innerText, 'Book Inventory');
|
||||
assert.equal(document.querySelector('h1')?.innerText.trim(), 'Book Inventory');
|
||||
```
|
||||
|
||||
You should have only one `h1` element.
|
||||
@@ -59,31 +59,31 @@ assert.equal(document.querySelectorAll('th')?.length, 5);
|
||||
Your first column should have the text `Title` as the heading.
|
||||
|
||||
```js
|
||||
assert.equal(document.querySelectorAll('th')[0]?.innerText, 'Title');
|
||||
assert.equal(document.querySelectorAll('th')[0]?.innerText.trim(), 'Title');
|
||||
```
|
||||
|
||||
Your second column should have the text `Author` as the heading.
|
||||
|
||||
```js
|
||||
assert.equal(document.querySelectorAll('th')[1]?.innerText, 'Author');
|
||||
assert.equal(document.querySelectorAll('th')[1]?.innerText.trim(), 'Author');
|
||||
```
|
||||
|
||||
Your third column should have the text `Category` as the heading.
|
||||
|
||||
```js
|
||||
assert.equal(document.querySelectorAll('th')[2]?.innerText, 'Category');
|
||||
assert.equal(document.querySelectorAll('th')[2]?.innerText.trim(), 'Category');
|
||||
```
|
||||
|
||||
Your fourth column should have the text `Status` as the heading.
|
||||
|
||||
```js
|
||||
assert.equal(document.querySelectorAll('th')[3]?.innerText, 'Status');
|
||||
assert.equal(document.querySelectorAll('th')[3]?.innerText.trim(), 'Status');
|
||||
```
|
||||
|
||||
Your fifth column should have the text `Rate` as the heading.
|
||||
|
||||
```js
|
||||
assert.equal(document.querySelectorAll('th')[4]?.innerText, 'Rate');
|
||||
assert.equal(document.querySelectorAll('th')[4]?.innerText.trim(), 'Rate');
|
||||
```
|
||||
|
||||
Your table should have at least four rows.
|
||||
@@ -132,7 +132,7 @@ const statusSpans = document.querySelectorAll('tr td:nth-child(4) :first-child')
|
||||
const rows = Array.from(document.querySelectorAll('tr')).slice(1);
|
||||
assert.isAbove(statusSpans.length, 0);
|
||||
for (let i = 0; i < rows.length; i++) {
|
||||
switch (statusSpans[i]?.innerText) {
|
||||
switch (statusSpans[i]?.innerText.trim()) {
|
||||
case 'Read':
|
||||
assert.isTrue(rows[i].classList.contains('read'));
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user