diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css/add-a-negative-margin-to-an-element.md b/curriculum/challenges/english/01-responsive-web-design/basic-css/add-a-negative-margin-to-an-element.md index 200db3a4434..d697faf194e 100644 --- a/curriculum/challenges/english/01-responsive-web-design/basic-css/add-a-negative-margin-to-an-element.md +++ b/curriculum/challenges/english/01-responsive-web-design/basic-css/add-a-negative-margin-to-an-element.md @@ -24,7 +24,9 @@ Change the `margin` of the blue box to `-15px`, so it fills the entire horizonta Your `blue-box` class should give elements `-15px` of `margin`. ```js -assert($('.blue-box').css('margin-top') === '-15px'); +const blueBox = document.querySelector('.blue-box'); +const marginTop = window.getComputedStyle(blueBox)["margin-top"]; +assert.strictEqual(marginTop, "-15px"); ``` # --seed-- diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css/add-borders-around-your-elements.md b/curriculum/challenges/english/01-responsive-web-design/basic-css/add-borders-around-your-elements.md index 425dcfade1b..4d395b07e01 100644 --- a/curriculum/challenges/english/01-responsive-web-design/basic-css/add-borders-around-your-elements.md +++ b/curriculum/challenges/english/01-responsive-web-design/basic-css/add-borders-around-your-elements.md @@ -38,35 +38,38 @@ Remember that you can apply multiple classes to an element using its `class` att Your `img` element should have the class `smaller-image`. ```js -assert($('img').hasClass('smaller-image')); +assert.isTrue(document.querySelector('img').classList.contains('smaller-image')); ``` Your `img` element should have the class `thick-green-border`. ```js -assert($('img').hasClass('thick-green-border')); +assert.isTrue(document.querySelector('img').classList.contains('thick-green-border')); ``` Your image should have a border width of `10px`. ```js -assert( - $('img').hasClass('thick-green-border') && - parseInt($('img').css('border-top-width'), 10) >= 8 && - parseInt($('img').css('border-top-width'), 10) <= 12 -); +const image = document.querySelector('img'); +const imageBorderTopWidth = window.getComputedStyle(image)["border-top-width"]; + +assert.strictEqual(imageBorderTopWidth, "10px") ``` Your image should have a border style of `solid`. ```js -assert($('img').css('border-right-style') === 'solid'); +const image = document.querySelector('img'); +const borderRightStyle = window.getComputedStyle(image)["border-right-style"]; +assert.strictEqual(borderRightStyle, 'solid'); ``` The border around your `img` element should be green. ```js -assert($('img').css('border-left-color') === 'rgb(0, 128, 0)'); +const image = document.querySelector('img'); +const borderLeftColor = window.getComputedStyle(image)["border-left-color"]; +assert.strictEqual(borderLeftColor, 'rgb(0, 128, 0)'); ``` # --seed-- diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css/add-different-margins-to-each-side-of-an-element.md b/curriculum/challenges/english/01-responsive-web-design/basic-css/add-different-margins-to-each-side-of-an-element.md index f73e198f201..dca46c2d729 100644 --- a/curriculum/challenges/english/01-responsive-web-design/basic-css/add-different-margins-to-each-side-of-an-element.md +++ b/curriculum/challenges/english/01-responsive-web-design/basic-css/add-different-margins-to-each-side-of-an-element.md @@ -22,25 +22,33 @@ Give the blue box a `margin` of `40px` on its top and left side, but only `20px` Your `blue-box` class should give the top of elements `40px` of `margin`. ```js -assert($('.blue-box').css('margin-top') === '40px'); +const blueBox = document.querySelector('.blue-box'); +const marginTop = window.getComputedStyle(blueBox)['margin-top']; +assert.strictEqual(marginTop, '40px'); ``` Your `blue-box` class should give the right of elements `20px` of `margin`. ```js -assert($('.blue-box').css('margin-right') === '20px'); +const blueBox = document.querySelector('.blue-box'); +const marginRight = window.getComputedStyle(blueBox)['margin-right']; +assert.strictEqual(marginRight, '20px'); ``` Your `blue-box` class should give the bottom of elements `20px` of `margin`. ```js -assert($('.blue-box').css('margin-bottom') === '20px'); +const blueBox = document.querySelector('.blue-box'); +const marginBottom = window.getComputedStyle(blueBox)['margin-bottom']; +assert.strictEqual(marginBottom, '20px'); ``` Your `blue-box` class should give the left of elements `40px` of `margin`. ```js -assert($('.blue-box').css('margin-left') === '40px'); +const blueBox = document.querySelector('.blue-box'); +const marginLeft = window.getComputedStyle(blueBox)['margin-left']; +assert.strictEqual(marginLeft,'40px'); ``` # --seed-- diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css/add-different-padding-to-each-side-of-an-element.md b/curriculum/challenges/english/01-responsive-web-design/basic-css/add-different-padding-to-each-side-of-an-element.md index b0699d0fc87..2dec6f8f849 100644 --- a/curriculum/challenges/english/01-responsive-web-design/basic-css/add-different-padding-to-each-side-of-an-element.md +++ b/curriculum/challenges/english/01-responsive-web-design/basic-css/add-different-padding-to-each-side-of-an-element.md @@ -22,25 +22,33 @@ Give the blue box a `padding` of `40px` on its top and left side, but only `20px Your `blue-box` class should give the top of the elements `40px` of `padding`. ```js -assert($('.blue-box').css('padding-top') === '40px'); +const blueBox = document.querySelector('.blue-box'); +const paddingTop = window.getComputedStyle(blueBox)['padding-top']; +assert.strictEqual(paddingTop, '40px'); ``` Your `blue-box` class should give the right of the elements `20px` of `padding`. ```js -assert($('.blue-box').css('padding-right') === '20px'); +const blueBox = document.querySelector('.blue-box'); +const paddingRight = window.getComputedStyle(blueBox)['padding-right']; +assert.strictEqual(paddingRight, '20px'); ``` Your `blue-box` class should give the bottom of the elements `20px` of `padding`. ```js -assert($('.blue-box').css('padding-bottom') === '20px'); +const blueBox = document.querySelector('.blue-box'); +const paddingBottom = window.getComputedStyle(blueBox)['padding-bottom']; +assert.strictEqual(paddingBottom, '20px'); ``` Your `blue-box` class should give the left of the elements `40px` of `padding`. ```js -assert($('.blue-box').css('padding-left') === '40px'); +const blueBox = document.querySelector('.blue-box'); +const paddingLeft = window.getComputedStyle(blueBox)['padding-left']; +assert.strictEqual(paddingLeft, '40px'); ``` # --seed-- diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css/add-rounded-corners-with-border-radius.md b/curriculum/challenges/english/01-responsive-web-design/basic-css/add-rounded-corners-with-border-radius.md index 2d3899fc209..2dc240ab5a9 100644 --- a/curriculum/challenges/english/01-responsive-web-design/basic-css/add-rounded-corners-with-border-radius.md +++ b/curriculum/challenges/english/01-responsive-web-design/basic-css/add-rounded-corners-with-border-radius.md @@ -22,18 +22,23 @@ You can specify a `border-radius` with pixels. Give your cat photo a `border-rad Your image element should have the class `thick-green-border`. ```js -assert($('img').hasClass('thick-green-border')); +assert.isTrue(document.querySelector('img').classList.contains('thick-green-border')); ``` Your image should have a border radius of `10px`. ```js -assert( - $('img').css('border-top-left-radius') === '10px' && - $('img').css('border-top-right-radius') === '10px' && - $('img').css('border-bottom-left-radius') === '10px' && - $('img').css('border-bottom-right-radius') === '10px' -); +const image = document.querySelector('img'); +const style = window.getComputedStyle(image); +const borderTopLeftRadius = style['border-top-left-radius']; +const borderTopRightRadius = style['border-top-right-radius']; +const borderBottomLeftRadius = style['border-bottom-left-radius']; +const borderBottomRightRadius = style['border-bottom-right-radius']; + +assert.strictEqual(borderTopLeftRadius, '10px'); +assert.strictEqual(borderTopRightRadius, '10px'); +assert.strictEqual(borderBottomLeftRadius, '10px'); +assert.strictEqual(borderBottomRightRadius, '10px'); ``` # --seed-- diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css/adjust-the-margin-of-an-element.md b/curriculum/challenges/english/01-responsive-web-design/basic-css/adjust-the-margin-of-an-element.md index 31a48593e00..9193efffd4c 100644 --- a/curriculum/challenges/english/01-responsive-web-design/basic-css/adjust-the-margin-of-an-element.md +++ b/curriculum/challenges/english/01-responsive-web-design/basic-css/adjust-the-margin-of-an-element.md @@ -24,7 +24,9 @@ Change the `margin` of the blue box to match that of the red box. Your `blue-box` class should give elements `20px` of `margin`. ```js -assert($('.blue-box').css('margin-top') === '20px'); +const blueBox = document.querySelector('.blue-box'); +const marginTop = window.getComputedStyle(blueBox)['margin-top']; +assert.strictEqual(marginTop, '20px'); ``` # --seed-- diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css/adjust-the-padding-of-an-element.md b/curriculum/challenges/english/01-responsive-web-design/basic-css/adjust-the-padding-of-an-element.md index cbbd38c5d89..d9e67f8c56d 100644 --- a/curriculum/challenges/english/01-responsive-web-design/basic-css/adjust-the-padding-of-an-element.md +++ b/curriculum/challenges/english/01-responsive-web-design/basic-css/adjust-the-padding-of-an-element.md @@ -30,7 +30,9 @@ Change the `padding` of your blue box to match that of your red box. Your `blue-box` class should give elements `20px` of `padding`. ```js -assert($('.blue-box').css('padding-top') === '20px'); +const blueBox = document.querySelector('.blue-box'); +const paddingTop = window.getComputedStyle(blueBox)['padding-top']; +assert.strictEqual(paddingTop, '20px'); ``` # --seed-- diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css/attach-a-fallback-value-to-a-css-variable.md b/curriculum/challenges/english/01-responsive-web-design/basic-css/attach-a-fallback-value-to-a-css-variable.md index 1d49492240f..a8ed8ae6c78 100644 --- a/curriculum/challenges/english/01-responsive-web-design/basic-css/attach-a-fallback-value-to-a-css-variable.md +++ b/curriculum/challenges/english/01-responsive-web-design/basic-css/attach-a-fallback-value-to-a-css-variable.md @@ -30,21 +30,13 @@ It looks like there is a problem with the variables supplied to the `.penguin-to The fallback value of `black` should be used in the `background` property of the `penguin-top` class. ```js -assert( - code.match( - /.penguin-top\s*?{[\s\S]*background\s*?:\s*?var\(\s*?--pengiun-skin\s*?,\s*?black\s*?\)\s*?;[\s\S]*}[\s\S]*.penguin-bottom\s{/gi - ) -); +assert.match(__helpers.removeCssComments(code), /.penguin-top\s*?{[\s\S]*background\s*?:\s*?var\(\s*?--pengiun-skin\s*?,\s*?black\s*?\)\s*?;[\s\S]*}[\s\S]*.penguin-bottom\s{/gi); ``` The fallback value of `black` should be used in `background` property of the `penguin-bottom` class. ```js -assert( - code.match( - /.penguin-bottom\s*?{[\s\S]*background\s*?:\s*?var\(\s*?--pengiun-skin\s*?,\s*?black\s*?\)\s*?;[\s\S]*}/gi - ) -); +assert.match(__helpers.removeCssComments(code), /.penguin-bottom\s*?{[\s\S]*background\s*?:\s*?var\(\s*?--pengiun-skin\s*?,\s*?black\s*?\)\s*?;[\s\S]*}/gi); ``` # --seed-- diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css/change-a-variable-for-a-specific-area.md b/curriculum/challenges/english/01-responsive-web-design/basic-css/change-a-variable-for-a-specific-area.md index f27c91041d1..c8f93ef7de1 100644 --- a/curriculum/challenges/english/01-responsive-web-design/basic-css/change-a-variable-for-a-specific-area.md +++ b/curriculum/challenges/english/01-responsive-web-design/basic-css/change-a-variable-for-a-specific-area.md @@ -22,17 +22,13 @@ Change the value of `--penguin-belly` to `white` in the `penguin` class. The `penguin` class should reassign the `--penguin-belly` variable to `white`. ```js -assert( - code.match(/\.penguin\s*?{[\s\S]*--penguin-belly\s*?:\s*?white\s*?;[\s\S]*}/gi) -); +assert.match(__helpers.removeCssComments(code), /\.penguin\s*?{[\s\S]*--penguin-belly\s*?:\s*?white\s*?;[\s\S]*}/gi); ``` The `penguin` class should not contain the `background-color` property. ```js -assert( - code.match(/^((?!background-color\s*?:\s*?)[\s\S])*$/g) -); +assert.match(__helpers.removeCssComments(code), /^((?!background-color\s*?:\s*?)[\s\S])*$/g); ``` diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css/change-the-color-of-text.md b/curriculum/challenges/english/01-responsive-web-design/basic-css/change-the-color-of-text.md index 1ec9e8ca660..597cd0f5dc2 100644 --- a/curriculum/challenges/english/01-responsive-web-design/basic-css/change-the-color-of-text.md +++ b/curriculum/challenges/english/01-responsive-web-design/basic-css/change-the-color-of-text.md @@ -32,19 +32,19 @@ Change your `h2` element's style so that its text color is red. Your `h2` element should have a `style` declaration. ```js -assert($('h2').attr('style')); +assert.exists(document.querySelector('h2').getAttribute('style')); ``` Your `h2` element should have color set to `red`. ```js -assert($('h2')[0].style.color === 'red'); +assert.strictEqual(document.querySelector('h2').style.color, 'red'); ``` Your `style` declaration should end with a `;` . ```js -assert($('h2').attr('style') && $('h2').attr('style').endsWith(';')); +assert.isTrue(document.querySelector('h2').getAttribute('style').endsWith(';')); ``` # --seed-- diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css/change-the-font-size-of-an-element.md b/curriculum/challenges/english/01-responsive-web-design/basic-css/change-the-font-size-of-an-element.md index afb836e7614..aab7db5eaa7 100644 --- a/curriculum/challenges/english/01-responsive-web-design/basic-css/change-the-font-size-of-an-element.md +++ b/curriculum/challenges/english/01-responsive-web-design/basic-css/change-the-font-size-of-an-element.md @@ -26,7 +26,7 @@ Inside the same `