-
Notifications
You must be signed in to change notification settings - Fork 0
/
progress.test.tsx
25 lines (22 loc) · 993 Bytes
/
progress.test.tsx
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
import { render, screen } from "@testing-library/react";
import { describe, expect, it } from "vitest";
import { Progress } from "./progress";
describe("Progress", () => {
it("renders without crashing", () => {
render(<Progress />);
const progressElement = screen.getByRole("progressbar");
expect(progressElement).toBeInTheDocument();
});
it("renders with correct value prop", () => {
const value = 50;
render(<Progress value={value} />);
const progressIndicator = screen.getByRole("progressbar").firstChild; // select the Indicator component
expect(progressIndicator).toHaveStyle(`transform: translateX(-${100 - value}%)`);
});
it("applies correct styles based on value prop", () => {
const value = 75;
render(<Progress value={value} />);
const progressIndicator = screen.getByRole("progressbar").firstChild; // select the Indicator component
expect(progressIndicator).toHaveStyle(`transform: translateX(-${100 - value}%)`);
});
});