From 683104fc758e7e94aefa9091ac4593aa57e6600e Mon Sep 17 00:00:00 2001 From: ErnestoXG Date: Wed, 3 Aug 2022 22:37:51 +0000 Subject: [PATCH 01/32] added missing solution and test files --- exercises/04.3-id-Selector/solution.hide.html | 0 exercises/04.3-id-Selector/test.js | 0 exercises/05-Specificity/solution.hide.css | 0 exercises/06-Practicing-Rules/solution.hide.css | 0 exercises/07-Very-Specific-Rules/solution.hide.css | 0 exercises/08-Rounded-Image/solution.hide.css | 0 exercises/09-Anchor-Styles/solution.hide.css | 0 exercises/10-Your-Own-Font/solution.hide.css | 0 exercises/12-Relative-Length-EM-REM/solution.hide.css | 0 exercises/13-Anchor-Like-Button/solution.hide.css | 0 10 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 exercises/04.3-id-Selector/solution.hide.html create mode 100644 exercises/04.3-id-Selector/test.js create mode 100644 exercises/05-Specificity/solution.hide.css create mode 100644 exercises/06-Practicing-Rules/solution.hide.css create mode 100644 exercises/07-Very-Specific-Rules/solution.hide.css create mode 100644 exercises/08-Rounded-Image/solution.hide.css create mode 100644 exercises/09-Anchor-Styles/solution.hide.css create mode 100644 exercises/10-Your-Own-Font/solution.hide.css create mode 100644 exercises/12-Relative-Length-EM-REM/solution.hide.css create mode 100644 exercises/13-Anchor-Like-Button/solution.hide.css diff --git a/exercises/04.3-id-Selector/solution.hide.html b/exercises/04.3-id-Selector/solution.hide.html new file mode 100644 index 00000000..e69de29b diff --git a/exercises/04.3-id-Selector/test.js b/exercises/04.3-id-Selector/test.js new file mode 100644 index 00000000..e69de29b diff --git a/exercises/05-Specificity/solution.hide.css b/exercises/05-Specificity/solution.hide.css new file mode 100644 index 00000000..e69de29b diff --git a/exercises/06-Practicing-Rules/solution.hide.css b/exercises/06-Practicing-Rules/solution.hide.css new file mode 100644 index 00000000..e69de29b diff --git a/exercises/07-Very-Specific-Rules/solution.hide.css b/exercises/07-Very-Specific-Rules/solution.hide.css new file mode 100644 index 00000000..e69de29b diff --git a/exercises/08-Rounded-Image/solution.hide.css b/exercises/08-Rounded-Image/solution.hide.css new file mode 100644 index 00000000..e69de29b diff --git a/exercises/09-Anchor-Styles/solution.hide.css b/exercises/09-Anchor-Styles/solution.hide.css new file mode 100644 index 00000000..e69de29b diff --git a/exercises/10-Your-Own-Font/solution.hide.css b/exercises/10-Your-Own-Font/solution.hide.css new file mode 100644 index 00000000..e69de29b diff --git a/exercises/12-Relative-Length-EM-REM/solution.hide.css b/exercises/12-Relative-Length-EM-REM/solution.hide.css new file mode 100644 index 00000000..e69de29b diff --git a/exercises/13-Anchor-Like-Button/solution.hide.css b/exercises/13-Anchor-Like-Button/solution.hide.css new file mode 100644 index 00000000..e69de29b From dbbb23158c97950124093004a6a4596978f476cc Mon Sep 17 00:00:00 2001 From: ErnestoXG Date: Wed, 3 Aug 2022 22:53:08 +0000 Subject: [PATCH 02/32] added solution to file --- exercises/04.3-id-Selector/solution.hide.html | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/exercises/04.3-id-Selector/solution.hide.html b/exercises/04.3-id-Selector/solution.hide.html index e69de29b..a7964559 100644 --- a/exercises/04.3-id-Selector/solution.hide.html +++ b/exercises/04.3-id-Selector/solution.hide.html @@ -0,0 +1,13 @@ + + + + + + 04.3 ID selector + + + + + I should look like a button + + From e2ab5947dda428539cbae8a6d33f7ff7544c54d7 Mon Sep 17 00:00:00 2001 From: ErnestoXG Date: Wed, 3 Aug 2022 22:53:39 +0000 Subject: [PATCH 03/32] added tests to file to check for id name and if span exists --- exercises/04.3-id-Selector/test.js | 32 ++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/exercises/04.3-id-Selector/test.js b/exercises/04.3-id-Selector/test.js index e69de29b..9277e129 100644 --- a/exercises/04.3-id-Selector/test.js +++ b/exercises/04.3-id-Selector/test.js @@ -0,0 +1,32 @@ +const fs = require('fs'); +const path = require('path'); +const html = fs.readFileSync(path.resolve(__dirname, './index.html'), 'utf8'); +document.documentElement.innerHTML = html.toString(); + +jest.dontMock('fs'); + +const span = document.querySelector("span"); +const link = document.querySelector("link"); + +test("There should be a span tag", ()=>{ + expect(span).toBeTruthy() +}) +test("The span tag should have id 'button1'", ()=>{ + let id = span.id + expect(id).toBe('button1') +}); +test("The span tag should not contain any inline style", ()=>{ + let emptyBodyInlineStyle = {}; + expect(span.style._values).toEqual(emptyBodyInlineStyle); +}); + +test("You should not change the existing head tag elements", ()=>{ + let head = document.querySelector('head') + expect(head).toBeTruthy() + + let meta = head.querySelector("meta") + expect(meta).toBe(null) + + const href = link.getAttribute("href") + expect(href).toBe('./styles.css') + }); \ No newline at end of file From 76db85ea49b2baa961ae1665be4a0f5aaff4e7d6 Mon Sep 17 00:00:00 2001 From: ErnestoXG Date: Wed, 3 Aug 2022 23:48:34 +0000 Subject: [PATCH 04/32] added solution file --- exercises/05-Specificity/solution.hide.css | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/exercises/05-Specificity/solution.hide.css b/exercises/05-Specificity/solution.hide.css index e69de29b..13374f70 100644 --- a/exercises/05-Specificity/solution.hide.css +++ b/exercises/05-Specificity/solution.hide.css @@ -0,0 +1,11 @@ +ul li { + background: blue; +} + +#thirditem { + background: yellow; +} +/****** DON NOT EDIT ANYTHING ABOVE THIS LINE ****/ +#thirditem { + background: green !important; +} From 1d99ba2853293078fc211db05c4d85aab8d3282a Mon Sep 17 00:00:00 2001 From: ErnestoXG Date: Wed, 3 Aug 2022 23:48:49 +0000 Subject: [PATCH 05/32] improved tests --- exercises/05-Specificity/tests.js | 57 +++++++++++++------------------ 1 file changed, 24 insertions(+), 33 deletions(-) diff --git a/exercises/05-Specificity/tests.js b/exercises/05-Specificity/tests.js index e58651a4..9e6d52d6 100644 --- a/exercises/05-Specificity/tests.js +++ b/exercises/05-Specificity/tests.js @@ -1,61 +1,52 @@ -const fs=require("fs"); -const path=require("path"); -const html=fs.readFileSync(path.resolve(__dirname, "./index.html"), "utf8"); -const css=fs.readFileSync(path.resolve(__dirname, "./styles.css"), "utf8"); +const fs = require('fs'); +const path = require('path'); +const html = fs.readFileSync(path.resolve(__dirname, './index.html'), 'utf8'); +const css = fs.readFileSync(path.resolve(__dirname, "./styles.css"), "utf8"); +document.documentElement.innerHTML = html.toString(); -jest.dontMock("fs"); +jest.dontMock('fs'); describe("All the styles should be applied", function () { - beforeEach(() => { - //here I import the HTML into the document - document.documentElement.innerHTML=html.toString(); - }); - afterEach(() => { - jest.resetModules(); - }); - - - it("You should not change the existing head tag elements", function () { + test("You should not change the existing head tag elements", function () { let head = document.querySelector('head') expect(head).toBeTruthy() - + let meta = head.querySelector("meta") expect(meta).not.toBe(null) - + const pathname = new URL(document.querySelector('link').href).pathname expect(pathname).toBe('/styles.css') - + let title = head.querySelector('title') expect(title).not.toBe(null) }) - it("You should not delete or edit the existing code", function () { + + test("You should not delete or edit the existing code", function () { document.querySelector( "head" - ).innerHTML=``; - let cssArray=document.styleSheets[0].cssRules[0].selectorText; - // console.log("cssArray:",cssArray) - let cssArrayBackground= document.styleSheets[0].cssRules[0].style.background - console.log("back:",cssArrayBackground) - let thirdItSelector=document.styleSheets[0].cssRules[1].selectorText; + ).innerHTML = ``; + let cssArray = document.styleSheets[0].cssRules[0].selectorText; + let cssArrayBackground = document.styleSheets[0].cssRules[0].style.background + console.log("back:", cssArrayBackground) + let thirdItSelector = document.styleSheets[0].cssRules[1].selectorText; let thirdItBackground = document.styleSheets[0].cssRules[1].style.background expect(thirdItSelector).toBe("#thirditem"); expect(thirdItBackground).toBe("yellow"); expect(cssArray).toBe("ul li"); expect(cssArrayBackground).toBe("blue"); }) - it("You should use a more specific rule using the !important annotation ", function () { + test("You should use a more specific rule using the !important annotation ", function () { document.querySelector( "head" - ).innerHTML=``; - let cssArray=document.styleSheets[0].cssRules; - // console.log("NEW", cssArray[2].style._importants) - let orangeHoverSelector=""; - for (let i=0; i${css.toString()}`; + let cssArray = document.styleSheets[0].cssRules; + let orangeHoverSelector = ""; + for (let i = 0; i < cssArray.length; i++) { + if (cssArray[i].selectorText === "#thirditem" && cssArray[i].style._importants.background === "important") { + orangeHoverSelector = cssArray[i].style.background; } } From dcfad06eb9a790990b6bdbf3af59d7280cdcdbcf Mon Sep 17 00:00:00 2001 From: ErnestoXG Date: Thu, 4 Aug 2022 00:40:23 +0000 Subject: [PATCH 06/32] added solution --- .../06-Practicing-Rules/solution.hide.css | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/exercises/06-Practicing-Rules/solution.hide.css b/exercises/06-Practicing-Rules/solution.hide.css index e69de29b..d1e24e3c 100644 --- a/exercises/06-Practicing-Rules/solution.hide.css +++ b/exercises/06-Practicing-Rules/solution.hide.css @@ -0,0 +1,26 @@ +/* add your styles here */ +body { + background: url("../../.learn/assets/background-vertical.jpg?raw=true") repeat-y; + font-family: "Times New Roman"; + padding-left: 20px; +} + +#id1 { + background: rgba(255, 255, 255, 0.2); + padding: 5px; +} + +h1 { + font-family: "Courier"; + color: red; + text-align: center; +} + +h2 { + text-decoration: underline; +} + +a:hover { + color: green; + text-decoration: none; +} From 7cc4d9fa49e24a6af25b401d09e4e77cf3478ea1 Mon Sep 17 00:00:00 2001 From: ErnestoXG Date: Thu, 4 Aug 2022 00:43:00 +0000 Subject: [PATCH 07/32] improved tests and fixed minor issues --- exercises/06-Practicing-Rules/tests.js | 150 ++++++++++++------------- 1 file changed, 70 insertions(+), 80 deletions(-) diff --git a/exercises/06-Practicing-Rules/tests.js b/exercises/06-Practicing-Rules/tests.js index ae40b996..5c2e9903 100644 --- a/exercises/06-Practicing-Rules/tests.js +++ b/exercises/06-Practicing-Rules/tests.js @@ -1,148 +1,138 @@ -const fs=require("fs"); -const path=require("path"); -const html=fs.readFileSync(path.resolve(__dirname, "./index.html"), "utf8"); -const css=fs.readFileSync(path.resolve(__dirname, "./styles.css"), "utf8"); +const fs = require('fs'); +const path = require('path'); +const html = fs.readFileSync(path.resolve(__dirname, './index.html'), 'utf8'); +const css = fs.readFileSync(path.resolve(__dirname, "./styles.css"), "utf8"); +document.documentElement.innerHTML = html.toString(); -jest.dontMock("fs"); +jest.dontMock('fs'); -describe("All the styles should be applied", function () { - beforeEach(() => { - //here I import the HTML into the document - document.documentElement.innerHTML=html.toString(); +describe("All the styles should be applied", ()=> { + let meta = document.querySelector("meta") + let link = document.querySelector("link") + let title = document.querySelector('title') - // apply the styles from the stylesheet if needed - - }); - afterEach(() => { - jest.resetModules(); - }); - - - - it("the background should match", function () { + test("the background should match", ()=> { document.querySelector( "head" - ).innerHTML=``; - let body=document.querySelector("body"); - let styles=window.getComputedStyle(body); + ).innerHTML = ``; + let body = document.querySelector("body"); + let styles = window.getComputedStyle(body); expect(styles["background"]).toBe( `url(../../.learn/assets/background-vertical.jpg?raw=true) repeat-y` ); }); - it("the font-family should be 'Times New Roman'", function () { + test("the font-family should be 'Times New Roman'", ()=> { document.querySelector( "head" - ).innerHTML=``; - let body=document.querySelector("body"); - let styles=window.getComputedStyle(body); - expect(styles["font-family"]).toBe("Times New Roman"); + ).innerHTML = ``; + let body = document.querySelector("body"); + let styles = window.getComputedStyle(body); + expect(styles["font-family"]).toBe("\"Times New Roman\""); }); - it("the padding-left should be '20px'", function () { + test("the padding-left should be '20px'", ()=> { document.querySelector( "head" - ).innerHTML=``; - let body=document.querySelector("body"); - let styles=window.getComputedStyle(body); + ).innerHTML = ``; + let body = document.querySelector("body"); + let styles = window.getComputedStyle(body); expect(styles["padding-left"]).toBe("20px"); }); - it("the font-family in the H1 Tag should be 'Courier'", function () { + test("the font-family in the H1 Tag should be 'Courier'", ()=> { document.querySelector( "head" - ).innerHTML=``; - let h1Tag=document.querySelector("h1"); - let h1TagStyles=window.getComputedStyle(h1Tag); + ).innerHTML = ``; + let h1Tag = document.querySelector("h1"); + let h1TagStyles = window.getComputedStyle(h1Tag); // get computed styles of any element you like - expect(h1TagStyles["font-family"]).toBe("Courier"); + expect(h1TagStyles["font-family"]).toBe("\"Courier\""); }); - it("the color in the H1 Tag should be 'red'", function () { + test("the color in the H1 Tag should be 'red'", ()=> { document.querySelector( "head" - ).innerHTML=``; - let h1Tag=document.querySelector("h1"); - let h1TagStyles=window.getComputedStyle(h1Tag); + ).innerHTML = ``; + let h1Tag = document.querySelector("h1"); + let h1TagStyles = window.getComputedStyle(h1Tag); // get computed styles of any element you like expect(h1TagStyles["color"]).toBe("red"); }); - it("the text-align in the H1 Tag should be 'center'", function () { + test("the text-align in the H1 Tag should be 'center'", ()=> { document.querySelector( "head" - ).innerHTML=``; - let h1Tag=document.querySelector("h1"); - let h1TagStyles=window.getComputedStyle(h1Tag); + ).innerHTML = ``; + let h1Tag = document.querySelector("h1"); + let h1TagStyles = window.getComputedStyle(h1Tag); // get computed styles of any element you like expect(h1TagStyles["text-align"]).toBe("center"); }); - it("the text-decoration in the H2 Tag should be 'underline'", function () { + test("the text-decoration in the H2 Tag should be 'underline'", ()=> { document.querySelector( "head" - ).innerHTML=``; + ).innerHTML = ``; // get computed styles of any element you like - const h2Tag=document.querySelector("h2"); - let h2TagStyles=window.getComputedStyle(h2Tag); + const h2Tag = document.querySelector("h2"); + let h2TagStyles = window.getComputedStyle(h2Tag); expect(h2TagStyles["text-decoration"]).toBe("underline"); }); - it("the padding in the #id1 Tag should be '5px'", function () { + test("the padding in the #id1 Tag should be '5px'", ()=> { document.querySelector( "head" - ).innerHTML=``; + ).innerHTML = ``; // get computed styles of any element you like - const idTag=document.querySelector("#id1"); - let idTagStyles=window.getComputedStyle(idTag); + const idTag = document.querySelector("#id1"); + let idTagStyles = window.getComputedStyle(idTag); expect(idTagStyles["padding"]).toBe("5px"); }); - it("the background-color in the #id1 Tag should be 'semi transparent white'", function () { + test("the background-color in the #id1 Tag should be 'semi transparent white'", ()=> { document.querySelector( "head" - ).innerHTML=``; + ).innerHTML = ``; // get computed styles of any element you like - const idTag=document.querySelector("#id1"); - let idTagStyles=window.getComputedStyle(idTag); + const idTag = document.querySelector("#id1"); + let idTagStyles = window.getComputedStyle(idTag); console.log("$$$:", idTagStyles) expect(idTagStyles["background-color"]).toBe("rgba(255, 255, 255, 0.2)"); }); - it("The a hover underline should be removed", function () { + test("The a hover underline should be removed", ()=> { document.querySelector( "head" - ).innerHTML=``; - let cssArray=document.styleSheets[0].cssRules; + ).innerHTML = ``; + let cssArray = document.styleSheets[0].cssRules; // console.log("$$$:", cssArray) - let orangeHoverSelector=""; - for (let i=0; i< cssArray.length; i++) { + if (cssArray[i].selectorText === "a:hover") { + orangeHoverSelector = cssArray[i].style['text-decoration']; console.log("$$$:", orangeHoverSelector) } } expect(orangeHoverSelector).toBe("none"); }); - it("The a hover color should be green", function () { + test("The a hover color should be green", ()=> { document.querySelector( "head" - ).innerHTML=``; + ).innerHTML = ``; - let cssArray=document.styleSheets[0].cssRules; + let cssArray = document.styleSheets[0].cssRules; console.log("$$$:", cssArray[0]) - let orangeHoverSelector=""; - for (let i=0; i< cssArray.length; i++) { + if (cssArray[i].selectorText === "a:hover") { + orangeHoverSelector = cssArray[i].style.color; } } expect(orangeHoverSelector).toBe('green'); }); - it("You should not change the existing head tag elements", function () { + test("You should not change the existing head tag elements", ()=> { let head = document.querySelector('head') expect(head).toBeTruthy() - - let meta = head.querySelector("meta") - expect(meta).not.toBe(null) - - const pathname = new URL(document.querySelector('link').href).pathname - expect(pathname).toBe('/styles.css') - - let title = head.querySelector('title') - expect(title).not.toBe(null) + + expect(meta).toBeTruthy() + + let pathname = link.getAttribute("href") + expect(pathname).toBe('./styles.css') + + expect(title).toBeTruthy() }) }); From 9e629d73d45ff2eb032dc390aede164a584cfbf0 Mon Sep 17 00:00:00 2001 From: ErnestoXG Date: Thu, 4 Aug 2022 15:29:26 +0000 Subject: [PATCH 08/32] added solution --- .../07-Very-Specific-Rules/solution.hide.css | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/exercises/07-Very-Specific-Rules/solution.hide.css b/exercises/07-Very-Specific-Rules/solution.hide.css index e69de29b..eb60fcfa 100644 --- a/exercises/07-Very-Specific-Rules/solution.hide.css +++ b/exercises/07-Very-Specific-Rules/solution.hide.css @@ -0,0 +1,25 @@ +/** Insert your code here **/ +ul li { + color: red; +} + +ol li:nth-child(2) { + background-color: green; +} + +tr:nth-child(odd) { + background: yellow; +} +/*********** READ ONLY BLOCK ****** +You CANNOT UPDATE anything from here on, +only add lines of code on top of this lines +**/ + +body { + color: blue; +} + +ul li, +ol li { + color: green; +} From 67b25638673e82fb8c220c2b1a34ef256e4b6a84 Mon Sep 17 00:00:00 2001 From: ErnestoXG Date: Thu, 4 Aug 2022 15:30:01 +0000 Subject: [PATCH 09/32] fixed minor errors and improved test format --- exercises/07-Very-Specific-Rules/tests.js | 101 ++++++++++------------ 1 file changed, 47 insertions(+), 54 deletions(-) diff --git a/exercises/07-Very-Specific-Rules/tests.js b/exercises/07-Very-Specific-Rules/tests.js index 9cdd774c..10b24a7e 100644 --- a/exercises/07-Very-Specific-Rules/tests.js +++ b/exercises/07-Very-Specific-Rules/tests.js @@ -1,86 +1,79 @@ -const fs=require("fs"); -const path=require("path"); -const html=fs.readFileSync(path.resolve(__dirname, "./index.html"), "utf8"); -const css=fs.readFileSync(path.resolve(__dirname, "./styles.css"), "utf8"); +const fs = require('fs'); +const path = require('path'); +const html = fs.readFileSync(path.resolve(__dirname, './index.html'), 'utf8'); +const css = fs.readFileSync(path.resolve(__dirname, "./styles.css"), "utf8"); +document.documentElement.innerHTML = html.toString(); -jest.dontMock("fs"); +jest.dontMock('fs'); -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(); - }); - - - it("The ul li color has to be red", function () { +describe("All the styles should be applied", ()=>{ + const meta = document.querySelector("meta") + const title = document.querySelector('title') + const link = document.querySelector('link') + + test("The ul li color has to be red", ()=>{ document.querySelector( "head" - ).innerHTML=``; - let cssArray=document.styleSheets[0].cssRules; - let orangeHoverSelector=""; - for (let i=0; i li") { - orangeHoverSelector=cssArray[i].style.color; + ).innerHTML = ``; + let cssArray = document.styleSheets[0].cssRules; + let orangeHoverSelector = ""; + for (let i = 0; i < cssArray.length; i++) { + if (cssArray[i].selectorText === "ul li" || cssArray[i].selectorText === "ul > li") { + orangeHoverSelector = cssArray[i].style["color"]; } - expect(orangeHoverSelector).toBe("red"); } + expect(orangeHoverSelector).toBe("red"); }); - it("The ul second element background should be green", function () { + test("The ul second element background should be green", ()=>{ document.querySelector( "head" - ).innerHTML=``; - let cssArray=document.styleSheets[0].cssRules; + ).innerHTML = ``; + let cssArray = document.styleSheets[0].cssRules; - let orangeHoverSelector=""; - for (let i=0; i li:nth-child(2)" ) { - orangeHoverSelector=cssArray[i].style['background-color']; + let orangeHoverSelector = ""; + for (let i = 0; i < cssArray.length; i++) { + if (cssArray[i].selectorText === "ol li:nth-child(2)" || cssArray[i].selectorText === "ol > li:nth-child(2)") { + orangeHoverSelector = cssArray[i].style['background-color']; } - }expect(orangeHoverSelector).toBe("green"); + } expect(orangeHoverSelector).toBe("green"); }) - it("The odd rows of the table should have yellow background", function () { + test("The odd rows of the table should have yellow background", ()=>{ document.querySelector( "head" - ).innerHTML=``; - let cssArray=document.styleSheets[0].cssRules; + ).innerHTML = ``; + let cssArray = document.styleSheets[0].cssRules; - let orangeHoverSelector=""; - for (let i=0; i< cssArray.length; i++) { + if (cssArray[i].selectorText === "tr:nth-child(odd)") { + orangeHoverSelector = cssArray[i].style['background']; } - }expect(orangeHoverSelector).toBe("yellow"); + } expect(orangeHoverSelector).toBe("yellow"); }) - it("Write all your rules above the existing code", function () { + test("Write all your rules above the existing code", ()=>{ document.querySelector( "head" - ).innerHTML=``; - let cssBody=document.styleSheets[0].cssRules[3].selectorText; - let cssArray=document.styleSheets[0].cssRules[4].selectorText; + ).innerHTML = ``; + let cssBody = document.styleSheets[0].cssRules[3].selectorText; + let cssArray = document.styleSheets[0].cssRules[4].selectorText; expect(cssArray).toBe("ul li,\nol li"); expect(cssBody).toBe("body"); } ) - it("You should not change the existing head tag elements", function () { + test("You should not change the existing head tag elements", ()=>{ let head = document.querySelector('head') expect(head).toBeTruthy() - - let meta = head.querySelector("meta") - expect(meta).not.toBe(null) - - const pathname = new URL(document.querySelector('link').href).pathname - expect(pathname).toBe('/styles.css') - - let title = head.querySelector('title') - expect(title).not.toBe(null) + + expect(meta).toBeTruthy() + + let href = link.getAttribute('href') + expect(href).toBe('./styles.css') + + expect(title).toBeTruthy() }) }); \ No newline at end of file From 62a29ac6547049d730d99ef45a94f293acb5ce3a Mon Sep 17 00:00:00 2001 From: ErnestoXG Date: Thu, 4 Aug 2022 17:12:02 +0000 Subject: [PATCH 10/32] added solution --- exercises/08-Rounded-Image/solution.hide.css | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/exercises/08-Rounded-Image/solution.hide.css b/exercises/08-Rounded-Image/solution.hide.css index e69de29b..56819f66 100644 --- a/exercises/08-Rounded-Image/solution.hide.css +++ b/exercises/08-Rounded-Image/solution.hide.css @@ -0,0 +1,13 @@ +body { + background: #bdbdbd; +} +.rounded { + border-radius: 100%; + background-image: url("https://github.com/4GeeksAcademy/css-tutorial-exercises-course/blob/master/.learn/assets/einstein.png?raw=true"); + background-position-x: center; + background-position-y: center; + background-size: contain; + object-fit: cover; + width: 200px; + height: 200px; +} From d62d736175aeceae5e670bb3f8990f1920a5ca02 Mon Sep 17 00:00:00 2001 From: ErnestoXG Date: Thu, 4 Aug 2022 17:13:17 +0000 Subject: [PATCH 11/32] fix minor issues and improved format --- exercises/08-Rounded-Image/tests.js | 58 +++++++++++++---------------- 1 file changed, 25 insertions(+), 33 deletions(-) diff --git a/exercises/08-Rounded-Image/tests.js b/exercises/08-Rounded-Image/tests.js index fc2abaa5..c03d1580 100644 --- a/exercises/08-Rounded-Image/tests.js +++ b/exercises/08-Rounded-Image/tests.js @@ -1,35 +1,29 @@ -const fs = require("fs"); -const path = require("path"); -const html = fs.readFileSync(path.resolve(__dirname, "./index.html"), "utf8"); +const fs = require('fs'); +const path = require('path'); +const html = fs.readFileSync(path.resolve(__dirname, './index.html'), 'utf8'); const css = fs.readFileSync(path.resolve(__dirname, "./styles.css"), "utf8"); +document.documentElement.innerHTML = html.toString(); -jest.dontMock("fs"); +jest.dontMock('fs'); -describe("All the styles should be applied", function() { - beforeEach(() => { - //here I import the HTML into the document - document.documentElement.innerHTML = html.toString(); +describe("All the styles should be applied", () => { + const meta = document.querySelector("meta") + const title = document.querySelector('title') + const link = document.querySelector('link') - //apply the styles from the stylesheet if needed - - }); - afterEach(() => { - jest.resetModules(); - }); - - it("The tag has to be removed", function() { + test("The tag has to be removed", () => { document.querySelector( "head" ).innerHTML = ``; expect(document.querySelector("img")).toBeFalsy(); }); - it("The
tag should exists", function() { + test("The
tag should exists", () => { document.querySelector( "head" ).innerHTML = ``; expect(document.querySelector("div")).toBeTruthy(); }); - it("the width in the div Tag should be '200px'", function() { + test("the width in the div Tag should be '200px'", () => { // get computed styles of any element you like document.querySelector( "head" @@ -38,7 +32,7 @@ describe("All the styles should be applied", function() { let idTagStyles = window.getComputedStyle(divTag); expect(idTagStyles["width"]).toBe("200px"); }); - it("the height in the div Tag should be '200px'", function() { + test("the height in the div Tag should be '200px'", () => { // get computed styles of any element you like document.querySelector( "head" @@ -47,7 +41,7 @@ describe("All the styles should be applied", function() { let idTagStyles = window.getComputedStyle(divTag); expect(idTagStyles["height"]).toBe("200px"); }); - it("the border radius in the div Tag should be '100%'", function() { + test("the border radius in the div Tag should be '100%'", () => { // get computed styles of any element you like document.querySelector( "head" @@ -56,7 +50,7 @@ describe("All the styles should be applied", function() { let idTagStyles = window.getComputedStyle(divTag); expect(idTagStyles["border-radius"]).toBe("100%"); }); - it("the background position x in the div Tag should be 'center'", function() { + test("the background position x in the div Tag should be 'center'", () => { // get computed styles of any element you like document.querySelector( "head" @@ -65,7 +59,7 @@ describe("All the styles should be applied", function() { let idTagStyles = window.getComputedStyle(divTag); expect(idTagStyles["background-position-x"]).toBe("center"); }); - it("the background position y in the div Tag should be 'center'", function() { + test("the background position y in the div Tag should be 'center'", () => { // get computed styles of any element you like document.querySelector( "head" @@ -74,7 +68,7 @@ describe("All the styles should be applied", function() { let idTagStyles = window.getComputedStyle(divTag); expect(idTagStyles["background-position-y"]).toBe("center"); }); - it("the background image in the div Tag should exists", function() { + test("the background image in the div Tag should exists", () => { // get computed styles of any element you like document.querySelector( "head" @@ -83,17 +77,15 @@ describe("All the styles should be applied", function() { let idTagStyles = window.getComputedStyle(divTag); expect(idTagStyles["background-image"]).toBeTruthy(); }); - it("You should not change the existing head tag elements", function () { + test("You should not change the existing head tag elements", ()=>{ let head = document.querySelector('head') expect(head).toBeTruthy() - - let meta = head.querySelector("meta") - expect(meta).not.toBe(null) - - const pathname = new URL(document.querySelector('link').href).pathname - expect(pathname).toBe('/styles.css') - - let title = head.querySelector('title') - expect(title).not.toBe(null) + + expect(meta).toBeTruthy() + + let href = link.getAttribute('href') + expect(href).toBe('./styles.css') + + expect(title).toBeTruthy() }) }); From 2ff5fcafa6d3e0bb1426504ba16b627236da6831 Mon Sep 17 00:00:00 2001 From: ErnestoXG Date: Thu, 4 Aug 2022 17:37:26 +0000 Subject: [PATCH 12/32] added solution --- exercises/09-Anchor-Styles/solution.hide.css | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/exercises/09-Anchor-Styles/solution.hide.css b/exercises/09-Anchor-Styles/solution.hide.css index e69de29b..b3e6a36b 100644 --- a/exercises/09-Anchor-Styles/solution.hide.css +++ b/exercises/09-Anchor-Styles/solution.hide.css @@ -0,0 +1,15 @@ +.threeDimension { + display: block; + border: 1px solid; + border-color: #aaa #000 #000 #aaa; + width: 8em; + background: #fc0; + text-decoration: none; + text-align: center; + color: black; +} + +a.threeDimension:active { + /* your code here*/ + border-color: #000 #aaa #aaa #000; +} \ No newline at end of file From e5ae3f25e771f0ce5d39970048b612e2c4f306aa Mon Sep 17 00:00:00 2001 From: ErnestoXG Date: Thu, 4 Aug 2022 17:37:58 +0000 Subject: [PATCH 13/32] added test to prevent user from changing default styles plus minor improvements --- exercises/09-Anchor-Styles/tests.js | 98 +++++++++++++++++------------ 1 file changed, 58 insertions(+), 40 deletions(-) diff --git a/exercises/09-Anchor-Styles/tests.js b/exercises/09-Anchor-Styles/tests.js index cab43954..73192e4f 100644 --- a/exercises/09-Anchor-Styles/tests.js +++ b/exercises/09-Anchor-Styles/tests.js @@ -1,68 +1,86 @@ -const fs=require("fs"); -const path=require("path"); -const html=fs.readFileSync(path.resolve(__dirname, "./index.html"), "utf8"); -const css=fs.readFileSync(path.resolve(__dirname, "./styles.css"), "utf8"); -let cssArray=null; -jest.dontMock("fs"); +const fs = require('fs'); +const path = require('path'); +const html = fs.readFileSync(path.resolve(__dirname, './index.html'), 'utf8'); +const css = fs.readFileSync(path.resolve(__dirname, "./styles.css"), "utf8"); +document.documentElement.innerHTML = html.toString(); -describe("All the styles should be applied", function () { - beforeEach(() => { - //here I import the HTML into the document - document.documentElement.innerHTML=html.toString(); +jest.dontMock('fs'); - //apply the styles from the stylesheet if needed +let cssArray = null; - - }); - afterEach(() => { - jest.resetModules(); - }); - - it("You should not add your rules above the existing code", function () { +describe("All the styles should be applied", () => { + const meta = document.querySelector("meta") + const title = document.querySelector('title') + const link = document.querySelector('link') + test("You should not add your rules above the existing code", () => { document.querySelector( "head" - ).innerHTML=``; - let cssArray=document.styleSheets[0].cssRules[0].selectorText; + ).innerHTML = ``; + let cssArray = document.styleSheets[0].cssRules[0].selectorText; expect(cssArray).toBe(".threeDimension"); }) - it("the 'a' tag in the index.html should not be deleted", function () { + test("the 'a' tag in the index.html should not be deleted", () => { // we can read from the source code // console.log(html.toString()); - expect(html.toString().indexOf(`-1).toBeTruthy(); + expect(html.toString().indexOf(` -1).toBeTruthy(); }); - it("The border-color rule for the 'threeDimension active ' property should match the instruction color", function () { + test("The border-color rule for the 'threeDimension active ' property should match the instruction color", () => { // get computed styles of any element you like // let cssArray=document.styleSheets[0].cssRules; document.querySelector( "head" - ).innerHTML=``; - let cssArray=document.styleSheets[0].cssRules; + ).innerHTML = ``; + let cssArray = document.styleSheets[0].cssRules; - let orangeHoverSelector=""; - for (let i=0; i< cssArray.length; i++) { + if (cssArray[i].selectorText === "a.threeDimension:active") { + orangeHoverSelector = cssArray[i].style['border-color']; } } - expect(orangeHoverSelector).toBe("#000 #aaa #aaa #000"); + + }); + test("You should not change the default styles", () => { + // get computed styles of any element you like + // let cssArray=document.styleSheets[0].cssRules; + document.querySelector( + "head" + ).innerHTML = ``; + let cssArray = document.styleSheets[0].cssRules; + + let borderColor = ""; + let color = ""; + let background = ""; + let width = ""; + for (let i = 0; i < cssArray.length; i++) { + if (cssArray[i].selectorText === ".threeDimension") { + borderColor = cssArray[i].style["border-color"]; + color = cssArray[i].style['color']; + background = cssArray[i].style['background']; + width = cssArray[i].style['width']; + expect(borderColor).toBe("#aaa #000 #000 #aaa"); + expect(color).toBe("black"); + expect(background).toBe("#fc0"); + expect(width).toBe("8em"); + } + } + }); - it("You should not change the existing head tag elements", function () { + test("You should not change the existing head tag elements", () => { let head = document.querySelector('head') expect(head).toBeTruthy() - - let meta = head.querySelector("meta") - expect(meta).not.toBe(null) - - const pathname = new URL(document.querySelector('link').href).pathname - expect(pathname).toBe('/styles.css') - - let title = head.querySelector('title') - expect(title).not.toBe(null) + + expect(meta).toBeTruthy() + + let href = link.getAttribute('href') + expect(href).toBe('./styles.css') + + expect(title).toBeTruthy() }) }); From b512f717377fe13c5b66cfab03336c81531a4c51 Mon Sep 17 00:00:00 2001 From: ErnestoXG Date: Thu, 4 Aug 2022 19:22:40 +0000 Subject: [PATCH 14/32] added solutions for html and css --- exercises/10-Your-Own-Font/solution.hide.css | 4 ++++ exercises/10-Your-Own-Font/solution.hide.html | 20 +++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 exercises/10-Your-Own-Font/solution.hide.html diff --git a/exercises/10-Your-Own-Font/solution.hide.css b/exercises/10-Your-Own-Font/solution.hide.css index e69de29b..371e026b 100644 --- a/exercises/10-Your-Own-Font/solution.hide.css +++ b/exercises/10-Your-Own-Font/solution.hide.css @@ -0,0 +1,4 @@ +.myTitle { + /*your code here*/ + font-family: 'Roboto'; /*Varies depending on the font you chose*/ +} diff --git a/exercises/10-Your-Own-Font/solution.hide.html b/exercises/10-Your-Own-Font/solution.hide.html new file mode 100644 index 00000000..b2268633 --- /dev/null +++ b/exercises/10-Your-Own-Font/solution.hide.html @@ -0,0 +1,20 @@ + + + + + + + + + + + 10 Your Own Font + + + +

