mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-09-01 15:02:09 +08:00
fix(curriculum): correct Hotel Feedback Form hint tests (#69084)
This commit is contained in:
+4
-4
@@ -23,7 +23,7 @@ Below your `h1` element, add a `p` element. The `p` element's text should be `Th
|
||||
You should have an opening `header` tag.
|
||||
|
||||
```js
|
||||
assert.match(code, /<header>/i);
|
||||
assert.exists(document.querySelector('header'));
|
||||
```
|
||||
|
||||
You should have a closing `header` tag.
|
||||
@@ -35,7 +35,7 @@ assert.match(code, /<\/header>/i);
|
||||
You should have an opening `h1` tag.
|
||||
|
||||
```js
|
||||
assert.match(code, /<h1>/i);
|
||||
assert.exists(document.querySelector('h1'));
|
||||
```
|
||||
|
||||
You should have a closing `h1` tag.
|
||||
@@ -61,7 +61,7 @@ assert.strictEqual(h1?.parentElement.tagName, 'HEADER');
|
||||
You should have an opening `p` tag.
|
||||
|
||||
```js
|
||||
assert.match(code, /<p>/i);
|
||||
assert.exists(document.querySelector('p'));
|
||||
```
|
||||
|
||||
You should have a closing `p` tag.
|
||||
@@ -88,7 +88,7 @@ Your paragraph element should come after your `h1`.
|
||||
|
||||
```js
|
||||
const pElement = document.querySelector('p');
|
||||
assert.strictEqual(pElement?.previousElementSibling.tagName, 'H1');
|
||||
assert.strictEqual(pElement?.previousElementSibling?.tagName, 'H1');
|
||||
```
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ Now, it is time to add the `main` element which represents the main content of t
|
||||
You should have an opening `main` tag.
|
||||
|
||||
```js
|
||||
assert.match(code, /<main>/i);
|
||||
assert.exists(document.querySelector('main'));
|
||||
```
|
||||
|
||||
You should have a closing `main` tag.
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ Inside your `main` element, add a `form` element with an `action` attribute set
|
||||
You should have an opening `form` tag.
|
||||
|
||||
```js
|
||||
assert.match(code, /<form.*>/i);
|
||||
assert.exists(document.querySelector('form'));
|
||||
```
|
||||
|
||||
You should have a closing `form` tag.
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ Inside your `form` element, add a `fieldset` element.
|
||||
You should have an opening `fieldset` tag.
|
||||
|
||||
```js
|
||||
assert.match(code, /<fieldset>/i);
|
||||
assert.exists(document.querySelector('fieldset'));
|
||||
```
|
||||
|
||||
You should have a closing `fieldset` tag.
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ Inside your `fieldset` element, add a `legend` element with the text `Personal I
|
||||
You should have an opening `legend` tag.
|
||||
|
||||
```js
|
||||
assert.match(code, /<legend>/);
|
||||
assert.exists(document.querySelector('legend'));
|
||||
```
|
||||
|
||||
You should have a closing `legend` tag.
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ Then below your `label` element, add an `input` element with no attributes. In t
|
||||
You should have an opening `label` tag.
|
||||
|
||||
```js
|
||||
assert.match(code, /<label.*>/);
|
||||
assert.exists(document.querySelector('label'));
|
||||
```
|
||||
|
||||
You should have a closing `label` tag.
|
||||
|
||||
+2
-1
@@ -28,7 +28,8 @@ assert.strictEqual(document.querySelector('fieldset label:nth-of-type(2)')?.inne
|
||||
Your `label` element should have a `for` attribute set to the value of `"email"`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(document.querySelector('fieldset label[for="email"]')?.getAttribute('for'), 'email');
|
||||
const emailLabel = document.querySelector('fieldset label:nth-of-type(2)');
|
||||
assert.strictEqual(emailLabel?.getAttribute('for'), 'email');
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ assert.isNotNull(document.querySelector('input[name="email"]'));
|
||||
Your `input` element should have a `required` attribute.
|
||||
|
||||
```js
|
||||
assert.strictEqual(document.querySelector('input#email')?.getAttribute('required'), "");
|
||||
assert.isTrue(document.querySelector('input#email')?.hasAttribute('required'));
|
||||
```
|
||||
|
||||
Your `input` element should have a `placeholder` attribute set to `"example@email.com"`.
|
||||
|
||||
-1
@@ -60,7 +60,6 @@ assert.exists(document.querySelector('option[value="good"]'));
|
||||
Your `option` element with the `value` of `"good"` should have the text `Good`.
|
||||
|
||||
```js
|
||||
|
||||
assert.strictEqual(document.querySelector('option[value="good"]')?.textContent.trim(), 'Good');
|
||||
```
|
||||
|
||||
|
||||
-1
@@ -63,7 +63,6 @@ assert.exists(document.querySelector('fieldset:nth-of-type(4) select#food option
|
||||
Your `option` with the `value` of `"good"` should have the text `"Good"`.
|
||||
|
||||
```js
|
||||
|
||||
assert.strictEqual(document.querySelector('fieldset:nth-of-type(4) select#food option[value="good"]')?.textContent.trim(), 'Good');
|
||||
```
|
||||
|
||||
|
||||
+4
-4
@@ -21,15 +21,15 @@ Give the name and email inputs a `size` attribute with a value of `"20"`.
|
||||
You should give the name `input` a `size` attribute with a value of `"20"`.
|
||||
|
||||
```js
|
||||
const label1 = document.querySelector('label:nth-of-type(1) + input');
|
||||
assert.strictEqual(label1?.getAttribute('size'), '20');
|
||||
const nameInput = document.querySelector('label:nth-of-type(1) + input');
|
||||
assert.strictEqual(nameInput?.getAttribute('size'), '20');
|
||||
```
|
||||
|
||||
You should give the email `input` a `size` attribute with a value of `"20"`.
|
||||
|
||||
```js
|
||||
const label2 = document.querySelector('label:nth-of-type(2) + input');
|
||||
assert.strictEqual(label2?.getAttribute('size'), '20');
|
||||
const emailInput = document.querySelector('label:nth-of-type(2) + input');
|
||||
assert.strictEqual(emailInput?.getAttribute('size'), '20');
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
Reference in New Issue
Block a user