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
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