Skip to content

Commit 7ff4e76

Browse files
committed
flexible tests
1 parent 026191a commit 7ff4e76

File tree

4 files changed

+14
-12
lines changed

4 files changed

+14
-12
lines changed

exercises/07-Very-Specific-Rules/README.es.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ En este ejercicio, puedes agregar tu código solo arriba del **READ ONLY BLOCK**
88

99
1. Establece el color de texto `ul` a rojo (`red`) (anula los conflictos siendo más específico).
1010

11-
2. Establece el color de fondo (`background-color`) del segundo `li` del `ol` a verde (`green`) (no uses el selector #id).
11+
2. Establece el color de fondo (`background-color`) del segundo `li` del `ol` a verde (`green`) (no uses el selector #id ni el .class).
1212

1313
3. Haz que las filas impares de las tablas tengan fondo amarillo usando `tr:nth-child`.
1414

exercises/07-Very-Specific-Rules/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ In this exercise, you can add your code only above the **READ ONLY BLOCK** of th
1313

1414
1. Set the `ul` text color to `red` (override conflicts with specificity).
1515

16-
2. Set the `background-color` of the second `li` of the `ol` to `green` (don't use the #id selector).
16+
2. Set the `background-color` of the second `li` of the `ol` to `green` (don't use the #id selector or .class selector).
1717

1818
3. Change the odd rows of the tables to a yellow background using `tr:nth-child`.
1919

exercises/07-Very-Specific-Rules/styles.css

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
/** Insert your code here **/
22

3-
4-
53
/*********** READ ONLY BLOCK ******
64
You CANNOT UPDATE anything from here on,
75
only add lines of code on top of this lines
@@ -14,4 +12,4 @@ body {
1412
ul li,
1513
ol li {
1614
color: green;
17-
}
15+
}

exercises/07-Very-Specific-Rules/tests.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,16 @@ describe("All the styles should be applied", ()=>{
3535
).innerHTML = `<style>${css.toString()}</style>`;
3636
let cssArray = document.styleSheets[0].cssRules;
3737

38-
let orangeHoverSelector = "";
38+
let background = "";
39+
let backgroundColor="";
3940
for (let i = 0; i < cssArray.length; i++) {
4041
if (cssArray[i].selectorText === "ol li:nth-child(2)" || cssArray[i].selectorText === "ol > li:nth-child(2)") {
41-
orangeHoverSelector = cssArray[i].style['background-color'];
42+
background = cssArray[i].style['background'];
43+
backgroundColor = cssArray[i].style['background-color'];
4244

4345
}
4446

45-
} expect(orangeHoverSelector).toBe("green");
47+
} expect(background === 'green' || backgroundColor === 'green').toBeTruthy();
4648
})
4749

4850
test("The odd rows of the table should have yellow background", ()=>{
@@ -51,14 +53,16 @@ describe("All the styles should be applied", ()=>{
5153
).innerHTML = `<style>${css.toString()}</style>`;
5254
let cssArray = document.styleSheets[0].cssRules;
5355

54-
let orangeHoverSelector = "";
56+
let background = "";
57+
let backgroundColor = "";
5558
for (let i = 0; i < cssArray.length; i++) {
5659
if (cssArray[i].selectorText === "tr:nth-child(odd)") {
57-
orangeHoverSelector = cssArray[i].style['background'];
58-
60+
background = cssArray[i].style['background'];
61+
backgroundColor = cssArray[i].style['background-color'];
62+
5963
}
6064

61-
} expect(orangeHoverSelector).toBe("yellow");
65+
} expect(background === "yellow" || backgroundColor === "yellow").toBeTruthy();
6266
})
6367

6468
test("Write all your rules above the existing code", ()=>{

0 commit comments

Comments
 (0)