My unique font

+ + + \ No newline at end of file From e4452cc9bc10c0beeb41aadd3cb757c5300d9b3b Mon Sep 17 00:00:00 2001 From: ErnestoXG Date: Thu, 4 Aug 2022 19:23:45 +0000 Subject: [PATCH 15/32] fixed issue with CSS rules, improved tests --- exercises/10-Your-Own-Font/tests.js | 60 +++++++++++++---------------- 1 file changed, 27 insertions(+), 33 deletions(-) diff --git a/exercises/10-Your-Own-Font/tests.js b/exercises/10-Your-Own-Font/tests.js index dd13147d..52e13aa6 100644 --- a/exercises/10-Your-Own-Font/tests.js +++ b/exercises/10-Your-Own-Font/tests.js @@ -1,53 +1,47 @@ -const fs=require("fs"); -const path=require("path"); -const html=fs.readFileSync(path.resolve(__dirname, "./index.html"), "utf8"); -const css=fs.readFileSync(path.resolve(__dirname, "./styles.css"), "utf8"); - -jest.dontMock("fs"); - -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 - // document.querySelector( - // "head" - // ).innerHTML=``; - }); - afterEach(() => { - jest.resetModules(); - }); +const fs = require('fs'); +const path = require('path'); +const html = fs.readFileSync(path.resolve(__dirname, './index.html'), 'utf8'); +const css = fs.readFileSync(path.resolve(__dirname, "./styles.css"), "utf8"); +document.documentElement.innerHTML = html.toString(); + +jest.dontMock('fs'); + +let cssArray = null; + +describe("All the styles should be applied", ()=>{ + const link = document.querySelectorAll("link") + test("the font-family in the .myTitle should exists", ()=>{ + document.querySelector( + "head" + ).innerHTML = ``; - it("the font-family in the .myTitle should exists", function () { // get computed styles of any element you like - let cssArray=document.styleSheets[0].cssRules; + let cssArray = document.styleSheets[0].cssRules; // console.log("%%% ", cssArray) - let orangeHoverSelector=""; - for (let i=0; i< cssArray.length; i++) { + if (cssArray[i].selectorText === ".myTitle") { // console.log("%%% ", cssArray[i].selectorText) - orangeHoverSelector=cssArray[i].style['font-family']; + orangeHoverSelector = cssArray[i].style['font-family']; } } expect(orangeHoverSelector).toBeTruthy(); }); - it('the h1 tag should have a class "myTitle"', function () { + test('the h1 tag should have a class "myTitle"', ()=>{ //or use query selector to compare hoy mane scriptags do we have - const h=document.querySelector("h1"); + const h = document.querySelector("h1"); expect(h.classList.contains("myTitle")).toBeTruthy(); }); - it("The link should be included in the head tag", function () { + test("The link should be included in the head tag", ()=>{ // let headContent=document.getElementsByTagName("*") // console.log("###", headContent[1].innerHTML) - console.log("###", document.head.childNodes) - expect(document.querySelectorAll("link").length).toBe(2); + expect(link.length).toBe(2); }); - it("The Head tag should not includes a Style tag", function () { - expect(html.toString().indexOf(`-1).toBeFalsy(); + test("The Head tag should not includes a Style tag", ()=>{ + expect(html.toString().indexOf(` -1).toBeFalsy(); }); }); From a01e4bf84c31401661d13f72b9f7a0d3e0f2703f Mon Sep 17 00:00:00 2001 From: ErnestoXG Date: Thu, 4 Aug 2022 19:38:45 +0000 Subject: [PATCH 16/32] added solution --- exercises/11-Font-Awesome-Icons/solution.hide.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exercises/11-Font-Awesome-Icons/solution.hide.html b/exercises/11-Font-Awesome-Icons/solution.hide.html index bd68c2a7..e9778b12 100644 --- a/exercises/11-Font-Awesome-Icons/solution.hide.html +++ b/exercises/11-Font-Awesome-Icons/solution.hide.html @@ -9,9 +9,9 @@
    -
  • Hello
  • -
  • Flag
  • -
  • Heart
  • +
  • Hello
  • +
  • Hello
  • +
  • Hello
