freeCodeCamp: Hover State of Anchor Tag Test Insufficient
Challenge Name
Issue Description
This challenge was updated recently with PR https://github.com/freeCodeCamp/freeCodeCamp/pull/13604. The second test now only requires that you change the color of the tag while hovering to blue.
The anchor tag should have a
colorof blue on hover.
This test only checks for the word blue. The instructions only ask for blue, but do not specify how it should be blue i.e. RGB? Hex code?
Proposed Changes
So I propose the regex be something like this.
- /a:hover\s*?{\s*?color:\s*?blue;\s*?}/gi
+ /a:hover\s*?{\s*?color:\s*?(blue|#0000ff|#00f)\s*;\s*?}/gi
Test Regex: https://regex101.com/r/mCY6xJ/2
Which means this line should be changed to include something like this
- code.match(/a:hover\\s*?{\\s*?color:\\s*?blue;\\s*?}/gi)
+ code.match(/a:hover\\s*?{\\s*?color:\\s*?(blue|#0000ff|#00f)\\s*;\\s*?}/gi)
Browser Information
- Browser Name, Version: Chrome 56.0.2924.87 (64-bit)
- Operating System: Linux
- Mobile, Desktop, or Tablet: Desktop
Screenshot

About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 19 (16 by maintainers)
Thanks @systimotic . I am on it,
@erictleung @systimotic @BhaveshSGupta Hello everyone, It seems jQuery doesn’t have a solution for getting css properties of
:hoverwithout triggering the hover. I was reading about this and came across this http://jsfiddle.net/3FYz6/. This vanilla JS solution seems to work. We can use this but It seems unnecessary to me to have a JS solution for this. I think we can just include the possible color values mentioned above in the regular expression and that would suffice. There’s almost no possibility of a camper trying to use some other color value.I can submit the PR with updated the regex if you guys agree.
@systimotic I think I have made a mistake here, using $(a).hover().css(color) wont work, I am still trying to figure out a solution for this.