Files
excalidraw/src/tests/queries/dom.ts
2023-10-20 17:45:37 +02:00

14 lines
369 B
TypeScript

import { waitFor } from "@testing-library/dom";
export const getTextEditor = async (waitForEditor = true) => {
const query = () =>
document.querySelector(
".excalidraw-textEditorContainer > textarea",
) as HTMLTextAreaElement;
if (waitForEditor) {
await waitFor(() => expect(query()).not.toBe(null));
return query();
}
return query();
};