1 | import React from "react";
|
2 |
|
3 | import { app, grid, nextButton, previousButton } from "@/test/elements";
|
4 | import { renderApp } from "@/test/renderApp";
|
5 | import { user } from "@/test/user";
|
6 |
|
7 | import { Rtl } from "./Rtl";
|
8 |
|
9 | const today = new Date(2021, 10, 25);
|
10 |
|
11 | beforeAll(() => jest.setSystemTime(today));
|
12 | afterAll(() => jest.useRealTimers());
|
13 |
|
14 | beforeEach(() => {
|
15 | renderApp(<Rtl />);
|
16 | });
|
17 |
|
18 | test("should have the rtl dir attribute", () => {
|
19 | expect(app().firstChild).toHaveAttribute("dir", "rtl");
|
20 | });
|
21 |
|
22 | describe("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 |
|
29 | describe("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 | });
|