1 | import React from "react";
|
2 |
|
3 | import { dateButton, gridcell } from "@/test/elements";
|
4 | import { render } from "@/test/render";
|
5 | import { user } from "@/test/user";
|
6 |
|
7 | import { SingleRequired } from "./SingleRequired";
|
8 |
|
9 | beforeEach(() => {
|
10 | render(<SingleRequired />);
|
11 | });
|
12 |
|
13 | describe("when a day is clicked", () => {
|
14 | const day = new Date();
|
15 | beforeEach(async () => {
|
16 | await user.click(dateButton(day));
|
17 | });
|
18 | test("should appear as selected", () => {
|
19 | expect(gridcell(day, true)).toHaveAttribute("aria-selected", "true");
|
20 | });
|
21 | describe("when the day is clicked again", () => {
|
22 | beforeEach(async () => {
|
23 | await user.click(dateButton(day));
|
24 | });
|
25 | test("should appear as selected", () => {
|
26 | expect(gridcell(day, true)).toHaveAttribute("aria-selected", "true");
|
27 | });
|
28 | });
|
29 | });
|