Skip to content

Commit 0a24364

Browse files
committed
Add in new css test
1 parent b66d4de commit 0a24364

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

src/HtmlCss.test.tsx

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ describe("Some basic CSS is added.", () => {
3030
render(<App />);
3131
const banner = screen.getByRole("banner");
3232
expect(banner).not.toHaveStyle({
33-
"background-color": "rgb(40, 44, 52)"
33+
"background-color": "rgb(40, 44, 52)",
3434
});
3535
});
3636
});
@@ -59,6 +59,25 @@ describe("Some Bootstrap Elements are added", () => {
5959
});
6060
});
6161

62-
/**
63-
* Remember, there are additional tasks described on the page!
64-
*/
62+
describe("Some additional CSS was added", () => {
63+
test("checks if any element has a background color of red", () => {
64+
const { container } = render(<App />);
65+
// Get all elements in the rendered container
66+
const elements = container.querySelectorAll("*");
67+
68+
// Check if any element has a background color of red
69+
let foundRedBackground = false;
70+
71+
elements.forEach((element) => {
72+
const style = getComputedStyle(element);
73+
if (
74+
style.backgroundColor === "red" ||
75+
style.backgroundColor === "rgb(255, 0, 0)"
76+
) {
77+
foundRedBackground = true;
78+
}
79+
});
80+
81+
expect(foundRedBackground).toBe(true);
82+
});
83+
});

0 commit comments

Comments
 (0)