fix(curriculum): add .trim() to innerText and textContent assertions (#62810)

This commit is contained in:
Giftea ☕
2025-10-15 23:11:54 +01:00
committed by GitHub
parent a4da6d2882
commit f6a4c48636
13 changed files with 57 additions and 57 deletions

View File

@@ -45,7 +45,7 @@ Your first new `span` element should have the text `AcmeWidgetCorp`.
```js
assert.strictEqual(
document.querySelector('.flex')?.children?.[0]?.textContent,
document.querySelector('.flex')?.children?.[0]?.textContent.trim(),
'AcmeWidgetCorp'
);
```
@@ -54,7 +54,7 @@ Your second new `span` element should have the text `Balance Sheet`.
```js
assert.strictEqual(
document.querySelector('.flex')?.children?.[1]?.textContent,
document.querySelector('.flex')?.children?.[1]?.textContent.trim(),
'Balance Sheet'
);
```

View File

@@ -28,7 +28,7 @@ Your first `span` should have the text `2019`.
```js
assert.strictEqual(
document.querySelector('div')?.children?.[0]?.textContent,
document.querySelector('div')?.children?.[0]?.textContent.trim(),
'2019'
);
```
@@ -37,7 +37,7 @@ Your second `span` should have the text `2020`.
```js
assert.strictEqual(
document.querySelector('div')?.children?.[1]?.textContent,
document.querySelector('div')?.children?.[1]?.textContent.trim(),
'2020'
);
```
@@ -46,7 +46,7 @@ Your third `span` should have the text `2021`.
```js
assert.strictEqual(
document.querySelector('div')?.children?.[2]?.textContent,
document.querySelector('div')?.children?.[2]?.textContent.trim(),
'2021'
);
```

View File

@@ -39,7 +39,7 @@ Your first `span` element should have the text `2019`.
```js
assert.strictEqual(
document.querySelectorAll('th')?.[0]?.children?.[0]?.textContent,
document.querySelectorAll('th')?.[0]?.children?.[0]?.textContent.trim(),
'2019'
);
```
@@ -48,7 +48,7 @@ Your second `span` element should have the text `2020`.
```js
assert.strictEqual(
document.querySelectorAll('th')?.[1]?.children?.[0]?.textContent,
document.querySelectorAll('th')?.[1]?.children?.[0]?.textContent.trim(),
'2020'
);
```
@@ -57,7 +57,7 @@ Your third `span` element should have the text `2021`.
```js
assert.strictEqual(
document.querySelectorAll('th')?.[2]?.children?.[0]?.textContent,
document.querySelectorAll('th')?.[2]?.children?.[0]?.textContent.trim(),
'2021'
);
```
@@ -78,7 +78,7 @@ Your `td` element should be empty.
```js
const table = document.querySelector('table');
const tableData = table.querySelectorAll('td')?.[0];
assert.strictEqual(tableData?.textContent, '');
assert.strictEqual(tableData?.textContent.trim(), '');
assert.isEmpty(tableData?.children);
```

View File

@@ -27,7 +27,7 @@ Your `th` element should have the text `Cash This is the cash we currently have
const tableBody = document.querySelector('tbody');
const tableRow = tableBody?.querySelectorAll('tr')?.[0];
assert.strictEqual(
tableRow?.querySelector('th')?.innerText,
tableRow?.querySelector('th')?.innerText.trim(),
'Cash This is the cash we currently have on hand.'
);
```
@@ -38,7 +38,7 @@ You should wrap the text `This is the cash we currently have on hand.` in a `spa
const tableBody = document.querySelector('tbody');
const tableRow = tableBody?.querySelectorAll('tr')?.[0];
assert.strictEqual(
tableRow?.querySelector('th > span')?.textContent,
tableRow?.querySelector('th > span')?.textContent.trim(),
'This is the cash we currently have on hand.'
);
```
@@ -66,7 +66,7 @@ Your first `td` element should have the text `$25`.
```js
const tableBody = document.querySelector('tbody');
const tableRow = tableBody?.querySelectorAll('tr')?.[0];
assert.strictEqual(tableRow?.querySelectorAll('td')?.[0]?.textContent, '$25');
assert.strictEqual(tableRow?.querySelectorAll('td')?.[0]?.textContent.trim(), '$25');
```
Your second `td` element should have the text `$30`.
@@ -74,7 +74,7 @@ Your second `td` element should have the text `$30`.
```js
const tableBody = document.querySelector('tbody');
const tableRow = tableBody?.querySelectorAll('tr')?.[0];
assert.strictEqual(tableRow?.querySelectorAll('td')?.[1]?.textContent, '$30');
assert.strictEqual(tableRow?.querySelectorAll('td')?.[1]?.textContent.trim(), '$30');
```
Your third `td` element should have the text `$28`.
@@ -82,7 +82,7 @@ Your third `td` element should have the text `$28`.
```js
const tableBody = document.querySelector('tbody');
const tableRow = tableBody?.querySelectorAll('tr')?.[0];
assert.strictEqual(tableRow?.querySelectorAll('td')?.[2]?.textContent, '$28');
assert.strictEqual(tableRow?.querySelectorAll('td')?.[2]?.textContent.trim(), '$28');
```
Your third `td` element should have the `class` set to `current`.

View File

@@ -27,7 +27,7 @@ Your `th` element should have the text `Checking Our primary transactional accou
const tableBody = document.querySelector('tbody');
const tableRow = tableBody?.querySelectorAll('tr')?.[1];
assert.strictEqual(
tableRow?.querySelector('th')?.innerText,
tableRow?.querySelector('th')?.innerText.trim(),
'Checking Our primary transactional account.'
);
```
@@ -38,7 +38,7 @@ You should wrap the text `Our primary transactional account.` in a `span` elemen
const tableBody = document.querySelector('tbody');
const tableRow = tableBody?.querySelectorAll('tr')?.[1];
assert.strictEqual(
tableRow?.querySelector('th > span')?.textContent,
tableRow?.querySelector('th > span')?.textContent.trim(),
'Our primary transactional account.'
);
```
@@ -66,7 +66,7 @@ Your first `td` element should have the text `$54`.
```js
const tableBody = document.querySelector('tbody');
const tableRow = tableBody?.querySelectorAll('tr')?.[1];
assert.strictEqual(tableRow?.querySelectorAll('td')?.[0]?.textContent, '$54');
assert.strictEqual(tableRow?.querySelectorAll('td')?.[0]?.textContent.trim(), '$54');
```
Your second `td` element should have the text `$56`.
@@ -74,7 +74,7 @@ Your second `td` element should have the text `$56`.
```js
const tableBody = document.querySelector('tbody');
const tableRow = tableBody?.querySelectorAll('tr')?.[1];
assert.strictEqual(tableRow?.querySelectorAll('td')?.[1]?.textContent, '$56');
assert.strictEqual(tableRow?.querySelectorAll('td')?.[1]?.textContent.trim(), '$56');
```
Your third `td` element should have the text `$53`.
@@ -82,7 +82,7 @@ Your third `td` element should have the text `$53`.
```js
const tableBody = document.querySelector('tbody');
const tableRow = tableBody?.querySelectorAll('tr')?.[1];
assert.strictEqual(tableRow?.querySelectorAll('td')?.[2]?.textContent, '$53');
assert.strictEqual(tableRow?.querySelectorAll('td')?.[2]?.textContent.trim(), '$53');
```
Your third `td` element should have the `class` set to `current`.

View File

@@ -27,7 +27,7 @@ Your `th` element should have the text `Savings Funds set aside for emergencies.
const tableBody = document.querySelector('tbody');
const tableRow = tableBody?.querySelectorAll('tr')?.[2];
assert.strictEqual(
tableRow?.querySelector('th')?.innerText,
tableRow?.querySelector('th')?.innerText.trim(),
'Savings Funds set aside for emergencies.'
);
```
@@ -38,7 +38,7 @@ You should wrap the text `Funds set aside for emergencies.` in a `span` element.
const tableBody = document.querySelector('tbody');
const tableRow = tableBody?.querySelectorAll('tr')?.[2];
assert.strictEqual(
tableRow?.querySelector('th > span')?.textContent,
tableRow?.querySelector('th > span')?.textContent.trim(),
'Funds set aside for emergencies.'
);
```
@@ -66,7 +66,7 @@ Your first `td` element should have the text `$500`.
```js
const tableBody = document.querySelector('tbody');
const tableRow = tableBody?.querySelectorAll('tr')?.[2];
assert.strictEqual(tableRow?.querySelectorAll('td')?.[0]?.textContent, '$500');
assert.strictEqual(tableRow?.querySelectorAll('td')?.[0]?.textContent.trim(), '$500');
```
Your second `td` element should have the text `$650`.
@@ -74,7 +74,7 @@ Your second `td` element should have the text `$650`.
```js
const tableBody = document.querySelector('tbody');
const tableRow = tableBody?.querySelectorAll('tr')?.[2];
assert.strictEqual(tableRow?.querySelectorAll('td')?.[1]?.textContent, '$650');
assert.strictEqual(tableRow?.querySelectorAll('td')?.[1]?.textContent.trim(), '$650');
```
Your third `td` element should have the text `$728`.
@@ -82,7 +82,7 @@ Your third `td` element should have the text `$728`.
```js
const tableBody = document.querySelector('tbody');
const tableRow = tableBody?.querySelectorAll('tr')?.[2];
assert.strictEqual(tableRow?.querySelectorAll('td')?.[2]?.textContent, '$728');
assert.strictEqual(tableRow?.querySelectorAll('td')?.[2]?.textContent.trim(), '$728');
```
Your third `td` element should have the `class` set to `current`.

View File

@@ -39,7 +39,7 @@ Your first `span` element should have the text `2019`.
```js
const table = document.querySelectorAll('table')?.[1];
const th = table.querySelectorAll('th')?.[0];
assert.strictEqual(th.children?.[0]?.textContent, '2019');
assert.strictEqual(th.children?.[0]?.textContent.trim(), '2019');
```
Your second `span` element should have the text `2020`.
@@ -47,7 +47,7 @@ Your second `span` element should have the text `2020`.
```js
const table = document.querySelectorAll('table')?.[1];
const th = table.querySelectorAll('th')?.[1];
assert.strictEqual(th?.children?.[0]?.textContent, '2020');
assert.strictEqual(th?.children?.[0]?.textContent.trim(), '2020');
```
Your third `span` element should have the text `2021`.
@@ -55,7 +55,7 @@ Your third `span` element should have the text `2021`.
```js
const table = document.querySelectorAll('table')?.[1];
const th = table.querySelectorAll('th')?.[2];
assert.strictEqual(th?.children?.[0]?.textContent, '2021');
assert.strictEqual(th?.children?.[0]?.textContent.trim(), '2021');
```
Your `td` element should be empty.
@@ -63,7 +63,7 @@ Your `td` element should be empty.
```js
const table = document.querySelectorAll('table')?.[1];
const td = table.querySelectorAll('td')?.[0];
assert.strictEqual(td?.textContent, '');
assert.strictEqual(td?.textContent.trim(), '');
assert.lengthOf(td?.children, 0);
```

View File

@@ -29,7 +29,7 @@ const table = document.querySelectorAll('table')?.[1];
const tbody = table?.querySelector('tbody');
const tableRow = tbody?.querySelectorAll('tr')?.[0];
assert.strictEqual(
tableRow?.querySelector('th')?.innerText,
tableRow?.querySelector('th')?.innerText.trim(),
'Loans The outstanding balance on our startup loan.'
);
```
@@ -41,7 +41,7 @@ const table = document.querySelectorAll('table')?.[1];
const tbody = table?.querySelector('tbody');
const tableRow = tbody?.querySelectorAll('tr')?.[0];
assert.strictEqual(
tableRow?.querySelector('th > span')?.textContent,
tableRow?.querySelector('th > span')?.textContent.trim(),
'The outstanding balance on our startup loan.'
);
```
@@ -72,7 +72,7 @@ Your first `td` element should have the text `$500`.
const table = document.querySelectorAll('table')?.[1];
const tbody = table?.querySelector('tbody');
const tableRow = tbody?.querySelectorAll('tr')?.[0];
assert.strictEqual(tableRow?.querySelectorAll('td')?.[0]?.textContent, '$500');
assert.strictEqual(tableRow?.querySelectorAll('td')?.[0]?.textContent.trim(), '$500');
```
Your second `td` element should have the text `$250`.
@@ -81,7 +81,7 @@ Your second `td` element should have the text `$250`.
const table = document.querySelectorAll('table')?.[1];
const tbody = table?.querySelector('tbody');
const tableRow = tbody?.querySelectorAll('tr')?.[0];
assert.strictEqual(tableRow?.querySelectorAll('td')?.[1]?.textContent, '$250');
assert.strictEqual(tableRow?.querySelectorAll('td')?.[1]?.textContent.trim(), '$250');
```
Your third `td` element should have the text `$0`.
@@ -90,7 +90,7 @@ Your third `td` element should have the text `$0`.
const table = document.querySelectorAll('table')?.[1];
const tbody = table?.querySelector('tbody');
const tableRow = tbody?.querySelectorAll('tr')?.[0];
assert.strictEqual(tableRow?.querySelectorAll('td')?.[2]?.textContent, '$0');
assert.strictEqual(tableRow?.querySelectorAll('td')?.[2]?.textContent.trim(), '$0');
```
Your third `td` element should have the `class` set to `current`.

View File

@@ -29,7 +29,7 @@ const table = document.querySelectorAll('table')?.[1];
const tbody = table?.querySelector('tbody');
const tableRow = tbody?.querySelectorAll('tr')?.[1];
assert.strictEqual(
tableRow?.querySelector('th')?.innerText,
tableRow?.querySelector('th')?.innerText.trim(),
'Expenses Annual anticipated expenses, such as payroll.'
);
```
@@ -41,7 +41,7 @@ const table = document.querySelectorAll('table')?.[1];
const tbody = table?.querySelector('tbody');
const tableRow = tbody?.querySelectorAll('tr')?.[1];
assert.strictEqual(
tableRow?.querySelector('th > span')?.textContent,
tableRow?.querySelector('th > span')?.textContent.trim(),
'Annual anticipated expenses, such as payroll.'
);
```
@@ -72,7 +72,7 @@ Your first `td` element should have the text `$200`.
const table = document.querySelectorAll('table')?.[1];
const tbody = table?.querySelector('tbody');
const tableRow = tbody?.querySelectorAll('tr')?.[1];
assert.strictEqual(tableRow?.querySelectorAll('td')?.[0]?.textContent, '$200');
assert.strictEqual(tableRow?.querySelectorAll('td')?.[0]?.textContent.trim(), '$200');
```
Your second `td` element should have the text `$300`.
@@ -81,7 +81,7 @@ Your second `td` element should have the text `$300`.
const table = document.querySelectorAll('table')?.[1];
const tbody = table?.querySelector('tbody');
const tableRow = tbody?.querySelectorAll('tr')?.[1];
assert.strictEqual(tableRow?.querySelectorAll('td')?.[1]?.textContent, '$300');
assert.strictEqual(tableRow?.querySelectorAll('td')?.[1]?.textContent.trim(), '$300');
```
Your third `td` element should have the text `$400`.
@@ -90,7 +90,7 @@ Your third `td` element should have the text `$400`.
const table = document.querySelectorAll('table')?.[1];
const tbody = table?.querySelector('tbody');
const tableRow = tbody?.querySelectorAll('tr')?.[1];
assert.strictEqual(tableRow?.querySelectorAll('td')?.[2]?.textContent, '$400');
assert.strictEqual(tableRow?.querySelectorAll('td')?.[2]?.textContent.trim(), '$400');
```
Your third `td` element should have the `class` set to `current`.

View File

@@ -29,7 +29,7 @@ const table = document.querySelectorAll('table')?.[1];
const tbody = table?.querySelector('tbody');
const tableRow = tbody?.querySelectorAll('tr')?.[2];
assert.strictEqual(
tableRow?.querySelector('th')?.innerText,
tableRow?.querySelector('th')?.innerText.trim(),
'Credit The outstanding balance on our credit card.'
);
```
@@ -41,7 +41,7 @@ const table = document.querySelectorAll('table')?.[1];
const tbody = table?.querySelector('tbody');
const tableRow = tbody?.querySelectorAll('tr')?.[2];
assert.strictEqual(
tableRow?.querySelector('th > span')?.textContent,
tableRow?.querySelector('th > span')?.textContent.trim(),
'The outstanding balance on our credit card.'
);
```
@@ -72,7 +72,7 @@ Your first `td` element should have the text `$50`.
const table = document.querySelectorAll('table')?.[1];
const tbody = table?.querySelector('tbody');
const tableRow = tbody?.querySelectorAll('tr')?.[2];
assert.strictEqual(tableRow?.querySelectorAll('td')?.[0]?.textContent, '$50');
assert.strictEqual(tableRow?.querySelectorAll('td')?.[0]?.textContent.trim(), '$50');
```
Your second `td` element should have the text `$50`.
@@ -81,7 +81,7 @@ Your second `td` element should have the text `$50`.
const table = document.querySelectorAll('table')?.[1];
const tbody = table?.querySelector('tbody');
const tableRow = tbody?.querySelectorAll('tr')?.[2];
assert.strictEqual(tableRow?.querySelectorAll('td')?.[1]?.textContent, '$50');
assert.strictEqual(tableRow?.querySelectorAll('td')?.[1]?.textContent.trim(), '$50');
```
Your third `td` element should have the text `$75`.
@@ -90,7 +90,7 @@ Your third `td` element should have the text `$75`.
const table = document.querySelectorAll('table')?.[1];
const tbody = table?.querySelector('tbody');
const tableRow = tbody?.querySelectorAll('tr')?.[2];
assert.strictEqual(tableRow?.querySelectorAll('td')?.[2]?.textContent, '$75');
assert.strictEqual(tableRow?.querySelectorAll('td')?.[2]?.textContent.trim(), '$75');
```
Your third `td` element should have the `class` set to `current`.

View File

@@ -29,7 +29,7 @@ const table = document.querySelectorAll('table')?.[1];
const tbody = table?.querySelector('tbody');
const tableRow = tbody?.querySelectorAll('tr')?.[3];
assert.strictEqual(
tableRow?.querySelector('th')?.innerText,
tableRow?.querySelector('th')?.innerText.trim(),
'Total Liabilities'
);
```
@@ -41,7 +41,7 @@ const table = document.querySelectorAll('table')?.[1];
const tbody = table?.querySelector('tbody');
const tableRow = tbody?.querySelectorAll('tr')?.[3];
assert.strictEqual(
tableRow?.querySelector('th > span')?.textContent,
tableRow?.querySelector('th > span')?.textContent.trim(),
'Liabilities'
);
```
@@ -72,7 +72,7 @@ Your first `td` element should have the text `$750`.
const table = document.querySelectorAll('table')?.[1];
const tbody = table?.querySelector('tbody');
const tableRow = tbody?.querySelectorAll('tr')?.[3];
assert.strictEqual(tableRow?.querySelectorAll('td')?.[0]?.textContent, '$750');
assert.strictEqual(tableRow?.querySelectorAll('td')?.[0]?.textContent.trim(), '$750');
```
Your second `td` element should have the text `$600`.
@@ -81,7 +81,7 @@ Your second `td` element should have the text `$600`.
const table = document.querySelectorAll('table')?.[1];
const tbody = table?.querySelector('tbody');
const tableRow = tbody?.querySelectorAll('tr')?.[3];
assert.strictEqual(tableRow?.querySelectorAll('td')?.[1]?.textContent, '$600');
assert.strictEqual(tableRow?.querySelectorAll('td')?.[1]?.textContent.trim(), '$600');
```
Your third `td` element should have the text `$475`.
@@ -90,7 +90,7 @@ Your third `td` element should have the text `$475`.
const table = document.querySelectorAll('table')?.[1];
const tbody = table?.querySelector('tbody');
const tableRow = tbody?.querySelectorAll('tr')?.[3];
assert.strictEqual(tableRow?.querySelectorAll('td')?.[2]?.textContent, '$475');
assert.strictEqual(tableRow?.querySelectorAll('td')?.[2]?.textContent.trim(), '$475');
```
Your third `td` element should have the `class` set to `current`.

View File

@@ -66,7 +66,7 @@ Your first `span` element should have the text `2019`.
```js
const table = document.querySelectorAll('table')?.[2];
const thead = table.querySelectorAll('th')?.[0];
assert.strictEqual(thead?.children?.[0]?.textContent, '2019');
assert.strictEqual(thead?.children?.[0]?.textContent.trim(), '2019');
```
Your second `span` element should have the text `2020`.
@@ -74,7 +74,7 @@ Your second `span` element should have the text `2020`.
```js
const table = document.querySelectorAll('table')?.[2];
const thead = table.querySelectorAll('th')?.[1];
assert.strictEqual(thead?.children?.[0]?.textContent, '2020');
assert.strictEqual(thead?.children?.[0]?.textContent.trim(), '2020');
```
Your third `span` element should have the text `2021`.
@@ -82,7 +82,7 @@ Your third `span` element should have the text `2021`.
```js
const table = document.querySelectorAll('table')?.[2];
const thead = table.querySelectorAll('th')?.[2];
assert.strictEqual(thead?.children?.[0]?.textContent, '2021');
assert.strictEqual(thead?.children?.[0]?.textContent.trim(), '2021');
```
Your `td` element should be empty.
@@ -90,7 +90,7 @@ Your `td` element should be empty.
```js
const table = document.querySelectorAll('table')?.[2];
const tableData = table?.querySelectorAll('td')?.[0];
assert.strictEqual(tableData?.textContent, '');
assert.strictEqual(tableData?.textContent.trim(), '');
assert.isTrue(tableData?.children?.length === 0);
```

View File

@@ -44,7 +44,7 @@ Your `th` element should have the text `Total Net Worth`.
const table = document.querySelectorAll('table')?.[2];
const tbody = table?.querySelector('tbody');
const tableRow = tbody?.querySelectorAll('tr')?.[0];
assert.strictEqual(tableRow?.querySelector('th')?.innerText, 'Total Net Worth');
assert.strictEqual(tableRow?.querySelector('th')?.innerText.trim(), 'Total Net Worth');
```
You should wrap the text `Net Worth` in a `span` element.
@@ -54,7 +54,7 @@ const table = document.querySelectorAll('table')?.[2];
const tbody = table?.querySelector('tbody');
const tableRow = tbody?.querySelectorAll('tr')?.[0];
assert.strictEqual(
tableRow?.querySelector('th > span')?.textContent,
tableRow?.querySelector('th > span')?.textContent.trim(),
'Net Worth'
);
```
@@ -85,7 +85,7 @@ Your first `td` element should have the text `$-171`.
const table = document.querySelectorAll('table')?.[2];
const tbody = table?.querySelector('tbody');
const tableRow = tbody?.querySelectorAll('tr')?.[0];
assert.strictEqual(tableRow?.querySelectorAll('td')?.[0]?.textContent, '$-171');
assert.strictEqual(tableRow?.querySelectorAll('td')?.[0]?.textContent.trim(), '$-171');
```
Your second `td` element should have the text `$136`.
@@ -94,7 +94,7 @@ Your second `td` element should have the text `$136`.
const table = document.querySelectorAll('table')?.[2];
const tbody = table?.querySelector('tbody');
const tableRow = tbody?.querySelectorAll('tr')?.[0];
assert.strictEqual(tableRow?.querySelectorAll('td')?.[1]?.textContent, '$136');
assert.strictEqual(tableRow?.querySelectorAll('td')?.[1]?.textContent.trim(), '$136');
```
Your third `td` element should have the text `$334`.
@@ -103,7 +103,7 @@ Your third `td` element should have the text `$334`.
const table = document.querySelectorAll('table')?.[2];
const tbody = table?.querySelector('tbody');
const tableRow = tbody?.querySelectorAll('tr')?.[0];
assert.strictEqual(tableRow?.querySelectorAll('td')?.[2]?.textContent, '$334');
assert.strictEqual(tableRow?.querySelectorAll('td')?.[2]?.textContent.trim(), '$334');
```
Your third `td` element should have the `class` set to `current`.