Skip to content

Commit e88ac6c

Browse files
committed
added test to check if the div exists and if it contains the proper classes
1 parent ada8f10 commit e88ac6c

File tree

1 file changed

+24
-0
lines changed
  • exercises/04.2-Apply-several-classes

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
const fs = require("fs");
2+
const path = require("path");
3+
const html = fs.readFileSync(path.resolve(__dirname, './index.html'), 'utf8');
4+
document.documentElement.innerHTML = html.toString();
5+
6+
jest.dontMock("fs");
7+
8+
describe("You should change the class on the div tag", () => {
9+
const div = document.querySelectorAll("div")
10+
test("There should only be 1 div tag", () => {
11+
expect(div.length).toBe(1)
12+
});
13+
14+
test("The div class should NOT have the spades class", () => {
15+
div.forEach(e=>{
16+
expect(e.classList.contains("spade")).toBe(false)
17+
})
18+
});
19+
test("The div class should have the heart class", () => {
20+
div.forEach(e=>{
21+
expect(e.classList.contains("heart")).toBe(true)
22+
})
23+
});
24+
});

0 commit comments

Comments
 (0)