// @vitest-environment jsdom import { cleanup, render, screen } from "@testing-library/react" import { afterEach, describe, expect, it } from "vitest" import { ActionGroup, Bold, Date, LexicalActions, LexicalBubbleToolbar, LexicalContent, LexicalFixedToolbar, LexicalFooter, LexicalRoot, } from "." afterEach(cleanup) describe("declarative Lexical actions", () => { it("renders actions only in their declared regions", () => { render( undefined}> ) expect(screen.getByRole("toolbar", { name: "fixed" })).not.toBeNull() expect(screen.getByLabelText("footer")).not.toBeNull() expect(screen.getByRole("button", { name: "Bold" })).not.toBeNull() expect(screen.getByRole("button", { name: "Date" })).not.toBeNull() }) it("supports menu groups", () => { render( undefined}> ) expect(screen.getByRole("button", { name: "格式" })).not.toBeNull() }) it("does not render optional regions without matching actions", () => { render( undefined}> ) expect(screen.queryByLabelText("bubble")).toBeNull() expect(screen.queryByLabelText("footer")).toBeNull() }) })