UNPKG

801 BTypeScriptView Raw
1import React from "react";
2
3import { dateButton, gridcell } from "@/test/elements";
4import { render } from "@/test/render";
5import { user } from "@/test/user";
6
7import { SingleRequired } from "./SingleRequired";
8
9beforeEach(() => {
10 render(<SingleRequired />);
11});
12
13describe("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});