mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-10-29 01:44:25 +01:00
feat: wireframe-to-code (#7334)
This commit is contained in:
@@ -1,23 +1,9 @@
|
||||
import { queries, buildQueries } from "@testing-library/react";
|
||||
import { ToolType } from "../../types";
|
||||
import { TOOL_TYPE } from "../../constants";
|
||||
|
||||
const toolMap = {
|
||||
lock: "lock",
|
||||
selection: "selection",
|
||||
rectangle: "rectangle",
|
||||
diamond: "diamond",
|
||||
ellipse: "ellipse",
|
||||
arrow: "arrow",
|
||||
line: "line",
|
||||
freedraw: "freedraw",
|
||||
text: "text",
|
||||
eraser: "eraser",
|
||||
frame: "frame",
|
||||
};
|
||||
|
||||
export type ToolName = keyof typeof toolMap;
|
||||
|
||||
const _getAllByToolName = (container: HTMLElement, tool: string) => {
|
||||
const toolTitle = toolMap[tool as ToolName];
|
||||
const _getAllByToolName = (container: HTMLElement, tool: ToolType | "lock") => {
|
||||
const toolTitle = tool === "lock" ? "lock" : TOOL_TYPE[tool];
|
||||
return queries.getAllByTestId(container, `toolbar-${toolTitle}`);
|
||||
};
|
||||
|
||||
@@ -32,7 +18,7 @@ export const [
|
||||
getByToolName,
|
||||
findAllByToolName,
|
||||
findByToolName,
|
||||
] = buildQueries<string[]>(
|
||||
] = buildQueries<(ToolType | "lock")[]>(
|
||||
_getAllByToolName,
|
||||
getMultipleError,
|
||||
getMissingError,
|
||||
|
||||
Reference in New Issue
Block a user