fix(challenge): fix broken regex (#35632)
* fix(challenge): fix broken regex * fix(challenge): update solution
This commit is contained in:
@ -23,7 +23,7 @@ It looks like a variable is being used to set the background color of the <code>
|
|||||||
```yml
|
```yml
|
||||||
tests:
|
tests:
|
||||||
- text: Your <code>.red-box</code> rule should include a fallback with the <code>background</code> set to red immediately before the existing <code>background</code> declaration.
|
- text: Your <code>.red-box</code> rule should include a fallback with the <code>background</code> set to red immediately before the existing <code>background</code> declaration.
|
||||||
testString: assert(code.match(/.red-box\s*{[^}]*background:\s*(red|#ff0000|#f00|rgb\(\s*255\s*,\s*0\s*,\s*0\s*\)|rgb\(\s*100%\s*,\s*0%\s*,\s*0%\s*\)|hsl\(\s*0\s*,\s*100%\s*,\s*50%\s*\))\s*;\s*background:\s*var\(\s*--red-color\s*\);/gi), 'Your <code>.red-box</code> rule should include a fallback with the <code>background</code> set to red immediately before the existing <code>background</code> declaration.');
|
testString: assert(code.replace(/\s/g, "").match(/\.red-box{background:(red|#ff0000|#f00|rgb\(255,0,0\)|rgb\(100%,0%,0%\)|hsl\(0,100%,50%\));background:var\(--red-color\);height:200px;width:200px;}/gi));
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -59,8 +59,19 @@ tests:
|
|||||||
<section id='solution'>
|
<section id='solution'>
|
||||||
|
|
||||||
|
|
||||||
```js
|
```html
|
||||||
var code=".red-box {background: red; background: var(--red-color);}"
|
<style>
|
||||||
|
:root {
|
||||||
|
--red-color: red;
|
||||||
|
}
|
||||||
|
.red-box {
|
||||||
|
background: red;
|
||||||
|
background: var(--red-color);
|
||||||
|
height: 200px;
|
||||||
|
width:200px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div class="red-box"></div>
|
||||||
```
|
```
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
Reference in New Issue
Block a user