From 5647ddb30200422e7c8fa711b0960472fd4d5d2d Mon Sep 17 00:00:00 2001 From: Tomas Gonzalez Date: Thu, 21 Oct 2021 02:31:34 +0000 Subject: [PATCH 1/3] PR 27 fixed --- exercises/01.2-Your-First-Style/tests.js | 4 +++- exercises/01.3-Your-Second-Style/tests.js | 5 +++-- exercises/02-Separate-Stylesheet/tests.js | 7 +++++-- exercises/02.1-Background/tests.js | 13 ++++++++----- exercises/03-Inline-Styles/tests.js | 9 +++++---- exercises/04.1-Combined-Rules/tests.js | 13 ++++++++----- exercises/05-Specificity/tests.js | 13 ++++++++----- exercises/06-Practicing-Rules/tests.js | 13 ++++++++----- exercises/07-Very-Specific-Rules/tests.js | 13 ++++++++----- exercises/08-Rounded-Image/tests.js | 13 ++++++++----- exercises/09-Anchor-Styles/tests.js | 13 ++++++++----- exercises/12-Relative-Length-EM-REM/tests.js | 13 ++++++++----- exercises/13-Anchor-Like-Button/tests.js | 13 ++++++++----- learn.json | 4 ++-- 14 files changed, 90 insertions(+), 56 deletions(-) diff --git a/exercises/01.2-Your-First-Style/tests.js b/exercises/01.2-Your-First-Style/tests.js index cdccc97a..8e94018b 100644 --- a/exercises/01.2-Your-First-Style/tests.js +++ b/exercises/01.2-Your-First-Style/tests.js @@ -26,8 +26,10 @@ describe("All the styles should be applied", function() { // console.log(bodyInlineStyle[0].style._values.background); }); it("You should not change the existing head tag elements", function () { - let meta = document.querySelector('head').querySelector("meta") + let head = document.querySelector('head') + expect(head).toBeTruthy() + let meta = head.querySelector("meta") expect(meta).toBe(null) }) }); diff --git a/exercises/01.3-Your-Second-Style/tests.js b/exercises/01.3-Your-Second-Style/tests.js index cdccc97a..2e0fa1a3 100644 --- a/exercises/01.3-Your-Second-Style/tests.js +++ b/exercises/01.3-Your-Second-Style/tests.js @@ -26,8 +26,9 @@ describe("All the styles should be applied", function() { // console.log(bodyInlineStyle[0].style._values.background); }); it("You should not change the existing head tag elements", function () { - let meta = document.querySelector('head').querySelector("meta") - + let head = document.querySelector('head') + expect(head).toBeTruthy() + let meta = head.querySelector("meta") expect(meta).toBe(null) }) }); diff --git a/exercises/02-Separate-Stylesheet/tests.js b/exercises/02-Separate-Stylesheet/tests.js index baeb9f93..7dfe0863 100644 --- a/exercises/02-Separate-Stylesheet/tests.js +++ b/exercises/02-Separate-Stylesheet/tests.js @@ -52,10 +52,13 @@ describe("All the styles should be applied", function () { expect(styles["background-repeat"]).toBe("inherit"); }); it("You should not change the existing head tag elements", function () { - let meta = document.querySelector('head').querySelector("meta") - let link = document.querySelector('link').href + let head = document.querySelector('head') + expect(head).toBeTruthy() + let meta = head.querySelector("meta") expect(meta).toBe(null) + + let link = document.querySelector('link').href expect(link).toBe('http://localhost/styles.css') }) }); diff --git a/exercises/02.1-Background/tests.js b/exercises/02.1-Background/tests.js index 0c19450a..cfde6b1f 100644 --- a/exercises/02.1-Background/tests.js +++ b/exercises/02.1-Background/tests.js @@ -52,13 +52,16 @@ describe("All the styles should be applied", function () { expect(styles["background-repeat"]).toBe("inherit"); }); it("You should not change the existing head tag elements", function () { - let head = document.querySelector('head'); - let meta = head.querySelector("meta") - let link = head.querySelector('link').href - let title = head.querySelector('title').innerHTML + let head = document.querySelector('head') + expect(head).toBeTruthy() + let meta = head.querySelector("meta") expect(meta).toBe(null) - expect(link).toBe('http://localhost/styles.css') + + const pathname = new URL(document.querySelector('link').href).pathname + expect(pathname).toBe('/styles.css') + + let title = head.querySelector('title').innerHTML expect(title).toBe('02 Background') }) }); diff --git a/exercises/03-Inline-Styles/tests.js b/exercises/03-Inline-Styles/tests.js index 0e37fc09..3de572dd 100644 --- a/exercises/03-Inline-Styles/tests.js +++ b/exercises/03-Inline-Styles/tests.js @@ -16,13 +16,14 @@ describe("The Table tag should contain inline style background: green", function }); it("You should not change the existing head tag elements", function () { - let head = document.querySelector('head'); - let meta = head.querySelector("meta") - let title = head.querySelector('title').innerHTML + let head = document.querySelector('head') + expect(head).toBeTruthy() + let meta = head.querySelector("meta") expect(meta).toBe(null) - expect(title).toBe('03 Inline Styles') + let title = head.querySelector('title').innerHTML + expect(title).toBe('03 Inline Styles') }) it("The background should be green", function() { diff --git a/exercises/04.1-Combined-Rules/tests.js b/exercises/04.1-Combined-Rules/tests.js index d8e05434..16c3296a 100644 --- a/exercises/04.1-Combined-Rules/tests.js +++ b/exercises/04.1-Combined-Rules/tests.js @@ -161,13 +161,16 @@ describe("All the styles should be applied", function () { expect(padLeft).toBeFalsy(); }); it("You should not change the existing head tag elements", function () { - let head = document.querySelector('head'); - let meta = head.querySelector("meta") - let link = head.querySelector('link').href - let title = head.querySelector('title') + let head = document.querySelector('head') + expect(head).toBeTruthy() + let meta = head.querySelector("meta") expect(meta).toBe(null) - expect(link).toBe('http://localhost/styles.css') + + const pathname = new URL(document.querySelector('link').href).pathname + expect(pathname).toBe('/styles.css') + + let title = head.querySelector('title') expect(title).not.toBe(null) }) }); diff --git a/exercises/05-Specificity/tests.js b/exercises/05-Specificity/tests.js index e53f47cd..e58651a4 100644 --- a/exercises/05-Specificity/tests.js +++ b/exercises/05-Specificity/tests.js @@ -17,13 +17,16 @@ describe("All the styles should be applied", function () { it("You should not change the existing head tag elements", function () { - let head = document.querySelector('head'); - let meta = head.querySelector("meta") - let link = head.querySelector('link').href - let title = head.querySelector('title') + let head = document.querySelector('head') + expect(head).toBeTruthy() + let meta = head.querySelector("meta") expect(meta).not.toBe(null) - expect(link).toBe('http://localhost/styles.css') + + const pathname = new URL(document.querySelector('link').href).pathname + expect(pathname).toBe('/styles.css') + + let title = head.querySelector('title') expect(title).not.toBe(null) }) it("You should not delete or edit the existing code", function () { diff --git a/exercises/06-Practicing-Rules/tests.js b/exercises/06-Practicing-Rules/tests.js index 62263d92..ae40b996 100644 --- a/exercises/06-Practicing-Rules/tests.js +++ b/exercises/06-Practicing-Rules/tests.js @@ -132,13 +132,16 @@ describe("All the styles should be applied", function () { expect(orangeHoverSelector).toBe('green'); }); it("You should not change the existing head tag elements", function () { - let head = document.querySelector('head'); - let meta = head.querySelector("meta") - let link = head.querySelector('link').href - let title = head.querySelector('title') + let head = document.querySelector('head') + expect(head).toBeTruthy() + let meta = head.querySelector("meta") expect(meta).not.toBe(null) - expect(link).toBe('http://localhost/styles.css') + + const pathname = new URL(document.querySelector('link').href).pathname + expect(pathname).toBe('/styles.css') + + let title = head.querySelector('title') expect(title).not.toBe(null) }) diff --git a/exercises/07-Very-Specific-Rules/tests.js b/exercises/07-Very-Specific-Rules/tests.js index ef3fa28e..f3b4d5a9 100644 --- a/exercises/07-Very-Specific-Rules/tests.js +++ b/exercises/07-Very-Specific-Rules/tests.js @@ -78,13 +78,16 @@ describe("All the styles should be applied", function () { } ) it("You should not change the existing head tag elements", function () { - let head = document.querySelector('head'); - let meta = head.querySelector("meta") - let link = head.querySelector('link').href - let title = head.querySelector('title') + let head = document.querySelector('head') + expect(head).toBeTruthy() + let meta = head.querySelector("meta") expect(meta).not.toBe(null) - expect(link).toBe('http://localhost/styles.css') + + const pathname = new URL(document.querySelector('link').href).pathname + expect(pathname).toBe('/styles.css') + + let title = head.querySelector('title') expect(title).not.toBe(null) }) diff --git a/exercises/08-Rounded-Image/tests.js b/exercises/08-Rounded-Image/tests.js index 3b84c476..fc2abaa5 100644 --- a/exercises/08-Rounded-Image/tests.js +++ b/exercises/08-Rounded-Image/tests.js @@ -84,13 +84,16 @@ describe("All the styles should be applied", function() { expect(idTagStyles["background-image"]).toBeTruthy(); }); it("You should not change the existing head tag elements", function () { - let head = document.querySelector('head'); - let meta = head.querySelector("meta") - let link = head.querySelector('link').href - let title = head.querySelector('title') + let head = document.querySelector('head') + expect(head).toBeTruthy() + let meta = head.querySelector("meta") expect(meta).not.toBe(null) - expect(link).toBe('http://localhost/styles.css') + + const pathname = new URL(document.querySelector('link').href).pathname + expect(pathname).toBe('/styles.css') + + let title = head.querySelector('title') expect(title).not.toBe(null) }) }); diff --git a/exercises/09-Anchor-Styles/tests.js b/exercises/09-Anchor-Styles/tests.js index 82d9c456..cab43954 100644 --- a/exercises/09-Anchor-Styles/tests.js +++ b/exercises/09-Anchor-Styles/tests.js @@ -52,13 +52,16 @@ describe("All the styles should be applied", function () { }); it("You should not change the existing head tag elements", function () { - let head = document.querySelector('head'); - let meta = head.querySelector("meta") - let link = head.querySelector('link').href - let title = head.querySelector('title') + let head = document.querySelector('head') + expect(head).toBeTruthy() + let meta = head.querySelector("meta") expect(meta).not.toBe(null) - expect(link).toBe('http://localhost/styles.css') + + const pathname = new URL(document.querySelector('link').href).pathname + expect(pathname).toBe('/styles.css') + + let title = head.querySelector('title') expect(title).not.toBe(null) }) }); diff --git a/exercises/12-Relative-Length-EM-REM/tests.js b/exercises/12-Relative-Length-EM-REM/tests.js index 1344fed0..2f884753 100644 --- a/exercises/12-Relative-Length-EM-REM/tests.js +++ b/exercises/12-Relative-Length-EM-REM/tests.js @@ -53,13 +53,16 @@ describe("All the styles should be applied", function () { } ) it("You should not change the existing head tag elements", function () { - let head = document.querySelector('head'); - let meta = head.querySelector("meta") - let link = head.querySelector('link').href - let title = head.querySelector('title') + let head = document.querySelector('head') + expect(head).toBeTruthy() + let meta = head.querySelector("meta") expect(meta).not.toBe(null) - expect(link).toBe('http://localhost/styles.css') + + const pathname = new URL(document.querySelector('link').href).pathname + expect(pathname).toBe('/styles.css') + + let title = head.querySelector('title') expect(title).not.toBe(null) }) diff --git a/exercises/13-Anchor-Like-Button/tests.js b/exercises/13-Anchor-Like-Button/tests.js index 0b53d9f6..32f0c21e 100644 --- a/exercises/13-Anchor-Like-Button/tests.js +++ b/exercises/13-Anchor-Like-Button/tests.js @@ -91,13 +91,16 @@ describe("All the styles should be applied", function () { } ) it("You should not change the existing head tag elements", function () { - let head = document.querySelector('head'); - let meta = head.querySelector("meta") - let link = head.querySelector('link').href - let title = head.querySelector('title') + let head = document.querySelector('head') + expect(head).toBeTruthy() + let meta = head.querySelector("meta") expect(meta).not.toBe(null) - expect(link).toBe('http://localhost/styles.css') + + const pathname = new URL(document.querySelector('link').href).pathname + expect(pathname).toBe('/styles.css') + + let title = head.querySelector('title') expect(title).not.toBe(null) }) diff --git a/learn.json b/learn.json index 044f86f1..92548a15 100644 --- a/learn.json +++ b/learn.json @@ -10,9 +10,9 @@ "duration": 8, "difficulty": "easy", "video-solutions": true, - "graded": false, + "graded": true, "config": { - "disableGrading": true, + "disableGrading": false, "editor": { "version": "1.0.69" } From 4e06006e70c433198d5b68b8726f0c41ce056459 Mon Sep 17 00:00:00 2001 From: Tomas Gonzalez Date: Thu, 21 Oct 2021 02:34:44 +0000 Subject: [PATCH 2/3] Test of the second exercise improved --- exercises/02-Separate-Stylesheet/tests.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exercises/02-Separate-Stylesheet/tests.js b/exercises/02-Separate-Stylesheet/tests.js index 7dfe0863..a583e81e 100644 --- a/exercises/02-Separate-Stylesheet/tests.js +++ b/exercises/02-Separate-Stylesheet/tests.js @@ -58,7 +58,7 @@ describe("All the styles should be applied", function () { let meta = head.querySelector("meta") expect(meta).toBe(null) - let link = document.querySelector('link').href - expect(link).toBe('http://localhost/styles.css') + const pathname = new URL(document.querySelector('link').href).pathname + expect(pathname).toBe('/styles.css') }) }); From efc0174f092fd3d238ae591aa26ac2c67cedef93 Mon Sep 17 00:00:00 2001 From: Tomas Gonzalez Date: Thu, 28 Oct 2021 22:33:03 +0000 Subject: [PATCH 3/3] Editor version updated --- learn.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/learn.json b/learn.json index 92548a15..aa168546 100644 --- a/learn.json +++ b/learn.json @@ -14,7 +14,7 @@ "config": { "disableGrading": false, "editor": { - "version": "1.0.69" + "version": "1.0.71" } } }