From 07c775adeb4813ec4f30f296e8bcae6e4881c9f3 Mon Sep 17 00:00:00 2001 From: plucodev Date: Thu, 1 Aug 2019 12:11:02 -0400 Subject: [PATCH 01/25] Added all 13 exercises folders with all the files --- bc.json | 2 +- exercises/01-hello-world/README.md | 8 +-- exercises/02-Background/README.md | 15 ++++++ exercises/02-Background/index.html | 14 +++++ exercises/02-Background/index.js | 1 + exercises/02-Background/styles.css | 5 ++ exercises/02-Background/tests.js | 54 +++++++++++++++++++ exercises/03-Inline-Styles/README.md | 15 ++++++ exercises/03-Inline-Styles/index.html | 14 +++++ exercises/03-Inline-Styles/index.js | 1 + exercises/03-Inline-Styles/styles.css | 0 exercises/03-Inline-Styles/tests.js | 54 +++++++++++++++++++ exercises/04-Combined-Rules/README.md | 15 ++++++ exercises/04-Combined-Rules/index.html | 14 +++++ exercises/04-Combined-Rules/index.js | 1 + exercises/04-Combined-Rules/styles.css | 0 exercises/04-Combined-Rules/tests.js | 54 +++++++++++++++++++ exercises/05-Specificity/README.md | 15 ++++++ exercises/05-Specificity/index.html | 14 +++++ exercises/05-Specificity/index.js | 1 + exercises/05-Specificity/styles.css | 0 exercises/05-Specificity/tests.js | 54 +++++++++++++++++++ exercises/06-Practicing-Rules/README.md | 15 ++++++ exercises/06-Practicing-Rules/index.html | 14 +++++ exercises/06-Practicing-Rules/index.js | 1 + exercises/06-Practicing-Rules/styles.css | 0 exercises/06-Practicing-Rules/tests.js | 54 +++++++++++++++++++ exercises/07-Very-Specific-Rules/README.md | 15 ++++++ exercises/07-Very-Specific-Rules/index.html | 14 +++++ exercises/07-Very-Specific-Rules/index.js | 1 + exercises/07-Very-Specific-Rules/styles.css | 0 exercises/07-Very-Specific-Rules/tests.js | 54 +++++++++++++++++++ exercises/08-Rounded-Image/README.md | 15 ++++++ exercises/08-Rounded-Image/index.html | 14 +++++ exercises/08-Rounded-Image/index.js | 1 + exercises/08-Rounded-Image/styles.css | 0 exercises/08-Rounded-Image/tests.js | 54 +++++++++++++++++++ exercises/09-Anchor-Styles/README.md | 15 ++++++ exercises/09-Anchor-Styles/index.html | 14 +++++ exercises/09-Anchor-Styles/index.js | 1 + exercises/09-Anchor-Styles/styles.css | 0 exercises/09-Anchor-Styles/tests.js | 54 +++++++++++++++++++ exercises/10-Your-Own-Font/README.md | 15 ++++++ exercises/10-Your-Own-Font/index.html | 14 +++++ exercises/10-Your-Own-Font/index.js | 1 + exercises/10-Your-Own-Font/styles.css | 0 exercises/10-Your-Own-Font/tests.js | 54 +++++++++++++++++++ exercises/11-Font-Awesome-Icons/README.md | 15 ++++++ exercises/11-Font-Awesome-Icons/index.html | 14 +++++ exercises/11-Font-Awesome-Icons/index.js | 1 + exercises/11-Font-Awesome-Icons/styles.css | 0 exercises/11-Font-Awesome-Icons/tests.js | 54 +++++++++++++++++++ exercises/12-Relative-Length-EM-REM/README.md | 15 ++++++ .../12-Relative-Length-EM-REM/index.html | 14 +++++ exercises/12-Relative-Length-EM-REM/index.js | 1 + .../12-Relative-Length-EM-REM/styles.css | 0 exercises/12-Relative-Length-EM-REM/tests.js | 54 +++++++++++++++++++ exercises/13-Anchor-Like-Button/README.md | 15 ++++++ exercises/13-Anchor-Like-Button/index.html | 14 +++++ exercises/13-Anchor-Like-Button/index.js | 1 + exercises/13-Anchor-Like-Button/styles.css | 0 exercises/13-Anchor-Like-Button/tests.js | 54 +++++++++++++++++++ 62 files changed, 1019 insertions(+), 4 deletions(-) create mode 100644 exercises/02-Background/README.md create mode 100644 exercises/02-Background/index.html create mode 100644 exercises/02-Background/index.js create mode 100644 exercises/02-Background/styles.css create mode 100644 exercises/02-Background/tests.js create mode 100644 exercises/03-Inline-Styles/README.md create mode 100644 exercises/03-Inline-Styles/index.html create mode 100644 exercises/03-Inline-Styles/index.js create mode 100644 exercises/03-Inline-Styles/styles.css create mode 100644 exercises/03-Inline-Styles/tests.js create mode 100644 exercises/04-Combined-Rules/README.md create mode 100644 exercises/04-Combined-Rules/index.html create mode 100644 exercises/04-Combined-Rules/index.js create mode 100644 exercises/04-Combined-Rules/styles.css create mode 100644 exercises/04-Combined-Rules/tests.js create mode 100644 exercises/05-Specificity/README.md create mode 100644 exercises/05-Specificity/index.html create mode 100644 exercises/05-Specificity/index.js create mode 100644 exercises/05-Specificity/styles.css create mode 100644 exercises/05-Specificity/tests.js create mode 100644 exercises/06-Practicing-Rules/README.md create mode 100644 exercises/06-Practicing-Rules/index.html create mode 100644 exercises/06-Practicing-Rules/index.js create mode 100644 exercises/06-Practicing-Rules/styles.css create mode 100644 exercises/06-Practicing-Rules/tests.js create mode 100644 exercises/07-Very-Specific-Rules/README.md create mode 100644 exercises/07-Very-Specific-Rules/index.html create mode 100644 exercises/07-Very-Specific-Rules/index.js create mode 100644 exercises/07-Very-Specific-Rules/styles.css create mode 100644 exercises/07-Very-Specific-Rules/tests.js create mode 100644 exercises/08-Rounded-Image/README.md create mode 100644 exercises/08-Rounded-Image/index.html create mode 100644 exercises/08-Rounded-Image/index.js create mode 100644 exercises/08-Rounded-Image/styles.css create mode 100644 exercises/08-Rounded-Image/tests.js create mode 100644 exercises/09-Anchor-Styles/README.md create mode 100644 exercises/09-Anchor-Styles/index.html create mode 100644 exercises/09-Anchor-Styles/index.js create mode 100644 exercises/09-Anchor-Styles/styles.css create mode 100644 exercises/09-Anchor-Styles/tests.js create mode 100644 exercises/10-Your-Own-Font/README.md create mode 100644 exercises/10-Your-Own-Font/index.html create mode 100644 exercises/10-Your-Own-Font/index.js create mode 100644 exercises/10-Your-Own-Font/styles.css create mode 100644 exercises/10-Your-Own-Font/tests.js create mode 100644 exercises/11-Font-Awesome-Icons/README.md create mode 100644 exercises/11-Font-Awesome-Icons/index.html create mode 100644 exercises/11-Font-Awesome-Icons/index.js create mode 100644 exercises/11-Font-Awesome-Icons/styles.css create mode 100644 exercises/11-Font-Awesome-Icons/tests.js create mode 100644 exercises/12-Relative-Length-EM-REM/README.md create mode 100644 exercises/12-Relative-Length-EM-REM/index.html create mode 100644 exercises/12-Relative-Length-EM-REM/index.js create mode 100644 exercises/12-Relative-Length-EM-REM/styles.css create mode 100644 exercises/12-Relative-Length-EM-REM/tests.js create mode 100644 exercises/13-Anchor-Like-Button/README.md create mode 100644 exercises/13-Anchor-Like-Button/index.html create mode 100644 exercises/13-Anchor-Like-Button/index.js create mode 100644 exercises/13-Anchor-Like-Button/styles.css create mode 100644 exercises/13-Anchor-Like-Button/tests.js diff --git a/bc.json b/bc.json index bca021c6..47d3bb08 100644 --- a/bc.json +++ b/bc.json @@ -1,3 +1,3 @@ { "compiler": "vanillajs" -} \ No newline at end of file +} diff --git a/exercises/01-hello-world/README.md b/exercises/01-hello-world/README.md index ea6379fb..e8143c69 100644 --- a/exercises/01-hello-world/README.md +++ b/exercises/01-hello-world/README.md @@ -4,14 +4,16 @@ In this website, we have 2 elements: a H1 with the ID #theTitle and a paragraph You can select any of the objects in the DOM with the getElementById function. If we want to select the h1 paragraph and assign it to a variable, do the following: -var aux = document.getElementById('theTitle'); +```javascript +var aux = document.getElementById("theTitle"); +``` Now that we have our h1 element stored in the aux variable, we can access any of the properties of the element, for example we can retrieve the font-size style property. ## 📝 Instructions: + Prompt an alert with the ID of the h1. Hint: -- Here you can read more about the id property of any DOM element: http://www.w3schools.com/jsref/prop_html_id.asp - +- Here you can read more about the id property of any DOM element: http://www.w3schools.com/jsref/prop_html_id.asp diff --git a/exercises/02-Background/README.md b/exercises/02-Background/README.md new file mode 100644 index 00000000..60ff20bf --- /dev/null +++ b/exercises/02-Background/README.md @@ -0,0 +1,15 @@ +# `02` Background + +The "background" CSS rule allows us to assign and work with the background of any container- the background can be a color or an image. If it is an image you can specify if you want the image to repeat horizontally, vertically, both, or not at all, and you can also specify if you want it to resize and fit the whole container where its being applied, among other properties that can be modified. + +## 📝 Instructions: + +Run the exercise. +Change the background-size to "contain" (check the index.css tab). +Run the exercise again. +Change the background-repeat to inherit to make it repeat over the x axis and y axis. +Run the exercise again. + +Hint: + +- How to use the background-size: http://lmgtfy.com/?q=css+background-size diff --git a/exercises/02-Background/index.html b/exercises/02-Background/index.html new file mode 100644 index 00000000..e5ddcd6d --- /dev/null +++ b/exercises/02-Background/index.html @@ -0,0 +1,14 @@ + + + + + + + + +

+ This is my description, it needs to be long because is supposed to be a + paragraph and not a title. +

+ + diff --git a/exercises/02-Background/index.js b/exercises/02-Background/index.js new file mode 100644 index 00000000..ee1aa2a5 --- /dev/null +++ b/exercises/02-Background/index.js @@ -0,0 +1 @@ +//nothing to see here diff --git a/exercises/02-Background/styles.css b/exercises/02-Background/styles.css new file mode 100644 index 00000000..fec6568c --- /dev/null +++ b/exercises/02-Background/styles.css @@ -0,0 +1,5 @@ +body { + background-image: url(https://4geeksacademy.github.io/exercise-assets/img/bg/small-mosaic.jpg); + background-size: cover; + background-repeat: no-repeat; +} diff --git a/exercises/02-Background/tests.js b/exercises/02-Background/tests.js new file mode 100644 index 00000000..dd0b70b7 --- /dev/null +++ b/exercises/02-Background/tests.js @@ -0,0 +1,54 @@ +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(); + }); + + it("the background should be blue", function() { + // get computed styles of any element you like + const body = document.querySelector("body"); + var styles = window.getComputedStyle(body); + expect(styles["background-color"]).toBe("blue"); + }); +}); + +describe("All the css should match", function() { + beforeEach(() => { + //here I import the HTML into the document + document.documentElement.innerHTML = html.toString(); + }); + afterEach(() => { + jest.resetModules(); + }); + + it("the html code should contain a p tag", function() { + // we can read from the source code + console.log(html.toString()); + expect(html.toString().indexOf(` -1).toBeTruthy(); + + //or use query selector to compare hoy mane scriptags do we have + const pTags = document.querySelectorAll("p"); + expect(pTags.length).toBe(1); + }); + + it('the p tag should have a class "big"', function() { + //or use query selector to compare hoy mane scriptags do we have + const p = document.querySelector("p"); + expect(p.classList.contains("big")).toBeTruthy(); + }); +}); diff --git a/exercises/03-Inline-Styles/README.md b/exercises/03-Inline-Styles/README.md new file mode 100644 index 00000000..66332896 --- /dev/null +++ b/exercises/03-Inline-Styles/README.md @@ -0,0 +1,15 @@ +# `03` Inline Styles + +The "background" CSS rule allows us to assign and work with the background of any container- the background can be a color or an image. If it is an image you can specify if you want the image to repeat horizontally, vertically, both, or not at all, and you can also specify if you want it to resize and fit the whole container where its being applied, among other properties that can be modified. + +## 📝 Instructions: + +Run the exercise. +Change the background-size to "contain" (check the index.css tab). +Run the exercise again. +Change the background-repeat to inherit to make it repeat over the x axis and y axis. +Run the exercise again. + +Hint: + +- How to use the background-size: http://lmgtfy.com/?q=css+background-size diff --git a/exercises/03-Inline-Styles/index.html b/exercises/03-Inline-Styles/index.html new file mode 100644 index 00000000..e5ddcd6d --- /dev/null +++ b/exercises/03-Inline-Styles/index.html @@ -0,0 +1,14 @@ + + + + + + + + +

+ This is my description, it needs to be long because is supposed to be a + paragraph and not a title. +

+ + diff --git a/exercises/03-Inline-Styles/index.js b/exercises/03-Inline-Styles/index.js new file mode 100644 index 00000000..ee1aa2a5 --- /dev/null +++ b/exercises/03-Inline-Styles/index.js @@ -0,0 +1 @@ +//nothing to see here diff --git a/exercises/03-Inline-Styles/styles.css b/exercises/03-Inline-Styles/styles.css new file mode 100644 index 00000000..e69de29b diff --git a/exercises/03-Inline-Styles/tests.js b/exercises/03-Inline-Styles/tests.js new file mode 100644 index 00000000..48541114 --- /dev/null +++ b/exercises/03-Inline-Styles/tests.js @@ -0,0 +1,54 @@ + +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(); }); + + it('the background should be blue', function () { + + // get computed styles of any element you like + const body = document.querySelector('body'); + var styles = window.getComputedStyle(body); + expect(styles["background-color"]).toBe("blue"); + }); +}); + + +describe('All the html should match', function () { + beforeEach(() => { + //here I import the HTML into the document + document.documentElement.innerHTML = html.toString(); + }); + afterEach(() => { jest.resetModules(); }); + + it('the html code should contain a p tag', function () { + + // we can read from the source code + console.log(html.toString()); + expect(html.toString().indexOf(` -1).toBeTruthy(); + + //or use query selector to compare hoy mane scriptags do we have + const pTags = document.querySelectorAll("p"); + expect(pTags.length).toBe(1); + }); + + + it('the p tag should have a class "big"', function () { + + //or use query selector to compare hoy mane scriptags do we have + const p = document.querySelector("p"); + expect(p.classList.contains("big")).toBeTruthy(); + }); +}); \ No newline at end of file diff --git a/exercises/04-Combined-Rules/README.md b/exercises/04-Combined-Rules/README.md new file mode 100644 index 00000000..b881b914 --- /dev/null +++ b/exercises/04-Combined-Rules/README.md @@ -0,0 +1,15 @@ +# `04` Combined Rules + +The "background" CSS rule allows us to assign and work with the background of any container- the background can be a color or an image. If it is an image you can specify if you want the image to repeat horizontally, vertically, both, or not at all, and you can also specify if you want it to resize and fit the whole container where its being applied, among other properties that can be modified. + +## 📝 Instructions: + +Run the exercise. +Change the background-size to "contain" (check the index.css tab). +Run the exercise again. +Change the background-repeat to inherit to make it repeat over the x axis and y axis. +Run the exercise again. + +Hint: + +- How to use the background-size: http://lmgtfy.com/?q=css+background-size diff --git a/exercises/04-Combined-Rules/index.html b/exercises/04-Combined-Rules/index.html new file mode 100644 index 00000000..e5ddcd6d --- /dev/null +++ b/exercises/04-Combined-Rules/index.html @@ -0,0 +1,14 @@ + + + + + + + + +

+ This is my description, it needs to be long because is supposed to be a + paragraph and not a title. +

