refactor: simplify DigitalClock and TimeConverter components
This commit is contained in:
committed by
Loic Coenen (aider)
parent
3fed6dc168
commit
0b8d76a057
@@ -36,15 +36,16 @@ describe("DigitalClock", () => {
|
||||
expect(input).toBeDisabled();
|
||||
});
|
||||
|
||||
it("renders the digital time and input when enabled", () => {
|
||||
it("renders the input with the correct initial value when enabled", () => {
|
||||
render(
|
||||
<DigitalClock
|
||||
currentTime={new Date(2025, 0, 1, 14, 30, 15)}
|
||||
onTimeChange={onTimeChangeMock}
|
||||
/>,
|
||||
);
|
||||
expect(screen.getByTestId("digital-clock")).toHaveTextContent("14:30:15");
|
||||
expect(screen.getByTestId("time-input")).toBeInTheDocument();
|
||||
const input = screen.getByTestId("time-input") as HTMLInputElement;
|
||||
expect(input).toBeInTheDocument();
|
||||
expect(input.value).toBe("14:30:15");
|
||||
});
|
||||
|
||||
it("calls onTimeChange when a valid time is entered", () => {
|
||||
|
||||
Reference in New Issue
Block a user