1 | import React from "react";
|
2 |
|
3 | import { grid } from "@/test/elements";
|
4 | import { render, screen } from "@/test/render";
|
5 | import { user } from "@/test/user";
|
6 |
|
7 | import { Controlled } from "./Controlled";
|
8 |
|
9 | beforeAll(() => jest.setSystemTime(new Date(2022, 5, 10)));
|
10 | afterAll(() => jest.useRealTimers());
|
11 |
|
12 | describe('when the "Today" button is clicked', () => {
|
13 | const todayButton = () => screen.getByRole("button", { name: "Go to Today" });
|
14 | beforeEach(async () => {
|
15 | render(<Controlled />);
|
16 | await user.click(todayButton());
|
17 | });
|
18 | test("the button should be disabled", async () => {
|
19 | expect(todayButton()).toBeDisabled();
|
20 | });
|
21 | test("should display the current month", () => {
|
22 | expect(grid()).toHaveAccessibleName("June 2022");
|
23 | });
|
24 | });
|