fix(curriculum): add guidance and tests for lowercase HTML tags (#61875)

This commit is contained in:
Ezoh Zhang 2025-09-22 12:16:41 +01:00 committed by GitHub
parent 428918f966
commit ae6357fe43
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 81 additions and 1 deletions

View File

@ -26,6 +26,12 @@ Your `h1` element should have an opening tag. Opening tags have this syntax: `<e
assert.exists(document.querySelector('h1'));
```
Your `h1` tags should be in lowercase. By convention, all HTML tags are written in lowercase.
```js
assert.notMatch(code, /<\/?H1>/);
```
Your `h1` element should have a closing tag. Closing tags have this syntax: `</elementName>`.
```js

View File

@ -37,6 +37,12 @@ Your `h1` element's text should be 'CatPhotoApp'. You have either omitted the te
assert.equal(document.querySelector('h1')?.innerText.toLowerCase(), 'catphotoapp');
```
Your `h2` tags should be in lowercase. By convention, all HTML tags are written in lowercase.
```js
assert.notMatch(code, /<\/?H2>/);
```
Your `h2` element should have an opening tag. Opening tags have this syntax: `<elementName>`.
```js

View File

@ -19,6 +19,12 @@ Your `p` element should have an opening tag. Opening tags have the following syn
assert.exists(document.querySelector('p'));
```
Your `p` tags should be in lowercase. By convention, all HTML tags are written in lowercase.
```js
assert.notMatch(code, /<\/?P>/);
```
Your `p` element should have a closing tag. Closing tags have a `/` just after the `<` character.
```js

View File

@ -28,6 +28,12 @@ Your `h1` element should have an opening tag. Opening tags have this syntax: `<e
assert(document.querySelector('h1'));
```
Your `h1` tags should be in lowercase. By convention, all HTML tags are written in lowercase.
```js
assert.notMatch(code, /<\/?H1>/);
```
Your `h1` element should have a closing tag. Closing tags have a `/` just after the `<` character.
```js

View File

@ -52,6 +52,12 @@ Your `h1` element's text should be `CatPhotoApp`. You have either omitted the te
assert(document.querySelector('h1').innerText.toLowerCase() === 'catphotoapp');
```
Your `h2` tags should be in lowercase. By convention, all HTML tags are written in lowercase.
```js
assert.notMatch(code, /<\/?H2>/);
```
Your `h2` element should have an opening tag. Opening tags have this syntax: `<elementName>`.
```js

View File

@ -19,6 +19,12 @@ Your `p` element should have an opening tag. Opening tags have the following syn
assert(document.querySelector('p'));
```
Your `p` tags should be in lowercase. By convention, all HTML tags are written in lowercase.
```js
assert.notMatch(code, /<\/?P>/);
```
Your `p` element should have a closing tag. Closing tags have a `/` just after the `<` character.
```js

View File

@ -28,6 +28,19 @@ Your `main` element should have an opening tag. Opening tags have this syntax: `
assert(document.querySelector('main'));
```
Your `main` tags should be in lowercase. By convention, all HTML tags are written in lowercase.
```js
const mainTagMatches = code.matchAll(/<\/?main>/gi);
for (const match of mainTagMatches) {
const tag = match[0];
assert.strictEqual(
tag,
tag.toLowerCase()
);
}
```
Your `main` element should have a closing tag. Closing tags have a `/` just after the `<` character.
```js

View File

@ -13,7 +13,7 @@ HTML, which stands for Hypertext Markup Language, is a markup language for creat
<p>Hello</p>
```
Most elements will have an opening tag and a closing tag. Sometimes those tags are referred to as start and end tags. In between those two tags, you will have the content. This content can be text or other HTML elements. Both opening and closing tags start with a left angle bracket (`<`), and end with a right angle bracket (`>`), with the tag name placed between these angle brackets. Here is a closer look at just the opening and closing paragraph tags:
Most elements will have an opening tag and a closing tag. Sometimes those tags are referred to as start and end tags. In between those two tags, you will have the content. This content can be text or other HTML elements. Both opening and closing tags start with a left angle bracket (`<`), and end with a right angle bracket (`>`), with the tag name placed between these angle brackets. While HTML tag names are case-insensitive, it is a widely accepted convention and best practice to write them in lowercase. Here is a closer look at just the opening and closing paragraph tags:
```html
<p>

View File

@ -26,6 +26,12 @@ Your `h1` element should have an opening tag. Opening tags have this syntax: `<e
assert.exists(document.querySelector('h1'));
```
Your `h1` tags should be in lowercase. By convention, all HTML tags are written in lowercase.
```js
assert.notMatch(code, /<\/?H1>/);
```
Your `h1` element should have a closing tag. Closing tags have this syntax: `</elementName>`.
```js

View File

@ -37,6 +37,12 @@ Your `h1` element's text should be 'CatPhotoApp'. You have either omitted the te
assert.equal(document.querySelector('h1')?.innerText?.trim().toLowerCase(), 'catphotoapp');
```
Your `h2` tags should be in lowercase. By convention, all HTML tags are written in lowercase.
```js
assert.notMatch(code, /<\/?H2>/);
```
Your `h2` element should have an opening tag. Opening tags have this syntax: `<elementName>`.
```js

View File

@ -19,6 +19,12 @@ Your `p` element should have an opening tag. Opening tags have the following syn
assert.exists(document.querySelector('p'));
```
Your `p` tags should be in lowercase. By convention, all HTML tags are written in lowercase.
```js
assert.notMatch(code, /<\/?P>/);
```
Your `p` element should have a closing tag. Closing tags have a `/` just after the `<` character.
```js

View File

@ -28,6 +28,19 @@ Your `main` element should have an opening tag. Opening tags have this syntax: `
assert.exists(document.querySelector('main'));
```
Your `main` tags should be in lowercase. By convention, all HTML tags are written in lowercase.
```js
const mainTagMatches = code.matchAll(/<\/?main>/gi);
for (const match of mainTagMatches) {
const tag = match[0]
assert.strictEqual(
tag,
tag.toLowerCase()
);
}
```
Your `main` element should have a closing tag. Closing tags have a `/` just after the `<` character.
```js