+ + diff --git a/exercises/04-Combined-Rules/index.js b/exercises/04-Combined-Rules/index.js new file mode 100644 index 00000000..ee1aa2a5 --- /dev/null +++ b/exercises/04-Combined-Rules/index.js @@ -0,0 +1 @@ +//nothing to see here diff --git a/exercises/04-Combined-Rules/styles.css b/exercises/04-Combined-Rules/styles.css new file mode 100644 index 00000000..e69de29b diff --git a/exercises/04-Combined-Rules/tests.js b/exercises/04-Combined-Rules/tests.js new file mode 100644 index 00000000..48541114 --- /dev/null +++ b/exercises/04-Combined-Rules/tests.js @@ -0,0 +1,54 @@ + +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(); }); + + it('the background should be blue', function () { + + // get computed styles of any element you like + const body = document.querySelector('body'); + var styles = window.getComputedStyle(body); + expect(styles["background-color"]).toBe("blue"); + }); +}); + + +describe('All the html should match', function () { + beforeEach(() => { + //here I import the HTML into the document + document.documentElement.innerHTML = html.toString(); + }); + afterEach(() => { jest.resetModules(); }); + + it('the html code should contain a p tag', function () { + + // we can read from the source code + console.log(html.toString()); + expect(html.toString().indexOf(` -1).toBeTruthy(); + + //or use query selector to compare hoy mane scriptags do we have + const pTags = document.querySelectorAll("p"); + expect(pTags.length).toBe(1); + }); + + + it('the p tag should have a class "big"', function () { + + //or use query selector to compare hoy mane scriptags do we have + const p = document.querySelector("p"); + expect(p.classList.contains("big")).toBeTruthy(); + }); +}); \ No newline at end of file diff --git a/exercises/05-Specificity/README.md b/exercises/05-Specificity/README.md new file mode 100644 index 00000000..e8e8d35f --- /dev/null +++ b/exercises/05-Specificity/README.md @@ -0,0 +1,15 @@ +# `05` Specificity + +The "background" CSS rule allows us to assign and work with the background of any container- the background can be a color or an image. If it is an image you can specify if you want the image to repeat horizontally, vertically, both, or not at all, and you can also specify if you want it to resize and fit the whole container where its being applied, among other properties that can be modified. + +## 📝 Instructions: + +Run the exercise. +Change the background-size to "contain" (check the index.css tab). +Run the exercise again. +Change the background-repeat to inherit to make it repeat over the x axis and y axis. +Run the exercise again. + +Hint: + +- How to use the background-size: http://lmgtfy.com/?q=css+background-size diff --git a/exercises/05-Specificity/index.html b/exercises/05-Specificity/index.html new file mode 100644 index 00000000..e5ddcd6d --- /dev/null +++ b/exercises/05-Specificity/index.html @@ -0,0 +1,14 @@ + + + + + + + + +

+ This is my description, it needs to be long because is supposed to be a + paragraph and not a title. +

+ + diff --git a/exercises/05-Specificity/index.js b/exercises/05-Specificity/index.js new file mode 100644 index 00000000..ee1aa2a5 --- /dev/null +++ b/exercises/05-Specificity/index.js @@ -0,0 +1 @@ +//nothing to see here diff --git a/exercises/05-Specificity/styles.css b/exercises/05-Specificity/styles.css new file mode 100644 index 00000000..e69de29b diff --git a/exercises/05-Specificity/tests.js b/exercises/05-Specificity/tests.js new file mode 100644 index 00000000..48541114 --- /dev/null +++ b/exercises/05-Specificity/tests.js @@ -0,0 +1,54 @@ + +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(); }); + + it('the background should be blue', function () { + + // get computed styles of any element you like + const body = document.querySelector('body'); + var styles = window.getComputedStyle(body); + expect(styles["background-color"]).toBe("blue"); + }); +}); + + +describe('All the html should match', function () { + beforeEach(() => { + //here I import the HTML into the document + document.documentElement.innerHTML = html.toString(); + }); + afterEach(() => { jest.resetModules(); }); + + it('the html code should contain a p tag', function () { + + // we can read from the source code + console.log(html.toString()); + expect(html.toString().indexOf(` -1).toBeTruthy(); + + //or use query selector to compare hoy mane scriptags do we have + const pTags = document.querySelectorAll("p"); + expect(pTags.length).toBe(1); + }); + + + it('the p tag should have a class "big"', function () { + + //or use query selector to compare hoy mane scriptags do we have + const p = document.querySelector("p"); + expect(p.classList.contains("big")).toBeTruthy(); + }); +}); \ No newline at end of file diff --git a/exercises/06-Practicing-Rules/README.md b/exercises/06-Practicing-Rules/README.md new file mode 100644 index 00000000..5f712060 --- /dev/null +++ b/exercises/06-Practicing-Rules/README.md @@ -0,0 +1,15 @@ +# `06` Practicing Rules + +The "background" CSS rule allows us to assign and work with the background of any container- the background can be a color or an image. If it is an image you can specify if you want the image to repeat horizontally, vertically, both, or not at all, and you can also specify if you want it to resize and fit the whole container where its being applied, among other properties that can be modified. + +## 📝 Instructions: + +Run the exercise. +Change the background-size to "contain" (check the index.css tab). +Run the exercise again. +Change the background-repeat to inherit to make it repeat over the x axis and y axis. +Run the exercise again. + +Hint: + +- How to use the background-size: http://lmgtfy.com/?q=css+background-size diff --git a/exercises/06-Practicing-Rules/index.html b/exercises/06-Practicing-Rules/index.html new file mode 100644 index 00000000..e5ddcd6d --- /dev/null +++ b/exercises/06-Practicing-Rules/index.html @@ -0,0 +1,14 @@ + + + + + + + + +

+ This is my description, it needs to be long because is supposed to be a + paragraph and not a title. +

+ + diff --git a/exercises/06-Practicing-Rules/index.js b/exercises/06-Practicing-Rules/index.js new file mode 100644 index 00000000..ee1aa2a5 --- /dev/null +++ b/exercises/06-Practicing-Rules/index.js @@ -0,0 +1 @@ +//nothing to see here diff --git a/exercises/06-Practicing-Rules/styles.css b/exercises/06-Practicing-Rules/styles.css new file mode 100644 index 00000000..e69de29b diff --git a/exercises/06-Practicing-Rules/tests.js b/exercises/06-Practicing-Rules/tests.js new file mode 100644 index 00000000..48541114 --- /dev/null +++ b/exercises/06-Practicing-Rules/tests.js @@ -0,0 +1,54 @@ + +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(); }); + + it('the background should be blue', function () { + + // get computed styles of any element you like + const body = document.querySelector('body'); + var styles = window.getComputedStyle(body); + expect(styles["background-color"]).toBe("blue"); + }); +}); + + +describe('All the html should match', function () { + beforeEach(() => { + //here I import the HTML into the document + document.documentElement.innerHTML = html.toString(); + }); + afterEach(() => { jest.resetModules(); }); + + it('the html code should contain a p tag', function () { + + // we can read from the source code + console.log(html.toString()); + expect(html.toString().indexOf(` -1).toBeTruthy(); + + //or use query selector to compare hoy mane scriptags do we have + const pTags = document.querySelectorAll("p"); + expect(pTags.length).toBe(1); + }); + + + it('the p tag should have a class "big"', function () { + + //or use query selector to compare hoy mane scriptags do we have + const p = document.querySelector("p"); + expect(p.classList.contains("big")).toBeTruthy(); + }); +}); \ No newline at end of file diff --git a/exercises/07-Very-Specific-Rules/README.md b/exercises/07-Very-Specific-Rules/README.md new file mode 100644 index 00000000..b1e92db2 --- /dev/null +++ b/exercises/07-Very-Specific-Rules/README.md @@ -0,0 +1,15 @@ +# `07` Very Specific Rules + +The "background" CSS rule allows us to assign and work with the background of any container- the background can be a color or an image. If it is an image you can specify if you want the image to repeat horizontally, vertically, both, or not at all, and you can also specify if you want it to resize and fit the whole container where its being applied, among other properties that can be modified. + +## 📝 Instructions: + +Run the exercise. +Change the background-size to "contain" (check the index.css tab). +Run the exercise again. +Change the background-repeat to inherit to make it repeat over the x axis and y axis. +Run the exercise again. + +Hint: + +- How to use the background-size: http://lmgtfy.com/?q=css+background-size diff --git a/exercises/07-Very-Specific-Rules/index.html b/exercises/07-Very-Specific-Rules/index.html new file mode 100644 index 00000000..e5ddcd6d --- /dev/null +++ b/exercises/07-Very-Specific-Rules/index.html @@ -0,0 +1,14 @@ + + + + + + + + +

+ This is my description, it needs to be long because is supposed to be a + paragraph and not a title. +

+ + diff --git a/exercises/07-Very-Specific-Rules/index.js b/exercises/07-Very-Specific-Rules/index.js new file mode 100644 index 00000000..ee1aa2a5 --- /dev/null +++ b/exercises/07-Very-Specific-Rules/index.js @@ -0,0 +1 @@ +//nothing to see here diff --git a/exercises/07-Very-Specific-Rules/styles.css b/exercises/07-Very-Specific-Rules/styles.css new file mode 100644 index 00000000..e69de29b diff --git a/exercises/07-Very-Specific-Rules/tests.js b/exercises/07-Very-Specific-Rules/tests.js new file mode 100644 index 00000000..48541114 --- /dev/null +++ b/exercises/07-Very-Specific-Rules/tests.js @@ -0,0 +1,54 @@ + +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(); }); + + it('the background should be blue', function () { + + // get computed styles of any element you like + const body = document.querySelector('body'); + var styles = window.getComputedStyle(body); + expect(styles["background-color"]).toBe("blue"); + }); +}); + + +describe('All the html should match', function () { + beforeEach(() => { + //here I import the HTML into the document + document.documentElement.innerHTML = html.toString(); + }); + afterEach(() => { jest.resetModules(); }); + + it('the html code should contain a p tag', function () { + + // we can read from the source code + console.log(html.toString()); + expect(html.toString().indexOf(` -1).toBeTruthy(); + + //or use query selector to compare hoy mane scriptags do we have + const pTags = document.querySelectorAll("p"); + expect(pTags.length).toBe(1); + }); + + + it('the p tag should have a class "big"', function () { + + //or use query selector to compare hoy mane scriptags do we have + const p = document.querySelector("p"); + expect(p.classList.contains("big")).toBeTruthy(); + }); +}); \ No newline at end of file diff --git a/exercises/08-Rounded-Image/README.md b/exercises/08-Rounded-Image/README.md new file mode 100644 index 00000000..fdf84502 --- /dev/null +++ b/exercises/08-Rounded-Image/README.md @@ -0,0 +1,15 @@ +# `08` Rounded Image + +The "background" CSS rule allows us to assign and work with the background of any container- the background can be a color or an image. If it is an image you can specify if you want the image to repeat horizontally, vertically, both, or not at all, and you can also specify if you want it to resize and fit the whole container where its being applied, among other properties that can be modified. + +## 📝 Instructions: + +Run the exercise. +Change the background-size to "contain" (check the index.css tab). +Run the exercise again. +Change the background-repeat to inherit to make it repeat over the x axis and y axis. +Run the exercise again. + +Hint: + +- How to use the background-size: http://lmgtfy.com/?q=css+background-size diff --git a/exercises/08-Rounded-Image/index.html b/exercises/08-Rounded-Image/index.html new file mode 100644 index 00000000..e5ddcd6d --- /dev/null +++ b/exercises/08-Rounded-Image/index.html @@ -0,0 +1,14 @@ + + + + + + + + +

+ This is my description, it needs to be long because is supposed to be a + paragraph and not a title. +

+ + diff --git a/exercises/08-Rounded-Image/index.js b/exercises/08-Rounded-Image/index.js new file mode 100644 index 00000000..ee1aa2a5 --- /dev/null +++ b/exercises/08-Rounded-Image/index.js @@ -0,0 +1 @@ +//nothing to see here diff --git a/exercises/08-Rounded-Image/styles.css b/exercises/08-Rounded-Image/styles.css new file mode 100644 index 00000000..e69de29b diff --git a/exercises/08-Rounded-Image/tests.js b/exercises/08-Rounded-Image/tests.js new file mode 100644 index 00000000..48541114 --- /dev/null +++ b/exercises/08-Rounded-Image/tests.js @@ -0,0 +1,54 @@ + +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(); }); + + it('the background should be blue', function () { + + // get computed styles of any element you like + const body = document.querySelector('body'); + var styles = window.getComputedStyle(body); + expect(styles["background-color"]).toBe("blue"); + }); +}); + + +describe('All the html should match', function () { + beforeEach(() => { + //here I import the HTML into the document + document.documentElement.innerHTML = html.toString(); + }); + afterEach(() => { jest.resetModules(); }); + + it('the html code should contain a p tag', function () { + + // we can read from the source code + console.log(html.toString()); + expect(html.toString().indexOf(` -1).toBeTruthy(); + + //or use query selector to compare hoy mane scriptags do we have + const pTags = document.querySelectorAll("p"); + expect(pTags.length).toBe(1); + }); + + + it('the p tag should have a class "big"', function () { + + //or use query selector to compare hoy mane scriptags do we have + const p = document.querySelector("p"); + expect(p.classList.contains("big")).toBeTruthy(); + }); +}); \ No newline at end of file diff --git a/exercises/09-Anchor-Styles/README.md b/exercises/09-Anchor-Styles/README.md new file mode 100644 index 00000000..fdfcc63e --- /dev/null +++ b/exercises/09-Anchor-Styles/README.md @@ -0,0 +1,15 @@ +# `09` 3D Anchor Styles + +The "background" CSS rule allows us to assign and work with the background of any container- the background can be a color or an image. If it is an image you can specify if you want the image to repeat horizontally, vertically, both, or not at all, and you can also specify if you want it to resize and fit the whole container where its being applied, among other properties that can be modified. + +## 📝 Instructions: + +Run the exercise. +Change the background-size to "contain" (check the index.css tab). +Run the exercise again. +Change the background-repeat to inherit to make it repeat over the x axis and y axis. +Run the exercise again. + +Hint: + +- How to use the background-size: http://lmgtfy.com/?q=css+background-size diff --git a/exercises/09-Anchor-Styles/index.html b/exercises/09-Anchor-Styles/index.html new file mode 100644 index 00000000..e5ddcd6d --- /dev/null +++ b/exercises/09-Anchor-Styles/index.html @@ -0,0 +1,14 @@ + + + + + + + + +

+ This is my description, it needs to be long because is supposed to be a + paragraph and not a title. +

+ + diff --git a/exercises/09-Anchor-Styles/index.js b/exercises/09-Anchor-Styles/index.js new file mode 100644 index 00000000..ee1aa2a5 --- /dev/null +++ b/exercises/09-Anchor-Styles/index.js @@ -0,0 +1 @@ +//nothing to see here diff --git a/exercises/09-Anchor-Styles/styles.css b/exercises/09-Anchor-Styles/styles.css new file mode 100644 index 00000000..e69de29b diff --git a/exercises/09-Anchor-Styles/tests.js b/exercises/09-Anchor-Styles/tests.js new file mode 100644 index 00000000..48541114 --- /dev/null +++ b/exercises/09-Anchor-Styles/tests.js @@ -0,0 +1,54 @@ + +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(); }); + + it('the background should be blue', function () { + + // get computed styles of any element you like + const body = document.querySelector('body'); + var styles = window.getComputedStyle(body); + expect(styles["background-color"]).toBe("blue"); + }); +}); + + +describe('All the html should match', function () { + beforeEach(() => { + //here I import the HTML into the document + document.documentElement.innerHTML = html.toString(); + }); + afterEach(() => { jest.resetModules(); }); + + it('the html code should contain a p tag', function () { + + // we can read from the source code + console.log(html.toString()); + expect(html.toString().indexOf(` -1).toBeTruthy(); + + //or use query selector to compare hoy mane scriptags do we have + const pTags = document.querySelectorAll("p"); + expect(pTags.length).toBe(1); + }); + + + it('the p tag should have a class "big"', function () { + + //or use query selector to compare hoy mane scriptags do we have + const p = document.querySelector("p"); + expect(p.classList.contains("big")).toBeTruthy(); + }); +}); \ No newline at end of file diff --git a/exercises/10-Your-Own-Font/README.md b/exercises/10-Your-Own-Font/README.md new file mode 100644 index 00000000..f15365cd --- /dev/null +++ b/exercises/10-Your-Own-Font/README.md @@ -0,0 +1,15 @@ +# `10` Your Own Font + +The "background" CSS rule allows us to assign and work with the background of any container- the background can be a color or an image. If it is an image you can specify if you want the image to repeat horizontally, vertically, both, or not at all, and you can also specify if you want it to resize and fit the whole container where its being applied, among other properties that can be modified. + +## 📝 Instructions: + +Run the exercise. +Change the background-size to "contain" (check the index.css tab). +Run the exercise again. +Change the background-repeat to inherit to make it repeat over the x axis and y axis. +Run the exercise again. + +Hint: + +- How to use the background-size: http://lmgtfy.com/?q=css+background-size diff --git a/exercises/10-Your-Own-Font/index.html b/exercises/10-Your-Own-Font/index.html new file mode 100644 index 00000000..e5ddcd6d --- /dev/null +++ b/exercises/10-Your-Own-Font/index.html @@ -0,0 +1,14 @@ + + + + + + + + +

+ This is my description, it needs to be long because is supposed to be a + paragraph and not a title. +

