(react) update DateRangerPicker test

Due to the recent update of @react-aria/calendar the role of the calendar
has changed from group to application, the test were using this role.
This commit is contained in:
Nathan Vasse
2023-07-12 14:39:23 +02:00
committed by NathanVss
parent 72ebd56568
commit 16dd24148b
2 changed files with 5 additions and 5 deletions

View File

@@ -1,7 +1,7 @@
import userEvent from "@testing-library/user-event"; import userEvent from "@testing-library/user-event";
import { render, screen, within } from "@testing-library/react"; import { render, screen, within } from "@testing-library/react";
import React, { FormEvent, useState } from "react"; import React, { FormEvent, useState } from "react";
import { expect, vi, afterEach } from "vitest"; import { afterEach, expect, vi } from "vitest";
import { CunninghamProvider } from ":/components/Provider"; import { CunninghamProvider } from ":/components/Provider";
import { DatePicker } from ":/components/Forms/DatePicker/DatePicker"; import { DatePicker } from ":/components/Forms/DatePicker/DatePicker";
import { Button } from ":/components/Button"; import { Button } from ":/components/Button";
@@ -12,11 +12,11 @@ describe("<DatePicker/>", () => {
}); });
const expectCalendarToBeClosed = () => { const expectCalendarToBeClosed = () => {
expect(screen.queryByRole("group")).toBeNull(); expect(screen.queryByRole("application")).toBeNull();
}; };
const expectCalendarToBeOpen = () => { const expectCalendarToBeOpen = () => {
const calendar = screen.queryByRole("group"); const calendar = screen.queryByRole("application");
expect(calendar).toBeDefined(); expect(calendar).toBeDefined();
expect(calendar).not.toBeNull(); expect(calendar).not.toBeNull();
expect(Array.from(calendar!.classList)).contains( expect(Array.from(calendar!.classList)).contains(

View File

@@ -19,7 +19,7 @@ describe("<DateRangePicker/>", () => {
}; };
const expectCalendarToBeClosed = () => { const expectCalendarToBeClosed = () => {
expect(screen.queryByRole("group")).toBeNull(); expect(screen.queryByRole("application")).toBeNull();
}; };
const expectDateFieldsToBeDisplayed = () => { const expectDateFieldsToBeDisplayed = () => {
@@ -44,7 +44,7 @@ describe("<DateRangePicker/>", () => {
}; };
const expectCalendarToBeOpen = () => { const expectCalendarToBeOpen = () => {
const calendar = screen.queryByRole("group"); const calendar = screen.queryByRole("application");
expect(calendar).toBeDefined(); expect(calendar).toBeDefined();
expect(calendar).not.toBeNull(); expect(calendar).not.toBeNull();
expect(Array.from(calendar!.classList)).contains( expect(Array.from(calendar!.classList)).contains(