Creative Commons Attribution Share Alike 4.0 International
81
stars
124
forks
source link
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
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
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.\');'
}
Describe your problem and - if possible - how to reproduce it
Part of this challenge states:
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
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:
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
If possible, add a screenshot here