UNPKG

944 BTypeScriptView Raw
1import React from "react";
2
3import { app, grid, nextButton, previousButton } from "@/test/elements";
4import { renderApp } from "@/test/renderApp";
5import { user } from "@/test/user";
6
7import { Rtl } from "./Rtl";
8
9const today = new Date(2021, 10, 25);
10
11beforeAll(() => jest.setSystemTime(today));
12afterAll(() => jest.useRealTimers());
13
14beforeEach(() => {
15 renderApp(<Rtl />);
16});
17
18test("should have the rtl dir attribute", () => {
19 expect(app().firstChild).toHaveAttribute("dir", "rtl");
20});
21
22describe("when clicking the next month button", () => {
23 test("should display the next month", async () => {
24 await user.click(nextButton());
25 expect(grid()).toHaveAccessibleName("ديسمبر 2021");
26 });
27});
28
29describe("when clicking the previous month button", () => {
30 test("should display the previous month", async () => {
31 await user.click(previousButton());
32 expect(grid()).toHaveAccessibleName("أكتوبر 2021");
33 });
34});