+ + diff --git a/exercises/10-Your-Own-Font/index.js b/exercises/10-Your-Own-Font/index.js new file mode 100644 index 00000000..ee1aa2a5 --- /dev/null +++ b/exercises/10-Your-Own-Font/index.js @@ -0,0 +1 @@ +//nothing to see here diff --git a/exercises/10-Your-Own-Font/styles.css b/exercises/10-Your-Own-Font/styles.css new file mode 100644 index 00000000..e69de29b diff --git a/exercises/10-Your-Own-Font/tests.js b/exercises/10-Your-Own-Font/tests.js new file mode 100644 index 00000000..48541114 --- /dev/null +++ b/exercises/10-Your-Own-Font/tests.js @@ -0,0 +1,54 @@ + +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(); }); + + it('the background should be blue', function () { + + // get computed styles of any element you like + const body = document.querySelector('body'); + var styles = window.getComputedStyle(body); + expect(styles["background-color"]).toBe("blue"); + }); +}); + + +describe('All the html should match', function () { + beforeEach(() => { + //here I import the HTML into the document + document.documentElement.innerHTML = html.toString(); + }); + afterEach(() => { jest.resetModules(); }); + + it('the html code should contain a p tag', function () { + + // we can read from the source code + console.log(html.toString()); + expect(html.toString().indexOf(` -1).toBeTruthy(); + + //or use query selector to compare hoy mane scriptags do we have + const pTags = document.querySelectorAll("p"); + expect(pTags.length).toBe(1); + }); + + + it('the p tag should have a class "big"', function () { + + //or use query selector to compare hoy mane scriptags do we have + const p = document.querySelector("p"); + expect(p.classList.contains("big")).toBeTruthy(); + }); +}); \ No newline at end of file diff --git a/exercises/11-Font-Awesome-Icons/README.md b/exercises/11-Font-Awesome-Icons/README.md new file mode 100644 index 00000000..e3903e67 --- /dev/null +++ b/exercises/11-Font-Awesome-Icons/README.md @@ -0,0 +1,15 @@ +# `11` Font Awesome Icons + +The "background" CSS rule allows us to assign and work with the background of any container- the background can be a color or an image. If it is an image you can specify if you want the image to repeat horizontally, vertically, both, or not at all, and you can also specify if you want it to resize and fit the whole container where its being applied, among other properties that can be modified. + +## 📝 Instructions: + +Run the exercise. +Change the background-size to "contain" (check the index.css tab). +Run the exercise again. +Change the background-repeat to inherit to make it repeat over the x axis and y axis. +Run the exercise again. + +Hint: + +- How to use the background-size: http://lmgtfy.com/?q=css+background-size diff --git a/exercises/11-Font-Awesome-Icons/index.html b/exercises/11-Font-Awesome-Icons/index.html new file mode 100644 index 00000000..e5ddcd6d --- /dev/null +++ b/exercises/11-Font-Awesome-Icons/index.html @@ -0,0 +1,14 @@ + + + + + + + + +

+ This is my description, it needs to be long because is supposed to be a + paragraph and not a title. +

+ + diff --git a/exercises/11-Font-Awesome-Icons/index.js b/exercises/11-Font-Awesome-Icons/index.js new file mode 100644 index 00000000..ee1aa2a5 --- /dev/null +++ b/exercises/11-Font-Awesome-Icons/index.js @@ -0,0 +1 @@ +//nothing to see here diff --git a/exercises/11-Font-Awesome-Icons/styles.css b/exercises/11-Font-Awesome-Icons/styles.css new file mode 100644 index 00000000..e69de29b diff --git a/exercises/11-Font-Awesome-Icons/tests.js b/exercises/11-Font-Awesome-Icons/tests.js new file mode 100644 index 00000000..48541114 --- /dev/null +++ b/exercises/11-Font-Awesome-Icons/tests.js @@ -0,0 +1,54 @@ + +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(); }); + + it('the background should be blue', function () { + + // get computed styles of any element you like + const body = document.querySelector('body'); + var styles = window.getComputedStyle(body); + expect(styles["background-color"]).toBe("blue"); + }); +}); + + +describe('All the html should match', function () { + beforeEach(() => { + //here I import the HTML into the document + document.documentElement.innerHTML = html.toString(); + }); + afterEach(() => { jest.resetModules(); }); + + it('the html code should contain a p tag', function () { + + // we can read from the source code + console.log(html.toString()); + expect(html.toString().indexOf(` -1).toBeTruthy(); + + //or use query selector to compare hoy mane scriptags do we have + const pTags = document.querySelectorAll("p"); + expect(pTags.length).toBe(1); + }); + + + it('the p tag should have a class "big"', function () { + + //or use query selector to compare hoy mane scriptags do we have + const p = document.querySelector("p"); + expect(p.classList.contains("big")).toBeTruthy(); + }); +}); \ No newline at end of file diff --git a/exercises/12-Relative-Length-EM-REM/README.md b/exercises/12-Relative-Length-EM-REM/README.md new file mode 100644 index 00000000..5ad02b77 --- /dev/null +++ b/exercises/12-Relative-Length-EM-REM/README.md @@ -0,0 +1,15 @@ +# `12` Relative Length EM, REM + +The "background" CSS rule allows us to assign and work with the background of any container- the background can be a color or an image. If it is an image you can specify if you want the image to repeat horizontally, vertically, both, or not at all, and you can also specify if you want it to resize and fit the whole container where its being applied, among other properties that can be modified. + +## 📝 Instructions: + +Run the exercise. +Change the background-size to "contain" (check the index.css tab). +Run the exercise again. +Change the background-repeat to inherit to make it repeat over the x axis and y axis. +Run the exercise again. + +Hint: + +- How to use the background-size: http://lmgtfy.com/?q=css+background-size diff --git a/exercises/12-Relative-Length-EM-REM/index.html b/exercises/12-Relative-Length-EM-REM/index.html new file mode 100644 index 00000000..e5ddcd6d --- /dev/null +++ b/exercises/12-Relative-Length-EM-REM/index.html @@ -0,0 +1,14 @@ + + + + + + + + +

+ This is my description, it needs to be long because is supposed to be a + paragraph and not a title. +

+ + diff --git a/exercises/12-Relative-Length-EM-REM/index.js b/exercises/12-Relative-Length-EM-REM/index.js new file mode 100644 index 00000000..ee1aa2a5 --- /dev/null +++ b/exercises/12-Relative-Length-EM-REM/index.js @@ -0,0 +1 @@ +//nothing to see here diff --git a/exercises/12-Relative-Length-EM-REM/styles.css b/exercises/12-Relative-Length-EM-REM/styles.css new file mode 100644 index 00000000..e69de29b diff --git a/exercises/12-Relative-Length-EM-REM/tests.js b/exercises/12-Relative-Length-EM-REM/tests.js new file mode 100644 index 00000000..48541114 --- /dev/null +++ b/exercises/12-Relative-Length-EM-REM/tests.js @@ -0,0 +1,54 @@ + +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(); }); + + it('the background should be blue', function () { + + // get computed styles of any element you like + const body = document.querySelector('body'); + var styles = window.getComputedStyle(body); + expect(styles["background-color"]).toBe("blue"); + }); +}); + + +describe('All the html should match', function () { + beforeEach(() => { + //here I import the HTML into the document + document.documentElement.innerHTML = html.toString(); + }); + afterEach(() => { jest.resetModules(); }); + + it('the html code should contain a p tag', function () { + + // we can read from the source code + console.log(html.toString()); + expect(html.toString().indexOf(` -1).toBeTruthy(); + + //or use query selector to compare hoy mane scriptags do we have + const pTags = document.querySelectorAll("p"); + expect(pTags.length).toBe(1); + }); + + + it('the p tag should have a class "big"', function () { + + //or use query selector to compare hoy mane scriptags do we have + const p = document.querySelector("p"); + expect(p.classList.contains("big")).toBeTruthy(); + }); +}); \ No newline at end of file diff --git a/exercises/13-Anchor-Like-Button/README.md b/exercises/13-Anchor-Like-Button/README.md new file mode 100644 index 00000000..fe2e5f49 --- /dev/null +++ b/exercises/13-Anchor-Like-Button/README.md @@ -0,0 +1,15 @@ +# `13` Anchor Like Button + +The "background" CSS rule allows us to assign and work with the background of any container- the background can be a color or an image. If it is an image you can specify if you want the image to repeat horizontally, vertically, both, or not at all, and you can also specify if you want it to resize and fit the whole container where its being applied, among other properties that can be modified. + +## 📝 Instructions: + +Run the exercise. +Change the background-size to "contain" (check the index.css tab). +Run the exercise again. +Change the background-repeat to inherit to make it repeat over the x axis and y axis. +Run the exercise again. + +Hint: + +- How to use the background-size: http://lmgtfy.com/?q=css+background-size diff --git a/exercises/13-Anchor-Like-Button/index.html b/exercises/13-Anchor-Like-Button/index.html new file mode 100644 index 00000000..e5ddcd6d --- /dev/null +++ b/exercises/13-Anchor-Like-Button/index.html @@ -0,0 +1,14 @@ + + + + + + + + +

+ This is my description, it needs to be long because is supposed to be a + paragraph and not a title. +

+ + diff --git a/exercises/13-Anchor-Like-Button/index.js b/exercises/13-Anchor-Like-Button/index.js new file mode 100644 index 00000000..ee1aa2a5 --- /dev/null +++ b/exercises/13-Anchor-Like-Button/index.js @@ -0,0 +1 @@ +//nothing to see here diff --git a/exercises/13-Anchor-Like-Button/styles.css b/exercises/13-Anchor-Like-Button/styles.css new file mode 100644 index 00000000..e69de29b diff --git a/exercises/13-Anchor-Like-Button/tests.js b/exercises/13-Anchor-Like-Button/tests.js new file mode 100644 index 00000000..48541114 --- /dev/null +++ b/exercises/13-Anchor-Like-Button/tests.js @@ -0,0 +1,54 @@ + +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(); }); + + it('the background should be blue', function () { + + // get computed styles of any element you like + const body = document.querySelector('body'); + var styles = window.getComputedStyle(body); + expect(styles["background-color"]).toBe("blue"); + }); +}); + + +describe('All the html should match', function () { + beforeEach(() => { + //here I import the HTML into the document + document.documentElement.innerHTML = html.toString(); + }); + afterEach(() => { jest.resetModules(); }); + + it('the html code should contain a p tag', function () { + + // we can read from the source code + console.log(html.toString()); + expect(html.toString().indexOf(` -1).toBeTruthy(); + + //or use query selector to compare hoy mane scriptags do we have + const pTags = document.querySelectorAll("p"); + expect(pTags.length).toBe(1); + }); + + + it('the p tag should have a class "big"', function () { + + //or use query selector to compare hoy mane scriptags do we have + const p = document.querySelector("p"); + expect(p.classList.contains("big")).toBeTruthy(); + }); +}); \ No newline at end of file From f724ac53e2aad326a105ecd97b59f91f4a19b8e3 Mon Sep 17 00:00:00 2001 From: plucodev Date: Thu, 1 Aug 2019 14:36:33 -0400 Subject: [PATCH 02/25] completed exercise 02 --- exercises/01-hello-world/index.html | 7 +-- exercises/02-Background/README.md | 14 +++-- exercises/02-Background/index.html | 8 +-- exercises/02-Background/styles.css | 6 +- exercises/02-Background/tests.js | 34 +++-------- exercises/03-Inline-Styles/README.md | 24 +++++--- exercises/03-Inline-Styles/index.html | 13 +++-- exercises/03-Inline-Styles/tests.js | 84 ++++++++++----------------- 8 files changed, 79 insertions(+), 111 deletions(-) diff --git a/exercises/01-hello-world/index.html b/exercises/01-hello-world/index.html index e5ddcd6d..8fcd076d 100644 --- a/exercises/01-hello-world/index.html +++ b/exercises/01-hello-world/index.html @@ -5,10 +5,5 @@ - -

- This is my description, it needs to be long because is supposed to be a - paragraph and not a title. -

- + diff --git a/exercises/02-Background/README.md b/exercises/02-Background/README.md index 60ff20bf..6ae489d1 100644 --- a/exercises/02-Background/README.md +++ b/exercises/02-Background/README.md @@ -4,12 +4,16 @@ The "background" CSS rule allows us to assign and work with the background of an ## 📝 Instructions: -Run the exercise. -Change the background-size to "contain" (check the index.css tab). -Run the exercise again. -Change the background-repeat to inherit to make it repeat over the x axis and y axis. -Run the exercise again. +```plan/text +1. Build the exercise. +2. Check the Preview. +3. Change the background-size to "contain" (check the styles.css tab). +4. Build and Preview the exercise again. +5. Change the background-repeat to inherit to make it repeat over the x axis and y axis. +6. Build and Preview the exercise again. +``` Hint: - How to use the background-size: http://lmgtfy.com/?q=css+background-size +- How to use the background-repeat: http://lmgtfy.com/?q=css+background-repeat diff --git a/exercises/02-Background/index.html b/exercises/02-Background/index.html index e5ddcd6d..ed88f52c 100644 --- a/exercises/02-Background/index.html +++ b/exercises/02-Background/index.html @@ -4,11 +4,7 @@ + 02 Background - -

- This is my description, it needs to be long because is supposed to be a - paragraph and not a title. -

