mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-09-24 23:01:18 +08:00
chore(curriculum): update steps 2,8,9,10 of cat painting workshop to use specific asserts (#60823)
Co-authored-by: dev-kamil <54180588+dev-kamil@users.noreply.github.com>
This commit is contained in:
+3
-3
@@ -18,19 +18,19 @@ Instead of `static`, give your `.cat-head` a position of `relative`, and leave b
|
||||
Your `.cat-head` selector should have a `position` property set to `relative`. Make sure you add a semicolon.
|
||||
|
||||
```js
|
||||
assert(new __helpers.CSSHelp(document)?.getStyle('.cat-head')?.position === 'relative')
|
||||
assert.equal(new __helpers.CSSHelp(document)?.getStyle('.cat-head')?.position, 'relative');
|
||||
```
|
||||
|
||||
Your `.cat-head` selector should have a `top` property set to `100px`. Make sure you add a semicolon.
|
||||
|
||||
```js
|
||||
assert(new __helpers.CSSHelp(document)?.getStyle('.cat-head')?.top === '100px')
|
||||
assert.equal(new __helpers.CSSHelp(document)?.getStyle('.cat-head')?.top, '100px');
|
||||
```
|
||||
|
||||
Your `.cat-head` selector should have a `left` property set to `100px`. Make sure you add a semicolon.
|
||||
|
||||
```js
|
||||
assert(new __helpers.CSSHelp(document)?.getStyle('.cat-head')?.left === '100px')
|
||||
assert.equal(new __helpers.CSSHelp(document)?.getStyle('.cat-head')?.left, '100px');
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
+3
-3
@@ -18,21 +18,21 @@ Set the `position` property of your `.cat-head` element to `absolute`, then set
|
||||
Your `.cat-head` selector should have a `position` property set to `absolute`. Make sure you add a semicolon.
|
||||
|
||||
```js
|
||||
assert(new __helpers.CSSHelp(document)?.getStyle('.cat-head')?.position === 'absolute')
|
||||
assert.equal(new __helpers.CSSHelp(document)?.getStyle('.cat-head')?.position, 'absolute');
|
||||
```
|
||||
|
||||
Your `.cat-head` selector should have a `top` property set to any number in `px`. Make sure you add a semicolon.
|
||||
|
||||
```js
|
||||
// assert(new __helpers.CSSHelp(document)?.getStyle('.cat-head')?.top === '300px')
|
||||
assert.match(code, /top:\s*\d{1,4}px;/)
|
||||
assert.match(code, /top:\s*\d{1,4}px;/);
|
||||
```
|
||||
|
||||
Your `.cat-head` selector should have a `left` property set to any number in `px`. Make sure you add a semicolon.
|
||||
|
||||
```js
|
||||
// assert(new __helpers.CSSHelp(document)?.getStyle('.cat-head')?.left === '400px')
|
||||
assert.match(code, /left:\s*\d{1,4}px;/)
|
||||
assert.match(code, /left:\s*\d{1,4}px;/);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
+2
-2
@@ -16,13 +16,13 @@ You'll have to do some more markups to see how `fixed` positioning works. In you
|
||||
You should have a `div` element.
|
||||
|
||||
```js
|
||||
assert(document.querySelectorAll('div').length === 2);
|
||||
assert.lengthOf(document.querySelectorAll('div'), 2);
|
||||
```
|
||||
|
||||
Your `div` element should have the class `box`.
|
||||
|
||||
```js
|
||||
assert(document.querySelectorAll('div')[1]?.getAttribute('class') === 'box');
|
||||
assert.equal(document.querySelectorAll('div')[1]?.getAttribute('class'), 'box');
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
+2
-2
@@ -15,14 +15,14 @@ You should have the universal selector (`*`).
|
||||
|
||||
```js
|
||||
// assert.match(code, /\*\s*{\s*.*\s*}/)
|
||||
assert(new __helpers.CSSHelp(document).getStyle('*'))
|
||||
assert.exists(new __helpers.CSSHelp(document).getStyle('*'));
|
||||
```
|
||||
|
||||
Your universal selector should have a `box-sizing` property set to `border-box`.
|
||||
|
||||
```js
|
||||
// assert.match(code, /\*\s*{\s*box-sizing:\s*border-box;?\s*}/)
|
||||
assert(new __helpers.CSSHelp(document).getStyle('*')?.boxSizing === 'border-box')
|
||||
assert.strictEqual(new __helpers.CSSHelp(document).getStyle('*')?.boxSizing, 'border-box');
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
Reference in New Issue
Block a user