mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix act() wrapper console.error
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
4d0e841343
commit
a378621e73
@ -3,7 +3,7 @@
|
|||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { render } from "@testing-library/react";
|
import { render, act } from "@testing-library/react";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { UpdateButton } from "../update-button";
|
import { UpdateButton } from "../update-button";
|
||||||
import "@testing-library/jest-dom/extend-expect";
|
import "@testing-library/jest-dom/extend-expect";
|
||||||
@ -27,12 +27,12 @@ describe("<UpdateButton/>", () => {
|
|||||||
expect(getByTestId("update-button")).toMatchSnapshot();
|
expect(getByTestId("update-button")).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should open menu when clicked", () => {
|
it("should open menu when clicked", async () => {
|
||||||
const { getByTestId } = render(<UpdateButton update={update} warningLevel="light" />);
|
const { getByTestId } = render(<UpdateButton update={update} warningLevel="light" />);
|
||||||
|
|
||||||
const button = getByTestId("update-button");
|
const button = getByTestId("update-button");
|
||||||
|
|
||||||
button.click();
|
act(() => button.click());
|
||||||
|
|
||||||
expect(getByTestId("update-lens-menu-item")).toBeInTheDocument();
|
expect(getByTestId("update-lens-menu-item")).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
@ -42,7 +42,7 @@ describe("<UpdateButton/>", () => {
|
|||||||
|
|
||||||
const button = getByTestId("update-button");
|
const button = getByTestId("update-button");
|
||||||
|
|
||||||
button.click();
|
act(() => button.click());
|
||||||
|
|
||||||
const menuItem = getByTestId("update-lens-menu-item");
|
const menuItem = getByTestId("update-lens-menu-item");
|
||||||
|
|
||||||
|
|||||||
@ -50,6 +50,7 @@ export function UpdateButton({ warningLevel, update, id }: UpdateButtonProps) {
|
|||||||
isOpen={opened}
|
isOpen={opened}
|
||||||
close={toggle}
|
close={toggle}
|
||||||
open={toggle}
|
open={toggle}
|
||||||
|
aria-expanded={opened}
|
||||||
>
|
>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
icon={menuIconProps}
|
icon={menuIconProps}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user