Skip to content

added a condition to the test to make it more flexible #52

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion exercises/07-Very-Specific-Rules/styles.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/** Insert your code here **/

/*********** READ ONLY BLOCK ******
You CAN NOT UPDATE anything from here on,
You CANNOT UPDATE anything from here on,
only add lines of code on top of this lines
**/

Expand Down
16 changes: 2 additions & 14 deletions exercises/07-Very-Specific-Rules/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ describe("All the styles should be applied", function () {
beforeEach(() => {
//here I import the HTML into the document
document.documentElement.innerHTML=html.toString();

//apply the styles from the stylesheet if needed

});
afterEach(() => {
jest.resetModules();
Expand All @@ -23,18 +21,13 @@ describe("All the styles should be applied", function () {
"head"
).innerHTML=`<style>${css.toString()}</style>`;
let cssArray=document.styleSheets[0].cssRules;

let orangeHoverSelector="";
for (let i=0; i<cssArray.length; i++) {

if (cssArray[i].selectorText==="ul li") {
if (cssArray[i].selectorText==="ul li" || cssArray[i].selectorText==="ul > li") {
orangeHoverSelector=cssArray[i].style.color;

}
expect(orangeHoverSelector).toBe("red");
}


});
it("The ul second element background should be green", function () {
document.querySelector(
Expand All @@ -44,7 +37,7 @@ describe("All the styles should be applied", function () {

let orangeHoverSelector="";
for (let i=0; i<cssArray.length; i++) {
if (cssArray[i].selectorText==="ol li:nth-child(2)") {
if (cssArray[i].selectorText==="ol li:nth-child(2)" || cssArray[i].selectorText==="ol > li:nth-child(2)" ) {
orangeHoverSelector=cssArray[i].style['background-color'];

}
Expand Down Expand Up @@ -90,9 +83,4 @@ describe("All the styles should be applied", function () {
let title = head.querySelector('title')
expect(title).not.toBe(null)
})





});
11 changes: 5 additions & 6 deletions learn.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@
"difficulty": "easy",
"video-solutions": true,
"graded": true,

"disableGrading": true,
"editor": {
"version": "1.0.73"
}

"disabledActions": ["test"],
"disableGrading": false,
"editor": {
"version": "1.0.73"
}
}