mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
refactor: auto ordered imports (#9163)
All checks were successful
Tests / test (push) Successful in 4m38s
All checks were successful
Tests / test (push) Successful in 4m38s
This commit is contained in:
parent
82b9a6b464
commit
21ffaf4d76
421 changed files with 3532 additions and 2763 deletions
|
@ -1,10 +1,10 @@
|
|||
import React from "react";
|
||||
import * as StaticScene from "../renderer/staticScene";
|
||||
import { reseed } from "../random";
|
||||
import { render, queryByTestId, unmountComponent } from "../tests/test-utils";
|
||||
import { vi } from "vitest";
|
||||
|
||||
import { Excalidraw } from "../index";
|
||||
import { vi } from "vitest";
|
||||
import { reseed } from "../random";
|
||||
import * as StaticScene from "../renderer/staticScene";
|
||||
import { render, queryByTestId, unmountComponent } from "../tests/test-utils";
|
||||
|
||||
const renderStaticScene = vi.spyOn(StaticScene, "renderStaticScene");
|
||||
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
import React from "react";
|
||||
import { render, waitFor } from "./test-utils";
|
||||
import { Excalidraw } from "../index";
|
||||
import { expect } from "vitest";
|
||||
import { getTextEditor, updateTextEditor } from "./queries/dom";
|
||||
|
||||
import { Excalidraw } from "../index";
|
||||
|
||||
import { mockMermaidToExcalidraw } from "./helpers/mocks";
|
||||
import { getTextEditor, updateTextEditor } from "./queries/dom";
|
||||
import { render, waitFor } from "./test-utils";
|
||||
|
||||
mockMermaidToExcalidraw({
|
||||
mockRef: true,
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
import React from "react";
|
||||
|
||||
import { copiedStyles } from "../actions/actionStyles";
|
||||
import { Excalidraw } from "../index";
|
||||
import { CODES } from "../keys";
|
||||
import { API } from "../tests/helpers/api";
|
||||
|
@ -10,7 +12,6 @@ import {
|
|||
screen,
|
||||
togglePopover,
|
||||
} from "../tests/test-utils";
|
||||
import { copiedStyles } from "../actions/actionStyles";
|
||||
|
||||
const { h } = window;
|
||||
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
import React from "react";
|
||||
import { act, unmountComponent, render } from "./test-utils";
|
||||
import { Excalidraw } from "../index";
|
||||
import { defaultLang, setLanguage } from "../i18n";
|
||||
import { UI, Pointer, Keyboard } from "./helpers/ui";
|
||||
import { API } from "./helpers/api";
|
||||
import { KEYS } from "../keys";
|
||||
|
||||
import {
|
||||
actionAlignVerticallyCentered,
|
||||
actionAlignHorizontallyCentered,
|
||||
|
@ -14,6 +9,13 @@ import {
|
|||
actionAlignLeft,
|
||||
actionAlignRight,
|
||||
} from "../actions";
|
||||
import { defaultLang, setLanguage } from "../i18n";
|
||||
import { Excalidraw } from "../index";
|
||||
import { KEYS } from "../keys";
|
||||
|
||||
import { API } from "./helpers/api";
|
||||
import { UI, Pointer, Keyboard } from "./helpers/ui";
|
||||
import { act, unmountComponent, render } from "./test-utils";
|
||||
|
||||
const mouse = new Pointer("mouse");
|
||||
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
import React from "react";
|
||||
import { fireEvent, queryByTestId, render, waitFor } from "./test-utils";
|
||||
import { Excalidraw } from "../index";
|
||||
import { API } from "./helpers/api";
|
||||
|
||||
import { getDefaultAppState } from "../appState";
|
||||
import { EXPORT_DATA_TYPES, MIME_TYPES } from "../constants";
|
||||
import { Excalidraw } from "../index";
|
||||
|
||||
import { API } from "./helpers/api";
|
||||
import { Pointer, UI } from "./helpers/ui";
|
||||
import { fireEvent, queryByTestId, render, waitFor } from "./test-utils";
|
||||
|
||||
import type { ExcalidrawTextElement } from "../element/types";
|
||||
|
||||
const { h } = window;
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
import React from "react";
|
||||
import { fireEvent, render } from "./test-utils";
|
||||
import { Excalidraw, isLinearElement } from "../index";
|
||||
import { UI, Pointer, Keyboard } from "./helpers/ui";
|
||||
import { getTransformHandles } from "../element/transformHandles";
|
||||
import { API } from "./helpers/api";
|
||||
import { KEYS } from "../keys";
|
||||
import { actionWrapTextInContainer } from "../actions/actionBoundText";
|
||||
import { arrayToMap } from "../utils";
|
||||
import { pointFrom } from "@excalidraw/math";
|
||||
import React from "react";
|
||||
|
||||
import { actionWrapTextInContainer } from "../actions/actionBoundText";
|
||||
import { getTransformHandles } from "../element/transformHandles";
|
||||
import { Excalidraw, isLinearElement } from "../index";
|
||||
import { KEYS } from "../keys";
|
||||
import { arrayToMap } from "../utils";
|
||||
|
||||
import { API } from "./helpers/api";
|
||||
import { UI, Pointer, Keyboard } from "./helpers/ui";
|
||||
import { fireEvent, render } from "./test-utils";
|
||||
|
||||
const { h } = window;
|
||||
|
||||
|
|
|
@ -1,22 +1,25 @@
|
|||
import React from "react";
|
||||
import { vi } from "vitest";
|
||||
|
||||
import { createPasteEvent, serializeAsClipboardJSON } from "../clipboard";
|
||||
import { getElementBounds } from "../element";
|
||||
import { getLineHeightInPx } from "../element/textMeasurements";
|
||||
import { getLineHeight } from "../fonts";
|
||||
import { Excalidraw } from "../index";
|
||||
import { KEYS } from "../keys";
|
||||
import { arrayToMap } from "../utils";
|
||||
|
||||
import { API } from "./helpers/api";
|
||||
import { mockMermaidToExcalidraw } from "./helpers/mocks";
|
||||
import { Pointer, Keyboard } from "./helpers/ui";
|
||||
import {
|
||||
render,
|
||||
waitFor,
|
||||
GlobalTestState,
|
||||
unmountComponent,
|
||||
} from "./test-utils";
|
||||
import { Pointer, Keyboard } from "./helpers/ui";
|
||||
import { Excalidraw } from "../index";
|
||||
import { KEYS } from "../keys";
|
||||
import { getLineHeightInPx } from "../element/textMeasurements";
|
||||
import { getElementBounds } from "../element";
|
||||
|
||||
import type { NormalizedZoomValue } from "../types";
|
||||
import { API } from "./helpers/api";
|
||||
import { createPasteEvent, serializeAsClipboardJSON } from "../clipboard";
|
||||
import { arrayToMap } from "../utils";
|
||||
import { mockMermaidToExcalidraw } from "./helpers/mocks";
|
||||
import { getLineHeight } from "../fonts";
|
||||
|
||||
const { h } = window;
|
||||
|
||||
|
|
|
@ -1,4 +1,15 @@
|
|||
import React from "react";
|
||||
import { vi } from "vitest";
|
||||
|
||||
import { copiedStyles } from "../actions/actionStyles";
|
||||
import { Excalidraw } from "../index";
|
||||
import { KEYS } from "../keys";
|
||||
import { reseed } from "../random";
|
||||
import * as StaticScene from "../renderer/staticScene";
|
||||
import { setDateTimeForTests } from "../utils";
|
||||
|
||||
import { API } from "./helpers/api";
|
||||
import { UI, Pointer, Keyboard } from "./helpers/ui";
|
||||
import {
|
||||
render,
|
||||
fireEvent,
|
||||
|
@ -12,16 +23,8 @@ import {
|
|||
togglePopover,
|
||||
unmountComponent,
|
||||
} from "./test-utils";
|
||||
import { Excalidraw } from "../index";
|
||||
import * as StaticScene from "../renderer/staticScene";
|
||||
import { reseed } from "../random";
|
||||
import { UI, Pointer, Keyboard } from "./helpers/ui";
|
||||
import { KEYS } from "../keys";
|
||||
|
||||
import type { ShortcutName } from "../actions/shortcuts";
|
||||
import { copiedStyles } from "../actions/actionStyles";
|
||||
import { API } from "./helpers/api";
|
||||
import { setDateTimeForTests } from "../utils";
|
||||
import { vi } from "vitest";
|
||||
import type { ActionName } from "../actions/types";
|
||||
|
||||
const checkpoint = (name: string) => {
|
||||
|
|
|
@ -1,15 +1,18 @@
|
|||
import React from "react";
|
||||
import { vi } from "vitest";
|
||||
import { Keyboard, Pointer, UI } from "./helpers/ui";
|
||||
import type { ExcalidrawImageElement, ImageCrop } from "../element/types";
|
||||
import { act, GlobalTestState, render, unmountComponent } from "./test-utils";
|
||||
|
||||
import { Excalidraw, exportToCanvas, exportToSvg } from "..";
|
||||
import { API } from "./helpers/api";
|
||||
import type { NormalizedZoomValue } from "../types";
|
||||
import { KEYS } from "../keys";
|
||||
import { duplicateElement } from "../element";
|
||||
import { cloneJSON } from "../utils";
|
||||
import { actionFlipHorizontal, actionFlipVertical } from "../actions";
|
||||
import { duplicateElement } from "../element";
|
||||
import { KEYS } from "../keys";
|
||||
import { cloneJSON } from "../utils";
|
||||
|
||||
import { API } from "./helpers/api";
|
||||
import { Keyboard, Pointer, UI } from "./helpers/ui";
|
||||
import { act, GlobalTestState, render, unmountComponent } from "./test-utils";
|
||||
|
||||
import type { ExcalidrawImageElement, ImageCrop } from "../element/types";
|
||||
import type { NormalizedZoomValue } from "../types";
|
||||
|
||||
const { h } = window;
|
||||
const mouse = new Pointer("mouse");
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
import type { RemoteExcalidrawElement } from "../../data/reconcile";
|
||||
import { reconcileElements } from "../../data/reconcile";
|
||||
import { syncInvalidIndices } from "../../fractionalIndex";
|
||||
import { randomInteger } from "../../random";
|
||||
import { cloneJSON } from "../../utils";
|
||||
|
||||
import type { RemoteExcalidrawElement } from "../../data/reconcile";
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
OrderedExcalidrawElement,
|
||||
} from "../../element/types";
|
||||
import { syncInvalidIndices } from "../../fractionalIndex";
|
||||
import { randomInteger } from "../../random";
|
||||
import type { AppState } from "../../types";
|
||||
import { cloneJSON } from "../../utils";
|
||||
|
||||
type Id = string;
|
||||
type ElementLike = {
|
||||
|
|
|
@ -1,19 +1,21 @@
|
|||
import { pointFrom } from "@excalidraw/math";
|
||||
import { vi } from "vitest";
|
||||
|
||||
import { getDefaultAppState } from "../../appState";
|
||||
import { DEFAULT_SIDEBAR, FONT_FAMILY, ROUNDNESS } from "../../constants";
|
||||
import * as restore from "../../data/restore";
|
||||
import { newElementWith } from "../../element/mutateElement";
|
||||
import * as sizeHelpers from "../../element/sizeHelpers";
|
||||
import { API } from "../helpers/api";
|
||||
|
||||
import type { ImportedDataState } from "../../data/types";
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
ExcalidrawFreeDrawElement,
|
||||
ExcalidrawLinearElement,
|
||||
ExcalidrawTextElement,
|
||||
} from "../../element/types";
|
||||
import * as sizeHelpers from "../../element/sizeHelpers";
|
||||
import { API } from "../helpers/api";
|
||||
import { getDefaultAppState } from "../../appState";
|
||||
import type { ImportedDataState } from "../../data/types";
|
||||
import type { NormalizedZoomValue } from "../../types";
|
||||
import { DEFAULT_SIDEBAR, FONT_FAMILY, ROUNDNESS } from "../../constants";
|
||||
import { newElementWith } from "../../element/mutateElement";
|
||||
import { vi } from "vitest";
|
||||
import { pointFrom } from "@excalidraw/math";
|
||||
|
||||
describe("restoreElements", () => {
|
||||
const mockSizeHelper = vi.spyOn(sizeHelpers, "isInvisiblySmallElement");
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
import React from "react";
|
||||
import { vi } from "vitest";
|
||||
|
||||
import { Excalidraw } from "../index";
|
||||
import * as StaticScene from "../renderer/staticScene";
|
||||
import * as InteractiveScene from "../renderer/interactiveScene";
|
||||
import { KEYS } from "../keys";
|
||||
import { reseed } from "../random";
|
||||
import * as InteractiveScene from "../renderer/interactiveScene";
|
||||
import * as StaticScene from "../renderer/staticScene";
|
||||
|
||||
import {
|
||||
render,
|
||||
fireEvent,
|
||||
|
@ -10,9 +14,8 @@ import {
|
|||
restoreOriginalGetBoundingClientRect,
|
||||
unmountComponent,
|
||||
} from "./test-utils";
|
||||
|
||||
import type { ExcalidrawLinearElement } from "../element/types";
|
||||
import { reseed } from "../random";
|
||||
import { vi } from "vitest";
|
||||
|
||||
unmountComponent();
|
||||
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
import React from "react";
|
||||
|
||||
import { actionSelectAll } from "../actions";
|
||||
import { mutateElement } from "../element/mutateElement";
|
||||
import { t } from "../i18n";
|
||||
import { Excalidraw } from "../index";
|
||||
import { render, unmountComponent } from "../tests/test-utils";
|
||||
import { Keyboard, Pointer, UI } from "../tests/helpers/ui";
|
||||
import { KEYS } from "../keys";
|
||||
import { API } from "../tests/helpers/api";
|
||||
import { actionSelectAll } from "../actions";
|
||||
import { t } from "../i18n";
|
||||
import { mutateElement } from "../element/mutateElement";
|
||||
import { Keyboard, Pointer, UI } from "../tests/helpers/ui";
|
||||
import { render, unmountComponent } from "../tests/test-utils";
|
||||
|
||||
unmountComponent();
|
||||
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
import React from "react";
|
||||
import { fireEvent, GlobalTestState, toggleMenu, render } from "./test-utils";
|
||||
import { Excalidraw, Footer, MainMenu } from "../index";
|
||||
import { queryByText, queryByTestId } from "@testing-library/react";
|
||||
import React from "react";
|
||||
import { useMemo } from "react";
|
||||
|
||||
import { THEME } from "../constants";
|
||||
import { t } from "../i18n";
|
||||
import { useMemo } from "react";
|
||||
import { Excalidraw, Footer, MainMenu } from "../index";
|
||||
|
||||
import { fireEvent, GlobalTestState, toggleMenu, render } from "./test-utils";
|
||||
|
||||
const { h } = window;
|
||||
|
||||
|
|
|
@ -1,18 +1,21 @@
|
|||
import React from "react";
|
||||
import { render, waitFor } from "./test-utils";
|
||||
import { Excalidraw } from "../index";
|
||||
import { API } from "./helpers/api";
|
||||
|
||||
import { getDefaultAppState } from "../appState";
|
||||
import { SVG_NS } from "../constants";
|
||||
import { getDataURL } from "../data/blob";
|
||||
import { encodePngMetadata } from "../data/image";
|
||||
import { serializeAsJSON } from "../data/json";
|
||||
import { Excalidraw } from "../index";
|
||||
import {
|
||||
decodeSvgBase64Payload,
|
||||
encodeSvgBase64Payload,
|
||||
exportToSvg,
|
||||
} from "../scene/export";
|
||||
|
||||
import { API } from "./helpers/api";
|
||||
import { render, waitFor } from "./test-utils";
|
||||
|
||||
import type { FileId } from "../element/types";
|
||||
import { getDataURL } from "../data/blob";
|
||||
import { getDefaultAppState } from "../appState";
|
||||
import { SVG_NS } from "../constants";
|
||||
|
||||
const { h } = window;
|
||||
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import React from "react";
|
||||
import { act, render } from "./test-utils";
|
||||
import { API } from "./helpers/api";
|
||||
import { vi } from "vitest";
|
||||
|
||||
import { Excalidraw } from "../index";
|
||||
import { vi } from "vitest";
|
||||
|
||||
import { API } from "./helpers/api";
|
||||
import { act, render } from "./test-utils";
|
||||
|
||||
const { h } = window;
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { VERSIONS } from "../../constants";
|
||||
|
||||
import {
|
||||
diamondFixture,
|
||||
ellipseFixture,
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
import type { Radians } from "@excalidraw/math";
|
||||
|
||||
import { DEFAULT_FONT_FAMILY } from "../../constants";
|
||||
|
||||
import type { ExcalidrawElement } from "../../element/types";
|
||||
|
||||
const elementBase: Omit<ExcalidrawElement, "type"> = {
|
||||
|
|
|
@ -1,4 +1,21 @@
|
|||
import { pointFrom, type Radians } from "@excalidraw/math";
|
||||
import React from "react";
|
||||
import { vi } from "vitest";
|
||||
|
||||
import type { LocalPoint } from "@excalidraw/math";
|
||||
|
||||
import { actionFlipHorizontal, actionFlipVertical } from "../actions";
|
||||
import { createPasteEvent } from "../clipboard";
|
||||
import { ROUNDNESS } from "../constants";
|
||||
import { getElementAbsoluteCoords } from "../element";
|
||||
import { newLinearElement } from "../element";
|
||||
import { getBoundTextElementPosition } from "../element/textElement";
|
||||
import { Excalidraw } from "../index";
|
||||
import { KEYS } from "../keys";
|
||||
import { arrayToMap, cloneJSON } from "../utils";
|
||||
|
||||
import { API } from "./helpers/api";
|
||||
import { UI, Pointer, Keyboard } from "./helpers/ui";
|
||||
import {
|
||||
fireEvent,
|
||||
GlobalTestState,
|
||||
|
@ -7,10 +24,7 @@ import {
|
|||
unmountComponent,
|
||||
waitFor,
|
||||
} from "./test-utils";
|
||||
import { UI, Pointer, Keyboard } from "./helpers/ui";
|
||||
import { API } from "./helpers/api";
|
||||
import { actionFlipHorizontal, actionFlipVertical } from "../actions";
|
||||
import { getElementAbsoluteCoords } from "../element";
|
||||
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
ExcalidrawImageElement,
|
||||
|
@ -18,17 +32,7 @@ import type {
|
|||
ExcalidrawTextElementWithContainer,
|
||||
FileId,
|
||||
} from "../element/types";
|
||||
import { newLinearElement } from "../element";
|
||||
import { Excalidraw } from "../index";
|
||||
import type { NormalizedZoomValue } from "../types";
|
||||
import { ROUNDNESS } from "../constants";
|
||||
import { vi } from "vitest";
|
||||
import { KEYS } from "../keys";
|
||||
import { getBoundTextElementPosition } from "../element/textElement";
|
||||
import { createPasteEvent } from "../clipboard";
|
||||
import { arrayToMap, cloneJSON } from "../utils";
|
||||
import type { LocalPoint } from "@excalidraw/math";
|
||||
import { pointFrom, type Radians } from "@excalidraw/math";
|
||||
|
||||
const { h } = window;
|
||||
const mouse = new Pointer("mouse");
|
||||
|
|
|
@ -1,15 +1,18 @@
|
|||
/* eslint-disable no-lone-blocks */
|
||||
import { generateKeyBetween } from "fractional-indexing";
|
||||
|
||||
import { deepCopyElement } from "../element/newElement";
|
||||
import { InvalidFractionalIndexError } from "../errors";
|
||||
import {
|
||||
syncInvalidIndices,
|
||||
syncMovedIndices,
|
||||
validateFractionalIndices,
|
||||
} from "../fractionalIndex";
|
||||
import { API } from "./helpers/api";
|
||||
import { arrayToMap } from "../utils";
|
||||
import { InvalidFractionalIndexError } from "../errors";
|
||||
|
||||
import { API } from "./helpers/api";
|
||||
|
||||
import type { ExcalidrawElement, FractionalIndex } from "../element/types";
|
||||
import { deepCopyElement } from "../element/newElement";
|
||||
import { generateKeyBetween } from "fractional-indexing";
|
||||
|
||||
describe("sync invalid indices with array order", () => {
|
||||
describe("should NOT sync empty array", () => {
|
||||
|
|
|
@ -1,3 +1,32 @@
|
|||
import fs from "fs";
|
||||
import path from "path";
|
||||
import util from "util";
|
||||
|
||||
import { pointFrom, type LocalPoint, type Radians } from "@excalidraw/math";
|
||||
|
||||
import { getDefaultAppState } from "../../appState";
|
||||
import { createTestHook } from "../../components/App";
|
||||
import { DEFAULT_VERTICAL_ALIGN, ROUNDNESS } from "../../constants";
|
||||
import { getMimeType } from "../../data/blob";
|
||||
import { newElement, newTextElement, newLinearElement } from "../../element";
|
||||
import { mutateElement } from "../../element/mutateElement";
|
||||
import {
|
||||
newArrowElement,
|
||||
newEmbeddableElement,
|
||||
newFrameElement,
|
||||
newFreeDrawElement,
|
||||
newIframeElement,
|
||||
newImageElement,
|
||||
newMagicFrameElement,
|
||||
} from "../../element/newElement";
|
||||
import { isLinearElementType } from "../../element/typeChecks";
|
||||
import { selectGroupsForSelectedElements } from "../../groups";
|
||||
import { getSelectedElements } from "../../scene/selection";
|
||||
import { assertNever } from "../../utils";
|
||||
import { GlobalTestState, createEvent, fireEvent, act } from "../test-utils";
|
||||
|
||||
import type { Action } from "../../actions/types";
|
||||
import type App from "../../components/App";
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
ExcalidrawGenericElement,
|
||||
|
@ -13,34 +42,8 @@ import type {
|
|||
ExcalidrawArrowElement,
|
||||
FixedSegment,
|
||||
} from "../../element/types";
|
||||
import { newElement, newTextElement, newLinearElement } from "../../element";
|
||||
import { DEFAULT_VERTICAL_ALIGN, ROUNDNESS } from "../../constants";
|
||||
import { getDefaultAppState } from "../../appState";
|
||||
import { GlobalTestState, createEvent, fireEvent, act } from "../test-utils";
|
||||
import fs from "fs";
|
||||
import util from "util";
|
||||
import path from "path";
|
||||
import { getMimeType } from "../../data/blob";
|
||||
import {
|
||||
newArrowElement,
|
||||
newEmbeddableElement,
|
||||
newFrameElement,
|
||||
newFreeDrawElement,
|
||||
newIframeElement,
|
||||
newImageElement,
|
||||
newMagicFrameElement,
|
||||
} from "../../element/newElement";
|
||||
import type { AppState } from "../../types";
|
||||
import { getSelectedElements } from "../../scene/selection";
|
||||
import { isLinearElementType } from "../../element/typeChecks";
|
||||
import type { Mutable } from "../../utility-types";
|
||||
import { assertNever } from "../../utils";
|
||||
import type App from "../../components/App";
|
||||
import { createTestHook } from "../../components/App";
|
||||
import type { Action } from "../../actions/types";
|
||||
import { mutateElement } from "../../element/mutateElement";
|
||||
import { pointFrom, type LocalPoint, type Radians } from "@excalidraw/math";
|
||||
import { selectGroupsForSelectedElements } from "../../groups";
|
||||
|
||||
const readFile = util.promisify(fs.readFile);
|
||||
// so that window.h is available when App.tsx is not imported as well.
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import { vi } from "vitest";
|
||||
import * as MermaidToExcalidraw from "@excalidraw/mermaid-to-excalidraw";
|
||||
import type { parseMermaidToExcalidraw } from "@excalidraw/mermaid-to-excalidraw";
|
||||
import React from "react";
|
||||
import { vi } from "vitest";
|
||||
|
||||
import type { parseMermaidToExcalidraw } from "@excalidraw/mermaid-to-excalidraw";
|
||||
|
||||
export const mockMermaidToExcalidraw = (opts: {
|
||||
parseMermaidToExcalidraw: typeof parseMermaidToExcalidraw;
|
||||
|
|
|
@ -1,3 +1,33 @@
|
|||
import { pointFrom, pointRotateRads } from "@excalidraw/math";
|
||||
|
||||
import type { GlobalPoint, LocalPoint, Radians } from "@excalidraw/math";
|
||||
|
||||
import { createTestHook } from "../../components/App";
|
||||
import { getCommonBounds, getElementPointsCoords } from "../../element/bounds";
|
||||
import { cropElement } from "../../element/cropElement";
|
||||
import { mutateElement } from "../../element/mutateElement";
|
||||
import {
|
||||
getTransformHandles,
|
||||
getTransformHandlesFromCoords,
|
||||
OMIT_SIDES_FOR_FRAME,
|
||||
OMIT_SIDES_FOR_MULTIPLE_ELEMENTS,
|
||||
type TransformHandle,
|
||||
type TransformHandleDirection,
|
||||
} from "../../element/transformHandles";
|
||||
import {
|
||||
isLinearElement,
|
||||
isFreeDrawElement,
|
||||
isTextElement,
|
||||
isFrameLikeElement,
|
||||
} from "../../element/typeChecks";
|
||||
import { KEYS } from "../../keys";
|
||||
import { arrayToMap } from "../../utils";
|
||||
import { getTextEditor } from "../queries/dom";
|
||||
import { act, fireEvent, GlobalTestState, screen } from "../test-utils";
|
||||
|
||||
import { API } from "./api";
|
||||
|
||||
import type { TransformHandleType } from "../../element/transformHandles";
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
ExcalidrawLinearElement,
|
||||
|
@ -10,32 +40,6 @@ import type {
|
|||
ExcalidrawTextElementWithContainer,
|
||||
ExcalidrawImageElement,
|
||||
} from "../../element/types";
|
||||
import type { TransformHandleType } from "../../element/transformHandles";
|
||||
import {
|
||||
getTransformHandles,
|
||||
getTransformHandlesFromCoords,
|
||||
OMIT_SIDES_FOR_FRAME,
|
||||
OMIT_SIDES_FOR_MULTIPLE_ELEMENTS,
|
||||
type TransformHandle,
|
||||
type TransformHandleDirection,
|
||||
} from "../../element/transformHandles";
|
||||
import { KEYS } from "../../keys";
|
||||
import { act, fireEvent, GlobalTestState, screen } from "../test-utils";
|
||||
import { mutateElement } from "../../element/mutateElement";
|
||||
import { API } from "./api";
|
||||
import {
|
||||
isLinearElement,
|
||||
isFreeDrawElement,
|
||||
isTextElement,
|
||||
isFrameLikeElement,
|
||||
} from "../../element/typeChecks";
|
||||
import { getCommonBounds, getElementPointsCoords } from "../../element/bounds";
|
||||
import { getTextEditor } from "../queries/dom";
|
||||
import { arrayToMap } from "../../utils";
|
||||
import { createTestHook } from "../../components/App";
|
||||
import type { GlobalPoint, LocalPoint, Radians } from "@excalidraw/math";
|
||||
import { pointFrom, pointRotateRads } from "@excalidraw/math";
|
||||
import { cropElement } from "../../element/cropElement";
|
||||
import type { ToolType } from "../../types";
|
||||
|
||||
// so that window.h is available when App.tsx is not imported as well.
|
||||
|
|
|
@ -1,6 +1,43 @@
|
|||
import React from "react";
|
||||
import {
|
||||
queryByText,
|
||||
fireEvent,
|
||||
queryByTestId,
|
||||
waitFor,
|
||||
} from "@testing-library/react";
|
||||
import { vi } from "vitest";
|
||||
import { pointFrom } from "@excalidraw/math";
|
||||
|
||||
import type { LocalPoint, Radians } from "@excalidraw/math";
|
||||
|
||||
import "../global.d.ts";
|
||||
import "../../utils/test-utils";
|
||||
|
||||
import {
|
||||
actionSendBackward,
|
||||
actionBringForward,
|
||||
actionSendToBack,
|
||||
} from "../actions";
|
||||
import { createUndoAction, createRedoAction } from "../actions/actionHistory";
|
||||
import { actionToggleViewMode } from "../actions/actionToggleViewMode";
|
||||
import { getDefaultAppState } from "../appState";
|
||||
import { HistoryEntry } from "../history";
|
||||
import { Excalidraw } from "../index";
|
||||
import { KEYS } from "../keys";
|
||||
import * as StaticScene from "../renderer/staticScene";
|
||||
import { EXPORT_DATA_TYPES, MIME_TYPES, ORIG_ID } from "../constants";
|
||||
import { Snapshot, CaptureUpdateAction } from "../store";
|
||||
import { arrayToMap } from "../utils";
|
||||
import {
|
||||
COLOR_PALETTE,
|
||||
DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX,
|
||||
DEFAULT_ELEMENT_STROKE_COLOR_INDEX,
|
||||
} from "../colors";
|
||||
import { newElementWith } from "../element/mutateElement";
|
||||
import { AppStateChange, ElementsChange } from "../change";
|
||||
|
||||
import { API } from "./helpers/api";
|
||||
import { Keyboard, Pointer, UI } from "./helpers/ui";
|
||||
import {
|
||||
GlobalTestState,
|
||||
act,
|
||||
|
@ -9,24 +46,7 @@ import {
|
|||
togglePopover,
|
||||
getCloneByOrigId,
|
||||
} from "./test-utils";
|
||||
import "../../utils/test-utils";
|
||||
import { Excalidraw } from "../index";
|
||||
import { Keyboard, Pointer, UI } from "./helpers/ui";
|
||||
import { API } from "./helpers/api";
|
||||
import { getDefaultAppState } from "../appState";
|
||||
import { fireEvent, queryByTestId, waitFor } from "@testing-library/react";
|
||||
import { createUndoAction, createRedoAction } from "../actions/actionHistory";
|
||||
import { actionToggleViewMode } from "../actions/actionToggleViewMode";
|
||||
import { EXPORT_DATA_TYPES, MIME_TYPES, ORIG_ID } from "../constants";
|
||||
import type { AppState } from "../types";
|
||||
import { arrayToMap } from "../utils";
|
||||
import {
|
||||
COLOR_PALETTE,
|
||||
DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX,
|
||||
DEFAULT_ELEMENT_STROKE_COLOR_INDEX,
|
||||
} from "../colors";
|
||||
import { KEYS } from "../keys";
|
||||
import { newElementWith } from "../element/mutateElement";
|
||||
|
||||
import type {
|
||||
ExcalidrawElbowArrowElement,
|
||||
ExcalidrawFrameElement,
|
||||
|
@ -37,18 +57,7 @@ import type {
|
|||
FractionalIndex,
|
||||
SceneElementsMap,
|
||||
} from "../element/types";
|
||||
import {
|
||||
actionSendBackward,
|
||||
actionBringForward,
|
||||
actionSendToBack,
|
||||
} from "../actions";
|
||||
import { vi } from "vitest";
|
||||
import { queryByText } from "@testing-library/react";
|
||||
import { HistoryEntry } from "../history";
|
||||
import { AppStateChange, ElementsChange } from "../change";
|
||||
import { Snapshot, CaptureUpdateAction } from "../store";
|
||||
import type { LocalPoint, Radians } from "@excalidraw/math";
|
||||
import { pointFrom } from "@excalidraw/math";
|
||||
import type { AppState } from "../types";
|
||||
|
||||
const { h } = window;
|
||||
|
||||
|
|
|
@ -1,18 +1,20 @@
|
|||
import { act, queryByTestId } from "@testing-library/react";
|
||||
import React from "react";
|
||||
import { vi } from "vitest";
|
||||
import { fireEvent, getCloneByOrigId, render, waitFor } from "./test-utils";
|
||||
import { act, queryByTestId } from "@testing-library/react";
|
||||
|
||||
import { Excalidraw } from "../index";
|
||||
import { API } from "./helpers/api";
|
||||
import { MIME_TYPES, ORIG_ID } from "../constants";
|
||||
import type { LibraryItem, LibraryItems } from "../types";
|
||||
import { UI } from "./helpers/ui";
|
||||
import { parseLibraryJSON } from "../data/blob";
|
||||
import { serializeLibraryAsJSON } from "../data/json";
|
||||
import { distributeLibraryItemsOnSquareGrid } from "../data/library";
|
||||
import type { ExcalidrawGenericElement } from "../element/types";
|
||||
import { getCommonBoundingBox } from "../element/bounds";
|
||||
import { parseLibraryJSON } from "../data/blob";
|
||||
import { Excalidraw } from "../index";
|
||||
|
||||
import { API } from "./helpers/api";
|
||||
import { UI } from "./helpers/ui";
|
||||
import { fireEvent, getCloneByOrigId, render, waitFor } from "./test-utils";
|
||||
|
||||
import type { ExcalidrawGenericElement } from "../element/types";
|
||||
import type { LibraryItem, LibraryItems } from "../types";
|
||||
|
||||
const { h } = window;
|
||||
|
||||
|
|
|
@ -1,14 +1,25 @@
|
|||
import { pointCenter, pointFrom } from "@excalidraw/math";
|
||||
import { act, queryByTestId, queryByText } from "@testing-library/react";
|
||||
import React from "react";
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
ExcalidrawLinearElement,
|
||||
ExcalidrawTextElementWithContainer,
|
||||
FontString,
|
||||
} from "../element/types";
|
||||
import { vi } from "vitest";
|
||||
|
||||
import type { GlobalPoint } from "@excalidraw/math";
|
||||
|
||||
import { ROUNDNESS, VERTICAL_ALIGN } from "../constants";
|
||||
import { LinearElementEditor } from "../element/linearElementEditor";
|
||||
import {
|
||||
getBoundTextElementPosition,
|
||||
getBoundTextMaxWidth,
|
||||
} from "../element/textElement";
|
||||
import * as textElementUtils from "../element/textElement";
|
||||
import { wrapText } from "../element/textWrapping";
|
||||
import { Excalidraw, mutateElement } from "../index";
|
||||
import { KEYS } from "../keys";
|
||||
import { reseed } from "../random";
|
||||
import * as StaticScene from "../renderer/staticScene";
|
||||
import * as InteractiveCanvas from "../renderer/interactiveScene";
|
||||
import * as StaticScene from "../renderer/staticScene";
|
||||
import { API } from "../tests/helpers/api";
|
||||
import { arrayToMap } from "../utils";
|
||||
|
||||
import { Keyboard, Pointer, UI } from "./helpers/ui";
|
||||
import {
|
||||
|
@ -18,21 +29,13 @@ import {
|
|||
GlobalTestState,
|
||||
unmountComponent,
|
||||
} from "./test-utils";
|
||||
import { API } from "../tests/helpers/api";
|
||||
import { KEYS } from "../keys";
|
||||
import { LinearElementEditor } from "../element/linearElementEditor";
|
||||
import { act, queryByTestId, queryByText } from "@testing-library/react";
|
||||
import {
|
||||
getBoundTextElementPosition,
|
||||
getBoundTextMaxWidth,
|
||||
} from "../element/textElement";
|
||||
import * as textElementUtils from "../element/textElement";
|
||||
import { ROUNDNESS, VERTICAL_ALIGN } from "../constants";
|
||||
import { vi } from "vitest";
|
||||
import { arrayToMap } from "../utils";
|
||||
import type { GlobalPoint } from "@excalidraw/math";
|
||||
import { pointCenter, pointFrom } from "@excalidraw/math";
|
||||
import { wrapText } from "../element/textWrapping";
|
||||
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
ExcalidrawLinearElement,
|
||||
ExcalidrawTextElementWithContainer,
|
||||
FontString,
|
||||
} from "../element/types";
|
||||
|
||||
const renderInteractiveScene = vi.spyOn(
|
||||
InteractiveCanvas,
|
||||
|
|
|
@ -1,19 +1,22 @@
|
|||
import React from "react";
|
||||
import { vi } from "vitest";
|
||||
|
||||
import "../../utils/test-utils";
|
||||
import { render, fireEvent, act, unmountComponent } from "./test-utils";
|
||||
import { Excalidraw } from "../index";
|
||||
import * as StaticScene from "../renderer/staticScene";
|
||||
import * as InteractiveCanvas from "../renderer/interactiveScene";
|
||||
import { reseed } from "../random";
|
||||
import { bindOrUnbindLinearElement } from "../element/binding";
|
||||
import { Excalidraw } from "../index";
|
||||
import { KEYS } from "../keys";
|
||||
import { reseed } from "../random";
|
||||
import * as InteractiveCanvas from "../renderer/interactiveScene";
|
||||
import * as StaticScene from "../renderer/staticScene";
|
||||
|
||||
import { UI, Pointer, Keyboard } from "./helpers/ui";
|
||||
import { render, fireEvent, act, unmountComponent } from "./test-utils";
|
||||
|
||||
import type {
|
||||
ExcalidrawLinearElement,
|
||||
NonDeleted,
|
||||
ExcalidrawRectangleElement,
|
||||
} from "../element/types";
|
||||
import { UI, Pointer, Keyboard } from "./helpers/ui";
|
||||
import { KEYS } from "../keys";
|
||||
import { vi } from "vitest";
|
||||
import type Scene from "../scene/Scene";
|
||||
|
||||
unmountComponent();
|
||||
|
|
|
@ -1,4 +1,12 @@
|
|||
import React from "react";
|
||||
import { vi } from "vitest";
|
||||
|
||||
import { Excalidraw } from "../index";
|
||||
import { KEYS } from "../keys";
|
||||
import { reseed } from "../random";
|
||||
import * as InteractiveCanvas from "../renderer/interactiveScene";
|
||||
import * as StaticScene from "../renderer/staticScene";
|
||||
|
||||
import {
|
||||
render,
|
||||
fireEvent,
|
||||
|
@ -6,13 +14,8 @@ import {
|
|||
restoreOriginalGetBoundingClientRect,
|
||||
unmountComponent,
|
||||
} from "./test-utils";
|
||||
import { Excalidraw } from "../index";
|
||||
import * as StaticScene from "../renderer/staticScene";
|
||||
import * as InteractiveCanvas from "../renderer/interactiveScene";
|
||||
import { KEYS } from "../keys";
|
||||
|
||||
import type { ExcalidrawLinearElement } from "../element/types";
|
||||
import { reseed } from "../random";
|
||||
import { vi } from "vitest";
|
||||
|
||||
unmountComponent();
|
||||
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
import React from "react";
|
||||
import { vi } from "vitest";
|
||||
|
||||
import { Excalidraw, CaptureUpdateAction } from "../../index";
|
||||
import type { ExcalidrawImperativeAPI } from "../../types";
|
||||
import { resolvablePromise } from "../../utils";
|
||||
import { render } from "../test-utils";
|
||||
import { Pointer } from "../helpers/ui";
|
||||
import { API } from "../helpers/api";
|
||||
import { Pointer } from "../helpers/ui";
|
||||
import { render } from "../test-utils";
|
||||
|
||||
import type { ExcalidrawImperativeAPI } from "../../types";
|
||||
|
||||
describe("event callbacks", () => {
|
||||
const h = window.h;
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
import { queries, buildQueries } from "@testing-library/react";
|
||||
import type { ToolType } from "../../types";
|
||||
|
||||
import { TOOL_TYPE } from "../../constants";
|
||||
|
||||
import type { ToolType } from "../../types";
|
||||
|
||||
const _getAllByToolName = (container: HTMLElement, tool: ToolType | "lock") => {
|
||||
const toolTitle = tool === "lock" ? "lock" : TOOL_TYPE[tool];
|
||||
return queries.getAllByTestId(container, `toolbar-${toolTitle}`);
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
import React from "react";
|
||||
import type { ExcalidrawElement } from "../element/types";
|
||||
import { CODES, KEYS } from "../keys";
|
||||
import { vi } from "vitest";
|
||||
|
||||
import { FONT_FAMILY } from "../constants";
|
||||
import { Excalidraw } from "../index";
|
||||
import { CODES, KEYS } from "../keys";
|
||||
import { reseed } from "../random";
|
||||
import * as StaticScene from "../renderer/staticScene";
|
||||
import { setDateTimeForTests } from "../utils";
|
||||
|
||||
import { API } from "./helpers/api";
|
||||
import { Keyboard, Pointer, UI } from "./helpers/ui";
|
||||
import {
|
||||
|
@ -15,8 +18,8 @@ import {
|
|||
togglePopover,
|
||||
unmountComponent,
|
||||
} from "./test-utils";
|
||||
import { FONT_FAMILY } from "../constants";
|
||||
import { vi } from "vitest";
|
||||
|
||||
import type { ExcalidrawElement } from "../element/types";
|
||||
|
||||
const { h } = window;
|
||||
|
||||
|
|
|
@ -1,24 +1,28 @@
|
|||
import { pointFrom } from "@excalidraw/math";
|
||||
import React from "react";
|
||||
import { render, unmountComponent } from "./test-utils";
|
||||
|
||||
import type { LocalPoint } from "@excalidraw/math";
|
||||
|
||||
import { getElementPointsCoords } from "../element/bounds";
|
||||
import { LinearElementEditor } from "../element/linearElementEditor";
|
||||
import { resizeSingleElement } from "../element/resizeElements";
|
||||
import { isLinearElement } from "../element/typeChecks";
|
||||
import { Excalidraw } from "../index";
|
||||
import { KEYS } from "../keys";
|
||||
import { getSizeFromPoints } from "../points";
|
||||
import { reseed } from "../random";
|
||||
import { arrayToMap } from "../utils";
|
||||
|
||||
import { API } from "./helpers/api";
|
||||
import { UI, Keyboard, Pointer } from "./helpers/ui";
|
||||
import { render, unmountComponent } from "./test-utils";
|
||||
|
||||
import type { Bounds } from "../element/bounds";
|
||||
import type {
|
||||
ExcalidrawElbowArrowElement,
|
||||
ExcalidrawFreeDrawElement,
|
||||
ExcalidrawLinearElement,
|
||||
} from "../element/types";
|
||||
import type { Bounds } from "../element/bounds";
|
||||
import { getElementPointsCoords } from "../element/bounds";
|
||||
import { Excalidraw } from "../index";
|
||||
import { API } from "./helpers/api";
|
||||
import { KEYS } from "../keys";
|
||||
import { isLinearElement } from "../element/typeChecks";
|
||||
import { LinearElementEditor } from "../element/linearElementEditor";
|
||||
import { arrayToMap } from "../utils";
|
||||
import type { LocalPoint } from "@excalidraw/math";
|
||||
import { pointFrom } from "@excalidraw/math";
|
||||
import { resizeSingleElement } from "../element/resizeElements";
|
||||
import { getSizeFromPoints } from "../points";
|
||||
|
||||
unmountComponent();
|
||||
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
import React from "react";
|
||||
import { render, unmountComponent } from "./test-utils";
|
||||
import { reseed } from "../random";
|
||||
import { UI } from "./helpers/ui";
|
||||
import { Excalidraw } from "../index";
|
||||
import { expect } from "vitest";
|
||||
|
||||
import { Excalidraw } from "../index";
|
||||
import { reseed } from "../random";
|
||||
|
||||
import { UI } from "./helpers/ui";
|
||||
import { render, unmountComponent } from "./test-utils";
|
||||
|
||||
unmountComponent();
|
||||
|
||||
beforeEach(() => {
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import type {
|
||||
ExcalidrawTextElement,
|
||||
FractionalIndex,
|
||||
NonDeletedExcalidrawElement,
|
||||
} from "../../element/types";
|
||||
import { exportToCanvas, exportToSvg } from "@excalidraw/utils";
|
||||
|
||||
import { FONT_FAMILY, FRAME_STYLE } from "../../constants";
|
||||
import { prepareElementsForExport } from "../../data";
|
||||
import * as exportUtils from "../../scene/export";
|
||||
import {
|
||||
diamondFixture,
|
||||
|
@ -11,9 +10,12 @@ import {
|
|||
textFixture,
|
||||
} from "../fixtures/elementFixture";
|
||||
import { API } from "../helpers/api";
|
||||
import { exportToCanvas, exportToSvg } from "@excalidraw/utils";
|
||||
import { FONT_FAMILY, FRAME_STYLE } from "../../constants";
|
||||
import { prepareElementsForExport } from "../../data";
|
||||
|
||||
import type {
|
||||
ExcalidrawTextElement,
|
||||
FractionalIndex,
|
||||
NonDeletedExcalidrawElement,
|
||||
} from "../../element/types";
|
||||
|
||||
describe("exportToSvg", () => {
|
||||
const ELEMENT_HEIGHT = 100;
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
import React from "react";
|
||||
|
||||
import { Excalidraw } from "../index";
|
||||
import { KEYS } from "../keys";
|
||||
|
||||
import { API } from "./helpers/api";
|
||||
import { Keyboard } from "./helpers/ui";
|
||||
import {
|
||||
mockBoundingClientRect,
|
||||
render,
|
||||
restoreOriginalGetBoundingClientRect,
|
||||
waitFor,
|
||||
} from "./test-utils";
|
||||
import { Excalidraw } from "../index";
|
||||
import { API } from "./helpers/api";
|
||||
import { Keyboard } from "./helpers/ui";
|
||||
import { KEYS } from "../keys";
|
||||
|
||||
const { h } = window;
|
||||
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
import React from "react";
|
||||
import { act, render, waitFor } from "./test-utils";
|
||||
import { Excalidraw } from "../index";
|
||||
|
||||
import { CANVAS_SEARCH_TAB, CLASSES, DEFAULT_SIDEBAR } from "../constants";
|
||||
import { Keyboard } from "./helpers/ui";
|
||||
import { Excalidraw } from "../index";
|
||||
import { KEYS } from "../keys";
|
||||
import { updateTextEditor } from "./queries/dom";
|
||||
|
||||
import { API } from "./helpers/api";
|
||||
import { Keyboard } from "./helpers/ui";
|
||||
import { updateTextEditor } from "./queries/dom";
|
||||
import { act, render, waitFor } from "./test-utils";
|
||||
|
||||
import type { ExcalidrawTextElement } from "../element/types";
|
||||
|
||||
const { h } = window;
|
||||
|
|
|
@ -1,4 +1,15 @@
|
|||
import React from "react";
|
||||
import { vi } from "vitest";
|
||||
|
||||
import { Excalidraw } from "../index";
|
||||
import { KEYS } from "../keys";
|
||||
import { reseed } from "../random";
|
||||
import * as InteractiveCanvas from "../renderer/interactiveScene";
|
||||
import * as StaticScene from "../renderer/staticScene";
|
||||
import { SHAPES } from "../shapes";
|
||||
|
||||
import { API } from "./helpers/api";
|
||||
import { Keyboard, Pointer, UI } from "./helpers/ui";
|
||||
import {
|
||||
render,
|
||||
fireEvent,
|
||||
|
@ -7,15 +18,6 @@ import {
|
|||
assertSelectedElements,
|
||||
unmountComponent,
|
||||
} from "./test-utils";
|
||||
import { Excalidraw } from "../index";
|
||||
import * as StaticScene from "../renderer/staticScene";
|
||||
import * as InteractiveCanvas from "../renderer/interactiveScene";
|
||||
import { KEYS } from "../keys";
|
||||
import { reseed } from "../random";
|
||||
import { API } from "./helpers/api";
|
||||
import { Keyboard, Pointer, UI } from "./helpers/ui";
|
||||
import { SHAPES } from "../shapes";
|
||||
import { vi } from "vitest";
|
||||
|
||||
unmountComponent();
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
import React from "react";
|
||||
import { KEYS } from "../keys";
|
||||
|
||||
import { Excalidraw } from "../index";
|
||||
import { KEYS } from "../keys";
|
||||
|
||||
import { API } from "./helpers/api";
|
||||
import { Keyboard } from "./helpers/ui";
|
||||
import { fireEvent, render, waitFor } from "./test-utils";
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
import "pepjs";
|
||||
|
||||
import type { RenderResult, RenderOptions } from "@testing-library/react";
|
||||
import { act } from "@testing-library/react";
|
||||
import {
|
||||
render,
|
||||
|
@ -9,16 +7,20 @@ import {
|
|||
fireEvent,
|
||||
cleanup,
|
||||
} from "@testing-library/react";
|
||||
|
||||
import * as toolQueries from "./queries/toolQueries";
|
||||
import type { ImportedDataState } from "../data/types";
|
||||
import { STORAGE_KEYS } from "../../../excalidraw-app/app_constants";
|
||||
import { getSelectedElements } from "../scene/selection";
|
||||
import type { ExcalidrawElement } from "../element/types";
|
||||
import { UI } from "./helpers/ui";
|
||||
import ansi from "ansicolor";
|
||||
|
||||
import { STORAGE_KEYS } from "../../../excalidraw-app/app_constants";
|
||||
import { ORIG_ID } from "../constants";
|
||||
import { getSelectedElements } from "../scene/selection";
|
||||
import { arrayToMap } from "../utils";
|
||||
|
||||
import { UI } from "./helpers/ui";
|
||||
import * as toolQueries from "./queries/toolQueries";
|
||||
|
||||
import type { RenderResult, RenderOptions } from "@testing-library/react";
|
||||
|
||||
import type { ImportedDataState } from "../data/types";
|
||||
import type { ExcalidrawElement } from "../element/types";
|
||||
import type { AllPossibleKeys } from "../utility-types";
|
||||
|
||||
export { cleanup as unmountComponent };
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
import React from "react";
|
||||
|
||||
import { Excalidraw } from "../index";
|
||||
import type { ExcalidrawImperativeAPI } from "../types";
|
||||
import { resolvablePromise } from "../utils";
|
||||
import { act, render } from "./test-utils";
|
||||
|
||||
import { Pointer } from "./helpers/ui";
|
||||
import { act, render } from "./test-utils";
|
||||
|
||||
import type { ExcalidrawImperativeAPI } from "../types";
|
||||
|
||||
describe("setActiveTool()", () => {
|
||||
const h = window.h;
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
import React from "react";
|
||||
import { render, GlobalTestState } from "./test-utils";
|
||||
|
||||
import { CURSOR_TYPE } from "../constants";
|
||||
import { Excalidraw } from "../index";
|
||||
import { KEYS } from "../keys";
|
||||
import { Keyboard, Pointer, UI } from "./helpers/ui";
|
||||
import { CURSOR_TYPE } from "../constants";
|
||||
|
||||
import { API } from "./helpers/api";
|
||||
import { Keyboard, Pointer, UI } from "./helpers/ui";
|
||||
import { render, GlobalTestState } from "./test-utils";
|
||||
|
||||
const mouse = new Pointer("mouse");
|
||||
const touch = new Pointer("touch");
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import React from "react";
|
||||
import { act, getCloneByOrigId, render, unmountComponent } from "./test-utils";
|
||||
import { Excalidraw } from "../index";
|
||||
import { reseed } from "../random";
|
||||
|
||||
import {
|
||||
actionSendBackward,
|
||||
actionBringForward,
|
||||
|
@ -9,14 +7,19 @@ import {
|
|||
actionSendToBack,
|
||||
actionDuplicateSelection,
|
||||
} from "../actions";
|
||||
import type { AppState } from "../types";
|
||||
import { API } from "./helpers/api";
|
||||
import { selectGroupsForSelectedElements } from "../groups";
|
||||
import { Excalidraw } from "../index";
|
||||
import { reseed } from "../random";
|
||||
|
||||
import { API } from "./helpers/api";
|
||||
import { act, getCloneByOrigId, render, unmountComponent } from "./test-utils";
|
||||
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
ExcalidrawFrameElement,
|
||||
ExcalidrawSelectionElement,
|
||||
} from "../element/types";
|
||||
import type { AppState } from "../types";
|
||||
|
||||
unmountComponent();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue