Skip to content
This repository has been archived by the owner on Sep 25, 2019. It is now read-only.

Give a Background Color to a Div Element - missing test allows challenge to pass without creating silver-background class to change background of div to silver per instructions #254

Closed
RandellDawson opened this issue Aug 15, 2018 · 2 comments · Fixed by #258

Comments

@RandellDawson
Copy link
Member

Describe your problem and - if possible - how to reproduce it

Part of this challenge states:

Create a class called silver-background with the background-color of silver.

There is currently not a test which validates a class name of silver-background is defined which specifies the background-color property's value to be silver. The current tests only check:

  1. That the existing div element's class attribute value is "silver-background".
  2. That the final background color of the div element is silver.

Because it does not validate the class name of silver-background is define correctly, the following code will pass the test. I commented the line in the style section below which allows user to pass challenge incorrectly

<link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<style>
  .red-text {
    color: red;
  }

  h2 {
    font-family: Lobster, monospace;
  }

  p {
    font-size: 16px;
    font-family: monospace;
  }

  .thick-green-border {
    border-color: green;
    border-width: 10px;
    border-style: solid;
    border-radius: 50%;
  }

  .smaller-image {
    width: 100px;
  }

  div { /* This should not pass the tests */
    background-color: silver;
  }
</style>

<h2 class="red-text">CatPhotoApp</h2>
<main>
  <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p>
  
  <a href="#"><img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
  
  <div class="silver-background">
    <p>Things cats love:</p>
    <ul>
      <li>cat nip</li>
      <li>laser pointers</li>
      <li>lasagna</li>
    </ul>
    <p>Top 3 things cats hate:</p>
    <ol>
      <li>flea treatment</li>
      <li>thunder</li>
      <li>other cats</li>
    </ol>
  </div>
  
  <form action="/submit-cat-photo">
    <label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
    <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br>
    <label><input type="checkbox" name="personality" checked> Loving</label>
    <label><input type="checkbox" name="personality"> Lazy</label>
    <label><input type="checkbox" name="personality"> Energetic</label><br>
    <input type="text" placeholder="cat photo URL" required>
    <button type="submit">Submit</button>
  </form>
</main>

Partial Solution: I have not worked enough with test program to know how to best write the actual regex expression to make this check, but I have created the framework for the needed 3rd test below:

{
    text: "Define a class named <code>silver-background</code> within the <code>style</code> element and assign the value of <code>silver</code> to the <code>background-color</code> property.",
    testString: 'assert(Some Regex Expression to go here), \'Define a class named <code>silver-background</code> within the <code>style</code> element and assign the value of <code>silver</code> to the <code>background-color</code> property.\');'
}

Add a Link to the page with the problem

https://learn.freecodecamp.org/responsive-web-design/basic-css/give-a-background-color-to-a-div-element/

Tell us about your browser and operating system

  • Browser Name: Chrome
  • Browser Version: Version 67.0.3396.99 (Official Build) (64-bit)
  • Operating System: Windows 8.1

If possible, add a screenshot here

image

@Nirajn2311
Copy link
Member

I’ll work on it.

raisedadead pushed a commit that referenced this issue Sep 20, 2018
# [3.2.0](v3.1.2...v3.2.0) (2018-09-20)

### Bug Fixes

* **challenges:** a sentence didn't make sense, so I modified it ([3d77920](3d77920)), closes [#18046](https://github.com/freeCodeCamp/curriculum/issues/18046)
* **challenges:** add missing test to check for for css class ([6e42f53](6e42f53)), closes [#254](#254)
* **challenges:** add note at bottom of description in d3 challenge ([c60d332](c60d332)), closes [#17767](https://github.com/freeCodeCamp/curriculum/issues/17767)
* **challenges:** add solution, test to project euler problems ([f572324](f572324))
* **challenges:** add solutions to first 3 debugging challenges ([c2e5794](c2e5794))
* **challenges:** add test to check user is using \W in Regex ([296cf44](296cf44))
* **challenges:** add test to lookahead regex challenge ([e044de4](e044de4)), closes [#209](#209)
* **challenges:** added code tags ([065036b](065036b)), closes [#18054](https://github.com/freeCodeCamp/curriculum/issues/18054)
* **challenges:** added solutions to project euler problems 28, 31 ([5e12499](5e12499))
* **challenges:** adding code tags to description ([57d5b55](57d5b55)), closes [#17911](https://github.com/freeCodeCamp/curriculum/issues/17911)
* **challenges:** adding negative integer to challenge to improve tests ([#211](#211)) ([2adc516](2adc516))
* **challenges:** allow user to comment out undesired code ([72c2407](72c2407))
* **challenges:** challenge description is formatted and concised ([dcd8e45](dcd8e45))
* **challenges:** change challengeType to fix help button ([ddcc661](ddcc661))
* **challenges:** change definition of complementary colors ([#299](#299)) ([c022dff](c022dff))
* **challenges:** check for shorthand character in regex ([#238](#238)) ([0bf8d32](0bf8d32))
* **challenges:** commented output was wrong ([3cb972e](3cb972e))
* **challenges:** converts delete html test to regex ([d80d98d](d80d98d)), closes [#251](#251)
* **challenges:** corrected challenge instructions ([159203a](159203a))
* **challenges:** fix [#17155](https://github.com/freeCodeCamp/curriculum/issues/17155) ([cb21e59](cb21e59))
* **challenges:** fix confusing destructuring es6 challenge ([1a4f6a8](1a4f6a8)), closes [#213](#213)
* **challenges:** fix description in css variable fallback challenge ([bc33a03](bc33a03)), closes [freeCodeCamp/freeCodeCamp#17546](freeCodeCamp/freeCodeCamp#17546)
* **challenges:** fix flex direction row regex ([25ea07e](25ea07e)), closes [#260](#260)
* **challenges:** fix grammar and spelling errors ([#244](#244)) ([b0c0b74](b0c0b74))
* **challenges:** fix grid-gap shorthand regex ([#232](#232)) ([a49f45e](a49f45e)), closes [#229](#229)
* **challenges:** fix grid-gap shorthand regex ([#237](#237)) ([b369fa0](b369fa0)), closes [#229](#229)
* **challenges:** fix regex in a JS challenge ([#257](#257)) ([6058da3](6058da3))
* **challenges:** fix typo in wrap-reverse description ([434ea5c](434ea5c))
* **challenges:** fixed challenge accepted without any new code ([96b39c1](96b39c1)), closes [#198](#198)
* **challenges:** fixed esc chars in managing packages with npm lesson ([6335a15](6335a15))
* **challenges:** fixed tests to check for pre operators ([ded4705](ded4705)), closes [#199](#199)
* **challenges:** fixed typo in algorithms and ds ([31957a4](31957a4))
* **challenges:** Incorrect html closing tag ([a1464f0](a1464f0))
* **challenges:** insufficient objectives for javascript_algorithm/es6/19 ([7707b18](7707b18))
* **challenges:** missing space in code example ([c50cc4e](c50cc4e))
* **challenges:** remove race condition from react lifecycle challenge ([a20ac56](a20ac56))
* **challenges:** removed duplicate css top property ([0a79c58](0a79c58))
* **challenges:** rephrased wording in applied visual design ([#268](#268)) ([d560d58](d560d58))
* **challenges:** replaced em tags with code tags ([68daaf7](68daaf7)), closes [#18048](https://github.com/freeCodeCamp/curriculum/issues/18048)
* **challenges:** reword test text and improve test accuracy ([f834a98](f834a98))
* **challenges:** small edit to correct sematic issues ([322bf80](322bf80))
* clickjacking challenge description ([037990c](037990c))
* **challenges:** spelling and grammar errors addressed ([8f17adf](8f17adf))
* **challenges:** typo ([4f7faba](4f7faba))
* **challenges:** update test and add solution for DS challenge ([d1b2075](d1b2075)), closes [#164](#164)
* **challenges:** Update test to include whitespace ([#272](#272)) ([77689f4](77689f4)), closes [#271](#271)
* **schema:** change schema and unpack script ([b014b23](b014b23))

### Features

* **challenges:** add browser fallback challenge ([b090e8b](b090e8b)), closes [freeCodeCamp/freeCodeCamp#17546](freeCodeCamp/freeCodeCamp#17546)
@raisedadead
Copy link
Member

🎉 This issue has been resolved in version 3.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

beaucarnes pushed a commit to beaucarnes/curriculum that referenced this issue Sep 20, 2018
# [3.2.0](freeCodeCamp/curriculum@v3.1.2...v3.2.0) (2018-09-20)

### Bug Fixes

* **challenges:** a sentence didn't make sense, so I modified it ([3d77920](freeCodeCamp@3d77920)), closes [#18046](https://github.com/freeCodeCamp/curriculum/issues/18046)
* **challenges:** add missing test to check for for css class ([6e42f53](freeCodeCamp@6e42f53)), closes [freeCodeCamp#254](freeCodeCamp#254)
* **challenges:** add note at bottom of description in d3 challenge ([c60d332](freeCodeCamp@c60d332)), closes [#17767](https://github.com/freeCodeCamp/curriculum/issues/17767)
* **challenges:** add solution, test to project euler problems ([f572324](freeCodeCamp@f572324))
* **challenges:** add solutions to first 3 debugging challenges ([c2e5794](freeCodeCamp@c2e5794))
* **challenges:** add test to check user is using \W in Regex ([296cf44](freeCodeCamp@296cf44))
* **challenges:** add test to lookahead regex challenge ([e044de4](freeCodeCamp@e044de4)), closes [freeCodeCamp#209](freeCodeCamp#209)
* **challenges:** added code tags ([065036b](freeCodeCamp@065036b)), closes [#18054](https://github.com/freeCodeCamp/curriculum/issues/18054)
* **challenges:** added solutions to project euler problems 28, 31 ([5e12499](freeCodeCamp@5e12499))
* **challenges:** adding code tags to description ([57d5b55](freeCodeCamp@57d5b55)), closes [#17911](https://github.com/freeCodeCamp/curriculum/issues/17911)
* **challenges:** adding negative integer to challenge to improve tests ([freeCodeCamp#211](freeCodeCamp#211)) ([2adc516](freeCodeCamp@2adc516))
* **challenges:** allow user to comment out undesired code ([72c2407](freeCodeCamp@72c2407))
* **challenges:** challenge description is formatted and concised ([dcd8e45](freeCodeCamp@dcd8e45))
* **challenges:** change challengeType to fix help button ([ddcc661](freeCodeCamp@ddcc661))
* **challenges:** change definition of complementary colors ([freeCodeCamp#299](freeCodeCamp#299)) ([c022dff](freeCodeCamp@c022dff))
* **challenges:** check for shorthand character in regex ([freeCodeCamp#238](freeCodeCamp#238)) ([0bf8d32](freeCodeCamp@0bf8d32))
* **challenges:** commented output was wrong ([3cb972e](freeCodeCamp@3cb972e))
* **challenges:** converts delete html test to regex ([d80d98d](freeCodeCamp@d80d98d)), closes [freeCodeCamp#251](freeCodeCamp#251)
* **challenges:** corrected challenge instructions ([159203a](freeCodeCamp@159203a))
* **challenges:** fix [#17155](https://github.com/freeCodeCamp/curriculum/issues/17155) ([cb21e59](freeCodeCamp@cb21e59))
* **challenges:** fix confusing destructuring es6 challenge ([1a4f6a8](freeCodeCamp@1a4f6a8)), closes [freeCodeCamp#213](freeCodeCamp#213)
* **challenges:** fix description in css variable fallback challenge ([bc33a03](freeCodeCamp@bc33a03)), closes [freeCodeCamp/freeCodeCamp#17546](freeCodeCamp/freeCodeCamp#17546)
* **challenges:** fix flex direction row regex ([25ea07e](freeCodeCamp@25ea07e)), closes [freeCodeCamp#260](freeCodeCamp#260)
* **challenges:** fix grammar and spelling errors ([freeCodeCamp#244](freeCodeCamp#244)) ([b0c0b74](freeCodeCamp@b0c0b74))
* **challenges:** fix grid-gap shorthand regex ([freeCodeCamp#232](freeCodeCamp#232)) ([a49f45e](freeCodeCamp@a49f45e)), closes [freeCodeCamp#229](freeCodeCamp#229)
* **challenges:** fix grid-gap shorthand regex ([freeCodeCamp#237](freeCodeCamp#237)) ([b369fa0](freeCodeCamp@b369fa0)), closes [freeCodeCamp#229](freeCodeCamp#229)
* **challenges:** fix regex in a JS challenge ([freeCodeCamp#257](freeCodeCamp#257)) ([6058da3](freeCodeCamp@6058da3))
* **challenges:** fix typo in wrap-reverse description ([434ea5c](freeCodeCamp@434ea5c))
* **challenges:** fixed challenge accepted without any new code ([96b39c1](freeCodeCamp@96b39c1)), closes [freeCodeCamp#198](freeCodeCamp#198)
* **challenges:** fixed esc chars in managing packages with npm lesson ([6335a15](freeCodeCamp@6335a15))
* **challenges:** fixed tests to check for pre operators ([ded4705](freeCodeCamp@ded4705)), closes [freeCodeCamp#199](freeCodeCamp#199)
* **challenges:** fixed typo in algorithms and ds ([31957a4](freeCodeCamp@31957a4))
* **challenges:** Incorrect html closing tag ([a1464f0](freeCodeCamp@a1464f0))
* **challenges:** insufficient objectives for javascript_algorithm/es6/19 ([7707b18](freeCodeCamp@7707b18))
* **challenges:** missing space in code example ([c50cc4e](freeCodeCamp@c50cc4e))
* **challenges:** remove race condition from react lifecycle challenge ([a20ac56](freeCodeCamp@a20ac56))
* **challenges:** removed duplicate css top property ([0a79c58](freeCodeCamp@0a79c58))
* **challenges:** rephrased wording in applied visual design ([freeCodeCamp#268](freeCodeCamp#268)) ([d560d58](freeCodeCamp@d560d58))
* **challenges:** replaced em tags with code tags ([68daaf7](freeCodeCamp@68daaf7)), closes [#18048](https://github.com/freeCodeCamp/curriculum/issues/18048)
* **challenges:** reword test text and improve test accuracy ([f834a98](freeCodeCamp@f834a98))
* **challenges:** small edit to correct sematic issues ([322bf80](freeCodeCamp@322bf80))
* clickjacking challenge description ([037990c](freeCodeCamp@037990c))
* **challenges:** spelling and grammar errors addressed ([8f17adf](freeCodeCamp@8f17adf))
* **challenges:** typo ([4f7faba](freeCodeCamp@4f7faba))
* **challenges:** update test and add solution for DS challenge ([d1b2075](freeCodeCamp@d1b2075)), closes [freeCodeCamp#164](freeCodeCamp#164)
* **challenges:** Update test to include whitespace ([freeCodeCamp#272](freeCodeCamp#272)) ([77689f4](freeCodeCamp@77689f4)), closes [freeCodeCamp#271](freeCodeCamp#271)
* **schema:** change schema and unpack script ([b014b23](freeCodeCamp@b014b23))

### Features

* **challenges:** add browser fallback challenge ([b090e8b](freeCodeCamp@b090e8b)), closes [freeCodeCamp/freeCodeCamp#17546](freeCodeCamp/freeCodeCamp#17546)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants