FreeCodeCamp ― Test Does Not Recognize Correct Solution

This bug report discusses a code challenge on FreeCodeCamp.org that does not appear to be working correctly. When submitting the clearly expected answer the site rejects this answer and does not credit the user for a correct response.

The bug does not impact use of other challenges on the site, but prevents a user from fully completing one section of the free curriculum. This occurred using the Google Chrome browser on several devices. Other browsers were not tried.

Project Information

This issue was reported on the project owners repository here.
UPDATE: While doing a second pass of due diligence in the project's backlog I found this issue which raises the same behavior. However, the proposed solution did not work for me so I decided to go ahead and share what I already learned and had written up in the hopes that increased visibility might lead to an improved solution.

I understand that may make this post ineligible or lower quality as a Utopian contribution. That's a secondary concern. I'm hopeful that the information still proves useful to the project itself.

Expected behavior

When a correct solution to the exercise is entered in the code pane all the tests pass and the site acknowledges that the lesson is complete.

image.png

The instructions for this lesson read "[a]dd a height property to the h4 tag and set it to 25px." Thus the following code should pass. But does not.

<style>
  h4 {
    text-align: center;
    height: 25px;
  }
  p {
    text-align: justify;
  }
  .links {
    margin-right: 20px;
    text-align: left;
  }
  .fullCard {
    width: 245px;
    border: 1px solid #ccc;
    border-radius: 5px;
    margin: 10px 5px;
    padding: 4px;
  }
  .cardContent {
    padding: 10px;
  }
</style>
<div class="fullCard">
  <div class="cardContent">
    <h4>Google</h4>
    <div class="cardText">
      <p>Google was founded by Larry Page and Sergey Brin while they were Ph.D. students at Stanford University.</p>
    </div>
    <div class="cardLinks">
      <a href="https://en.wikipedia.org/wiki/Larry_Page" target="_blank" class="links">Larry Page</a>
      <a href="https://en.wikipedia.org/wiki/Sergey_Brin" target="_blank" class="links">Sergey Brin</a>
    </div>
  </div>
</div>

Actual behavior

When the code above is tested, the lesson unit tests fail and report as follows:

// running tests
Your code should change the h4 height property to a value of 25 pixels.
// tests completed

First impression investigation of cause

It may be that the default user-agent style sheet is slightly modifying the final computed height value of the applicable element, causing the causing the actual height not to match the expected `height in the following described test.

freeCodeCamp/curriculum/challenges/english/01-responsive-web-design/applied-visual-design/adjust-the-height-of-an-element-using-the-height-property.english.md

tests:
  - text: Your code should change the <code>h4</code> heightcode> property to a value of 25 pixels.
    testString: assert($('h4').css('height') == '25px', 'Your code should change the h4 height property to a value of 25 pixels.');

On inspection the computed value does come close to 25px. But it is not exact:

Screenshot 2018-12-11 at 18.22.35.png

How to reproduce

Operating system: Chrome OS v. 70.0.3538.110

  1. Navigate to https://learn.freecodecamp.org/responsive-web-design/applied-visual-design/adjust-the-height-of-an-element-using-the-height-property
  2. On line 4 of the code pane modify the h4 style by inserting height: 25px;
  3. Click the 'Run the Tests' button or press CTRL + ENTER to run the tests
  4. The tests should pass but don't.

Recording Of The Bug

free-code-camp-bug-1.gif
Link to full video: https://www.useloom.com/share/4895543830444027b427f067e76c6d1c

image.png
Inset view of code change

GitHub Account

https://github.com/tdreid
@tdre on the Steem blockchain

H2
H3
H4
Upload from PC
Video gallery
3 columns
2 columns
1 column
6 Comments