-
Notifications
You must be signed in to change notification settings - Fork 246
/
Copy pathtest.js
39 lines (33 loc) · 1.36 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const fs = require("fs");
const path = require("path");
const css = fs.readFileSync(path.resolve(__dirname, "./styles.css"), "utf8");
jest.dontMock("fs");
describe("CSS Styles", () => {
beforeAll(() => {
document.querySelector("head").innerHTML = `<style>${css.toString()}</style>`;
});
test("Cocacola list style should be applied correctly", () => {
const cocacolaItems = document.querySelectorAll(".cocacola");
cocacolaItems.forEach(item => {
expect(getComputedStyle(item).listStyleType).toBe("lower-alpha");
});
});
test("Pepsi list style should be applied correctly", () => {
const pepsiItems = document.querySelectorAll(".pepsi");
pepsiItems.forEach(item => {
expect(getComputedStyle(item).listStyleType).toBe("square");
});
});
test("Healthy list style should be applied correctly", () => {
const healthyItems = document.querySelectorAll(".healthy");
healthyItems.forEach(item => {
expect(getComputedStyle(item).listStyleType).toBe("armenian");
});
});
test("Dev-drinks list style should be applied correctly", () => {
const devDrinksItems = document.querySelectorAll(".dev-drinks");
devDrinksItems.forEach(item => {
expect(getComputedStyle(item).listStyleType).toBe("none");
});
});
});