- + diff --git a/exercises/02-Background/styles.css b/exercises/02-Background/styles.css index fec6568c..afdf956f 100644 --- a/exercises/02-Background/styles.css +++ b/exercises/02-Background/styles.css @@ -1,5 +1,5 @@ body { - background-image: url(https://4geeksacademy.github.io/exercise-assets/img/bg/small-mosaic.jpg); - background-size: cover; - background-repeat: no-repeat; + background-image: url(https://4geeksacademy.github.io/exercise-assets/img/bg/small-mosaic.jpg); + background-size: cover; + background-repeat: no-repeat; } diff --git a/exercises/02-Background/tests.js b/exercises/02-Background/tests.js index dd0b70b7..5c3e1cc8 100644 --- a/exercises/02-Background/tests.js +++ b/exercises/02-Background/tests.js @@ -19,36 +19,18 @@ describe("All the styles should be applied", function() { jest.resetModules(); }); - it("the background should be blue", function() { + it("the background-size should be 'contain'", function() { // get computed styles of any element you like - const body = document.querySelector("body"); + const body = document.querySelector("table"); var styles = window.getComputedStyle(body); - expect(styles["background-color"]).toBe("blue"); + expect(styles["background-size"]).toBe("contain"); }); -}); -describe("All the css should match", function() { - beforeEach(() => { - //here I import the HTML into the document - document.documentElement.innerHTML = html.toString(); - }); - afterEach(() => { - jest.resetModules(); - }); - - it("the html code should contain a p tag", function() { - // we can read from the source code - console.log(html.toString()); - expect(html.toString().indexOf(` -1).toBeTruthy(); - - //or use query selector to compare hoy mane scriptags do we have - const pTags = document.querySelectorAll("p"); - expect(pTags.length).toBe(1); - }); + it("the background-repeat should be 'no-repeat'", function() { + // get computed styles of any element you like + const body = document.querySelector("body"); + var styles = window.getComputedStyle(body); - it('the p tag should have a class "big"', function() { - //or use query selector to compare hoy mane scriptags do we have - const p = document.querySelector("p"); - expect(p.classList.contains("big")).toBeTruthy(); + expect(styles["background-repeat"]).toBe("inherit"); }); }); diff --git a/exercises/03-Inline-Styles/README.md b/exercises/03-Inline-Styles/README.md index 66332896..eaf255cf 100644 --- a/exercises/03-Inline-Styles/README.md +++ b/exercises/03-Inline-Styles/README.md @@ -1,15 +1,23 @@ # `03` Inline Styles -The "background" CSS rule allows us to assign and work with the background of any container- the background can be a color or an image. If it is an image you can specify if you want the image to repeat horizontally, vertically, both, or not at all, and you can also specify if you want it to resize and fit the whole container where its being applied, among other properties that can be modified. +Inline styles are a very bad idea unless you have no choice (and that's a very uncommon situation). Sadly, we have to teach you how to do it because there is a chance you will need to use them at some point. + +To use inline styles, instead of declaring a `; - }); - afterEach(() => { jest.resetModules(); }); - - it('the background should be blue', function () { - - // get computed styles of any element you like - const body = document.querySelector('body'); - var styles = window.getComputedStyle(body); - expect(styles["background-color"]).toBe("blue"); - }); +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 html should match", function() { + beforeEach(() => { + //here I import the HTML into the document + document.documentElement.innerHTML = html.toString(); + }); + afterEach(() => { + jest.resetModules(); + }); + + it("the html code should contain a table tag", function() { + // we can read from the source code + console.log(html.toString()); + expect(html.toString().indexOf(`table`)).toBeTruthy(); + + //or use query selector to compare hoy mane scriptags do we have + // const pTags = document.querySelectorAll("p"); + // expect(pTags.length).toBe(1); + }); + it("the background should be green", function() { + // get computed styles of any element you like + const body = document.querySelector("body"); + var styles = window.getComputedStyle(body); + expect(styles["background"]).toBe("green"); + }); }); - - -describe('All the html should match', function () { - beforeEach(() => { - //here I import the HTML into the document - document.documentElement.innerHTML = html.toString(); - }); - afterEach(() => { jest.resetModules(); }); - - it('the html code should contain a p tag', function () { - - // we can read from the source code - console.log(html.toString()); - expect(html.toString().indexOf(` -1).toBeTruthy(); - - //or use query selector to compare hoy mane scriptags do we have - const pTags = document.querySelectorAll("p"); - expect(pTags.length).toBe(1); - }); - - - it('the p tag should have a class "big"', function () { - - //or use query selector to compare hoy mane scriptags do we have - const p = document.querySelector("p"); - expect(p.classList.contains("big")).toBeTruthy(); - }); -}); \ No newline at end of file From 980799daa861cde418d171c0e6aa7c0aefd36bc1 Mon Sep 17 00:00:00 2001 From: plucodev Date: Thu, 1 Aug 2019 18:22:52 -0400 Subject: [PATCH 03/25] updated 03 and 04 --- exercises/03-Inline-Styles/tests.js | 5 ++- exercises/04-Combined-Rules/README.md | 32 +++++++++++++------ exercises/04-Combined-Rules/index.html | 43 +++++++++++++++++++++++--- exercises/05-Specificity/README.md | 13 +++++++- 4 files changed, 78 insertions(+), 15 deletions(-) diff --git a/exercises/03-Inline-Styles/tests.js b/exercises/03-Inline-Styles/tests.js index ba5102c0..0dc41c64 100644 --- a/exercises/03-Inline-Styles/tests.js +++ b/exercises/03-Inline-Styles/tests.js @@ -2,13 +2,16 @@ 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"); - +console.log(css); jest.dontMock("fs"); describe("All the html should match", function() { beforeEach(() => { //here I import the HTML into the document document.documentElement.innerHTML = html.toString(); + document.querySelector( + "head" + ).innerHTML = ``; }); afterEach(() => { jest.resetModules(); diff --git a/exercises/04-Combined-Rules/README.md b/exercises/04-Combined-Rules/README.md index b881b914..471f2dd6 100644 --- a/exercises/04-Combined-Rules/README.md +++ b/exercises/04-Combined-Rules/README.md @@ -1,15 +1,29 @@ # `04` Combined Rules -The "background" CSS rule allows us to assign and work with the background of any container- the background can be a color or an image. If it is an image you can specify if you want the image to repeat horizontally, vertically, both, or not at all, and you can also specify if you want it to resize and fit the whole container where its being applied, among other properties that can be modified. +CSS files take space on your server and also take time to download (like everything); it is yet another text document that the browser has to download before rendering the page, which is why is important to keep the CSS document as small as possible. -## 📝 Instructions: +One way to do that is by combining several properties into one such as with "border": -Run the exercise. -Change the background-size to "contain" (check the index.css tab). -Run the exercise again. -Change the background-repeat to inherit to make it repeat over the x axis and y axis. -Run the exercise again. +```css +border-color: black; +border-style: solid; +border-width: 1px; +``` -Hint: +Border's properties can be consolidated into a single line as: -- How to use the background-size: http://lmgtfy.com/?q=css+background-size +```css +border: black 1px solid; +``` + +# 📝 Instructions: + +Combine the 4 padding rules into just one using the "padding:" rule. +Combine the all background rules, but the background size, into just one line using the "background:" rule. + +P.S: The background size cannot be combined, the browsers don't support it yet. + +# Hint: + +- How to use the background-size: http://lmgtfy.com/?q=css+background +- How to use the background-size: http://lmgtfy.com/?q=css+padding diff --git a/exercises/04-Combined-Rules/index.html b/exercises/04-Combined-Rules/index.html index e5ddcd6d..a894aa76 100644 --- a/exercises/04-Combined-Rules/index.html +++ b/exercises/04-Combined-Rules/index.html @@ -4,11 +4,46 @@ + + 04 Combined Rules + + -

- This is my description, it needs to be long because is supposed to be a - paragraph and not a title. -

+
Hello!
+ + diff --git a/exercises/05-Specificity/README.md b/exercises/05-Specificity/README.md index e8e8d35f..03451bf7 100644 --- a/exercises/05-Specificity/README.md +++ b/exercises/05-Specificity/README.md @@ -1,6 +1,17 @@ # `05` Specificity -The "background" CSS rule allows us to assign and work with the background of any container- the background can be a color or an image. If it is an image you can specify if you want the image to repeat horizontally, vertically, both, or not at all, and you can also specify if you want it to resize and fit the whole container where its being applied, among other properties that can be modified. +When creating a CSS document, you need to start from the most generic selector and end with the most specific ones, that is the way CSS works. + +It's all about the level of Specificity. +If you specify that your div with id="thirditem" has a blue background, and later in the document you specify that all divs will have yellow background, #thirditem will keep his blue background. Period! + +Because the more specific, the more priority it has. +Instructions +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. + +Tip +You can use the !important annotation +https://css-tricks.com/when-using-important-is-the-right-choice/ ## 📝 Instructions: From 33c046d53d617d32dfbf7a4f928d46942cb782d0 Mon Sep 17 00:00:00 2001 From: plucodev Date: Fri, 2 Aug 2019 10:24:06 -0400 Subject: [PATCH 04/25] README 04 & 05 --- exercises/04-Combined-Rules/README.md | 6 +++--- exercises/05-Specificity/README.md | 17 ++++++----------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/exercises/04-Combined-Rules/README.md b/exercises/04-Combined-Rules/README.md index 471f2dd6..b3593ffd 100644 --- a/exercises/04-Combined-Rules/README.md +++ b/exercises/04-Combined-Rules/README.md @@ -18,10 +18,10 @@ border: black 1px solid; # 📝 Instructions: -Combine the 4 padding rules into just one using the "padding:" rule. -Combine the all background rules, but the background size, into just one line using the "background:" rule. +1. Combine the 4 padding rules into just one using the "padding:" rule. + Combine the all background rules, but the background size, into just one line using the "background:" rule. -P.S: The background size cannot be combined, the browsers don't support it yet. +2. **P.S: The background size cannot be combined, the browsers don't support it yet.** # Hint: diff --git a/exercises/05-Specificity/README.md b/exercises/05-Specificity/README.md index 03451bf7..49fae514 100644 --- a/exercises/05-Specificity/README.md +++ b/exercises/05-Specificity/README.md @@ -6,20 +6,15 @@ It's all about the level of Specificity. If you specify that your div with id="thirditem" has a blue background, and later in the document you specify that all divs will have yellow background, #thirditem will keep his blue background. Period! Because the more specific, the more priority it has. -Instructions -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. - -Tip -You can use the !important annotation -https://css-tricks.com/when-using-important-is-the-right-choice/ ## 📝 Instructions: -Run the exercise. -Change the background-size to "contain" (check the index.css tab). -Run the exercise again. -Change the background-repeat to inherit to make it repeat over the x axis and y axis. -Run the exercise again. +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. + +Tip: + +You can use the **!important** annotation: +https://css-tricks.com/when-using-important-is-the-right-choice/ Hint: From c44f71693e74d1efa8b418c87182b9f0f472bbec Mon Sep 17 00:00:00 2001 From: plucodev Date: Fri, 2 Aug 2019 11:06:00 -0400 Subject: [PATCH 05/25] README 06 --- exercises/06-Practicing-Rules/README.md | 27 ++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/exercises/06-Practicing-Rules/README.md b/exercises/06-Practicing-Rules/README.md index 5f712060..037d6860 100644 --- a/exercises/06-Practicing-Rules/README.md +++ b/exercises/06-Practicing-Rules/README.md @@ -1,15 +1,24 @@ # `06` Practicing Rules -The "background" CSS rule allows us to assign and work with the background of any container- the background can be a color or an image. If it is an image you can specify if you want the image to repeat horizontally, vertically, both, or not at all, and you can also specify if you want it to resize and fit the whole container where its being applied, among other properties that can be modified. - ## 📝 Instructions: -Run the exercise. -Change the background-size to "contain" (check the index.css tab). -Run the exercise again. -Change the background-repeat to inherit to make it repeat over the x axis and y axis. -Run the exercise again. +1. Set this URL as the background image of the page, and repeat it vertically only: + http://assets.breatheco.de/apis/img/bg/background-vertical.jpg + +2. Change the font-type of the h1 to Courier and the rest of the website to Times new Roman. + +3. Change the color of h1 to red. + +4. Make all the h2's with an underline. + +5. Center the h1 to the middle. + +6. Add a left padding to the whole document of 20px to make it easier to read. + +7. Add a white semi-transparent background to the first paragraph of "3 reasons you know you are learning" to make it easier to read (you have tu use rgba for that), and 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). -Hint: +The result should be something like this: -- How to use the background-size: http://lmgtfy.com/?q=css+background-size +![Example Image](http://i.imgur.com/KGk6D4P.png) From 2771fdd0c7ba91d332bf0566e7507eeda54f7843 Mon Sep 17 00:00:00 2001 From: plucodev Date: Fri, 2 Aug 2019 14:36:40 -0400 Subject: [PATCH 06/25] completed #07 --- exercises/07-Very-Specific-Rules/README.md | 13 ++-- exercises/07-Very-Specific-Rules/index.html | 75 ++++++++++++++++++++- exercises/07-Very-Specific-Rules/styles.css | 14 ++++ 3 files changed, 93 insertions(+), 9 deletions(-) diff --git a/exercises/07-Very-Specific-Rules/README.md b/exercises/07-Very-Specific-Rules/README.md index b1e92db2..66b7c8d3 100644 --- a/exercises/07-Very-Specific-Rules/README.md +++ b/exercises/07-Very-Specific-Rules/README.md @@ -1,15 +1,16 @@ # `07` Very Specific Rules -The "background" CSS rule allows us to assign and work with the background of any container- the background can be a color or an image. If it is an image you can specify if you want the image to repeat horizontally, vertically, both, or not at all, and you can also specify if you want it to resize and fit the whole container where its being applied, among other properties that can be modified. +# **Important:** + +In this exercise, you can add your code only above the **READ ONLY BLOCK** of the code, you can add as many lines as you want, but always above. ## 📝 Instructions: -Run the exercise. -Change the background-size to "contain" (check the index.css tab). -Run the exercise again. -Change the background-repeat to inherit to make it repeat over the x axis and y axis. -Run the exercise again. +- Set the
    text color to red (override conflicts with specificity). +- Set the background color of the second
  • of the
      to green (don't use the #id selector). +- Make the odd rows of the tables with yellow background using **tr:nth-child**. +![Example Image](http://i.imgur.com/MyeiuOb.png) Hint: - How to use the background-size: http://lmgtfy.com/?q=css+background-size diff --git a/exercises/07-Very-Specific-Rules/index.html b/exercises/07-Very-Specific-Rules/index.html index e5ddcd6d..474df89a 100644 --- a/exercises/07-Very-Specific-Rules/index.html +++ b/exercises/07-Very-Specific-Rules/index.html @@ -4,11 +4,80 @@ + 07 Very Specific Rules -

      - This is my description, it needs to be long because is supposed to be a - paragraph and not a title. +

      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 +

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      AgeGender
      12 yearsMale
      22 yearsFemale
      11 yearsMale
      21 yearsMale
      22 yearsFemale
      10 yearsMale
      13 yearsFemale
      13 yearsMale
      10 yearsMale
      11 yearsMale
      11 yearsMale
      diff --git a/exercises/07-Very-Specific-Rules/styles.css b/exercises/07-Very-Specific-Rules/styles.css index e69de29b..7762401f 100644 --- a/exercises/07-Very-Specific-Rules/styles.css +++ b/exercises/07-Very-Specific-Rules/styles.css @@ -0,0 +1,14 @@ +/** Insert your code here **/ + +/*********** REDONLY BLOCK ****** +You CAN NOT 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 23e91a362cde212049fb69bc464e217e43b49e53 Mon Sep 17 00:00:00 2001 From: plucodev Date: Sun, 4 Aug 2019 16:46:01 -0400 Subject: [PATCH 07/25] Completed 03 --- exercises/02-Background/tests.js | 1 + exercises/03-Inline-Styles/index.html | 2 +- exercises/03-Inline-Styles/tests.js | 61 ++++++++++++++++++++------- 3 files changed, 47 insertions(+), 17 deletions(-) diff --git a/exercises/02-Background/tests.js b/exercises/02-Background/tests.js index 5c3e1cc8..3939f839 100644 --- a/exercises/02-Background/tests.js +++ b/exercises/02-Background/tests.js @@ -22,6 +22,7 @@ describe("All the styles should be applied", function() { it("the background-size should be 'contain'", function() { // get computed styles of any element you like const body = document.querySelector("table"); + console.log("Body: " + body); var styles = window.getComputedStyle(body); expect(styles["background-size"]).toBe("contain"); }); diff --git a/exercises/03-Inline-Styles/index.html b/exercises/03-Inline-Styles/index.html index f375509d..9ef8cb68 100644 --- a/exercises/03-Inline-Styles/index.html +++ b/exercises/03-Inline-Styles/index.html @@ -7,7 +7,7 @@ 03 Inline Styles - +
      diff --git a/exercises/03-Inline-Styles/tests.js b/exercises/03-Inline-Styles/tests.js index 0dc41c64..77ee1f34 100644 --- a/exercises/03-Inline-Styles/tests.js +++ b/exercises/03-Inline-Styles/tests.js @@ -2,10 +2,10 @@ 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"); -console.log(css); + jest.dontMock("fs"); -describe("All the html should match", function() { +describe("The Table tag should contain inline style background: green", function() { beforeEach(() => { //here I import the HTML into the document document.documentElement.innerHTML = html.toString(); @@ -16,20 +16,49 @@ describe("All the html should match", function() { afterEach(() => { jest.resetModules(); }); - - it("the html code should contain a table tag", function() { - // we can read from the source code - console.log(html.toString()); - expect(html.toString().indexOf(`table`)).toBeTruthy(); - - //or use query selector to compare hoy mane scriptags do we have - // const pTags = document.querySelectorAll("p"); - // expect(pTags.length).toBe(1); + it("The styles.css file should be empty", function() { + console.log(css); + expect(css.toString() === "").toBeTruthy(); }); - it("the background should be green", function() { - // get computed styles of any element you like - const body = document.querySelector("body"); - var styles = window.getComputedStyle(body); - expect(styles["background"]).toBe("green"); + + it("The background should be green", function() { + const table = document.querySelector("table"); + expect(table.style.background === "green").toBeTruthy(); }); }); + +// describe("The Table tag should contain inline style background:green", function() { +// beforeEach(() => { +// //here I import the HTML into the document +// document.documentElement.innerHTML = html.toString(); +// document.querySelector( +// "head" +// ).innerHTML = ``; +// }); +// afterEach(() => { +// jest.resetModules(); +// }); + +// // it("the html code should contain a table tag", function() { +// // we can read from the source code +// // console.log("HTML: " + html.toString()); +// // console.log("CSS " + css.toString()); +// // expect(css.toString().toBeFalsy()); +// // expect(html.toString().indexOf(`table`)).toBeTruthy(); + +// //or use query selector to compare hoy mane scriptags do we have +// // const pTags = document.querySelectorAll("p"); +// // expect(pTags.length).toBe(1); +// // }); +// it("the background should be green", function() { + +// const table = document.querySelector("table"); +// expect(css.toString().toBeFalsy()); +// expect(table.style.background === "green").toBeTruthy(); +// // expect(table.contains("styles")); +// // var styles = window.getComputedStyle("table"); +// // console.log("Styles: " + styles); +// // expect(styles["background"]).toBe("green"); +// // console.log("Styles: " + table); +// }); +// }); From 7746b42bb5de17e6914fc4fd4d99b4be39a50bc3 Mon Sep 17 00:00:00 2001 From: plucodev Date: Sun, 4 Aug 2019 18:37:30 -0400 Subject: [PATCH 08/25] Completed 05 --- exercises/03-Inline-Styles/tests.js | 34 ---------- exercises/04-Combined-Rules/tests.js | 87 ++++++++++---------------- exercises/05-Specificity/index.html | 13 ++-- exercises/05-Specificity/styles.css | 6 ++ exercises/05-Specificity/tests.js | 93 ++++++++++++---------------- 5 files changed, 88 insertions(+), 145 deletions(-) diff --git a/exercises/03-Inline-Styles/tests.js b/exercises/03-Inline-Styles/tests.js index 77ee1f34..444d8dd8 100644 --- a/exercises/03-Inline-Styles/tests.js +++ b/exercises/03-Inline-Styles/tests.js @@ -27,38 +27,4 @@ describe("The Table tag should contain inline style background: green", function }); }); -// describe("The Table tag should contain inline style background:green", function() { -// beforeEach(() => { -// //here I import the HTML into the document -// document.documentElement.innerHTML = html.toString(); -// document.querySelector( -// "head" -// ).innerHTML = ``; -// }); -// afterEach(() => { -// jest.resetModules(); -// }); -// // it("the html code should contain a table tag", function() { -// // we can read from the source code -// // console.log("HTML: " + html.toString()); -// // console.log("CSS " + css.toString()); -// // expect(css.toString().toBeFalsy()); -// // expect(html.toString().indexOf(`table`)).toBeTruthy(); - -// //or use query selector to compare hoy mane scriptags do we have -// // const pTags = document.querySelectorAll("p"); -// // expect(pTags.length).toBe(1); -// // }); -// it("the background should be green", function() { - -// const table = document.querySelector("table"); -// expect(css.toString().toBeFalsy()); -// expect(table.style.background === "green").toBeTruthy(); -// // expect(table.contains("styles")); -// // var styles = window.getComputedStyle("table"); -// // console.log("Styles: " + styles); -// // expect(styles["background"]).toBe("green"); -// // console.log("Styles: " + table); -// }); -// }); diff --git a/exercises/04-Combined-Rules/tests.js b/exercises/04-Combined-Rules/tests.js index 48541114..3fe1a0ee 100644 --- a/exercises/04-Combined-Rules/tests.js +++ b/exercises/04-Combined-Rules/tests.js @@ -1,54 +1,35 @@ - -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(); }); - - it('the background should be blue', function () { - - // get computed styles of any element you like - const body = document.querySelector('body'); - var styles = window.getComputedStyle(body); - expect(styles["background-color"]).toBe("blue"); - }); +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(); + }); + + it("The styles.css file should be empty", function() { + console.log(css); + expect(css.toString() === "").toBeTruthy(); + }); + + it("The Padding - Shorthand Property should be applied ", function() { + let styles = document.querySelector("head").innerHTML; + console.log("Styles :" + styles); + // get computed styles of any element you like + // const body = document.querySelector('body'); + // var styles = window.getComputedStyle(body); + expect(styles["background-color"]).toBe("blue"); + }); }); - - -describe('All the html should match', function () { - beforeEach(() => { - //here I import the HTML into the document - document.documentElement.innerHTML = html.toString(); - }); - afterEach(() => { jest.resetModules(); }); - - it('the html code should contain a p tag', function () { - - // we can read from the source code - console.log(html.toString()); - expect(html.toString().indexOf(` -1).toBeTruthy(); - - //or use query selector to compare hoy mane scriptags do we have - const pTags = document.querySelectorAll("p"); - expect(pTags.length).toBe(1); - }); - - - it('the p tag should have a class "big"', function () { - - //or use query selector to compare hoy mane scriptags do we have - const p = document.querySelector("p"); - expect(p.classList.contains("big")).toBeTruthy(); - }); -}); \ No newline at end of file diff --git a/exercises/05-Specificity/index.html b/exercises/05-Specificity/index.html index e5ddcd6d..5a175de0 100644 --- a/exercises/05-Specificity/index.html +++ b/exercises/05-Specificity/index.html @@ -4,11 +4,14 @@ + 05 Specificity -

      - This is my description, it needs to be long because is supposed to be a - paragraph and not a title. -

      - +
        +
      • My first item of the list
      • +
      • My second item of the list
      • +
      • My third item of the list
      • +
      • My forth item of the list
      • +
      • My fifth item of the list
      • +
      diff --git a/exercises/05-Specificity/styles.css b/exercises/05-Specificity/styles.css index e69de29b..c927086f 100644 --- a/exercises/05-Specificity/styles.css +++ b/exercises/05-Specificity/styles.css @@ -0,0 +1,6 @@ +ul li { + background: blue; +} +#thirditem { + background: yellow; +} diff --git a/exercises/05-Specificity/tests.js b/exercises/05-Specificity/tests.js index 48541114..03ea99bc 100644 --- a/exercises/05-Specificity/tests.js +++ b/exercises/05-Specificity/tests.js @@ -1,54 +1,41 @@ - -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(); }); - - it('the background should be blue', function () { - - // get computed styles of any element you like - const body = document.querySelector('body'); - var styles = window.getComputedStyle(body); - expect(styles["background-color"]).toBe("blue"); - }); +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(); + }); + + it("The original code in styles.css should not be deleted", function() { + const oldCss = "ulli{background:blue;}#thirditem{background:yellow;}"; + expect( + css + .toString() + .replace(/\s/g, "") + .toLowerCase() + ).toContain(oldCss.toLowerCase()); + }); + it("The styles.css should match exactly", function() { + const newCss = + "ulli{background:blue;}#thirditem{background:yellow;}#thirditem{background:green!important;}"; + expect( + css + .toString() + .replace(/\s/g, "") + .toLowerCase() + ).toStrictEqual(newCss.toLowerCase()); + }); }); - - -describe('All the html should match', function () { - beforeEach(() => { - //here I import the HTML into the document - document.documentElement.innerHTML = html.toString(); - }); - afterEach(() => { jest.resetModules(); }); - - it('the html code should contain a p tag', function () { - - // we can read from the source code - console.log(html.toString()); - expect(html.toString().indexOf(` -1).toBeTruthy(); - - //or use query selector to compare hoy mane scriptags do we have - const pTags = document.querySelectorAll("p"); - expect(pTags.length).toBe(1); - }); - - - it('the p tag should have a class "big"', function () { - - //or use query selector to compare hoy mane scriptags do we have - const p = document.querySelector("p"); - expect(p.classList.contains("big")).toBeTruthy(); - }); -}); \ No newline at end of file From b1cb679edc1031044b6e8227c432262b9b388d45 Mon Sep 17 00:00:00 2001 From: plucodev Date: Sun, 11 Aug 2019 19:21:30 -0400 Subject: [PATCH 09/25] Fixed issues 01 --- exercises/01-Your-First-Style/README.md | 17 ++++++++++++++ exercises/01-Your-First-Style/index.html | 9 ++++++++ exercises/01-Your-First-Style/index.js | 0 exercises/01-Your-First-Style/tests.js | 28 ++++++++++++++++++++++++ 4 files changed, 54 insertions(+) create mode 100644 exercises/01-Your-First-Style/README.md create mode 100644 exercises/01-Your-First-Style/index.html create mode 100644 exercises/01-Your-First-Style/index.js create mode 100644 exercises/01-Your-First-Style/tests.js diff --git a/exercises/01-Your-First-Style/README.md b/exercises/01-Your-First-Style/README.md new file mode 100644 index 00000000..491235e1 --- /dev/null +++ b/exercises/01-Your-First-Style/README.md @@ -0,0 +1,17 @@ +# `01` Your First Style + +## 📝 Instructions: + +```Plain/Text +1. Add the `; + ).innerHTML=``; + const body=document.querySelector("body"); + var styles=window.getComputedStyle(body); }); afterEach(() => { jest.resetModules(); }); + it("The body tag should not contains any inline style", function () { + let bodyInlineStyle=document.getElementsByTagName("body"); + let emptyBodyInlineStyle={}; + expect(bodyInlineStyle[0].style._values).toEqual(emptyBodyInlineStyle); + // expect(bodyInlineStyle[0].style._values.background - repeat).toBe( + // undefined + // ); - it("the background-size should be 'contain'", function() { + console.log(bodyInlineStyle[0].style._values); + }); + it("The Head tag should not includes a Style tag", function () { + expect(html.toString().indexOf(`-1).toBeFalsy(); + }); + it("the background-size should be 'contain'", function () { // get computed styles of any element you like - const body = document.querySelector("table"); - console.log("Body: " + body); - var styles = window.getComputedStyle(body); + expect(styles["background-size"]).toBe("contain"); }); - it("the background-repeat should be 'no-repeat'", function() { + it("the background-repeat should be 'no-repeat'", function () { // get computed styles of any element you like - const body = document.querySelector("body"); - var styles = window.getComputedStyle(body); + // const body = document.querySelector("body"); + // var styles = window.getComputedStyle(body); expect(styles["background-repeat"]).toBe("inherit"); }); From 283f27ff83e25ec385338ef791beecb1452965c6 Mon Sep 17 00:00:00 2001 From: plucodev Date: Sun, 11 Aug 2019 19:35:08 -0400 Subject: [PATCH 11/25] fixed issues 02 --- exercises/02-Background/index.html | 1 - exercises/02-Background/tests.js | 12 ++++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/exercises/02-Background/index.html b/exercises/02-Background/index.html index 0e7c23e9..ed88f52c 100644 --- a/exercises/02-Background/index.html +++ b/exercises/02-Background/index.html @@ -5,7 +5,6 @@ 02 Background - diff --git a/exercises/02-Background/tests.js b/exercises/02-Background/tests.js index 7411aa8e..363bd444 100644 --- a/exercises/02-Background/tests.js +++ b/exercises/02-Background/tests.js @@ -14,8 +14,8 @@ describe("All the styles should be applied", function () { document.querySelector( "head" ).innerHTML=``; - const body=document.querySelector("body"); - var styles=window.getComputedStyle(body); + + }); afterEach(() => { jest.resetModules(); @@ -35,15 +35,15 @@ describe("All the styles should be applied", function () { }); it("the background-size should be 'contain'", function () { // get computed styles of any element you like - + const body=document.querySelector("body"); + let styles=window.getComputedStyle(body); expect(styles["background-size"]).toBe("contain"); }); it("the background-repeat should be 'no-repeat'", function () { - // get computed styles of any element you like - // const body = document.querySelector("body"); - // var styles = window.getComputedStyle(body); + const body=document.querySelector("body"); + let styles=window.getComputedStyle(body); expect(styles["background-repeat"]).toBe("inherit"); }); }); From c43acb1e1e6b9faa6bd5caffafc7bd15de9be24e Mon Sep 17 00:00:00 2001 From: plucodev Date: Sun, 11 Aug 2019 19:36:04 -0400 Subject: [PATCH 12/25] modified welcome README --- exercises/00-Welcome/README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/exercises/00-Welcome/README.md b/exercises/00-Welcome/README.md index dad9409a..9604acc7 100644 --- a/exercises/00-Welcome/README.md +++ b/exercises/00-Welcome/README.md @@ -1,3 +1,9 @@ # Welcome!! -Here are the CSS Excercises \ No newline at end of file +Here are the CSS Excercises + +Hello. We are very excited to have you here !! 🎉 😂 + +During this course you will be learning the following concepts: + +As you may have noticed, HTML allows you to create only basic websites. Nobody wants to see a white website with some horrible text on it. So it's time to learn what is CSS all about! Learn CSS to make your website beautiful. Let's make it shine! From cd9e0171fd04277c1a2982b789e69d59c574099d Mon Sep 17 00:00:00 2001 From: plucodev Date: Sun, 11 Aug 2019 19:38:18 -0400 Subject: [PATCH 13/25] fixed issues 01 --- exercises/01-hello-world/README.md | 19 ---------- exercises/01-hello-world/index.html | 9 ----- exercises/01-hello-world/index.js | 1 - exercises/01-hello-world/styles.css | 6 ---- exercises/01-hello-world/tests.js | 54 ----------------------------- 5 files changed, 89 deletions(-) delete mode 100644 exercises/01-hello-world/README.md delete mode 100644 exercises/01-hello-world/index.html delete mode 100644 exercises/01-hello-world/index.js delete mode 100644 exercises/01-hello-world/styles.css delete mode 100644 exercises/01-hello-world/tests.js diff --git a/exercises/01-hello-world/README.md b/exercises/01-hello-world/README.md deleted file mode 100644 index e8143c69..00000000 --- a/exercises/01-hello-world/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# `01` Hello World - -In this website, we have 2 elements: a H1 with the ID #theTitle and a paragraph with the ID #theParagraph. - -You can select any of the objects in the DOM with the getElementById function. If we want to select the h1 paragraph and assign it to a variable, do the following: - -```javascript -var aux = document.getElementById("theTitle"); -``` - -Now that we have our h1 element stored in the aux variable, we can access any of the properties of the element, for example we can retrieve the font-size style property. - -## 📝 Instructions: - -Prompt an alert with the ID of the h1. - -Hint: - -- Here you can read more about the id property of any DOM element: http://www.w3schools.com/jsref/prop_html_id.asp diff --git a/exercises/01-hello-world/index.html b/exercises/01-hello-world/index.html deleted file mode 100644 index 8fcd076d..00000000 --- a/exercises/01-hello-world/index.html +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/exercises/01-hello-world/index.js b/exercises/01-hello-world/index.js deleted file mode 100644 index ee1aa2a5..00000000 --- a/exercises/01-hello-world/index.js +++ /dev/null @@ -1 +0,0 @@ -//nothing to see here diff --git a/exercises/01-hello-world/styles.css b/exercises/01-hello-world/styles.css deleted file mode 100644 index cec80d88..00000000 --- a/exercises/01-hello-world/styles.css +++ /dev/null @@ -1,6 +0,0 @@ -body { - background: blue; -} -#theTitle { - font-size: 22px; -} diff --git a/exercises/01-hello-world/tests.js b/exercises/01-hello-world/tests.js deleted file mode 100644 index 48541114..00000000 --- a/exercises/01-hello-world/tests.js +++ /dev/null @@ -1,54 +0,0 @@ - -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(); }); - - it('the background should be blue', function () { - - // get computed styles of any element you like - const body = document.querySelector('body'); - var styles = window.getComputedStyle(body); - expect(styles["background-color"]).toBe("blue"); - }); -}); - - -describe('All the html should match', function () { - beforeEach(() => { - //here I import the HTML into the document - document.documentElement.innerHTML = html.toString(); - }); - afterEach(() => { jest.resetModules(); }); - - it('the html code should contain a p tag', function () { - - // we can read from the source code - console.log(html.toString()); - expect(html.toString().indexOf(` -1).toBeTruthy(); - - //or use query selector to compare hoy mane scriptags do we have - const pTags = document.querySelectorAll("p"); - expect(pTags.length).toBe(1); - }); - - - it('the p tag should have a class "big"', function () { - - //or use query selector to compare hoy mane scriptags do we have - const p = document.querySelector("p"); - expect(p.classList.contains("big")).toBeTruthy(); - }); -}); \ No newline at end of file From 5d5fc613a5cf7f7ddb53f6a39a3ce5a5245f1b5f Mon Sep 17 00:00:00 2001 From: plucodev Date: Sun, 11 Aug 2019 19:46:29 -0400 Subject: [PATCH 14/25] refactoring 03 --- exercises/03-Inline-Styles/README.md | 4 +++- exercises/03-Inline-Styles/index.html | 3 ++- exercises/03-Inline-Styles/tests.js | 13 ++++++------- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/exercises/03-Inline-Styles/README.md b/exercises/03-Inline-Styles/README.md index eaf255cf..283787b5 100644 --- a/exercises/03-Inline-Styles/README.md +++ b/exercises/03-Inline-Styles/README.md @@ -16,7 +16,9 @@ Note: You can append as many CSS rules as you want, within the same line, separa ## 📝 Instructions: -Set an inline style to change the background color of the table to green. For this exercise, do NOT use styles.css :( +```Plain/Text +1. Set an inline style to change the background color of the table to green. For this exercise, do NOT use styles.css :( +``` ### Hint: diff --git a/exercises/03-Inline-Styles/index.html b/exercises/03-Inline-Styles/index.html index 9ef8cb68..c1c8d2e0 100644 --- a/exercises/03-Inline-Styles/index.html +++ b/exercises/03-Inline-Styles/index.html @@ -6,8 +6,9 @@ 03 Inline Styles + -
      Hello
      +
      diff --git a/exercises/03-Inline-Styles/tests.js b/exercises/03-Inline-Styles/tests.js index 444d8dd8..402b36bf 100644 --- a/exercises/03-Inline-Styles/tests.js +++ b/exercises/03-Inline-Styles/tests.js @@ -9,22 +9,21 @@ describe("The Table tag should contain inline style background: green", function beforeEach(() => { //here I import the HTML into the document document.documentElement.innerHTML = html.toString(); - document.querySelector( - "head" - ).innerHTML = ``; }); afterEach(() => { jest.resetModules(); }); it("The styles.css file should be empty", function() { - console.log(css); expect(css.toString() === "").toBeTruthy(); }); + it("The Head tag should not includes a Style tag", function() { + expect(html.toString().indexOf(` -1).toBeFalsy(); + }); it("The background should be green", function() { const table = document.querySelector("table"); - expect(table.style.background === "green").toBeTruthy(); + // expect(table.style.background === "green").toBeTruthy(); + var styles = window.getComputedStyle(table); + expect(styles["background"]).toBe("green"); }); }); - - From 8c3d06c5731cf148e0dc771e1f27a6c21ea3ccb1 Mon Sep 17 00:00:00 2001 From: plucodev Date: Sun, 11 Aug 2019 20:50:09 -0400 Subject: [PATCH 15/25] fixed issues 04 --- exercises/04-Combined-Rules/README.md | 8 ++- exercises/04-Combined-Rules/index.html | 29 ++------- exercises/04-Combined-Rules/tests.js | 85 ++++++++++++++++++++------ 3 files changed, 80 insertions(+), 42 deletions(-) diff --git a/exercises/04-Combined-Rules/README.md b/exercises/04-Combined-Rules/README.md index b3593ffd..e51bcf4a 100644 --- a/exercises/04-Combined-Rules/README.md +++ b/exercises/04-Combined-Rules/README.md @@ -18,10 +18,14 @@ border: black 1px solid; # 📝 Instructions: +```Plain/Text 1. Combine the 4 padding rules into just one using the "padding:" rule. - Combine the all background rules, but the background size, into just one line using the "background:" rule. +2. Combine the all background rules, but the background size, into just one line using the "background:" rule. -2. **P.S: The background size cannot be combined, the browsers don't support it yet.** + +``` + +P.S: The background size cannot be combined, the browsers don't support it yet.\*\* # Hint: diff --git a/exercises/04-Combined-Rules/index.html b/exercises/04-Combined-Rules/index.html index a894aa76..2dbf2f7a 100644 --- a/exercises/04-Combined-Rules/index.html +++ b/exercises/04-Combined-Rules/index.html @@ -9,41 +9,24 @@ + -
      Hello!
      +
      Hello!
      - - diff --git a/exercises/04-Combined-Rules/tests.js b/exercises/04-Combined-Rules/tests.js index 3fe1a0ee..20a70ecf 100644 --- a/exercises/04-Combined-Rules/tests.js +++ b/exercises/04-Combined-Rules/tests.js @@ -1,35 +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"); +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() { +describe("All the styles should be applied", function () { beforeEach(() => { //here I import the HTML into the document - document.documentElement.innerHTML = html.toString(); + document.documentElement.innerHTML=html.toString(); //apply the styles from the stylesheet if needed - document.querySelector( - "head" - ).innerHTML = ``; + // document.querySelector( + // "head" + // ).innerHTML = ``; }); afterEach(() => { jest.resetModules(); }); - it("The styles.css file should be empty", function() { + it("The styles.css file should be empty", function () { console.log(css); - expect(css.toString() === "").toBeTruthy(); + expect(css.toString()==="").toBeTruthy(); }); + it("The Head tag should includes a Style tag", function () { + expect(html.toString().indexOf(`-1).toBeTruthy(); + }); + it("The body tag should not contains any inline style", function () { + let bodyInlineStyle=document.getElementsByTagName("style"); + let emptyBodyInlineStyle={}; + expect(bodyInlineStyle[0].style._values).toEqual(emptyBodyInlineStyle); + console.log("sty: ", bodyInlineStyle[0]); + }); + it("the width should be '50px'", function () { + // get computed styles of any element you like + const body=document.querySelector(".myBox"); + var styles=window.getComputedStyle(body); + expect(styles["width"]).toBe("50px"); + }); + it("the height should be '50px'", function () { + // get computed styles of any element you like + const body=document.querySelector(".myBox"); + var styles=window.getComputedStyle(body); + expect(styles["height"]).toBe("50px"); + }); + // it("the background should be in rgb code rgb(189, 189, 189)", function() { + // // get computed styles of any element you like + // const body = document.querySelector(".myBox"); + // var styles = window.getComputedStyle(body); + // expect(styles["background"]).toBe("rgb(189, 189, 189)"); + // }); + it("the background-size should be 'contain'", function () { + // get computed styles of any element you like + const body=document.querySelector(".myBox"); + + var styles=window.getComputedStyle(body); + console.log("@@@", styles._values) + expect(styles["background-size"]).toBe("contain"); + }); + // it("the padding-top should be deleted", function () { + // // get computed styles of any element you like + // const body=document.querySelector(".myBox"); + // var styles=window.getComputedStyle(body); + // expect(styles["padding-top"]).toBeFalsy(); + // expect(styles["padding-bottom"]).toBeFalsy(); + // expect(styles["padding-right"]).toBeFalsy(); + // expect(styles["padding-left"]).toBeFalsy(); - it("The Padding - Shorthand Property should be applied ", function() { - let styles = document.querySelector("head").innerHTML; - console.log("Styles :" + styles); + // }); + it("the padding should include the shorthand property", function () { + // get computed styles of any element you like + const body=document.querySelector(".myBox"); + var styles=window.getComputedStyle(body); + expect(styles["padding"]).toBe("10px 190px 50px 30px"); + + }); + it("the background should include the shorthand property ", function () { // get computed styles of any element you like - // const body = document.querySelector('body'); - // var styles = window.getComputedStyle(body); - expect(styles["background-color"]).toBe("blue"); + const body=document.querySelector(".myBox"); + var styles=window.getComputedStyle(body); + expect(styles["background"]).toBe( + `rgb(189, 189, 189) url(https://assets.breatheco.de/img/funny/scared-baby.jpg) no-repeat 100px` + ); }); }); From 0598eaabd25da7911f7d015710c2196655046392 Mon Sep 17 00:00:00 2001 From: plucodev Date: Sun, 11 Aug 2019 20:54:20 -0400 Subject: [PATCH 16/25] fixed issues 05 --- exercises/05-Specificity/README.md | 4 ++-- exercises/05-Specificity/tests.js | 27 ++++++++++++++++----------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/exercises/05-Specificity/README.md b/exercises/05-Specificity/README.md index 49fae514..9e63cfa6 100644 --- a/exercises/05-Specificity/README.md +++ b/exercises/05-Specificity/README.md @@ -9,13 +9,13 @@ Because the more specific, the more priority it has. ## 📝 Instructions: +```Plain/Text 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. +``` Tip: You can use the **!important** annotation: https://css-tricks.com/when-using-important-is-the-right-choice/ -Hint: -- How to use the background-size: http://lmgtfy.com/?q=css+background-size diff --git a/exercises/05-Specificity/tests.js b/exercises/05-Specificity/tests.js index 03ea99bc..539cd3ba 100644 --- a/exercises/05-Specificity/tests.js +++ b/exercises/05-Specificity/tests.js @@ -1,26 +1,31 @@ -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"); jest.dontMock("fs"); -describe("All the styles should be applied", function() { +describe("All the styles should be applied", function () { beforeEach(() => { //here I import the HTML into the document - document.documentElement.innerHTML = html.toString(); + document.documentElement.innerHTML=html.toString(); //apply the styles from the stylesheet if needed document.querySelector( "head" - ).innerHTML = ``; + ).innerHTML=``; }); afterEach(() => { jest.resetModules(); }); + it("The Head tag should not includes a Style tag", function () { + expect(html.toString().indexOf(`-1).toBeFalsy(); + }); + + - it("The original code in styles.css should not be deleted", function() { - const oldCss = "ulli{background:blue;}#thirditem{background:yellow;}"; + it("The original code in styles.css should not be deleted", function () { + const oldCss="ulli{background:blue;}#thirditem{background:yellow;}"; expect( css .toString() @@ -28,8 +33,8 @@ describe("All the styles should be applied", function() { .toLowerCase() ).toContain(oldCss.toLowerCase()); }); - it("The styles.css should match exactly", function() { - const newCss = + it("The styles.css should match exactly", function () { + const newCss= "ulli{background:blue;}#thirditem{background:yellow;}#thirditem{background:green!important;}"; expect( css From 8a61c792d54fcb0a9179bc0c73394193228d9d11 Mon Sep 17 00:00:00 2001 From: plucodev Date: Sun, 11 Aug 2019 20:57:46 -0400 Subject: [PATCH 17/25] fixed issues 06 --- exercises/06-Practicing-Rules/README.md | 2 + exercises/06-Practicing-Rules/index.html | 27 ++++- exercises/06-Practicing-Rules/tests.js | 124 ++++++++++++++--------- 3 files changed, 102 insertions(+), 51 deletions(-) diff --git a/exercises/06-Practicing-Rules/README.md b/exercises/06-Practicing-Rules/README.md index 037d6860..73fbcc78 100644 --- a/exercises/06-Practicing-Rules/README.md +++ b/exercises/06-Practicing-Rules/README.md @@ -2,6 +2,7 @@ ## 📝 Instructions: +```Plain/Text 1. Set this URL as the background image of the page, and repeat it vertically only: http://assets.breatheco.de/apis/img/bg/background-vertical.jpg @@ -18,6 +19,7 @@ 7. Add a white semi-transparent background to the first paragraph of "3 reasons you know you are learning" to make it easier to read (you have tu use rgba for that), and 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). +``` The result should be something like this: diff --git a/exercises/06-Practicing-Rules/index.html b/exercises/06-Practicing-Rules/index.html index e5ddcd6d..52a82850 100644 --- a/exercises/06-Practicing-Rules/index.html +++ b/exercises/06-Practicing-Rules/index.html @@ -4,11 +4,32 @@ + 06 Practicing Rules + -

      - This is my description, it needs to be long because is supposed to be a - paragraph and not a title. +

      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/tests.js b/exercises/06-Practicing-Rules/tests.js index 48541114..75eb0bfd 100644 --- a/exercises/06-Practicing-Rules/tests.js +++ b/exercises/06-Practicing-Rules/tests.js @@ -1,54 +1,82 @@ +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'); +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', 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(); + }); - //apply the styles from the stylesheet if needed - document.querySelector('head').innerHTML = ``; - }); - afterEach(() => { jest.resetModules(); }); + it("The Head tag should not includes a Style tag", function() { + expect(html.toString().indexOf(` -1).toBeFalsy(); + }); - it('the background should be blue', function () { - - // get computed styles of any element you like - const body = document.querySelector('body'); - var styles = window.getComputedStyle(body); - expect(styles["background-color"]).toBe("blue"); - }); + it("the background should match", function() { + // get computed styles of any element you like + const body = document.querySelector("body"); + var styles = window.getComputedStyle(body); + expect(styles["background"]).toBe( + `url(http://assets.breatheco.de/apis/img/bg/background-vertical.jpg) repeat-y` + ); + }); + it("the font-family should be 'Times New Roman'", function() { + // get computed styles of any element you like + const body = document.querySelector("body"); + var styles = window.getComputedStyle(body); + expect(styles["font-family"]).toBe("Times New Roman"); + }); + it("the padding-left should be '20px'", function() { + // get computed styles of any element you like + const body = document.querySelector("body"); + var styles = window.getComputedStyle(body); + expect(styles["padding-left"]).toBe("20px"); + }); + it("the font-family in the H1 Tag should be 'Courier'", function() { + // get computed styles of any element you like + const h1Tag = document.querySelector("h1"); + let h1TagStyles = window.getComputedStyle(h1Tag); + expect(h1TagStyles["font-family"]).toBe("Courier"); + }); + it("the color in the H1 Tag should be 'red'", function() { + // get computed styles of any element you like + const h1Tag = document.querySelector("h1"); + let h1TagStyles = window.getComputedStyle(h1Tag); + expect(h1TagStyles["color"]).toBe("red"); + }); + it("the text-align in the H1 Tag should be 'center'", function() { + // get computed styles of any element you like + const h1Tag = document.querySelector("h1"); + let h1TagStyles = window.getComputedStyle(h1Tag); + expect(h1TagStyles["text-align"]).toBe("center"); + }); + it("the text-decoration in the H2 Tag should be 'underline'", function() { + // get computed styles of any element you like + 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() { + // get computed styles of any element you like + 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() { + // 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)"); + }); }); - - -describe('All the html should match', function () { - beforeEach(() => { - //here I import the HTML into the document - document.documentElement.innerHTML = html.toString(); - }); - afterEach(() => { jest.resetModules(); }); - - it('the html code should contain a p tag', function () { - - // we can read from the source code - console.log(html.toString()); - expect(html.toString().indexOf(` -1).toBeTruthy(); - - //or use query selector to compare hoy mane scriptags do we have - const pTags = document.querySelectorAll("p"); - expect(pTags.length).toBe(1); - }); - - - it('the p tag should have a class "big"', function () { - - //or use query selector to compare hoy mane scriptags do we have - const p = document.querySelector("p"); - expect(p.classList.contains("big")).toBeTruthy(); - }); -}); \ No newline at end of file From 7269d6442c73957ff1190d0fb1208218567daedb Mon Sep 17 00:00:00 2001 From: plucodev Date: Sun, 11 Aug 2019 20:59:18 -0400 Subject: [PATCH 18/25] fixed issues 07 --- exercises/07-Very-Specific-Rules/README.md | 10 +- exercises/07-Very-Specific-Rules/styles.css | 3 +- exercises/07-Very-Specific-Rules/tests.js | 107 ++++++++++++-------- 3 files changed, 75 insertions(+), 45 deletions(-) diff --git a/exercises/07-Very-Specific-Rules/README.md b/exercises/07-Very-Specific-Rules/README.md index 66b7c8d3..491a4d1e 100644 --- a/exercises/07-Very-Specific-Rules/README.md +++ b/exercises/07-Very-Specific-Rules/README.md @@ -6,11 +6,13 @@ In this exercise, you can add your code only above the **READ ONLY BLOCK** of th ## 📝 Instructions: -- Set the
        text color to red (override conflicts with specificity). -- Set the background color of the second
      • of the
          to green (don't use the #id selector). -- Make the odd rows of the tables with yellow background using **tr:nth-child**. +```Plain/Text +1. Set the
            text color to red (override conflicts with specificity). +2. Set the background color of the second
          • of the
              to green (don't use the #id selector). +3. Make the odd rows of the tables with yellow background using **tr:nth-child**. +``` ![Example Image](http://i.imgur.com/MyeiuOb.png) Hint: -- How to use the background-size: http://lmgtfy.com/?q=css+background-size + diff --git a/exercises/07-Very-Specific-Rules/styles.css b/exercises/07-Very-Specific-Rules/styles.css index 7762401f..defdb77a 100644 --- a/exercises/07-Very-Specific-Rules/styles.css +++ b/exercises/07-Very-Specific-Rules/styles.css @@ -1,6 +1,6 @@ /** Insert your code here **/ -/*********** REDONLY BLOCK ****** +/*********** READ ONLY BLOCK ****** You CAN NOT UPDATE anything from here on, only add lines of code on top of this lines **/ @@ -8,6 +8,7 @@ only add lines of code on top of this lines body { color: blue; } + ul li, ol li { color: green; diff --git a/exercises/07-Very-Specific-Rules/tests.js b/exercises/07-Very-Specific-Rules/tests.js index 48541114..7f79a6af 100644 --- a/exercises/07-Very-Specific-Rules/tests.js +++ b/exercises/07-Very-Specific-Rules/tests.js @@ -1,54 +1,81 @@ +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'); +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', 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(); + }); - //apply the styles from the stylesheet if needed - document.querySelector('head').innerHTML = ``; - }); - afterEach(() => { jest.resetModules(); }); - it('the background should be blue', function () { + it("The ul li color has to be red", function () { + let cssArray=document.styleSheets[0].cssRules; + + let orangeHoverSelector=""; + for (let i=0; i { - //here I import the HTML into the document - document.documentElement.innerHTML = html.toString(); - }); - afterEach(() => { jest.resetModules(); }); + let orangeHoverSelector=""; + for (let i=0; i -1).toBeTruthy(); + let orangeHoverSelector=""; + for (let i=0; i-1).toBeFalsy(); + }); - it('the p tag should have a class "big"', function () { - //or use query selector to compare hoy mane scriptags do we have - const p = document.querySelector("p"); - expect(p.classList.contains("big")).toBeTruthy(); - }); -}); \ No newline at end of file + + +}); + From d8e6e3be1f31d24914f3ca821c21daea18c78ab4 Mon Sep 17 00:00:00 2001 From: plucodev Date: Sun, 11 Aug 2019 21:04:25 -0400 Subject: [PATCH 19/25] fixed issues 08 --- exercises/08-Rounded-Image/README.md | 29 ++++++++++++++++++--------- exercises/08-Rounded-Image/index.html | 10 +++++---- exercises/08-Rounded-Image/styles.css | 6 ++++++ 3 files changed, 32 insertions(+), 13 deletions(-) diff --git a/exercises/08-Rounded-Image/README.md b/exercises/08-Rounded-Image/README.md index fdf84502..c99386c9 100644 --- a/exercises/08-Rounded-Image/README.md +++ b/exercises/08-Rounded-Image/README.md @@ -1,15 +1,26 @@ # `08` Rounded Image -The "background" CSS rule allows us to assign and work with the background of any container- the background can be a color or an image. If it is an image you can specify if you want the image to repeat horizontally, vertically, both, or not at all, and you can also specify if you want it to resize and fit the whole container where its being applied, among other properties that can be modified. +A lot of websites use rounded profile images, a technique that really makes a website more beautiful! -## 📝 Instructions: +The obvious way create a rounded profile picture is to create an image tag and apply border-radius:100%. The problem with this approach, is that it only works for squared pictures... profile pictures with different height and width will not look like a circle, they will look like ovals: + +![Example Image](http://i.imgur.com/H7btEoU.png) + +Instead of doing that, the right approach will be to create a squared div (a.ka: with equal width and height), assign the image as a background, and then apply a border-radius to that div. -Run the exercise. -Change the background-size to "contain" (check the index.css tab). -Run the exercise again. -Change the background-repeat to inherit to make it repeat over the x axis and y axis. -Run the exercise again. +If the image ends up being bigger than the div (or with different proportions) we can adjust the background-position or background-size to choose what part of the image we want to display inside of the circle. + +## 📝 Instructions: -Hint: +```Plain/Text +1. Instead of doing that, the right approach will +be to create a squared div (a.ka: with equal width +and height), assign the image as a background, and +then apply a border-radius to that div. -- How to use the background-size: http://lmgtfy.com/?q=css+background-size +2. If the image ends up being bigger than the div +(or with different proportions) we can adjust the +background-position or background-size to choose +what part of the image we want to display inside +of the circle. +``` diff --git a/exercises/08-Rounded-Image/index.html b/exercises/08-Rounded-Image/index.html index e5ddcd6d..a6f14062 100644 --- a/exercises/08-Rounded-Image/index.html +++ b/exercises/08-Rounded-Image/index.html @@ -4,11 +4,13 @@ + 08 Rounded Image + -

              - This is my description, it needs to be long because is supposed to be a - paragraph and not a title. -

              + diff --git a/exercises/08-Rounded-Image/styles.css b/exercises/08-Rounded-Image/styles.css index e69de29b..62006948 100644 --- a/exercises/08-Rounded-Image/styles.css +++ b/exercises/08-Rounded-Image/styles.css @@ -0,0 +1,6 @@ +body { + background: #bdbdbd; +} +.rounded { + border-radius: 100%; +} From 006be0b1b714ed6f4bd5817cb3f25f646ce92fc2 Mon Sep 17 00:00:00 2001 From: plucodev Date: Sun, 11 Aug 2019 21:15:49 -0400 Subject: [PATCH 20/25] fixed issues 09 --- exercises/08-Rounded-Image/tests.js | 112 ++++++++++++++------------ exercises/09-Anchor-Styles/README.md | 24 ++++-- exercises/09-Anchor-Styles/index.html | 6 +- exercises/09-Anchor-Styles/styles.css | 13 +++ exercises/09-Anchor-Styles/tests.js | 100 +++++++++++------------ 5 files changed, 142 insertions(+), 113 deletions(-) diff --git a/exercises/08-Rounded-Image/tests.js b/exercises/08-Rounded-Image/tests.js index 48541114..bc578ad4 100644 --- a/exercises/08-Rounded-Image/tests.js +++ b/exercises/08-Rounded-Image/tests.js @@ -1,54 +1,66 @@ +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'); +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', 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(); }); - - it('the background should be blue', function () { - - // get computed styles of any element you like - const body = document.querySelector('body'); - var styles = window.getComputedStyle(body); - expect(styles["background-color"]).toBe("blue"); - }); + //apply the styles from the stylesheet if needed + document.querySelector( + "head" + ).innerHTML = ``; + }); + afterEach(() => { + jest.resetModules(); + }); + it("The Head tag should not includes a Style tag", function() { + expect(html.toString().indexOf(` -1).toBeFalsy(); + }); + it("The tag has to be removed", function() { + expect(document.querySelector("img")).toBeFalsy(); + }); + it("The
              tag should exists", function() { + expect(document.querySelector("div")).toBeTruthy(); + }); + it("the width in the div Tag should be '200px'", function() { + // get computed styles of any element you like + const divTag = document.querySelector("div"); + let idTagStyles = window.getComputedStyle(divTag); + expect(idTagStyles["width"]).toBe("200px"); + }); + it("the height in the div Tag should be '200px'", function() { + // get computed styles of any element you like + const divTag = document.querySelector("div"); + let idTagStyles = window.getComputedStyle(divTag); + expect(idTagStyles["height"]).toBe("200px"); + }); + it("the border radius in the div Tag should be '100%'", function() { + // get computed styles of any element you like + const divTag = document.querySelector("div"); + let idTagStyles = window.getComputedStyle(divTag); + expect(idTagStyles["border-radius"]).toBe("100%"); + }); + it("the background position x in the div Tag should be 'center'", function() { + // get computed styles of any element you like + const divTag = document.querySelector("div"); + 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() { + // get computed styles of any element you like + const divTag = document.querySelector("div"); + let idTagStyles = window.getComputedStyle(divTag); + expect(idTagStyles["background-position-y"]).toBe("center"); + }); + it("the background image in the div Tag should exists", function() { + // get computed styles of any element you like + const divTag = document.querySelector("div"); + let idTagStyles = window.getComputedStyle(divTag); + expect(idTagStyles["background-image"]).toBeTruthy(); + }); }); - - -describe('All the html should match', function () { - beforeEach(() => { - //here I import the HTML into the document - document.documentElement.innerHTML = html.toString(); - }); - afterEach(() => { jest.resetModules(); }); - - it('the html code should contain a p tag', function () { - - // we can read from the source code - console.log(html.toString()); - expect(html.toString().indexOf(` -1).toBeTruthy(); - - //or use query selector to compare hoy mane scriptags do we have - const pTags = document.querySelectorAll("p"); - expect(pTags.length).toBe(1); - }); - - - it('the p tag should have a class "big"', function () { - - //or use query selector to compare hoy mane scriptags do we have - const p = document.querySelector("p"); - expect(p.classList.contains("big")).toBeTruthy(); - }); -}); \ No newline at end of file diff --git a/exercises/09-Anchor-Styles/README.md b/exercises/09-Anchor-Styles/README.md index fdfcc63e..262b6b14 100644 --- a/exercises/09-Anchor-Styles/README.md +++ b/exercises/09-Anchor-Styles/README.md @@ -1,15 +1,23 @@ # `09` 3D Anchor Styles -The "background" CSS rule allows us to assign and work with the background of any container- the background can be a color or an image. If it is an image you can specify if you want the image to repeat horizontally, vertically, both, or not at all, and you can also specify if you want it to resize and fit the whole container where its being applied, among other properties that can be modified. +People like to feel that they are clicking on something, a great approach to accomplish that is by faking a 3D effect. To do so, designers normally play with the borders. Example: + +![Example Image](http://i.imgur.com/kLPzBXc.png) + +You can control what css rules apply to each state of an anchor by using the ":hover" (for mouse hover) or ":active" (for mouse pressing) selectors, example: + +```css +a:active { + /* here you can specify whatever css rule that applies to the anchor while being 'pressed' */ +} +``` ## 📝 Instructions: -Run the exercise. -Change the background-size to "contain" (check the index.css tab). -Run the exercise again. -Change the background-repeat to inherit to make it repeat over the x axis and y axis. -Run the exercise again. +```Plain/Text +1. Change the border colors of the anchor, +when being pressed, to the following: -Hint: -- How to use the background-size: http://lmgtfy.com/?q=css+background-size +border-color: #000 #aaa #aaa #000; +``` diff --git a/exercises/09-Anchor-Styles/index.html b/exercises/09-Anchor-Styles/index.html index e5ddcd6d..28111137 100644 --- a/exercises/09-Anchor-Styles/index.html +++ b/exercises/09-Anchor-Styles/index.html @@ -4,11 +4,9 @@ + 09 Anchor Styles -

              - This is my description, it needs to be long because is supposed to be a - paragraph and not a title. -

              + Click me diff --git a/exercises/09-Anchor-Styles/styles.css b/exercises/09-Anchor-Styles/styles.css index e69de29b..7c25cc72 100644 --- a/exercises/09-Anchor-Styles/styles.css +++ b/exercises/09-Anchor-Styles/styles.css @@ -0,0 +1,13 @@ +.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*/ +} diff --git a/exercises/09-Anchor-Styles/tests.js b/exercises/09-Anchor-Styles/tests.js index 48541114..667f4c22 100644 --- a/exercises/09-Anchor-Styles/tests.js +++ b/exercises/09-Anchor-Styles/tests.js @@ -1,54 +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'); - -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(); }); - - it('the background should be blue', function () { - - // get computed styles of any element you like - const body = document.querySelector('body'); - var styles = window.getComputedStyle(body); - expect(styles["background-color"]).toBe("blue"); - }); +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"); + +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=``; + cssArray=document.styleSheets[0].cssRules; + }); + afterEach(() => { + jest.resetModules(); + }); + it("The Head tag should not includes a Style tag", function () { + expect(html.toString().indexOf(`-1).toBeFalsy(); + }); + it("You should not add your rules above the existing code", function () { + 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 () { + // we can read from the source code + // console.log(html.toString()); + expect(html.toString().indexOf(`-1).toBeTruthy(); + }); + + + it("The border-color rule for the 'threeDimension active ' property should match the instruction color", function () { + // get computed styles of any element you like + // let cssArray=document.styleSheets[0].cssRules; + + let orangeHoverSelector=""; + for (let i=0; i { - //here I import the HTML into the document - document.documentElement.innerHTML = html.toString(); - }); - afterEach(() => { jest.resetModules(); }); - - it('the html code should contain a p tag', function () { - - // we can read from the source code - console.log(html.toString()); - expect(html.toString().indexOf(` -1).toBeTruthy(); - - //or use query selector to compare hoy mane scriptags do we have - const pTags = document.querySelectorAll("p"); - expect(pTags.length).toBe(1); - }); - - - it('the p tag should have a class "big"', function () { - - //or use query selector to compare hoy mane scriptags do we have - const p = document.querySelector("p"); - expect(p.classList.contains("big")).toBeTruthy(); - }); -}); \ No newline at end of file From 39ebd1271c7ac464e280fc23d6f1a6a148c78940 Mon Sep 17 00:00:00 2001 From: plucodev Date: Sun, 11 Aug 2019 21:43:55 -0400 Subject: [PATCH 21/25] fixed issues 11 --- exercises/11-Font-Awesome-Icons/README.md | 23 +++-- exercises/11-Font-Awesome-Icons/index.html | 8 +- exercises/11-Font-Awesome-Icons/styles.css | 3 + exercises/11-Font-Awesome-Icons/tests.js | 98 ++++++++++------------ 4 files changed, 66 insertions(+), 66 deletions(-) diff --git a/exercises/11-Font-Awesome-Icons/README.md b/exercises/11-Font-Awesome-Icons/README.md index e3903e67..e1ea851b 100644 --- a/exercises/11-Font-Awesome-Icons/README.md +++ b/exercises/11-Font-Awesome-Icons/README.md @@ -1,15 +1,20 @@ # `11` Font Awesome Icons -The "background" CSS rule allows us to assign and work with the background of any container- the background can be a color or an image. If it is an image you can specify if you want the image to repeat horizontally, vertically, both, or not at all, and you can also specify if you want it to resize and fit the whole container where its being applied, among other properties that can be modified. +As a developer/designer, you want to use certain icons to make your website easy to understand; for example, we know that a "trash" icon means "delete". -## 📝 Instructions: +But using icons can be frustrating and time-consuming because each icon is an image and working with images is horrible! + +Font-awesome solve the "image" problem by creating a new font- each letter is a different icon and you can now import the whole font into your website and use whatever icon you want. -Run the exercise. -Change the background-size to "contain" (check the index.css tab). -Run the exercise again. -Change the background-repeat to inherit to make it repeat over the x axis and y axis. -Run the exercise again. +After linking your website with font-awesome, you can use the following to code to insert a specific icon: -Hint: +```html + "camera-retro" will be the name of the icon, +you can find all the available names here: http://fontawesome.io/icons/ +``` + +## 📝 Instructions: -- How to use the background-size: http://lmgtfy.com/?q=css+background-size +```Plain/Text +Add two more items into your list and add a different icon at the beginning of each item. +``` diff --git a/exercises/11-Font-Awesome-Icons/index.html b/exercises/11-Font-Awesome-Icons/index.html index e5ddcd6d..a619ff63 100644 --- a/exercises/11-Font-Awesome-Icons/index.html +++ b/exercises/11-Font-Awesome-Icons/index.html @@ -4,11 +4,11 @@ + 11 Font Awesome -

              - This is my description, it needs to be long because is supposed to be a - paragraph and not a title. -

              +
                +
              • Hello
              • +
              diff --git a/exercises/11-Font-Awesome-Icons/styles.css b/exercises/11-Font-Awesome-Icons/styles.css index e69de29b..b22aedca 100644 --- a/exercises/11-Font-Awesome-Icons/styles.css +++ b/exercises/11-Font-Awesome-Icons/styles.css @@ -0,0 +1,3 @@ +li { + list-style: none; +} diff --git a/exercises/11-Font-Awesome-Icons/tests.js b/exercises/11-Font-Awesome-Icons/tests.js index 48541114..10afe9c1 100644 --- a/exercises/11-Font-Awesome-Icons/tests.js +++ b/exercises/11-Font-Awesome-Icons/tests.js @@ -1,54 +1,46 @@ - -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(); }); - - it('the background should be blue', function () { - - // get computed styles of any element you like - const body = document.querySelector('body'); - var styles = window.getComputedStyle(body); - expect(styles["background-color"]).toBe("blue"); - }); +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(); + }); + + it("ul tag should exists", function() { + expect(document.querySelector("ul")).toBeTruthy(); + }); + it("At least 3 li tags should exist", function() { + expect(document.querySelectorAll("li").length).toBe(3); + }); + it("At least 3 i tags should exist", function() { + expect(document.querySelectorAll("i").length).toBe(3); + }); + it(" LI innerHTML exist", function() { + 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 "fa"', function() { + //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(); + } + }); }); - - -describe('All the html should match', function () { - beforeEach(() => { - //here I import the HTML into the document - document.documentElement.innerHTML = html.toString(); - }); - afterEach(() => { jest.resetModules(); }); - - it('the html code should contain a p tag', function () { - - // we can read from the source code - console.log(html.toString()); - expect(html.toString().indexOf(` -1).toBeTruthy(); - - //or use query selector to compare hoy mane scriptags do we have - const pTags = document.querySelectorAll("p"); - expect(pTags.length).toBe(1); - }); - - - it('the p tag should have a class "big"', function () { - - //or use query selector to compare hoy mane scriptags do we have - const p = document.querySelector("p"); - expect(p.classList.contains("big")).toBeTruthy(); - }); -}); \ No newline at end of file From e2e50916f7ace55d5e090986a53499c84a9c37c7 Mon Sep 17 00:00:00 2001 From: plucodev Date: Sun, 11 Aug 2019 22:05:32 -0400 Subject: [PATCH 22/25] fixed issues 12 --- exercises/12-Relative-Length-EM-REM/README.md | 21 ++-- .../12-Relative-Length-EM-REM/index.html | 15 ++- .../12-Relative-Length-EM-REM/styles.css | 8 ++ exercises/12-Relative-Length-EM-REM/tests.js | 98 +++++++++---------- 4 files changed, 80 insertions(+), 62 deletions(-) diff --git a/exercises/12-Relative-Length-EM-REM/README.md b/exercises/12-Relative-Length-EM-REM/README.md index 5ad02b77..360d037a 100644 --- a/exercises/12-Relative-Length-EM-REM/README.md +++ b/exercises/12-Relative-Length-EM-REM/README.md @@ -1,14 +1,23 @@ # `12` Relative Length EM, REM -The "background" CSS rule allows us to assign and work with the background of any container- the background can be a color or an image. If it is an image you can specify if you want the image to repeat horizontally, vertically, both, or not at all, and you can also specify if you want it to resize and fit the whole container where its being applied, among other properties that can be modified. +By now, we are used to working with pixels as measurement unit, for example, saying that a box has 100px of width. +There are other types of units that are not fixed, but relative. We use them when we want the element size to be related to another element or measurement unit. + +### Example using em: +In this exercise we have two

              headings. They are both

              , but one is bigger than the other because headings have relative font-sizes by default. Since the first div has a bigger based font-size, then the heading resizes accordingly. +```Plain/Text +em: Relative to the current font-size of the parent. +rem: Relative to the original font-size of the page. +``` ## 📝 Instructions: +```Plain/Text +1. Give a font-size of 0.8em to both h2's +2. Now give a font-size of 0.8rem to both h3's -Run the exercise. -Change the background-size to "contain" (check the index.css tab). -Run the exercise again. -Change the background-repeat to inherit to make it repeat over the x axis and y axis. -Run the exercise again. +``` +The result should look like this: +![Example Image](http://i.imgur.com/UZFY6HG.png) Hint: diff --git a/exercises/12-Relative-Length-EM-REM/index.html b/exercises/12-Relative-Length-EM-REM/index.html index e5ddcd6d..cf464ed8 100644 --- a/exercises/12-Relative-Length-EM-REM/index.html +++ b/exercises/12-Relative-Length-EM-REM/index.html @@ -4,11 +4,18 @@ + 12 Relative Length EM REM -

              - This is my description, it needs to be long because is supposed to be a - paragraph and not a title. -

              +
              +

              First h2 heading

              +

              First h3 heading

              +

              Here is some nice fake content

              +
              +
              +

              Second h2 heading

              +

              Second h3 heading

              +

              More fake content but now in the second container

              +
              diff --git a/exercises/12-Relative-Length-EM-REM/styles.css b/exercises/12-Relative-Length-EM-REM/styles.css index e69de29b..bfba63b9 100644 --- a/exercises/12-Relative-Length-EM-REM/styles.css +++ b/exercises/12-Relative-Length-EM-REM/styles.css @@ -0,0 +1,8 @@ +#my-first-div { + font-size: 15px; +} +#the-second-one { + font-size: 25px; +} + +/* YOUR CODE BELOW THIS LINE */ diff --git a/exercises/12-Relative-Length-EM-REM/tests.js b/exercises/12-Relative-Length-EM-REM/tests.js index 48541114..66036afe 100644 --- a/exercises/12-Relative-Length-EM-REM/tests.js +++ b/exercises/12-Relative-Length-EM-REM/tests.js @@ -1,54 +1,48 @@ +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(); + }); + it("The Head tag should not includes a Style tag", function () { + expect(html.toString().indexOf(`-1).toBeFalsy(); + }); + it("The H2 Tag has to have font-size: 0.8em", function () { + // get computed styles of any element you like + const h2Tag=document.querySelector("h2"); + var styles=window.getComputedStyle(h2Tag); + expect(styles["font-size"]).toBe("0.8em"); + }); + it("The H3 Tag has to have font-size: 0.8rem", function () { + // get computed styles of any element you like + 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 () { + 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 () { + let cssArray=document.styleSheets[0].cssRules[1].selectorText; + expect(cssArray).toBe("#the-second-one"); + } + ) -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(); }); - - it('the background should be blue', function () { - - // get computed styles of any element you like - const body = document.querySelector('body'); - var styles = window.getComputedStyle(body); - expect(styles["background-color"]).toBe("blue"); - }); }); - - -describe('All the html should match', function () { - beforeEach(() => { - //here I import the HTML into the document - document.documentElement.innerHTML = html.toString(); - }); - afterEach(() => { jest.resetModules(); }); - - it('the html code should contain a p tag', function () { - - // we can read from the source code - console.log(html.toString()); - expect(html.toString().indexOf(` -1).toBeTruthy(); - - //or use query selector to compare hoy mane scriptags do we have - const pTags = document.querySelectorAll("p"); - expect(pTags.length).toBe(1); - }); - - - it('the p tag should have a class "big"', function () { - - //or use query selector to compare hoy mane scriptags do we have - const p = document.querySelector("p"); - expect(p.classList.contains("big")).toBeTruthy(); - }); -}); \ No newline at end of file From ed1cd317505cb45e47644e8c5f295653b7757150 Mon Sep 17 00:00:00 2001 From: plucodev Date: Sun, 11 Aug 2019 22:26:13 -0400 Subject: [PATCH 23/25] fixed issues 13 --- exercises/13-Anchor-Like-Button/README.md | 22 +++-- exercises/13-Anchor-Like-Button/index.html | 6 +- exercises/13-Anchor-Like-Button/styles.css | 7 ++ exercises/13-Anchor-Like-Button/tests.js | 98 +++++++++++++--------- 4 files changed, 80 insertions(+), 53 deletions(-) diff --git a/exercises/13-Anchor-Like-Button/README.md b/exercises/13-Anchor-Like-Button/README.md index fe2e5f49..be27d0aa 100644 --- a/exercises/13-Anchor-Like-Button/README.md +++ b/exercises/13-Anchor-Like-Button/README.md @@ -1,15 +1,21 @@ # `13` Anchor Like Button -The "background" CSS rule allows us to assign and work with the background of any container- the background can be a color or an image. If it is an image you can specify if you want the image to repeat horizontally, vertically, both, or not at all, and you can also specify if you want it to resize and fit the whole container where its being applied, among other properties that can be modified. +Anchors are not only used within text- when you are going to use anchors outside text, it is better to make them look like buttons for a more user-friendly experience. ## 📝 Instructions: -Run the exercise. -Change the background-size to "contain" (check the index.css tab). -Run the exercise again. -Change the background-repeat to inherit to make it repeat over the x axis and y axis. -Run the exercise again. +```Plain/Text +1. Make it look like a box: Set padding to 10px +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. +4. Remove underline: Set text-decoration to none +5. Set the color of the text to white +``` -Hint: +![Example Image](http://i.imgur.com/AqYDX7n.gif) -- How to use the background-size: http://lmgtfy.com/?q=css+background-size +To make the button look different when the user hovers over with the mouse, we use the "hover" selector: http://lmgtfy.com/?q=how+to+use+the+hover + +```Plain/Text +1.Inside of the :hover selector change the background of the button to a darker orange. +``` diff --git a/exercises/13-Anchor-Like-Button/index.html b/exercises/13-Anchor-Like-Button/index.html index e5ddcd6d..38f3abf1 100644 --- a/exercises/13-Anchor-Like-Button/index.html +++ b/exercises/13-Anchor-Like-Button/index.html @@ -4,11 +4,9 @@ + 13 Anchor Like Button -

              - This is my description, it needs to be long because is supposed to be a - paragraph and not a title. -

              + Beautiful Button diff --git a/exercises/13-Anchor-Like-Button/styles.css b/exercises/13-Anchor-Like-Button/styles.css index e69de29b..93996cbd 100644 --- a/exercises/13-Anchor-Like-Button/styles.css +++ b/exercises/13-Anchor-Like-Button/styles.css @@ -0,0 +1,7 @@ +.orange-btn { + /*your code here*/ +} + +.orange-btn:hover { + /*YOUR CODE HERE FOR THE HOVER STATE*/ +} diff --git a/exercises/13-Anchor-Like-Button/tests.js b/exercises/13-Anchor-Like-Button/tests.js index 48541114..2d9ada29 100644 --- a/exercises/13-Anchor-Like-Button/tests.js +++ b/exercises/13-Anchor-Like-Button/tests.js @@ -1,54 +1,70 @@ +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 divTag=null +let classTagStyles=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'); -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", function () { + beforeEach(() => { + //here I import the HTML into the document + document.documentElement.innerHTML=html.toString(); + // let classTagStyles = window.getComputedStyle( + // document.querySelector(".orange-btn") + // ); + //apply the styles from the stylesheet if needed + document.querySelector( + "head" + ).innerHTML=``; + divTag=document.querySelector(".orange-btn"); + classTagStyles=window.getComputedStyle(divTag); + }); + afterEach(() => { + jest.resetModules(); + }); - //apply the styles from the stylesheet if needed - document.querySelector('head').innerHTML = ``; - }); - afterEach(() => { jest.resetModules(); }); + it("the padding should be '10px'", function () { - it('the background should be blue', function () { - - // get computed styles of any element you like - const body = document.querySelector('body'); - var styles = window.getComputedStyle(body); - expect(styles["background-color"]).toBe("blue"); - }); -}); + expect(classTagStyles["padding"]).toBe("10px"); + }); + it("the border radius should be '4px'", function () { + expect(classTagStyles["border-radius"]).toBe("4px"); + }); + it("the border should be '1px solid #ffffff;'", function () { -describe('All the html should match', function () { - beforeEach(() => { - //here I import the HTML into the document - document.documentElement.innerHTML = html.toString(); - }); - afterEach(() => { jest.resetModules(); }); + expect(classTagStyles["border"]).toBe("1px solid #ffffff"); + }); + it("the background should be 'rgb(255, 153, 51)'", function () { - it('the html code should contain a p tag', function () { + expect(classTagStyles["background"]).toBe("rgb(255, 153, 51)"); + }); + it("the underline should to be removed", function () { - // we can read from the source code - console.log(html.toString()); - expect(html.toString().indexOf(` -1).toBeTruthy(); + expect(classTagStyles["text-decoration"]).toBe("none"); + }); + it("The Mouse hover property should be blue", function () { + // get computed styles of any element you like + let cssArray=document.styleSheets[0].cssRules; + console.log("***", cssArray) + let orangeHoverSelector=""; + for (let i=0; i Date: Mon, 12 Aug 2019 09:52:20 -0400 Subject: [PATCH 24/25] fixed issues 06 --- exercises/06-Practicing-Rules/README.md | 14 +++- exercises/06-Practicing-Rules/tests.js | 97 +++++++++++++++---------- 2 files changed, 67 insertions(+), 44 deletions(-) diff --git a/exercises/06-Practicing-Rules/README.md b/exercises/06-Practicing-Rules/README.md index 73fbcc78..2d7856fd 100644 --- a/exercises/06-Practicing-Rules/README.md +++ b/exercises/06-Practicing-Rules/README.md @@ -6,7 +6,8 @@ 1. Set this URL as the background image of the page, and repeat it vertically only: http://assets.breatheco.de/apis/img/bg/background-vertical.jpg -2. Change the font-type of the h1 to Courier and the rest of the website to Times new Roman. +2. Change the font-type of the h1 to Courier + and the rest of the website to Times new Roman. 3. Change the color of h1 to red. @@ -14,11 +15,16 @@ 5. Center the h1 to the middle. -6. 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. -7. Add a white semi-transparent background to the first paragraph of "3 reasons you know you are learning" to make it easier to read (you have tu use rgba for that), and then apply a padding of 5px to all sides of that paragraph. +7. Add a white semi-transparent background to the first paragraph + of "3 reasons you know you are learning" to make it easier to + read (you have tu use rgba for that), and 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). +8. Change the anchor "hover" color to green and remove the underline. + (you have to actually hover the anchor to test it). ``` The result should be something like this: diff --git a/exercises/06-Practicing-Rules/tests.js b/exercises/06-Practicing-Rules/tests.js index 75eb0bfd..92f05293 100644 --- a/exercises/06-Practicing-Rules/tests.js +++ b/exercises/06-Practicing-Rules/tests.js @@ -1,82 +1,99 @@ -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"); +let body=null; +let styles=null; +let h1Tag=null; +let h1TagStyles=null; jest.dontMock("fs"); -describe("All the styles should be applied", function() { +describe("All the styles should be applied", function () { beforeEach(() => { //here I import the HTML into the document - document.documentElement.innerHTML = html.toString(); + document.documentElement.innerHTML=html.toString(); // apply the styles from the stylesheet if needed document.querySelector( "head" - ).innerHTML = ``; + ).innerHTML=``; + body=document.querySelector("body"); + styles=window.getComputedStyle(body); + h1Tag=document.querySelector("h1"); + h1TagStyles=window.getComputedStyle(h1Tag); }); afterEach(() => { jest.resetModules(); }); - it("The Head tag should not includes a Style tag", function() { - expect(html.toString().indexOf(` -1).toBeFalsy(); + it("The Head tag should not includes a Style tag", function () { + expect(html.toString().indexOf(`-1).toBeFalsy(); }); - it("the background should match", function() { - // get computed styles of any element you like - const body = document.querySelector("body"); - var styles = window.getComputedStyle(body); + it("the background should match", function () { expect(styles["background"]).toBe( `url(http://assets.breatheco.de/apis/img/bg/background-vertical.jpg) repeat-y` ); }); - it("the font-family should be 'Times New Roman'", function() { - // get computed styles of any element you like - const body = document.querySelector("body"); - var styles = window.getComputedStyle(body); + it("the font-family should be 'Times New Roman'", function () { expect(styles["font-family"]).toBe("Times New Roman"); }); - it("the padding-left should be '20px'", function() { - // get computed styles of any element you like - const body = document.querySelector("body"); - var styles = window.getComputedStyle(body); + it("the padding-left should be '20px'", function () { expect(styles["padding-left"]).toBe("20px"); }); - it("the font-family in the H1 Tag should be 'Courier'", function() { + it("the font-family in the H1 Tag should be 'Courier'", function () { // get computed styles of any element you like - const h1Tag = document.querySelector("h1"); - let h1TagStyles = window.getComputedStyle(h1Tag); expect(h1TagStyles["font-family"]).toBe("Courier"); }); - it("the color in the H1 Tag should be 'red'", function() { + it("the color in the H1 Tag should be 'red'", function () { // get computed styles of any element you like - const h1Tag = document.querySelector("h1"); - let h1TagStyles = window.getComputedStyle(h1Tag); expect(h1TagStyles["color"]).toBe("red"); }); - it("the text-align in the H1 Tag should be 'center'", function() { + it("the text-align in the H1 Tag should be 'center'", function () { // get computed styles of any element you like - const h1Tag = document.querySelector("h1"); - let h1TagStyles = window.getComputedStyle(h1Tag); expect(h1TagStyles["text-align"]).toBe("center"); }); - it("the text-decoration in the H2 Tag should be 'underline'", function() { + it("the text-decoration in the H2 Tag should be 'underline'", function () { // 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() { + it("the padding in the #id1 Tag should be '5px'", function () { // 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() { + it("the background-color in the #id1 Tag should be 'semi transparent white'", function () { // 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["background-color"]).toBe("rgba(255, 255, 255, 0.2)"); }); + it("The a hover underline should be removed", function () { + let cssArray=document.styleSheets[0].cssRules; + // console.log("$$$:", cssArray) + let orangeHoverSelector=""; + for (let i=0; i Date: Mon, 12 Aug 2019 10:26:07 -0400 Subject: [PATCH 25/25] fixed issues 10 --- exercises/10-Your-Own-Font/README.md | 21 +++--- exercises/10-Your-Own-Font/index.html | 9 ++- exercises/10-Your-Own-Font/styles.css | 3 + exercises/10-Your-Own-Font/tests.js | 102 +++++++++++++------------- 4 files changed, 71 insertions(+), 64 deletions(-) diff --git a/exercises/10-Your-Own-Font/README.md b/exercises/10-Your-Own-Font/README.md index f15365cd..254b20fc 100644 --- a/exercises/10-Your-Own-Font/README.md +++ b/exercises/10-Your-Own-Font/README.md @@ -1,15 +1,18 @@ # `10` Your Own Font -The "background" CSS rule allows us to assign and work with the background of any container- the background can be a color or an image. If it is an image you can specify if you want the image to repeat horizontally, vertically, both, or not at all, and you can also specify if you want it to resize and fit the whole container where its being applied, among other properties that can be modified. +Google Fonts can be found here: https://fonts.google.com -## 📝 Instructions: +After you pick your favorite one, you can use it by linking your website with the URL in which the font is stored. You have to do that in the tag of the HTML document like this: + +```Plain/Text + +``` -Run the exercise. -Change the background-size to "contain" (check the index.css tab). -Run the exercise again. -Change the background-repeat to inherit to make it repeat over the x axis and y axis. -Run the exercise again. +After your font is linked you need to assign the "font-family" CSS rule to whatever you want to apply the font, for example an

              . -Hint: +## 📝 Instructions: -- How to use the background-size: http://lmgtfy.com/?q=css+background-size +```Plain/Text +1. Link any google-font that you like into the website. +2. Apply that specific font-family to #myTitle. +``` diff --git a/exercises/10-Your-Own-Font/index.html b/exercises/10-Your-Own-Font/index.html index e5ddcd6d..a0e7f25a 100644 --- a/exercises/10-Your-Own-Font/index.html +++ b/exercises/10-Your-Own-Font/index.html @@ -3,12 +3,13 @@ + + + + 10 Your Own Font -

              - This is my description, it needs to be long because is supposed to be a - paragraph and not a title. -

              +

              My unique font

              diff --git a/exercises/10-Your-Own-Font/styles.css b/exercises/10-Your-Own-Font/styles.css index e69de29b..de7160fd 100644 --- a/exercises/10-Your-Own-Font/styles.css +++ b/exercises/10-Your-Own-Font/styles.css @@ -0,0 +1,3 @@ +.myTitle { + /*your code here*/ +} diff --git a/exercises/10-Your-Own-Font/tests.js b/exercises/10-Your-Own-Font/tests.js index 48541114..6109a451 100644 --- a/exercises/10-Your-Own-Font/tests.js +++ b/exercises/10-Your-Own-Font/tests.js @@ -1,54 +1,54 @@ - -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(); }); - - it('the background should be blue', function () { - - // get computed styles of any element you like - const body = document.querySelector('body'); - var styles = window.getComputedStyle(body); - expect(styles["background-color"]).toBe("blue"); - }); +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(); + }); + + it("the font-family in the #myTitle should exists", function () { + // get computed styles of any element you like + let cssArray=document.styleSheets[0].cssRules; + // console.log("%%% ", cssArray) + let orangeHoverSelector=""; + for (let i=0; i-1).toBeFalsy(); + }); }); -describe('All the html should match', function () { - beforeEach(() => { - //here I import the HTML into the document - document.documentElement.innerHTML = html.toString(); - }); - afterEach(() => { jest.resetModules(); }); - - it('the html code should contain a p tag', function () { - - // we can read from the source code - console.log(html.toString()); - expect(html.toString().indexOf(` -1).toBeTruthy(); - - //or use query selector to compare hoy mane scriptags do we have - const pTags = document.querySelectorAll("p"); - expect(pTags.length).toBe(1); - }); - - - it('the p tag should have a class "big"', function () { - - //or use query selector to compare hoy mane scriptags do we have - const p = document.querySelector("p"); - expect(p.classList.contains("big")).toBeTruthy(); - }); -}); \ No newline at end of file

      Hello