fix(curriculum): add .trim() to innerText assertions (#62806)

This commit is contained in:
Giftea ☕
2025-10-15 10:33:33 +01:00
committed by GitHub
parent d86703fce3
commit d1d3d36ea4

View File

@@ -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;