mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2025-12-19 10:07:46 -05:00
feat(curriculum): add test number enumeration (#55874)
This commit is contained in:
@@ -43,7 +43,7 @@ function TestSuite({ tests }: TestSuiteProps): JSX.Element {
|
||||
pass && !err ? t('icons.passed') : t('icons.failed');
|
||||
// Remove opening/closing <p> so screen reader will read both
|
||||
// status message and test text as one block.
|
||||
text = text.replace(/^<p>|<\/p>$/g, '');
|
||||
text = `${index + 1}. ${text.replace(/^<p>|<\/p>$/g, '')}`;
|
||||
return (
|
||||
<li
|
||||
className='test-result'
|
||||
|
||||
@@ -232,6 +232,7 @@ function* executeTests(testRunner, tests, testTimeout = 5000) {
|
||||
newTest.stack = stack;
|
||||
}
|
||||
|
||||
newTest.message = newTest.message.replace(/<p>/, `<p>${i + 1}. `);
|
||||
yield put(updateConsole(newTest.message));
|
||||
} finally {
|
||||
testResults.push(newTest);
|
||||
|
||||
@@ -13,7 +13,7 @@ const outputTexts = {
|
||||
> 1 | var
|
||||
| ^`,
|
||||
empty: `// running tests
|
||||
You should declare myName with the var keyword, ending with a semicolon
|
||||
1. You should declare myName with the var keyword, ending with a semicolon
|
||||
// tests completed`,
|
||||
passed: `// running tests
|
||||
// tests completed`
|
||||
|
||||
@@ -25,11 +25,15 @@ test.describe('Challenge Test Suite Component Tests', () => {
|
||||
await expect(page.getByTestId('test-result')).toHaveCount(3);
|
||||
await expect(page.getByText(translations.icons.initial)).toHaveCount(3);
|
||||
await expect(
|
||||
page.getByText('You should not change code above the specified comment.')
|
||||
page.getByText(
|
||||
'1. You should not change code above the specified comment.'
|
||||
)
|
||||
).toBeVisible();
|
||||
await expect(page.getByText('b should have a value of 7.')).toBeVisible();
|
||||
await expect(
|
||||
page.getByText('a should be assigned to b with =.')
|
||||
page.getByText('2. b should have a value of 7.')
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
page.getByText('3. a should be assigned to b with =.')
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user