From b62745c734e3cc8d7a67ede1ab83b7f662b8c60a Mon Sep 17 00:00:00 2001 From: ErnestoXG Date: Thu, 4 Aug 2022 19:40:47 +0000 Subject: [PATCH 17/32] fixed test checking for the wrong class, improved tests overall --- exercises/11-Font-Awesome-Icons/tests.js | 46 ++++++++++-------------- 1 file changed, 19 insertions(+), 27 deletions(-) diff --git a/exercises/11-Font-Awesome-Icons/tests.js b/exercises/11-Font-Awesome-Icons/tests.js index 3fa966cb..f7d8cf6e 100644 --- a/exercises/11-Font-Awesome-Icons/tests.js +++ b/exercises/11-Font-Awesome-Icons/tests.js @@ -1,46 +1,38 @@ -const fs = require("fs"); -const path = require("path"); -const html = fs.readFileSync(path.resolve(__dirname, "./index.html"), "utf8"); +const fs = require('fs'); +const path = require('path'); +const html = fs.readFileSync(path.resolve(__dirname, './index.html'), 'utf8'); const css = fs.readFileSync(path.resolve(__dirname, "./styles.css"), "utf8"); +document.documentElement.innerHTML = html.toString(); -jest.dontMock("fs"); +jest.dontMock('fs'); -describe("All the styles should be applied", function() { - beforeEach(() => { - //here I import the HTML into the document - document.documentElement.innerHTML = html.toString(); +let cssArray = null; - //apply the styles from the stylesheet if needed - document.querySelector( - "head" - ).innerHTML = ``; - }); - afterEach(() => { - jest.resetModules(); - }); - - it("ul tag should exists", function() { +describe("All the styles should be applied", ()=>{ + const icons = document.querySelectorAll("i"); + test("ul tag should exists", ()=>{ expect(document.querySelector("ul")).toBeTruthy(); }); - it("At least 3 li tags should exist", function() { + test("At least 3 li tags should exist", ()=>{ expect(document.querySelectorAll("li").length).toBe(3); }); - it("At least 3 i tags should exist", function() { + test("At least 3 i tags should exist", ()=>{ expect(document.querySelectorAll("i").length).toBe(3); }); - it(" LI innerHTML exist", function() { + test(" LI innerHTML exist", ()=>{ const li = document.querySelectorAll("li"); expect(document.querySelector("li")).toBeTruthy(); for (let i = 0; i < li.length; i++) { expect(li[i].innerHTML).toBeTruthy(); } }); - it('the i tag should have a class "fas"', function() { + test('the i tag should have a class "fas"', ()=>{ //or use query selector to compare hoy mane scriptags do we have - const icon = document.querySelectorAll("i"); - expect(document.querySelector("i")).toBeTruthy(); - for (let i = 0; i < icon.length; i++) { - expect(icon[i].classList.contains("fa")).toBeTruthy(); - } + expect(icons).toBeTruthy(); + + icons.forEach(icon=>{ + let hasFas = icon.classList.contains("fas") + expect(hasFas).toBe(true); + }) }); }); From 247b554390c32b901f751e7bed8bb900665364b1 Mon Sep 17 00:00:00 2001 From: ErnestoXG Date: Thu, 4 Aug 2022 20:29:44 +0000 Subject: [PATCH 18/32] added solution --- .../12-Relative-Length-EM-REM/solution.hide.css | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/exercises/12-Relative-Length-EM-REM/solution.hide.css b/exercises/12-Relative-Length-EM-REM/solution.hide.css index e69de29b..eeb04334 100644 --- a/exercises/12-Relative-Length-EM-REM/solution.hide.css +++ b/exercises/12-Relative-Length-EM-REM/solution.hide.css @@ -0,0 +1,15 @@ +#my-first-div { + font-size: 15px; +} +#the-second-one { + font-size: 25px; +} + +/* YOUR CODE BELOW THIS LINE */ +h2{ + font-size: 0.8em; +} + +h3{ + font-size: 0.8rem; +} \ No newline at end of file From cb10a77a787282c93cdc6dc09da99320004fe00f Mon Sep 17 00:00:00 2001 From: ErnestoXG Date: Thu, 4 Aug 2022 20:29:57 +0000 Subject: [PATCH 19/32] fixed and cleaned up tests --- exercises/12-Relative-Length-EM-REM/tests.js | 73 +++++++++----------- 1 file changed, 32 insertions(+), 41 deletions(-) diff --git a/exercises/12-Relative-Length-EM-REM/tests.js b/exercises/12-Relative-Length-EM-REM/tests.js index 2f884753..2752a78d 100644 --- a/exercises/12-Relative-Length-EM-REM/tests.js +++ b/exercises/12-Relative-Length-EM-REM/tests.js @@ -1,69 +1,60 @@ -const fs=require("fs"); -const path=require("path"); -const html=fs.readFileSync(path.resolve(__dirname, "./index.html"), "utf8"); -const css=fs.readFileSync(path.resolve(__dirname, "./styles.css"), "utf8"); +const fs = require('fs'); +const path = require('path'); +const html = fs.readFileSync(path.resolve(__dirname, './index.html'), 'utf8'); +const css = fs.readFileSync(path.resolve(__dirname, "./styles.css"), "utf8"); +document.documentElement.innerHTML = html.toString(); -jest.dontMock("fs"); +jest.dontMock('fs'); -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(); - }); - - it("The H2 Tag should have a font-size: 0.8em", function () { +describe("All the styles should be applied", ()=>{ + const meta = document.querySelector("meta") + const title = document.querySelector('title') + const link = document.querySelector('link') + test("The H2 Tag should have a font-size: 0.8em", ()=>{ // get computed styles of any element you like document.querySelector( "head" - ).innerHTML=``; - const h2Tag=document.querySelector("h2"); - var styles=window.getComputedStyle(h2Tag); + ).innerHTML = ``; + const h2Tag = document.querySelector("h2"); + var styles = window.getComputedStyle(h2Tag); expect(styles["font-size"]).toBe("0.8em"); }); - it("The H3 Tag should haave a font-size: 0.8rem", function () { + test("The H3 Tag should haave a font-size: 0.8rem", ()=>{ // get computed styles of any element you like document.querySelector( "head" - ).innerHTML=``; - const h3Tag=document.querySelector("h3"); - var styles=window.getComputedStyle(h3Tag); + ).innerHTML = ``; + const h3Tag = document.querySelector("h3"); + var styles = window.getComputedStyle(h3Tag); expect(styles["font-size"]).toBe("0.8rem"); }); - it("You should add your rules below the existing code", function () { + test("You should add your rules below the existing code", ()=>{ document.querySelector( "head" - ).innerHTML=``; - let cssArray=document.styleSheets[0].cssRules[0].selectorText; + ).innerHTML = ``; + let cssArray = document.styleSheets[0].cssRules[0].selectorText; expect(cssArray).toBe("#my-first-div"); } ) - it("You should add your rules below the existing code", function () { + test("You should add your rules below the existing code", ()=>{ document.querySelector( "head" - ).innerHTML=``; - let cssArray=document.styleSheets[0].cssRules[1].selectorText; + ).innerHTML = ``; + let cssArray = document.styleSheets[0].cssRules[1].selectorText; expect(cssArray).toBe("#the-second-one"); } ) - it("You should not change the existing head tag elements", function () { + test("You should not change the existing head tag elements", ()=>{ let head = document.querySelector('head') expect(head).toBeTruthy() - - let meta = head.querySelector("meta") - expect(meta).not.toBe(null) - - const pathname = new URL(document.querySelector('link').href).pathname - expect(pathname).toBe('/styles.css') - - let title = head.querySelector('title') - expect(title).not.toBe(null) + + expect(meta).toBeTruthy() + + let href = link.getAttribute('href') + expect(href).toBe('./styles.css') + + expect(title).toBeTruthy() }) }); From fdaa2df10b8c994347f5cb23c6f7af73f7090460 Mon Sep 17 00:00:00 2001 From: ErnestoXG Date: Sat, 6 Aug 2022 02:54:50 +0000 Subject: [PATCH 20/32] changed colors color requirements to orange and dark orange --- exercises/13-Anchor-Like-Button/tests.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exercises/13-Anchor-Like-Button/tests.js b/exercises/13-Anchor-Like-Button/tests.js index 32f0c21e..bddebed7 100644 --- a/exercises/13-Anchor-Like-Button/tests.js +++ b/exercises/13-Anchor-Like-Button/tests.js @@ -54,7 +54,7 @@ describe("All the styles should be applied", function () { ).innerHTML=``; let divTag=document.querySelector(".orange-btn"); let classTagStyles=window.getComputedStyle(divTag); - expect(classTagStyles["background"]).toBe("rgb(255, 153, 51)"); + expect(classTagStyles["background"]).toBe("orange"); }); it("the underline should to be removed", function () { document.querySelector( @@ -79,7 +79,7 @@ describe("All the styles should be applied", function () { } } - expect(orangeHoverSelector).toBe("#cc7a00"); + expect(orangeHoverSelector).toBe("darkorange"); }); it("You should be careful with the specifity", function () { From 2a3353ce41387d81223b366b536a2d80fbfb6a08 Mon Sep 17 00:00:00 2001 From: ErnestoXG <60261375+UmiKami@users.noreply.github.com> Date: Sun, 7 Aug 2022 23:46:26 -0400 Subject: [PATCH 21/32] Update index.html better format --- exercises/12-Relative-Length-EM-REM/index.html | 1 + 1 file changed, 1 insertion(+) diff --git a/exercises/12-Relative-Length-EM-REM/index.html b/exercises/12-Relative-Length-EM-REM/index.html index 60a98594..f4d745fd 100644 --- a/exercises/12-Relative-Length-EM-REM/index.html +++ b/exercises/12-Relative-Length-EM-REM/index.html @@ -12,6 +12,7 @@

First h2 heading

First h3 heading

Here is some nice fake content

+

Second h2 heading

Second h3 heading

From 4328860e8d1e81db2310da502c4ab1e394fa2b45 Mon Sep 17 00:00:00 2001 From: ErnestoXG Date: Wed, 10 Aug 2022 02:40:49 +0000 Subject: [PATCH 22/32] Gave user specific colors to use --- exercises/13-Anchor-Like-Button/README.es.md | 2 +- exercises/13-Anchor-Like-Button/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/exercises/13-Anchor-Like-Button/README.es.md b/exercises/13-Anchor-Like-Button/README.es.md index a1fda469..576d146b 100644 --- a/exercises/13-Anchor-Like-Button/README.es.md +++ b/exercises/13-Anchor-Like-Button/README.es.md @@ -10,7 +10,7 @@ Siga estos pasos para que tu enlace (`anchor`) se vea así: 2. Bordes redondeados: establece el `border-radius` en `4px`. -3. Encuentra y aplica el color: usa el selector de `color` (color picker) para encontrar el color exacto y aplicárselo al `background`. +3. El `background` debe ser de color `orange`, y cuando el ratón esté sobre el botón (`:hover`), el `background` debe ser `darkorange` 4. Eliminar subrayado: establece `text-decoration` a `none`. diff --git a/exercises/13-Anchor-Like-Button/README.md b/exercises/13-Anchor-Like-Button/README.md index 40327be6..49ced0bf 100644 --- a/exercises/13-Anchor-Like-Button/README.md +++ b/exercises/13-Anchor-Like-Button/README.md @@ -8,7 +8,7 @@ Anchors are not only used within text- when you are going to use anchors outside 2. Rounded borders: Set `border-radius` to `4px`. -3. Find and apply the color: Use the color picker to find the color and apply make the background to that color. +3. The background should be `orange` when not hovered, and `darkorange` on hover (`:hover`). 4. Remove underline: Set `text-decoration` to `none`. From 13991d0b869c311002a7e25303cc8692e19c1cd5 Mon Sep 17 00:00:00 2001 From: ErnestoXG Date: Wed, 10 Aug 2022 02:41:02 +0000 Subject: [PATCH 23/32] added solution --- exercises/13-Anchor-Like-Button/solution.hide.css | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/exercises/13-Anchor-Like-Button/solution.hide.css b/exercises/13-Anchor-Like-Button/solution.hide.css index e69de29b..fd0db11b 100644 --- a/exercises/13-Anchor-Like-Button/solution.hide.css +++ b/exercises/13-Anchor-Like-Button/solution.hide.css @@ -0,0 +1,13 @@ +.orange-btn { + /*your code here*/ + padding: 10px; + border-radius: 4px; + text-decoration: none; + color: white; + background: orange; +} + +.orange-btn:hover { + /*YOUR CODE HERE FOR THE HOVER STATE*/ + background: darkorange; +} From 9bf97689150f71e33bf5f10087e3f645f7c92f6b Mon Sep 17 00:00:00 2001 From: ErnestoXG Date: Wed, 10 Aug 2022 02:41:54 +0000 Subject: [PATCH 24/32] improved tests and cleaned them up --- exercises/13-Anchor-Like-Button/tests.js | 105 ++++++++++------------- 1 file changed, 44 insertions(+), 61 deletions(-) diff --git a/exercises/13-Anchor-Like-Button/tests.js b/exercises/13-Anchor-Like-Button/tests.js index bddebed7..fcc69fa4 100644 --- a/exercises/13-Anchor-Like-Button/tests.js +++ b/exercises/13-Anchor-Like-Button/tests.js @@ -1,107 +1,90 @@ -const fs=require("fs"); -const path=require("path"); -const html=fs.readFileSync(path.resolve(__dirname, "./index.html"), "utf8"); -const css=fs.readFileSync(path.resolve(__dirname, "./styles.css"), "utf8"); +const fs = require('fs'); +const path = require('path'); +const html = fs.readFileSync(path.resolve(__dirname, './index.html'), 'utf8'); +const css = fs.readFileSync(path.resolve(__dirname, "./styles.css"), "utf8"); +document.documentElement.innerHTML = html.toString(); +jest.dontMock('fs'); -jest.dontMock("fs"); -describe("All the styles should be applied", function () { - beforeEach(() => { - //here I import the HTML into the document - document.documentElement.innerHTML=html.toString(); - - - }); - afterEach(() => { - jest.resetModules(); - }); - - it("the padding should be '10px'", function () { +describe("All the styles should be applied", ()=>{ + const meta = document.querySelector("meta") + const title = document.querySelector('title') + const link = document.querySelector('link') + test("the padding should be '10px'", ()=>{ document.querySelector( "head" - ).innerHTML=``; - let divTag=document.querySelector(".orange-btn"); - let classTagStyles=window.getComputedStyle(divTag); + ).innerHTML = ``; + let divTag = document.querySelector(".orange-btn"); + let classTagStyles = window.getComputedStyle(divTag); expect(classTagStyles["padding"]).toBe("10px"); }); - it("the border radius should be '4px'", function () { + test("the border radius should be '4px'", ()=>{ document.querySelector( "head" - ).innerHTML=``; - let divTag=document.querySelector(".orange-btn"); - let classTagStyles=window.getComputedStyle(divTag); + ).innerHTML = ``; + let divTag = document.querySelector(".orange-btn"); + let classTagStyles = window.getComputedStyle(divTag); expect(classTagStyles["border-radius"]).toBe("4px"); }); - it("the border should be '1px solid #ffffff;'", function () { - document.querySelector( - "head" - - ).innerHTML=``; - let divTag=document.querySelector(".orange-btn"); - let classTagStyles=window.getComputedStyle(divTag); - expect(classTagStyles["border"]).toBe("1px solid #ffffff"); - }); - it("the background should be 'rgb(255, 153, 51)'", function () { + test("the background should be 'orange'", ()=>{ document.querySelector( "head" - ).innerHTML=``; - let divTag=document.querySelector(".orange-btn"); - let classTagStyles=window.getComputedStyle(divTag); + ).innerHTML = ``; + let divTag = document.querySelector(".orange-btn"); + let classTagStyles = window.getComputedStyle(divTag); expect(classTagStyles["background"]).toBe("orange"); }); - it("the underline should to be removed", function () { + test("the underline should to be removed", ()=>{ document.querySelector( "head" - ).innerHTML=``; - let divTag=document.querySelector(".orange-btn"); - let classTagStyles=window.getComputedStyle(divTag); + ).innerHTML = ``; + let divTag = document.querySelector(".orange-btn"); + let classTagStyles = window.getComputedStyle(divTag); expect(classTagStyles["text-decoration"]).toBe("none"); }); - it("The mouse hover property should be #cc7a00", function () { + test("The mouse hover property should be 'darkorange'", ()=>{ // get computed styles of any element you like document.querySelector( "head" - ).innerHTML=``; - let cssArray=document.styleSheets[0].cssRules; + ).innerHTML = ``; + let cssArray = document.styleSheets[0].cssRules; - let orangeHoverSelector=""; - for (let i=0; i< cssArray.length; i++) { + if (cssArray[i].selectorText === ".orange-btn:hover") { + orangeHoverSelector = cssArray[i].style.background; } } expect(orangeHoverSelector).toBe("darkorange"); }); - it("You should be careful with the specifity", function () { + test("You should be careful with the specifity", ()=>{ document.querySelector( "head" - ).innerHTML=``; - let cssArray=document.styleSheets[0].cssRules[0].selectorText; + ).innerHTML = ``; + let cssArray = document.styleSheets[0].cssRules[0].selectorText; expect(cssArray).toBe(".orange-btn"); } ) - it("You should not change the existing head tag elements", function () { + test("You should not change the existing head tag elements", ()=>{ let head = document.querySelector('head') expect(head).toBeTruthy() - - let meta = head.querySelector("meta") - expect(meta).not.toBe(null) - - const pathname = new URL(document.querySelector('link').href).pathname - expect(pathname).toBe('/styles.css') - - let title = head.querySelector('title') - expect(title).not.toBe(null) + + expect(meta).toBeTruthy() + + let href = link.getAttribute('href') + expect(href).toBe('./styles.css') + + expect(title).toBeTruthy() }) }); From 9aa151e07f42bea69f2643c4c16e714e6f141579 Mon Sep 17 00:00:00 2001 From: ErnestoXG Date: Tue, 16 Aug 2022 21:50:46 +0000 Subject: [PATCH 25/32] Updated typo on readme code --- exercises/06-Practicing-Rules/README.es.md | 2 +- exercises/06-Practicing-Rules/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/exercises/06-Practicing-Rules/README.es.md b/exercises/06-Practicing-Rules/README.es.md index c95ae914..ee953a20 100644 --- a/exercises/06-Practicing-Rules/README.es.md +++ b/exercises/06-Practicing-Rules/README.es.md @@ -4,7 +4,7 @@ 1. Establece esta URL como la imagen de fondo de la página y repítela solo verticalmente: `../../.learn/assets/background-vertical.jpg?raw=true` -2. Cambia el tipo de fuente (`font-type`) del `h1` a `Courier` y el resto del sitio web a `Times New Roman`. +2. Cambia el tipo de fuente (`font-family`) del `h1` a `Courier` y el resto del sitio web a `Times New Roman`. 3. Cambia el color del `h1` a rojo(`red`). diff --git a/exercises/06-Practicing-Rules/README.md b/exercises/06-Practicing-Rules/README.md index 64428af4..b8b63bcc 100644 --- a/exercises/06-Practicing-Rules/README.md +++ b/exercises/06-Practicing-Rules/README.md @@ -8,7 +8,7 @@ tutorial: "https://www.youtube.com/watch?v=4wguurrl-lU" 1. Set this URL as the background image of the page, and repeat it vertically only: `../../.learn/assets/background-vertical.jpg?raw=true` -2. Change the font-type of the `h1` to `Courier` and the rest of the website to `Times new Roman`. +2. Change the font-family of the `h1` to `Courier` and the rest of the website to `Times new Roman`. 3. Change the color of `h1` to `red`. From 7c58c65296e84fca82607fda95085195f8e27d7e Mon Sep 17 00:00:00 2001 From: Tomas Gonzalez Date: Thu, 1 Sep 2022 21:57:15 +0000 Subject: [PATCH 26/32] Some solutions and tests modified --- exercises/04.3-id-Selector/index.html | 2 +- exercises/04.3-id-Selector/test.js | 30 +++++++++------- exercises/05-Specificity/README.es.md | 2 +- exercises/05-Specificity/README.md | 2 +- exercises/05-Specificity/styles.css | 7 ++-- exercises/05-Specificity/tests.js | 12 +++---- exercises/06-Practicing-Rules/index.html | 6 ++-- exercises/06-Practicing-Rules/tests.js | 36 +++++++++----------- exercises/07-Very-Specific-Rules/styles.css | 12 +++++++ exercises/08-Rounded-Image/solution.hide.css | 6 +--- exercises/09-Anchor-Styles/index.html | 2 +- exercises/09-Anchor-Styles/solution.hide.css | 2 +- exercises/10-Your-Own-Font/tests.js | 3 -- exercises/11-Font-Awesome-Icons/tests.js | 2 +- exercises/13-Anchor-Like-Button/tests.js | 11 +++--- learn.json | 4 +-- 16 files changed, 68 insertions(+), 71 deletions(-) diff --git a/exercises/04.3-id-Selector/index.html b/exercises/04.3-id-Selector/index.html index 5b9a773d..a7964559 100644 --- a/exercises/04.3-id-Selector/index.html +++ b/exercises/04.3-id-Selector/index.html @@ -8,6 +8,6 @@ - I should look like a button + I should look like a button diff --git a/exercises/04.3-id-Selector/test.js b/exercises/04.3-id-Selector/test.js index 9277e129..cbae3b3f 100644 --- a/exercises/04.3-id-Selector/test.js +++ b/exercises/04.3-id-Selector/test.js @@ -8,25 +8,29 @@ jest.dontMock('fs'); const span = document.querySelector("span"); const link = document.querySelector("link"); -test("There should be a span tag", ()=>{ +test("There should be a span tag", () => { expect(span).toBeTruthy() -}) -test("The span tag should have id 'button1'", ()=>{ +}); + +test("The span tag should have id 'button1'", () => { + expect(span).toBeTruthy(); let id = span.id - expect(id).toBe('button1') + expect(id).toBe('button1'); }); -test("The span tag should not contain any inline style", ()=>{ + +test("The span tag should not contain any inline style", () => { let emptyBodyInlineStyle = {}; + expect(span).toBeTruthy() expect(span.style._values).toEqual(emptyBodyInlineStyle); }); -test("You should not change the existing head tag elements", ()=>{ - let head = document.querySelector('head') - expect(head).toBeTruthy() +test("You should not change the existing head tag elements", () => { + let head = document.querySelector('head'); + expect(head).toBeTruthy(); - let meta = head.querySelector("meta") - expect(meta).toBe(null) + let meta = head.querySelector("meta"); + expect(meta).toBe(null); - const href = link.getAttribute("href") - expect(href).toBe('./styles.css') - }); \ No newline at end of file + const href = link.getAttribute("href"); + expect(href).toBe('./styles.css'); +}); \ No newline at end of file diff --git a/exercises/05-Specificity/README.es.md b/exercises/05-Specificity/README.es.md index 890c542d..a87b6e2d 100644 --- a/exercises/05-Specificity/README.es.md +++ b/exercises/05-Specificity/README.es.md @@ -9,7 +9,7 @@ Se trata del nivel de especificidad. Si especificas que tu `div` con `id="thirdi ## 📝 Instrucciones: -1. Anula el color de fondo (`background-color`) de `#thirditem` sin eliminar ningún código CSS, simplemente agrega al CSS una regla más específica al final del documento para anular el color de fondo a verde. +1. Anula el color de fondo (`background`) de `#thirditem` sin eliminar ningún código CSS, simplemente agrega al CSS una regla más específica al final del documento para anular el color de fondo a verde. ## 💡 Pista: diff --git a/exercises/05-Specificity/README.md b/exercises/05-Specificity/README.md index bbb243ad..db381074 100644 --- a/exercises/05-Specificity/README.md +++ b/exercises/05-Specificity/README.md @@ -13,7 +13,7 @@ It's all about the level of Specificity. If you specify that your `div` with `id ## 📝 Instrucciones: -1. Override the `background-color` of `#thirditem` without deleting any css code, simply append to the css a more specific rule at the end of the document to override the background-color to green. +1. Override the `background` of `#thirditem` without deleting any css code, simply append to the css a more specific rule at the end of the document to override the background-color to green. ### 💡 Hint: diff --git a/exercises/05-Specificity/styles.css b/exercises/05-Specificity/styles.css index db471c2b..c4e96d25 100644 --- a/exercises/05-Specificity/styles.css +++ b/exercises/05-Specificity/styles.css @@ -1,9 +1,8 @@ -ul li{ +ul li { background: blue; } -#thirditem{ +#thirditem { background: yellow; -} +} /****** DON NOT EDIT ANYTHING ABOVE THIS LINE ****/ - \ No newline at end of file diff --git a/exercises/05-Specificity/tests.js b/exercises/05-Specificity/tests.js index 9e6d52d6..a22fab68 100644 --- a/exercises/05-Specificity/tests.js +++ b/exercises/05-Specificity/tests.js @@ -21,17 +21,15 @@ describe("All the styles should be applied", function () { let title = head.querySelector('title') expect(title).not.toBe(null) }) - + test("You should not delete or edit the existing code", function () { + document.querySelector("head").innerHTML = ``; - document.querySelector( - "head" - ).innerHTML = ``; let cssArray = document.styleSheets[0].cssRules[0].selectorText; - let cssArrayBackground = document.styleSheets[0].cssRules[0].style.background - console.log("back:", cssArrayBackground) + let cssArrayBackground = document.styleSheets[0].cssRules[0].style.background; let thirdItSelector = document.styleSheets[0].cssRules[1].selectorText; - let thirdItBackground = document.styleSheets[0].cssRules[1].style.background + let thirdItBackground = document.styleSheets[0].cssRules[1].style.background; + expect(thirdItSelector).toBe("#thirditem"); expect(thirdItBackground).toBe("yellow"); expect(cssArray).toBe("ul li"); diff --git a/exercises/06-Practicing-Rules/index.html b/exercises/06-Practicing-Rules/index.html index 4119acb5..db2eb563 100644 --- a/exercises/06-Practicing-Rules/index.html +++ b/exercises/06-Practicing-Rules/index.html @@ -21,9 +21,7 @@

3 reasons you know you are learning

3 reasons you know love what you are learning

  • Time passes fast.
  • -
  • - You are anxious to finish this excercise and start the next one. -
  • +
  • You are anxious to finish this excercise and start the next one.
  • Is 12am and you don't want to go to sleep.

@@ -31,4 +29,4 @@

3 reasons you know love what you are learning

click here

- \ No newline at end of file + diff --git a/exercises/06-Practicing-Rules/tests.js b/exercises/06-Practicing-Rules/tests.js index 5c2e9903..9bb32a78 100644 --- a/exercises/06-Practicing-Rules/tests.js +++ b/exercises/06-Practicing-Rules/tests.js @@ -6,12 +6,12 @@ document.documentElement.innerHTML = html.toString(); jest.dontMock('fs'); -describe("All the styles should be applied", ()=> { +describe("All the styles should be applied", () => { let meta = document.querySelector("meta") let link = document.querySelector("link") let title = document.querySelector('title') - test("the background should match", ()=> { + test("the background should match", () => { document.querySelector( "head" ).innerHTML = ``; @@ -21,15 +21,15 @@ describe("All the styles should be applied", ()=> { `url(../../.learn/assets/background-vertical.jpg?raw=true) repeat-y` ); }); - test("the font-family should be 'Times New Roman'", ()=> { + test("the font-family should be 'Times New Roman'", () => { document.querySelector( "head" ).innerHTML = ``; let body = document.querySelector("body"); let styles = window.getComputedStyle(body); - expect(styles["font-family"]).toBe("\"Times New Roman\""); + expect(styles["font-family"].toLowerCase()).toBe("\"times new roman\""); }); - test("the padding-left should be '20px'", ()=> { + test("the padding-left should be '20px'", () => { document.querySelector( "head" ).innerHTML = ``; @@ -37,16 +37,16 @@ describe("All the styles should be applied", ()=> { let styles = window.getComputedStyle(body); expect(styles["padding-left"]).toBe("20px"); }); - test("the font-family in the H1 Tag should be 'Courier'", ()=> { + test("the font-family in the H1 Tag should be 'Courier'", () => { document.querySelector( "head" ).innerHTML = ``; let h1Tag = document.querySelector("h1"); let h1TagStyles = window.getComputedStyle(h1Tag); // get computed styles of any element you like - expect(h1TagStyles["font-family"]).toBe("\"Courier\""); + expect(h1TagStyles["font-family"].toLowerCase()).toBe("\"courier\""); }); - test("the color in the H1 Tag should be 'red'", ()=> { + test("the color in the H1 Tag should be 'red'", () => { document.querySelector( "head" ).innerHTML = ``; @@ -55,7 +55,7 @@ describe("All the styles should be applied", ()=> { // get computed styles of any element you like expect(h1TagStyles["color"]).toBe("red"); }); - test("the text-align in the H1 Tag should be 'center'", ()=> { + test("the text-align in the H1 Tag should be 'center'", () => { document.querySelector( "head" ).innerHTML = ``; @@ -64,7 +64,7 @@ describe("All the styles should be applied", ()=> { // get computed styles of any element you like expect(h1TagStyles["text-align"]).toBe("center"); }); - test("the text-decoration in the H2 Tag should be 'underline'", ()=> { + test("the text-decoration in the H2 Tag should be 'underline'", () => { document.querySelector( "head" ).innerHTML = ``; @@ -73,7 +73,7 @@ describe("All the styles should be applied", ()=> { let h2TagStyles = window.getComputedStyle(h2Tag); expect(h2TagStyles["text-decoration"]).toBe("underline"); }); - test("the padding in the #id1 Tag should be '5px'", ()=> { + test("the padding in the #id1 Tag should be '5px'", () => { document.querySelector( "head" ).innerHTML = ``; @@ -82,40 +82,36 @@ describe("All the styles should be applied", ()=> { let idTagStyles = window.getComputedStyle(idTag); expect(idTagStyles["padding"]).toBe("5px"); }); - test("the background-color in the #id1 Tag should be 'semi transparent white'", ()=> { + test("the background-color in the #id1 Tag should be 'semi transparent white'", () => { document.querySelector( "head" ).innerHTML = ``; // get computed styles of any element you like const idTag = document.querySelector("#id1"); let idTagStyles = window.getComputedStyle(idTag); - console.log("$$$:", idTagStyles) expect(idTagStyles["background-color"]).toBe("rgba(255, 255, 255, 0.2)"); }); - test("The a hover underline should be removed", ()=> { + test("The a hover underline should be removed", () => { document.querySelector( "head" ).innerHTML = ``; let cssArray = document.styleSheets[0].cssRules; - // console.log("$$$:", cssArray) let orangeHoverSelector = ""; for (let i = 0; i < cssArray.length; i++) { if (cssArray[i].selectorText === "a:hover") { orangeHoverSelector = cssArray[i].style['text-decoration']; - console.log("$$$:", orangeHoverSelector) } } expect(orangeHoverSelector).toBe("none"); }); - test("The a hover color should be green", ()=> { + test("The a hover color should be green", () => { document.querySelector( "head" ).innerHTML = ``; - let cssArray = document.styleSheets[0].cssRules; - console.log("$$$:", cssArray[0]) let orangeHoverSelector = ""; + for (let i = 0; i < cssArray.length; i++) { if (cssArray[i].selectorText === "a:hover") { orangeHoverSelector = cssArray[i].style.color; @@ -123,7 +119,7 @@ describe("All the styles should be applied", ()=> { } expect(orangeHoverSelector).toBe('green'); }); - test("You should not change the existing head tag elements", ()=> { + test("You should not change the existing head tag elements", () => { let head = document.querySelector('head') expect(head).toBeTruthy() diff --git a/exercises/07-Very-Specific-Rules/styles.css b/exercises/07-Very-Specific-Rules/styles.css index 300d0677..55fb5ff4 100644 --- a/exercises/07-Very-Specific-Rules/styles.css +++ b/exercises/07-Very-Specific-Rules/styles.css @@ -1,5 +1,17 @@ /** Insert your code here **/ +ul li { + color: red !important; +} + +ol li:nth-child(2) { + background-color: green; +} + +tr:nth-child(odd) { + background: yellow; +} + /*********** READ ONLY BLOCK ****** You CANNOT UPDATE anything from here on, only add lines of code on top of this lines diff --git a/exercises/08-Rounded-Image/solution.hide.css b/exercises/08-Rounded-Image/solution.hide.css index 56819f66..2ddc0eed 100644 --- a/exercises/08-Rounded-Image/solution.hide.css +++ b/exercises/08-Rounded-Image/solution.hide.css @@ -2,12 +2,8 @@ body { background: #bdbdbd; } .rounded { - border-radius: 100%; - background-image: url("https://github.com/4GeeksAcademy/css-tutorial-exercises-course/blob/master/.learn/assets/einstein.png?raw=true"); - background-position-x: center; - background-position-y: center; - background-size: contain; object-fit: cover; width: 200px; height: 200px; + border-radius: 100%; } diff --git a/exercises/09-Anchor-Styles/index.html b/exercises/09-Anchor-Styles/index.html index 984ca01e..30e00691 100644 --- a/exercises/09-Anchor-Styles/index.html +++ b/exercises/09-Anchor-Styles/index.html @@ -6,7 +6,7 @@ 09 Anchor Styles - + Click me diff --git a/exercises/09-Anchor-Styles/solution.hide.css b/exercises/09-Anchor-Styles/solution.hide.css index b3e6a36b..101d281c 100644 --- a/exercises/09-Anchor-Styles/solution.hide.css +++ b/exercises/09-Anchor-Styles/solution.hide.css @@ -12,4 +12,4 @@ a.threeDimension:active { /* your code here*/ border-color: #000 #aaa #aaa #000; -} \ No newline at end of file +} diff --git a/exercises/10-Your-Own-Font/tests.js b/exercises/10-Your-Own-Font/tests.js index 52e13aa6..e86491c0 100644 --- a/exercises/10-Your-Own-Font/tests.js +++ b/exercises/10-Your-Own-Font/tests.js @@ -17,11 +17,9 @@ describe("All the styles should be applied", ()=>{ // get computed styles of any element you like let cssArray = document.styleSheets[0].cssRules; - // console.log("%%% ", cssArray) let orangeHoverSelector = ""; for (let i = 0; i < cssArray.length; i++) { if (cssArray[i].selectorText === ".myTitle") { - // console.log("%%% ", cssArray[i].selectorText) orangeHoverSelector = cssArray[i].style['font-family']; } } @@ -35,7 +33,6 @@ describe("All the styles should be applied", ()=>{ }); test("The link should be included in the head tag", ()=>{ // let headContent=document.getElementsByTagName("*") - // console.log("###", headContent[1].innerHTML) expect(link.length).toBe(2); }); diff --git a/exercises/11-Font-Awesome-Icons/tests.js b/exercises/11-Font-Awesome-Icons/tests.js index f7d8cf6e..2b717fd5 100644 --- a/exercises/11-Font-Awesome-Icons/tests.js +++ b/exercises/11-Font-Awesome-Icons/tests.js @@ -20,8 +20,8 @@ describe("All the styles should be applied", ()=>{ expect(document.querySelectorAll("i").length).toBe(3); }); test(" LI innerHTML exist", ()=>{ - const li = document.querySelectorAll("li"); expect(document.querySelector("li")).toBeTruthy(); + const li = document.querySelectorAll("li"); for (let i = 0; i < li.length; i++) { expect(li[i].innerHTML).toBeTruthy(); } diff --git a/exercises/13-Anchor-Like-Button/tests.js b/exercises/13-Anchor-Like-Button/tests.js index fcc69fa4..d93dc049 100644 --- a/exercises/13-Anchor-Like-Button/tests.js +++ b/exercises/13-Anchor-Like-Button/tests.js @@ -6,9 +6,6 @@ document.documentElement.innerHTML = html.toString(); jest.dontMock('fs'); - - - describe("All the styles should be applied", ()=>{ const meta = document.querySelector("meta") const title = document.querySelector('title') @@ -23,7 +20,7 @@ describe("All the styles should be applied", ()=>{ expect(classTagStyles["padding"]).toBe("10px"); }); - test("the border radius should be '4px'", ()=>{ + test("the border radius should be '4px'", ()=>{ document.querySelector( "head" @@ -32,7 +29,7 @@ describe("All the styles should be applied", ()=>{ let classTagStyles = window.getComputedStyle(divTag); expect(classTagStyles["border-radius"]).toBe("4px"); }); - test("the background should be 'orange'", ()=>{ + test("the background should be 'orange'", ()=>{ document.querySelector( "head" @@ -41,7 +38,7 @@ describe("All the styles should be applied", ()=>{ let classTagStyles = window.getComputedStyle(divTag); expect(classTagStyles["background"]).toBe("orange"); }); - test("the underline should to be removed", ()=>{ + test("the underline should be removed", ()=>{ document.querySelector( "head" @@ -67,7 +64,7 @@ describe("All the styles should be applied", ()=>{ expect(orangeHoverSelector).toBe("darkorange"); }); - test("You should be careful with the specifity", ()=>{ + test("You should be careful with the specificity", ()=>{ document.querySelector( "head" ).innerHTML = ``; diff --git a/learn.json b/learn.json index 709ede73..dc56301e 100644 --- a/learn.json +++ b/learn.json @@ -11,8 +11,8 @@ "difficulty": "easy", "video-solutions": true, "graded": true, - "disabledActions": ["test"], - "disableGrading": true, + "disabledActions": [], + "disableGrading": false, "editor": { "version": "1.0.73" } From e93d52b08be5ed2969029c1ed463ced88962ed8f Mon Sep 17 00:00:00 2001 From: ErnestoXG Date: Fri, 2 Sep 2022 20:05:14 +0000 Subject: [PATCH 27/32] reversed file to original state --- exercises/07-Very-Specific-Rules/styles.css | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/exercises/07-Very-Specific-Rules/styles.css b/exercises/07-Very-Specific-Rules/styles.css index 55fb5ff4..c77b84c2 100644 --- a/exercises/07-Very-Specific-Rules/styles.css +++ b/exercises/07-Very-Specific-Rules/styles.css @@ -1,16 +1,5 @@ /** Insert your code here **/ -ul li { - color: red !important; -} - -ol li:nth-child(2) { - background-color: green; -} - -tr:nth-child(odd) { - background: yellow; -} /*********** READ ONLY BLOCK ****** You CANNOT UPDATE anything from here on, From 92519aa558563baaf3db05267151932bd72863b5 Mon Sep 17 00:00:00 2001 From: ErnestoXG Date: Mon, 5 Sep 2022 23:59:31 +0000 Subject: [PATCH 28/32] Added regex to check for important flag --- exercises/07-Very-Specific-Rules/tests.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/exercises/07-Very-Specific-Rules/tests.js b/exercises/07-Very-Specific-Rules/tests.js index 10b24a7e..66a759a2 100644 --- a/exercises/07-Very-Specific-Rules/tests.js +++ b/exercises/07-Very-Specific-Rules/tests.js @@ -11,19 +11,24 @@ describe("All the styles should be applied", ()=>{ const title = document.querySelector('title') const link = document.querySelector('link') - test("The ul li color has to be red", ()=>{ + test("The ul li color has to be red using !important", ()=>{ document.querySelector( "head" ).innerHTML = ``; + let cssArray = document.styleSheets[0].cssRules; - let orangeHoverSelector = ""; + let color = "" + for (let i = 0; i < cssArray.length; i++) { if (cssArray[i].selectorText === "ul li" || cssArray[i].selectorText === "ul > li") { - orangeHoverSelector = cssArray[i].style["color"]; + color = cssArray[i].cssText; } } - expect(orangeHoverSelector).toBe("red"); + let reg = new RegExp(/\s*color:\s*red\s*!important\s*;\s*/gm) + + expect(reg.test(color)).toBeTruthy(); }); + test("The ul second element background should be green", ()=>{ document.querySelector( "head" @@ -39,6 +44,7 @@ describe("All the styles should be applied", ()=>{ } expect(orangeHoverSelector).toBe("green"); }) + test("The odd rows of the table should have yellow background", ()=>{ document.querySelector( "head" @@ -63,8 +69,8 @@ describe("All the styles should be applied", ()=>{ let cssArray = document.styleSheets[0].cssRules[4].selectorText; expect(cssArray).toBe("ul li,\nol li"); expect(cssBody).toBe("body"); - } - ) + }) + test("You should not change the existing head tag elements", ()=>{ let head = document.querySelector('head') expect(head).toBeTruthy() @@ -76,4 +82,5 @@ describe("All the styles should be applied", ()=>{ expect(title).toBeTruthy() }) + }); \ No newline at end of file From d560a459118735b1040f52b5a9827ce9ebe4d065 Mon Sep 17 00:00:00 2001 From: ErnestoXG Date: Tue, 6 Sep 2022 01:14:36 +0000 Subject: [PATCH 29/32] improved exercises --- exercises/08-Rounded-Image/solution.hide.css | 1 + 1 file changed, 1 insertion(+) diff --git a/exercises/08-Rounded-Image/solution.hide.css b/exercises/08-Rounded-Image/solution.hide.css index 2ddc0eed..31815f5c 100644 --- a/exercises/08-Rounded-Image/solution.hide.css +++ b/exercises/08-Rounded-Image/solution.hide.css @@ -3,6 +3,7 @@ body { } .rounded { object-fit: cover; + object-position: top; width: 200px; height: 200px; border-radius: 100%; From 854e0162ed69aefa201d6fa8b70644812b01e654 Mon Sep 17 00:00:00 2001 From: ErnestoXG Date: Tue, 6 Sep 2022 01:15:14 +0000 Subject: [PATCH 30/32] improved instructions and provided additional documentation on object-fit --- exercises/08-Rounded-Image/README.es.md | 4 +++- exercises/08-Rounded-Image/README.md | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/exercises/08-Rounded-Image/README.es.md b/exercises/08-Rounded-Image/README.es.md index 956bcbb7..3e7e4c25 100644 --- a/exercises/08-Rounded-Image/README.es.md +++ b/exercises/08-Rounded-Image/README.es.md @@ -16,6 +16,8 @@ El problema con este enfoque es que solo funciona para imágenes cuadradas... La ## 💡 Pista: -+ Si la imagen es más grande que el `div` y quieres centrarla o enfocarte en una zona en particular puedes utilizar `object-position`. ++ Si la imagen es más grande que su contenedor y quieres centrarla o enfocarte en una zona en particular puedes utilizar `object-position`. + En este articulo puedes leer más [sobre la propiedad object fit](https://css-tricks.com/on-object-fit-and-object-position/) + ++ Adicionalmente, puedes [leer la documentación de object-position](https://developer.mozilla.org/en-US/docs/Web/CSS/object-position) y [la documentación de object-fit](https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit) diff --git a/exercises/08-Rounded-Image/README.md b/exercises/08-Rounded-Image/README.md index 7fedd48e..7cedf6b1 100644 --- a/exercises/08-Rounded-Image/README.md +++ b/exercises/08-Rounded-Image/README.md @@ -15,7 +15,8 @@ The obvious way create a rounded profile picture is to create an image tag and a ## 💡 Hint: -+ If the image ends up being bigger than the `div` (or with different proportions) you can adjust the `object-position` to choose what part of the image you want to display inside of the circle. ++ If the image ends up being bigger than its container (or with different proportions) you can adjust the `object-position` to choose what part of the image you want to display inside of the circle. + You can also read [this great article about object fit](https://css-tricks.com/on-object-fit-and-object-position/) ++ Additionally you can [read the documentation on object-position](https://developer.mozilla.org/en-US/docs/Web/CSS/object-position) and [the documentation on object-fit](https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit) \ No newline at end of file From 3047ec2a1e6dd7ce094b06356701ae615d4e03d9 Mon Sep 17 00:00:00 2001 From: ErnestoXG Date: Tue, 6 Sep 2022 01:15:53 +0000 Subject: [PATCH 31/32] deleted unnecessary tests, added tests to check for actual solution, and improved code format --- exercises/08-Rounded-Image/tests.js | 94 +++++++++++++---------------- 1 file changed, 43 insertions(+), 51 deletions(-) diff --git a/exercises/08-Rounded-Image/tests.js b/exercises/08-Rounded-Image/tests.js index c03d1580..adcba6f3 100644 --- a/exercises/08-Rounded-Image/tests.js +++ b/exercises/08-Rounded-Image/tests.js @@ -11,73 +11,65 @@ describe("All the styles should be applied", () => { const title = document.querySelector('title') const link = document.querySelector('link') - test("The tag has to be removed", () => { - document.querySelector( - "head" - ).innerHTML = ``; - expect(document.querySelector("img")).toBeFalsy(); - }); - test("The
tag should exists", () => { - document.querySelector( - "head" - ).innerHTML = ``; - expect(document.querySelector("div")).toBeTruthy(); - }); - test("the width in the div Tag should be '200px'", () => { - // get computed styles of any element you like - document.querySelector( - "head" - ).innerHTML = ``; - const divTag = document.querySelector("div"); - let idTagStyles = window.getComputedStyle(divTag); - expect(idTagStyles["width"]).toBe("200px"); - }); - test("the height in the div Tag should be '200px'", () => { - // get computed styles of any element you like - document.querySelector( - "head" - ).innerHTML = ``; - const divTag = document.querySelector("div"); - let idTagStyles = window.getComputedStyle(divTag); - expect(idTagStyles["height"]).toBe("200px"); - }); - test("the border radius in the div Tag should be '100%'", () => { - // get computed styles of any element you like + const img = document.querySelector(".rounded") + + test("the img tag should exist", () => { + expect(img).toBeTruthy(); + }) + + test("the width in the img Tag should be equal to its height and vice versa", () => { document.querySelector( "head" ).innerHTML = ``; - const divTag = document.querySelector("div"); - let idTagStyles = window.getComputedStyle(divTag); - expect(idTagStyles["border-radius"]).toBe("100%"); + + let cssArray = document.styleSheets[0].cssRules; + + let width = ""; + let height = ""; + + for (let i = 0; i < cssArray.length; i++) { + if (cssArray[i].selectorText === ".rounded") { + width = cssArray[i].style["width"]; + height = cssArray[i].style["height"]; + } + } + + // checks if styles return empty string "" or undefined + expect(width).toBeTruthy(); + expect(height).toBeTruthy(); + + expect(width).toBe(height); + expect(height).toBe(width); }); - test("the background position x in the div Tag should be 'center'", () => { - // get computed styles of any element you like + + test("the border radius of the img Tag should be '100%'", () => { document.querySelector( "head" ).innerHTML = ``; - const divTag = document.querySelector("div"); - let idTagStyles = window.getComputedStyle(divTag); - expect(idTagStyles["background-position-x"]).toBe("center"); + + let imgStyle = window.getComputedStyle(img); + expect(imgStyle["border-radius"]).toBe("100%"); }); - test("the background position y in the div Tag should be 'center'", () => { - // get computed styles of any element you like + + test("the object-fit value of the img Tag should be 'cover'", () => { document.querySelector( "head" ).innerHTML = ``; - const divTag = document.querySelector("div"); - let idTagStyles = window.getComputedStyle(divTag); - expect(idTagStyles["background-position-y"]).toBe("center"); + + let imgStyle = window.getComputedStyle(img); + expect(imgStyle["object-fit"]).toBe("cover"); }); - test("the background image in the div Tag should exists", () => { - // get computed styles of any element you like + + test("the object-position value of the img Tag should be 'top'", () => { document.querySelector( "head" ).innerHTML = ``; - const divTag = document.querySelector("div"); - let idTagStyles = window.getComputedStyle(divTag); - expect(idTagStyles["background-image"]).toBeTruthy(); + + let imgStyle = window.getComputedStyle(img); + expect(imgStyle["object-position"]).toBe("top"); }); - test("You should not change the existing head tag elements", ()=>{ + + test("You should not change the existing head tag elements", () => { let head = document.querySelector('head') expect(head).toBeTruthy() From 90e52397a48ad3572739790a95bf7b49d6b5c9aa Mon Sep 17 00:00:00 2001 From: Tomas Gonzalez Date: Mon, 12 Sep 2022 21:33:26 +0000 Subject: [PATCH 32/32] Some details added to the tests --- exercises/04.3-id-Selector/index.html | 2 +- exercises/04.3-id-Selector/test.js | 1 + exercises/06-Practicing-Rules/README.es.md | 6 +-- exercises/06-Practicing-Rules/README.md | 6 +-- exercises/06-Practicing-Rules/index.html | 42 ++++++++++--------- .../06-Practicing-Rules/solution.hide.css | 1 - exercises/06-Practicing-Rules/styles.css | 2 +- exercises/06-Practicing-Rules/tests.js | 19 +-------- .../07-Very-Specific-Rules/solution.hide.css | 4 +- exercises/07-Very-Specific-Rules/styles.css | 1 + exercises/07-Very-Specific-Rules/tests.js | 2 +- exercises/08-Rounded-Image/tests.js | 9 ---- exercises/12-Relative-Length-EM-REM/tests.js | 17 -------- exercises/13-Anchor-Like-Button/tests.js | 25 ----------- 14 files changed, 37 insertions(+), 100 deletions(-) diff --git a/exercises/04.3-id-Selector/index.html b/exercises/04.3-id-Selector/index.html index a7964559..5b9a773d 100644 --- a/exercises/04.3-id-Selector/index.html +++ b/exercises/04.3-id-Selector/index.html @@ -8,6 +8,6 @@ - I should look like a button + I should look like a button diff --git a/exercises/04.3-id-Selector/test.js b/exercises/04.3-id-Selector/test.js index cbae3b3f..f9ea69cc 100644 --- a/exercises/04.3-id-Selector/test.js +++ b/exercises/04.3-id-Selector/test.js @@ -15,6 +15,7 @@ test("There should be a span tag", () => { test("The span tag should have id 'button1'", () => { expect(span).toBeTruthy(); let id = span.id + expect(id).toBeTruthy(); expect(id).toBe('button1'); }); diff --git a/exercises/06-Practicing-Rules/README.es.md b/exercises/06-Practicing-Rules/README.es.md index ee953a20..9cf27efa 100644 --- a/exercises/06-Practicing-Rules/README.es.md +++ b/exercises/06-Practicing-Rules/README.es.md @@ -10,11 +10,11 @@ 4. Haz todos los `h2` tengan subrayado. -5. Centra el `h1`. +5. Agrega un `left padding` a todo el documento de `20px` para que sea más fácil de leer. -6. Agrega un `left padding` a todo el documento de `20px` para que sea más fácil de leer. +6. Agrega un fondo blanco semitransparente (`semi-transparent background 0.2`) al primer párrafo de "3 reasons you know you are learning" para que sea más fácil de leer (tienes que usar `rgba` para esto). -7. Agrega un fondo blanco semitransparente (`semi-transparent background 0.2`) al primer párrafo de "3 reasons you know you are learning" para que sea más fácil de leer (tienes que usar `rgba` para esto), y luego aplica un `padding` de `5px` a todos los lados de ese párrafo. +7. Luego aplica un `padding` de `5px` a todos los lados de ese párrafo. 8. Cambia el color del `anchor` "hover" a verde (`green`) y elimina el subrayado (tienes que colocar el anchor para probarlo). diff --git a/exercises/06-Practicing-Rules/README.md b/exercises/06-Practicing-Rules/README.md index b8b63bcc..1f418bfc 100644 --- a/exercises/06-Practicing-Rules/README.md +++ b/exercises/06-Practicing-Rules/README.md @@ -14,11 +14,11 @@ tutorial: "https://www.youtube.com/watch?v=4wguurrl-lU" 4. Make all the `h2's` with an `underline`. -5. Center the `h1` to the middle. +5. Add a `left padding` to the whole document of `20px` to make it easier to read. -6. Add a `left padding` to the whole document of `20px` to make it easier to read. +6. Add a white `semi-transparent background (0.2)` to the `first paragraph` to make it easier to read (you have tu use `rgba` for that) and write down "3 reasons you know you are learning". -7. Add a white `semi-transparent background (0.2)` to the `first paragraph` to make it easier to read (you have tu use `rgba` for that) and write down "3 reasons you know you are learning". Then apply a `padding` of `5px` to all sides of that paragraph. +7. Then apply a `padding` of `5px` to all sides of that paragraph. 8. Change the `anchor` "hover" color to `green` and remove the underline (you have to actually hover the anchor to test it). diff --git a/exercises/06-Practicing-Rules/index.html b/exercises/06-Practicing-Rules/index.html index db2eb563..2651f781 100644 --- a/exercises/06-Practicing-Rules/index.html +++ b/exercises/06-Practicing-Rules/index.html @@ -8,25 +8,27 @@ -

The learning essay

-

3 reasons you know you are learning

-

- We are going to explain in this pharagraph the 3 most comon signs that you should look into yourself to recognize if you are learning. -

-
    -
  1. You are able to complete the exercises by yourself.
  2. -
  3. You understand what the teacher is talking about
  4. -
  5. Your are able to have conversations about the topic
  6. -
-

3 reasons you know love what you are learning

-
    -
  • Time passes fast.
  • -
  • You are anxious to finish this excercise and start the next one.
  • -
  • Is 12am and you don't want to go to sleep.
  • -
-

- If you can't sleep, what better than watching videos of cats? - click here -

+
+

The learning essay

+

3 reasons you know you are learning

+

+ We are going to explain in this pharagraph the 3 most comon signs that you should look into yourself to recognize if you are learning. +

+
    +
  1. You are able to complete the exercises by yourself.
  2. +
  3. You understand what the teacher is talking about
  4. +
  5. Your are able to have conversations about the topic
  6. +
+

3 reasons you know love what you are learning

+
    +
  • Time passes fast.
  • +
  • You are anxious to finish this excercise and start the next one.
  • +
  • Is 12am and you don't want to go to sleep.
  • +
+

+ If you can't sleep, what better than watching videos of cats? + click here +

+
diff --git a/exercises/06-Practicing-Rules/solution.hide.css b/exercises/06-Practicing-Rules/solution.hide.css index d1e24e3c..4026152e 100644 --- a/exercises/06-Practicing-Rules/solution.hide.css +++ b/exercises/06-Practicing-Rules/solution.hide.css @@ -13,7 +13,6 @@ body { h1 { font-family: "Courier"; color: red; - text-align: center; } h2 { diff --git a/exercises/06-Practicing-Rules/styles.css b/exercises/06-Practicing-Rules/styles.css index d89b1a47..9a7fae86 100644 --- a/exercises/06-Practicing-Rules/styles.css +++ b/exercises/06-Practicing-Rules/styles.css @@ -1 +1 @@ -/* add your styles here */ \ No newline at end of file +/* add your styles here */ diff --git a/exercises/06-Practicing-Rules/tests.js b/exercises/06-Practicing-Rules/tests.js index 9bb32a78..a348b847 100644 --- a/exercises/06-Practicing-Rules/tests.js +++ b/exercises/06-Practicing-Rules/tests.js @@ -55,15 +55,6 @@ describe("All the styles should be applied", () => { // get computed styles of any element you like expect(h1TagStyles["color"]).toBe("red"); }); - test("the text-align in the H1 Tag should be 'center'", () => { - document.querySelector( - "head" - ).innerHTML = ``; - let h1Tag = document.querySelector("h1"); - let h1TagStyles = window.getComputedStyle(h1Tag); - // get computed styles of any element you like - expect(h1TagStyles["text-align"]).toBe("center"); - }); test("the text-decoration in the H2 Tag should be 'underline'", () => { document.querySelector( "head" @@ -82,15 +73,7 @@ describe("All the styles should be applied", () => { let idTagStyles = window.getComputedStyle(idTag); expect(idTagStyles["padding"]).toBe("5px"); }); - test("the background-color in the #id1 Tag should be 'semi transparent white'", () => { - document.querySelector( - "head" - ).innerHTML = ``; - // get computed styles of any element you like - const idTag = document.querySelector("#id1"); - let idTagStyles = window.getComputedStyle(idTag); - expect(idTagStyles["background-color"]).toBe("rgba(255, 255, 255, 0.2)"); - }); + test("The a hover underline should be removed", () => { document.querySelector( "head" diff --git a/exercises/07-Very-Specific-Rules/solution.hide.css b/exercises/07-Very-Specific-Rules/solution.hide.css index eb60fcfa..55fb5ff4 100644 --- a/exercises/07-Very-Specific-Rules/solution.hide.css +++ b/exercises/07-Very-Specific-Rules/solution.hide.css @@ -1,6 +1,7 @@ /** Insert your code here **/ + ul li { - color: red; + color: red !important; } ol li:nth-child(2) { @@ -10,6 +11,7 @@ ol li:nth-child(2) { tr:nth-child(odd) { background: yellow; } + /*********** READ ONLY BLOCK ****** You CANNOT UPDATE anything from here on, only add lines of code on top of this lines diff --git a/exercises/07-Very-Specific-Rules/styles.css b/exercises/07-Very-Specific-Rules/styles.css index c77b84c2..06ec4a71 100644 --- a/exercises/07-Very-Specific-Rules/styles.css +++ b/exercises/07-Very-Specific-Rules/styles.css @@ -1,6 +1,7 @@ /** Insert your code here **/ + /*********** READ ONLY BLOCK ****** You CANNOT UPDATE anything from here on, only add lines of code on top of this lines diff --git a/exercises/07-Very-Specific-Rules/tests.js b/exercises/07-Very-Specific-Rules/tests.js index 66a759a2..26cd5978 100644 --- a/exercises/07-Very-Specific-Rules/tests.js +++ b/exercises/07-Very-Specific-Rules/tests.js @@ -24,7 +24,7 @@ describe("All the styles should be applied", ()=>{ color = cssArray[i].cssText; } } - let reg = new RegExp(/\s*color:\s*red\s*!important\s*;\s*/gm) + let reg = new RegExp(/color:\s*red\s*!important\s*;/gm) expect(reg.test(color)).toBeTruthy(); }); diff --git a/exercises/08-Rounded-Image/tests.js b/exercises/08-Rounded-Image/tests.js index adcba6f3..70c5b643 100644 --- a/exercises/08-Rounded-Image/tests.js +++ b/exercises/08-Rounded-Image/tests.js @@ -42,15 +42,6 @@ describe("All the styles should be applied", () => { expect(height).toBe(width); }); - test("the border radius of the img Tag should be '100%'", () => { - document.querySelector( - "head" - ).innerHTML = ``; - - let imgStyle = window.getComputedStyle(img); - expect(imgStyle["border-radius"]).toBe("100%"); - }); - test("the object-fit value of the img Tag should be 'cover'", () => { document.querySelector( "head" diff --git a/exercises/12-Relative-Length-EM-REM/tests.js b/exercises/12-Relative-Length-EM-REM/tests.js index 2752a78d..f6987b7a 100644 --- a/exercises/12-Relative-Length-EM-REM/tests.js +++ b/exercises/12-Relative-Length-EM-REM/tests.js @@ -28,23 +28,6 @@ describe("All the styles should be applied", ()=>{ var styles = window.getComputedStyle(h3Tag); expect(styles["font-size"]).toBe("0.8rem"); }); - test("You should add your rules below the existing code", ()=>{ - document.querySelector( - "head" - ).innerHTML = ``; - let cssArray = document.styleSheets[0].cssRules[0].selectorText; - - expect(cssArray).toBe("#my-first-div"); - } - ) - test("You should add your rules below the existing code", ()=>{ - document.querySelector( - "head" - ).innerHTML = ``; - let cssArray = document.styleSheets[0].cssRules[1].selectorText; - expect(cssArray).toBe("#the-second-one"); - } - ) test("You should not change the existing head tag elements", ()=>{ let head = document.querySelector('head') expect(head).toBeTruthy() diff --git a/exercises/13-Anchor-Like-Button/tests.js b/exercises/13-Anchor-Like-Button/tests.js index d93dc049..587b95d7 100644 --- a/exercises/13-Anchor-Like-Button/tests.js +++ b/exercises/13-Anchor-Like-Button/tests.js @@ -29,15 +29,6 @@ describe("All the styles should be applied", ()=>{ let classTagStyles = window.getComputedStyle(divTag); expect(classTagStyles["border-radius"]).toBe("4px"); }); - test("the background should be 'orange'", ()=>{ - document.querySelector( - "head" - - ).innerHTML = ``; - let divTag = document.querySelector(".orange-btn"); - let classTagStyles = window.getComputedStyle(divTag); - expect(classTagStyles["background"]).toBe("orange"); - }); test("the underline should be removed", ()=>{ document.querySelector( "head" @@ -47,22 +38,6 @@ describe("All the styles should be applied", ()=>{ let classTagStyles = window.getComputedStyle(divTag); expect(classTagStyles["text-decoration"]).toBe("none"); }); - test("The mouse hover property should be 'darkorange'", ()=>{ - // get computed styles of any element you like - document.querySelector( - "head" - ).innerHTML = ``; - let cssArray = document.styleSheets[0].cssRules; - - let orangeHoverSelector = ""; - for (let i = 0; i < cssArray.length; i++) { - if (cssArray[i].selectorText === ".orange-btn:hover") { - orangeHoverSelector = cssArray[i].style.background; - } - } - - expect(orangeHoverSelector).toBe("darkorange"); - }); test("You should be careful with the specificity", ()=>{ document.querySelector(