Freecodecamp: Fix Test in Override Styles Using Important

Created on 8 May 2016  路  5Comments  路  Source: freeCodeCamp/freeCodeCamp

Challenge Override All Other Styles by using Important has an issue.
User Agent is: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.94 Safari/537.36.
Please describe how to reproduce this issue, and include links to screenshots if possible.

My code:

<style>
  body {
    background-color: black;
    font-family: Monospace;
    color: green;
  }
  #orange-text {
    color: orange;
  }
  .pink-text{
    color: pink !important;
  }
  .blue-text {
    color: blue;
  }
</style>
<h1 id="orange-text" class="pink-text blue-text" style="color: white">Hello World!</h1>

I can't go to the next challenge, because I haven't completed this point:

> Your pink-text class declaration should have the !important keyword to override all other declarations.

Most helpful comment

I'm going to tweet about this tomorrow from the twitter.com/yourfirstpr account! Thanks for this issue! :)

All 5 comments

@arthurver thanks for the issue. It appears that the regex for the test needs to allow spaces between .pink-text and the bracket. The beginning of the assert test in this line is currently

"assert(code.match(/\\.pink-text\\s+\\{\\s+color: ...

But it should be changed to:

"assert(code.match(/\\.pink-text\\s*?\\{\\s+color: ...

Next time if you get stuck with a challenge, please ask questions to the Help Room first to confirm this is a bug with the site or if there is a problem with your code.

I'm going to tweet about this tomorrow from the twitter.com/yourfirstpr account! Thanks for this issue! :)

I am getting the same issue again. Not able to pass this challenge due to this bug. What to do?

@Mausamagr please create a separate issue and share the code that you have which fails.

Was this page helpful?
0 / 5 - 0 ratings