UNPKG

769 BTypeScriptView Raw
1import React from "react";
2
3import { activeElement, dateButton } from "@/test/elements";
4import { render } from "@/test/render";
5import { user } from "@/test/user";
6
7import { FocusRecursive } from "./FocusRecursive";
8
9const today = new Date(2022, 5, 10);
10
11beforeAll(() => jest.setSystemTime(today));
12afterAll(() => jest.useRealTimers());
13
14test("the first selected day should have focus", async () => {
15 render(<FocusRecursive />).container;
16 await user.tab();
17 await user.tab();
18 await user.tab();
19 await user.type(activeElement(), "{arrowdown}");
20 await user.type(activeElement(), "{arrowdown}");
21 await user.type(activeElement(), "{arrowdown}");
22 await user.type(activeElement(), "{arrowdown}");
23 expect(dateButton(new Date(2022, 5, 22))).toHaveFocus();
24});