(react) remove warnings during tests

Numerous warnings was raised during tests. We remove most of them. Some
needs to be discussed before fix.
This commit is contained in:
jbpenrath
2024-04-29 15:29:33 +02:00
committed by Jean-Baptiste PENRATH
parent e8ef155b1e
commit a70f8129eb
7 changed files with 58 additions and 11 deletions

View File

@@ -1,5 +1,5 @@
import userEvent from "@testing-library/user-event";
import { render, screen, waitFor } from "@testing-library/react";
import { act, render, screen, waitFor } from "@testing-library/react";
import { expect } from "vitest";
import React, { createRef, FormEvent, useState } from "react";
import { within } from "@testing-library/dom";
@@ -835,7 +835,9 @@ describe("<Select/>", () => {
expect(document.activeElement?.tagName).toEqual("INPUT");
// Blur the select.
ref.current?.blur();
await act(async () => {
ref.current?.blur();
});
// Make sure the select is blured.
await waitFor(() => expectMenuToBeClosed(menu));
@@ -2017,7 +2019,9 @@ describe("<Select/>", () => {
expect(document.activeElement?.className).toContain("c__select__wrapper");
// Blur the select.
ref.current?.blur();
await act(async () => {
ref.current?.blur();
});
// Make sure the select is blured.
await waitFor(() => expectMenuToBeClosed(menu));

View File

@@ -1,5 +1,5 @@
import userEvent from "@testing-library/user-event";
import { render, screen, waitFor } from "@testing-library/react";
import { act, render, screen, waitFor } from "@testing-library/react";
import React, { createRef, FormEvent, useState } from "react";
import { expect } from "vitest";
import { within } from "@testing-library/dom";
@@ -836,7 +836,9 @@ describe("<Select multi={true} />", () => {
expect(document.activeElement?.className).toContain("c__select__wrapper");
// Blur the select.
ref.current?.blur();
await act(async () => {
ref.current?.blur();
});
// Make sure the select is blured.
await waitFor(() => expectMenuToBeClosed(menu));
@@ -1736,7 +1738,9 @@ describe("<Select multi={true} />", () => {
expect(document.activeElement?.tagName).toEqual("INPUT");
// Blur the select.
ref.current?.blur();
await act(async () => {
ref.current?.blur();
});
// Make sure the select is blured.
await waitFor(() => expectMenuToBeClosed(menu));