Skip to content

Commit 91383e5

Browse files
Some improvements added to the tests
1 parent 201f863 commit 91383e5

File tree

13 files changed

+49
-33
lines changed

13 files changed

+49
-33
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<!-- your code here -->
1+
<!-- your code here -->
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!-- your code here -->
22
<style>
3-
a {
4-
color: pink;
5-
}
3+
a {
4+
color: pink;
5+
}
66
</style>
7-
<a href="https://google.com" target="_blank">Click me to open google.com</a>
7+
<a href="https://google.com" target="_blank">Click me to open google.com</a>

exercises/01-Hello-World/test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,24 @@ const a = document.querySelector("a");
1010
test("There should be an anchor tag", ()=>{
1111
expect(a).toBeTruthy()
1212
})
13+
1314
test("The anchor tag should be pink", ()=>{
1415
let styles = window.getComputedStyle(a);
1516
expect(styles["color"]).toBe("pink");
1617
});
18+
1719
test("There should be a href attribute pointing to 'https://google.com'", ()=>{
1820
let href = a.getAttribute('href');
1921
expect(href).toBeTruthy();
2022
expect(href).toBe("https://google.com");
2123
})
24+
2225
test("There should be a target attribute pointing to '_blank'", ()=>{
2326
let target = a.getAttribute('target');
2427
expect(target).toBeTruthy();
2528
expect(target).toBe("_blank");
2629
})
30+
2731
test("The anchor tag should not contains any inline style", ()=>{
2832
let emptyBodyInlineStyle = {};
2933
expect(a.style._values).toEqual(emptyBodyInlineStyle);

exercises/01.1-The-Style-Tag/test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ jest.dontMock('fs');
88
const p = document.querySelector("p");
99

1010
test("There should be a p tag", ()=>{
11-
expect(p).toBeTruthy()
11+
expect(p).toBeTruthy();
1212
})
13+
1314
test("The p tag color should be blue", ()=>{
1415
let styles = window.getComputedStyle(p);
1516
expect(styles["color"]).toBe("blue");
1617
});
18+
1719
test("The p tag should not contain any inline style", ()=>{
1820
let emptyBodyInlineStyle = {};
1921
expect(p.style._values).toEqual(emptyBodyInlineStyle);

exercises/01.2-Your-First-Style/tests.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,23 @@ jest.dontMock('fs');
77

88
describe("All the styles should be applied", ()=>{
99
const a = document.querySelector("a");
10+
1011
test("The anchor tag should be yellow", ()=>{
1112
let styles = window.getComputedStyle(a);
1213
expect(styles["color"]).toBe("yellow");
1314
});
15+
1416
test("The body tag should not contain any inline style", ()=>{
1517
let bodyInlineStyle = document.getElementsByTagName("body");
1618
let emptyBodyInlineStyle = {};
1719
expect(bodyInlineStyle[0].style._values).toEqual(emptyBodyInlineStyle);
1820
});
21+
1922
test("The anchor tag should not contain any inline style", ()=>{
2023
let emptyBodyInlineStyle = {};
2124
expect(a.style._values).toEqual(emptyBodyInlineStyle);
2225
});
26+
2327
test("You should not change the existing head tag elements", ()=>{
2428
let head = document.querySelector('head')
2529
expect(head).toBeTruthy()

exercises/01.3-Your-Second-Style/index.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
<head>
44
<style>
55
/* Your code here */
6+
body {
7+
background-color: blue;
8+
}
69
</style>
710
</head>
811
<body>

exercises/01.3-Your-Second-Style/tests.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,21 @@ jest.dontMock('fs');
77

88
describe("All the styles should be applied", ()=>{
99
const body = document.querySelector("body");
10+
1011
test("The background should be blue", ()=>{
1112
let styles = window.getComputedStyle(body);
1213
expect(styles["background"]).toBe("blue");
1314
});
15+
1416
test("The body tag should not contains any inline style", ()=>{
1517
let emptyBodyInlineStyle = {};
1618
expect(body.style._values).toEqual(emptyBodyInlineStyle);
1719
});
20+
1821
test("You should not change the existing head tag elements", ()=>{
1922
let head = document.querySelector('head')
2023
expect(head).toBeTruthy()
24+
2125
let meta = head.querySelector("meta")
2226
expect(meta).toBe(null)
2327
})

exercises/02-Separate-Stylesheet/solution.hide.css

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
1. Select the body tag.
33
2. Add the background rule equal to blue.
44
*/
5-
body {
5+
body {
66
background: blue;
7-
background-size: contain;
8-
background-repeat: inherit;
9-
}
7+
}

exercises/02-Separate-Stylesheet/tests.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ jest.dontMock("fs");
88

99
describe("All the styles should be applied", ()=>{
1010
const link = document.querySelector("link");
11-
const body = document.querySelector("body")
11+
const body = document.querySelector("body");
12+
1213
test("The body tag should not contains any inline style", ()=>{
13-
document.querySelector(
14-
"head"
15-
).innerHTML=`<style>${css.toString()}</style>`;
14+
document.querySelector("head").innerHTML = `<style>${css.toString()}</style>`;
1615
let emptyBodyInlineStyle={};
1716
expect(body.style._values).toEqual(emptyBodyInlineStyle)
1817
});
18+
1919
test("You should not change the existing head tag elements", ()=>{
2020
let head = document.querySelector('head')
2121
expect(head).toBeTruthy()
@@ -26,6 +26,7 @@ describe("All the styles should be applied", ()=>{
2626
let href = link.getAttribute("href")
2727
expect(href).toEqual('./styles.css')
2828
});
29+
2930
test("Your body tag background color should be blue", ()=>{
3031
let styles = window.getComputedStyle(body)
3132
expect(styles["background-color"]).toBe("blue")

exercises/02.1-Background/tests.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ describe("All the styles should be applied", ()=>{
3636
let styles = window.getComputedStyle(body);
3737
expect(styles["background-repeat"]).toBe("inherit");
3838
});
39+
3940
test("You should not change the existing head tag elements", ()=>{
4041
let head = document.querySelector('head')
4142
expect(head).toBeTruthy()

0 commit comments

Comments
 (0)