fix accessibility-quiz and reg-form tests
This commit is contained in:
committed by
Oliver Eyton-Williams
parent
32c0995e47
commit
467f0b3e78
@ -29,7 +29,7 @@ You should give the `meta` a `content` attribute of `width=device-width, initial
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
// TODO: Double-check this is the only correct answer
|
// TODO: Double-check this is the only correct answer
|
||||||
assert.equal(document.querySelectorAll('body > meta[content="width=device-width, initial-scale=1"]')?.length, 1);
|
assert.equal(document.querySelectorAll('body > meta[content="width=device-width, initial-scale=1.0"]')?.length || document.querySelectorAll('body > meta[content="width=device-width, initial-scale=1"]')?.length, 1);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
|
@ -26,25 +26,25 @@ assert.equal(new __helpers.CSSHelp(document).getStyle('address')?.textAlign, 'ce
|
|||||||
You should give `address` a `padding-top` of at least `1px`.
|
You should give `address` a `padding-top` of at least `1px`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.isAtLeast(Number(new __helpers.CSSHelp(document).getStyle('address')?.paddingTop?.replace(/\D+/, '')), 1);
|
assert.isAtLeast(Number(window.getComputedStyle(document.querySelector('address'), null)?.getPropertyValue('padding-top')?.replace(/\D\D+/, '')), 1);
|
||||||
```
|
```
|
||||||
|
|
||||||
You should give `address` a `padding-right` of at least `1px`.
|
You should give `address` a `padding-right` of at least `1px`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.isAtLeast(Number(new __helpers.CSSHelp(document).getStyle('address')?.paddingRight?.replace(/\D+/, '')), 1);
|
assert.isAtLeast(Number(window.getComputedStyle(document.querySelector('address'), null)?.getPropertyValue('padding-right')?.replace(/\D\D+/, '')), 1);
|
||||||
```
|
```
|
||||||
|
|
||||||
You should give `address` a `padding-bottom` of at least `1px`.
|
You should give `address` a `padding-bottom` of at least `1px`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.isAtLeast(Number(new __helpers.CSSHelp(document).getStyle('address')?.paddingBottom?.replace(/\D+/, '')), 1);
|
assert.isAtLeast(Number(window.getComputedStyle(document.querySelector('address'), null)?.getPropertyValue('padding-bottom')?.replace(/\D\D+/, '')), 1);
|
||||||
```
|
```
|
||||||
|
|
||||||
You should give `address` a `padding-left` of at least `1px`.
|
You should give `address` a `padding-left` of at least `1px`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.isAtLeast(Number(new __helpers.CSSHelp(document).getStyle('address')?.paddingLeft?.replace(/\D+/, '')), 1);
|
assert.isAtLeast(Number(window.getComputedStyle(document.querySelector('address'), null)?.getPropertyValue('padding-left')?.replace(/\D\D+/, '')), 1);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
|
@ -24,7 +24,7 @@ assert.exists(document.querySelector('fieldset:nth-child(3) > label + label'));
|
|||||||
You should give the `label` the text `Input your age (years): `.
|
You should give the `label` the text `Input your age (years): `.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.equal(document.querySelector('fieldset:nth-child(3) > label:nth-child(2)')?.textContent, 'Input your age (years): ');
|
assert.equal(document.querySelector('fieldset:nth-child(3) > label:nth-child(2)')?.textContent?.trim(), 'Input your age (years):');
|
||||||
```
|
```
|
||||||
|
|
||||||
You should give the `label` an `input` with `type` of `number`.
|
You should give the `label` an `input` with `type` of `number`.
|
||||||
|
@ -31,10 +31,10 @@ You should give the second `option` element the text `freeCodeCamp News`.
|
|||||||
assert.equal(document.querySelectorAll('fieldset:nth-child(3) > label:nth-child(3) option')?.[1]?.textContent, 'freeCodeCamp News');
|
assert.equal(document.querySelectorAll('fieldset:nth-child(3) > label:nth-child(3) option')?.[1]?.textContent, 'freeCodeCamp News');
|
||||||
```
|
```
|
||||||
|
|
||||||
You should give the third `option` element the text `freeCodeCamp YouTube`.
|
You should give the third `option` element the text `freeCodeCamp YouTube Channel`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.equal(document.querySelectorAll('fieldset:nth-child(3) > label:nth-child(3) option')?.[2]?.textContent, 'freeCodeCamp YouTube');
|
assert.equal(document.querySelectorAll('fieldset:nth-child(3) > label:nth-child(3) option')?.[2]?.textContent, 'freeCodeCamp YouTube Channel');
|
||||||
```
|
```
|
||||||
|
|
||||||
You should give the fourth `option` element the text `freeCodeCamp Forum`.
|
You should give the fourth `option` element the text `freeCodeCamp Forum`.
|
||||||
|
@ -130,13 +130,13 @@ textarea,
|
|||||||
select {
|
select {
|
||||||
margin: 10px 0 0 0;
|
margin: 10px 0 0 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
min-height: 2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
input, textarea {
|
input, textarea {
|
||||||
background-color: #0a0a23;
|
background-color: #0a0a23;
|
||||||
border: 1px solid #0a0a23;
|
border: 1px solid #0a0a23;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
min-height: 2em;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.inline {
|
.inline {
|
||||||
|
@ -119,13 +119,13 @@ textarea,
|
|||||||
select {
|
select {
|
||||||
margin: 10px 0 0 0;
|
margin: 10px 0 0 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
min-height: 2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
input, textarea {
|
input, textarea {
|
||||||
background-color: #0a0a23;
|
background-color: #0a0a23;
|
||||||
border: 1px solid #0a0a23;
|
border: 1px solid #0a0a23;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
min-height: 2em;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.inline {
|
.inline {
|
||||||
|
@ -116,13 +116,13 @@ textarea,
|
|||||||
select {
|
select {
|
||||||
margin: 10px 0 0 0;
|
margin: 10px 0 0 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
min-height: 2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
input, textarea {
|
input, textarea {
|
||||||
background-color: #0a0a23;
|
background-color: #0a0a23;
|
||||||
border: 1px solid #0a0a23;
|
border: 1px solid #0a0a23;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
min-height: 2em;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.inline {
|
.inline {
|
||||||
|
@ -116,13 +116,13 @@ textarea,
|
|||||||
select {
|
select {
|
||||||
margin: 10px 0 0 0;
|
margin: 10px 0 0 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
min-height: 2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
input, textarea {
|
input, textarea {
|
||||||
background-color: #0a0a23;
|
background-color: #0a0a23;
|
||||||
border: 1px solid #0a0a23;
|
border: 1px solid #0a0a23;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
min-height: 2em;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.inline {
|
.inline {
|
||||||
@ -137,7 +137,7 @@ input[type="submit"] {
|
|||||||
width: 60%;
|
width: 60%;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
height: 2em;
|
height: 2em;
|
||||||
font-size: 1.1em;
|
font-size: 1.1rem;
|
||||||
|
|
||||||
}
|
}
|
||||||
--fcc-editable-region--
|
--fcc-editable-region--
|
||||||
|
@ -119,13 +119,13 @@ textarea,
|
|||||||
select {
|
select {
|
||||||
margin: 10px 0 0 0;
|
margin: 10px 0 0 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
min-height: 2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
input, textarea {
|
input, textarea {
|
||||||
background-color: #0a0a23;
|
background-color: #0a0a23;
|
||||||
border: 1px solid #0a0a23;
|
border: 1px solid #0a0a23;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
min-height: 2em;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.inline {
|
.inline {
|
||||||
@ -140,7 +140,7 @@ input[type="submit"] {
|
|||||||
width: 60%;
|
width: 60%;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
height: 2em;
|
height: 2em;
|
||||||
font-size: 1.1em;
|
font-size: 1.1rem;
|
||||||
background-color: #3b3b4f;
|
background-color: #3b3b4f;
|
||||||
border-color: white;
|
border-color: white;
|
||||||
|
|
||||||
|
@ -118,13 +118,13 @@ textarea,
|
|||||||
select {
|
select {
|
||||||
margin: 10px 0 0 0;
|
margin: 10px 0 0 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
min-height: 2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
input, textarea {
|
input, textarea {
|
||||||
background-color: #0a0a23;
|
background-color: #0a0a23;
|
||||||
border: 1px solid #0a0a23;
|
border: 1px solid #0a0a23;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
min-height: 2em;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.inline {
|
.inline {
|
||||||
@ -138,7 +138,7 @@ input[type="submit"] {
|
|||||||
width: 60%;
|
width: 60%;
|
||||||
margin: 1em auto;
|
margin: 1em auto;
|
||||||
height: 2em;
|
height: 2em;
|
||||||
font-size: 1.1em;
|
font-size: 1.1rem;
|
||||||
background-color: #3b3b4f;
|
background-color: #3b3b4f;
|
||||||
border-color: white;
|
border-color: white;
|
||||||
min-width: 300px;
|
min-width: 300px;
|
||||||
|
@ -119,13 +119,13 @@ textarea,
|
|||||||
select {
|
select {
|
||||||
margin: 10px 0 0 0;
|
margin: 10px 0 0 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
min-height: 2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
input, textarea {
|
input, textarea {
|
||||||
background-color: #0a0a23;
|
background-color: #0a0a23;
|
||||||
border: 1px solid #0a0a23;
|
border: 1px solid #0a0a23;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
min-height: 2em;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.inline {
|
.inline {
|
||||||
@ -139,7 +139,7 @@ input[type="submit"] {
|
|||||||
width: 60%;
|
width: 60%;
|
||||||
margin: 1em auto;
|
margin: 1em auto;
|
||||||
height: 2em;
|
height: 2em;
|
||||||
font-size: 1.1em;
|
font-size: 1.1rem;
|
||||||
background-color: #3b3b4f;
|
background-color: #3b3b4f;
|
||||||
border-color: white;
|
border-color: white;
|
||||||
min-width: 300px;
|
min-width: 300px;
|
||||||
|
@ -119,13 +119,13 @@ textarea,
|
|||||||
select {
|
select {
|
||||||
margin: 10px 0 0 0;
|
margin: 10px 0 0 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
min-height: 2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
input, textarea {
|
input, textarea {
|
||||||
background-color: #0a0a23;
|
background-color: #0a0a23;
|
||||||
border: 1px solid #0a0a23;
|
border: 1px solid #0a0a23;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
min-height: 2em;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.inline {
|
.inline {
|
||||||
@ -139,7 +139,7 @@ input[type="submit"] {
|
|||||||
width: 60%;
|
width: 60%;
|
||||||
margin: 1em auto;
|
margin: 1em auto;
|
||||||
height: 2em;
|
height: 2em;
|
||||||
font-size: 1.1em;
|
font-size: 1.1rem;
|
||||||
background-color: #3b3b4f;
|
background-color: #3b3b4f;
|
||||||
border-color: white;
|
border-color: white;
|
||||||
min-width: 300px;
|
min-width: 300px;
|
||||||
@ -154,3 +154,131 @@ input[type="file"] {
|
|||||||
--fcc-editable-region--
|
--fcc-editable-region--
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
# --solutions--
|
||||||
|
|
||||||
|
```html
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>freeCodeCamp Registration Form Project</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="styles.css" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Registration Form</h1>
|
||||||
|
<p>Please fill out this form with the required information</p>
|
||||||
|
<form action='https://fcc-registration-form.com'>
|
||||||
|
<fieldset>
|
||||||
|
<label>Enter Your First Name: <input type="text" name="first-name" required /></label>
|
||||||
|
<label>Enter Your Last Name: <input type="text" name="last-name" required /></label>
|
||||||
|
<label>Enter Your Email: <input type="email" name="email" required /></label>
|
||||||
|
<label>Create a New Password: <input type="password" name="password" pattern="[a-z0-5]{8,}" required /></label>
|
||||||
|
</fieldset>
|
||||||
|
<fieldset>
|
||||||
|
<label><input type="radio" name="account-type" class="inline" /> Personal Account</label>
|
||||||
|
<label><input type="radio" name="account-type" class="inline" /> Business Account</label>
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" name="terms" class="inline" required /> I accept the <a href="https://www.freecodecamp.org/news/terms-of-service/">terms and conditions</a>
|
||||||
|
</label>
|
||||||
|
</fieldset>
|
||||||
|
<fieldset>
|
||||||
|
<label>Upload a profile picture: <input type="file" name="file" /></label>
|
||||||
|
<label>Input your age (years): <input type="number" name="age" min="13" max="120" />
|
||||||
|
</label>
|
||||||
|
<label>How did you hear about us?
|
||||||
|
<select name="referrer">
|
||||||
|
<option value="">(select one)</option>
|
||||||
|
<option value="1">freeCodeCamp News</option>
|
||||||
|
<option value="2">freeCodeCamp YouTube Channel</option>
|
||||||
|
<option value="3">freeCodeCamp Forum</option>
|
||||||
|
<option value="4">Other</option>
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
<label>Provide a bio:
|
||||||
|
<textarea name="bio" rows="3" cols="30" placeholder="I like coding on the beach..."></textarea>
|
||||||
|
</label>
|
||||||
|
</fieldset>
|
||||||
|
<input type="submit" value="Submit" />
|
||||||
|
</form>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
```
|
||||||
|
|
||||||
|
```css
|
||||||
|
body {
|
||||||
|
width: 100%;
|
||||||
|
height: 100vh;
|
||||||
|
margin: 0;
|
||||||
|
background-color: #1b1b32;
|
||||||
|
color: #f5f6f7;
|
||||||
|
font-family: Tahoma;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1, p {
|
||||||
|
margin: 1em auto;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
form {
|
||||||
|
width: 60vw;
|
||||||
|
max-width: 500px;
|
||||||
|
min-width: 300px;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding-bottom: 2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
fieldset {
|
||||||
|
border: none;
|
||||||
|
padding: 2rem 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
fieldset:not(:last-of-type) {
|
||||||
|
border-bottom: 3px solid #3b3b4f;
|
||||||
|
}
|
||||||
|
|
||||||
|
label {
|
||||||
|
display: block;
|
||||||
|
margin: 0.5rem 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
input,
|
||||||
|
textarea,
|
||||||
|
select {
|
||||||
|
margin: 10px 0 0 0;
|
||||||
|
width: 100%;
|
||||||
|
min-height: 2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
input, textarea {
|
||||||
|
background-color: #0a0a23;
|
||||||
|
border: 1px solid #0a0a23;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.inline {
|
||||||
|
width: unset;
|
||||||
|
margin: 0 0.5em 0 0;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type="submit"] {
|
||||||
|
display: block;
|
||||||
|
width: 60%;
|
||||||
|
margin: 1em auto;
|
||||||
|
height: 2em;
|
||||||
|
font-size: 1.1rem;
|
||||||
|
background-color: #3b3b4f;
|
||||||
|
border-color: white;
|
||||||
|
min-width: 300px;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type="file"] {
|
||||||
|
padding: 1px 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: #dfdfe2;
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
Reference in New Issue
Block a user