From 748212f99c2df021f23122cf1063aefa9f2d9886 Mon Sep 17 00:00:00 2001 From: Ron Sogueco Date: Wed, 13 Mar 2019 13:54:59 -0400 Subject: [PATCH] fix: Test fails with comments (#35079) * fix: Test fails with comments * fix: Account for last line of code * fix: false positive for padding clockwise notation * fix: false positive for commented blue-box class * fix: use same assertion as #35342 * fix: update Solution section * fix: update last test for margin/padding challenges --- ...pecify-the-margin-of-an-element.english.md | 2 +- ...ecify-the-padding-of-an-element.english.md | 41 +++++++++++++++++-- 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css/use-clockwise-notation-to-specify-the-margin-of-an-element.english.md b/curriculum/challenges/english/01-responsive-web-design/basic-css/use-clockwise-notation-to-specify-the-margin-of-an-element.english.md index 691d5e411c..863f8f0f14 100644 --- a/curriculum/challenges/english/01-responsive-web-design/basic-css/use-clockwise-notation-to-specify-the-margin-of-an-element.english.md +++ b/curriculum/challenges/english/01-responsive-web-design/basic-css/use-clockwise-notation-to-specify-the-margin-of-an-element.english.md @@ -32,7 +32,7 @@ tests: - text: Your blue-box class should give the left of elements 40px of margin. testString: assert($(".blue-box").css("margin-left") === "40px"); - text: You should use the clockwise notation to set the margin of blue-box class. - testString: const removeCssComments = str => str.replace(/\/\*[\s\S]+?\*\//g, '');assert(/\.blue-box\s*{[\s\S]*margin:\s*\d+px\s+\d+px\s+\d+px\s+\d+px(;[\s\S]*}|\s*)/.test(removeCssComments($('style').text()))); + testString: const removeCssComments = str => str.replace(/\/\*[\s\S]+?\*\//g, '');assert(/\.blue-box\s*{[\s\S]*margin[\s]*:\s*\d+px\s+\d+px\s+\d+px\s+\d+px(;\s*[^}]+\s*}|;?\s*})/.test(removeCssComments($('style').text()))); ``` diff --git a/curriculum/challenges/english/01-responsive-web-design/basic-css/use-clockwise-notation-to-specify-the-padding-of-an-element.english.md b/curriculum/challenges/english/01-responsive-web-design/basic-css/use-clockwise-notation-to-specify-the-padding-of-an-element.english.md index cc954a4874..956ed43ec4 100644 --- a/curriculum/challenges/english/01-responsive-web-design/basic-css/use-clockwise-notation-to-specify-the-padding-of-an-element.english.md +++ b/curriculum/challenges/english/01-responsive-web-design/basic-css/use-clockwise-notation-to-specify-the-padding-of-an-element.english.md @@ -31,7 +31,7 @@ tests: - text: Your blue-box class should give the left of elements 40px of padding. testString: assert($(".blue-box").css("padding-left") === "40px", 'Your blue-box class should give the left of elements 40px of padding.'); - text: You should use the clockwise notation to set the padding of blue-box class. - testString: assert(!/padding-top|padding-right|padding-bottom|padding-left/.test(code), 'You should use the clockwise notation to set the padding of blue-box class.'); + testString: const removeCssComments = str => str.replace(/\/\*[\s\S]+?\*\//g, '');assert(/\.blue-box\s*{[\s\S]*padding[\s]*:\s*\d+px\s+\d+px\s+\d+px\s+\d+px(;\s*[^}]+\s*}|;?\s*})/.test(removeCssComments($('style').text()))); ``` @@ -89,7 +89,42 @@ tests: ## Solution
-```js -// solution required +```html + +
margin
+ +
+
padding
+
padding
+
```