|
@@ -6,7 +6,7 @@ import {
|
|
restoreOriginalGetBoundingClientRect,
|
|
restoreOriginalGetBoundingClientRect,
|
|
assertSelectedElements,
|
|
assertSelectedElements,
|
|
} from "./test-utils";
|
|
} from "./test-utils";
|
|
-import ExcalidrawApp from "../excalidraw-app";
|
|
|
|
|
|
+import { Excalidraw } from "../packages/excalidraw/index";
|
|
import * as Renderer from "../renderer/renderScene";
|
|
import * as Renderer from "../renderer/renderScene";
|
|
import { KEYS } from "../keys";
|
|
import { KEYS } from "../keys";
|
|
import { reseed } from "../random";
|
|
import { reseed } from "../random";
|
|
@@ -34,7 +34,7 @@ const mouse = new Pointer("mouse");
|
|
|
|
|
|
describe("box-selection", () => {
|
|
describe("box-selection", () => {
|
|
beforeEach(async () => {
|
|
beforeEach(async () => {
|
|
- await render(<ExcalidrawApp />);
|
|
|
|
|
|
+ await render(<Excalidraw />);
|
|
});
|
|
});
|
|
|
|
|
|
it("should allow adding to selection via box-select when holding shift", async () => {
|
|
it("should allow adding to selection via box-select when holding shift", async () => {
|
|
@@ -102,7 +102,7 @@ describe("box-selection", () => {
|
|
|
|
|
|
describe("inner box-selection", () => {
|
|
describe("inner box-selection", () => {
|
|
beforeEach(async () => {
|
|
beforeEach(async () => {
|
|
- await render(<ExcalidrawApp />);
|
|
|
|
|
|
+ await render(<Excalidraw />);
|
|
});
|
|
});
|
|
it("selecting elements visually nested inside another", async () => {
|
|
it("selecting elements visually nested inside another", async () => {
|
|
const rect1 = API.createElement({
|
|
const rect1 = API.createElement({
|
|
@@ -218,7 +218,7 @@ describe("inner box-selection", () => {
|
|
|
|
|
|
describe("selection element", () => {
|
|
describe("selection element", () => {
|
|
it("create selection element on pointer down", async () => {
|
|
it("create selection element on pointer down", async () => {
|
|
- const { getByToolName, container } = await render(<ExcalidrawApp />);
|
|
|
|
|
|
+ const { getByToolName, container } = await render(<Excalidraw />);
|
|
// select tool
|
|
// select tool
|
|
const tool = getByToolName("selection");
|
|
const tool = getByToolName("selection");
|
|
fireEvent.click(tool);
|
|
fireEvent.click(tool);
|
|
@@ -239,7 +239,7 @@ describe("selection element", () => {
|
|
});
|
|
});
|
|
|
|
|
|
it("resize selection element on pointer move", async () => {
|
|
it("resize selection element on pointer move", async () => {
|
|
- const { getByToolName, container } = await render(<ExcalidrawApp />);
|
|
|
|
|
|
+ const { getByToolName, container } = await render(<Excalidraw />);
|
|
// select tool
|
|
// select tool
|
|
const tool = getByToolName("selection");
|
|
const tool = getByToolName("selection");
|
|
fireEvent.click(tool);
|
|
fireEvent.click(tool);
|
|
@@ -261,7 +261,7 @@ describe("selection element", () => {
|
|
});
|
|
});
|
|
|
|
|
|
it("remove selection element on pointer up", async () => {
|
|
it("remove selection element on pointer up", async () => {
|
|
- const { getByToolName, container } = await render(<ExcalidrawApp />);
|
|
|
|
|
|
+ const { getByToolName, container } = await render(<Excalidraw />);
|
|
// select tool
|
|
// select tool
|
|
const tool = getByToolName("selection");
|
|
const tool = getByToolName("selection");
|
|
fireEvent.click(tool);
|
|
fireEvent.click(tool);
|
|
@@ -287,7 +287,9 @@ describe("select single element on the scene", () => {
|
|
});
|
|
});
|
|
|
|
|
|
it("rectangle", async () => {
|
|
it("rectangle", async () => {
|
|
- const { getByToolName, container } = await render(<ExcalidrawApp />);
|
|
|
|
|
|
+ const { getByToolName, container } = await render(
|
|
|
|
+ <Excalidraw handleKeyboardGlobally={true} />,
|
|
|
|
+ );
|
|
const canvas = container.querySelector("canvas.interactive")!;
|
|
const canvas = container.querySelector("canvas.interactive")!;
|
|
{
|
|
{
|
|
// create element
|
|
// create element
|
|
@@ -317,7 +319,9 @@ describe("select single element on the scene", () => {
|
|
});
|
|
});
|
|
|
|
|
|
it("diamond", async () => {
|
|
it("diamond", async () => {
|
|
- const { getByToolName, container } = await render(<ExcalidrawApp />);
|
|
|
|
|
|
+ const { getByToolName, container } = await render(
|
|
|
|
+ <Excalidraw handleKeyboardGlobally={true} />,
|
|
|
|
+ );
|
|
const canvas = container.querySelector("canvas.interactive")!;
|
|
const canvas = container.querySelector("canvas.interactive")!;
|
|
{
|
|
{
|
|
// create element
|
|
// create element
|
|
@@ -347,7 +351,9 @@ describe("select single element on the scene", () => {
|
|
});
|
|
});
|
|
|
|
|
|
it("ellipse", async () => {
|
|
it("ellipse", async () => {
|
|
- const { getByToolName, container } = await render(<ExcalidrawApp />);
|
|
|
|
|
|
+ const { getByToolName, container } = await render(
|
|
|
|
+ <Excalidraw handleKeyboardGlobally={true} />,
|
|
|
|
+ );
|
|
const canvas = container.querySelector("canvas.interactive")!;
|
|
const canvas = container.querySelector("canvas.interactive")!;
|
|
{
|
|
{
|
|
// create element
|
|
// create element
|
|
@@ -377,7 +383,9 @@ describe("select single element on the scene", () => {
|
|
});
|
|
});
|
|
|
|
|
|
it("arrow", async () => {
|
|
it("arrow", async () => {
|
|
- const { getByToolName, container } = await render(<ExcalidrawApp />);
|
|
|
|
|
|
+ const { getByToolName, container } = await render(
|
|
|
|
+ <Excalidraw handleKeyboardGlobally={true} />,
|
|
|
|
+ );
|
|
const canvas = container.querySelector("canvas.interactive")!;
|
|
const canvas = container.querySelector("canvas.interactive")!;
|
|
{
|
|
{
|
|
// create element
|
|
// create element
|
|
@@ -419,7 +427,9 @@ describe("select single element on the scene", () => {
|
|
});
|
|
});
|
|
|
|
|
|
it("arrow escape", async () => {
|
|
it("arrow escape", async () => {
|
|
- const { getByToolName, container } = await render(<ExcalidrawApp />);
|
|
|
|
|
|
+ const { getByToolName, container } = await render(
|
|
|
|
+ <Excalidraw handleKeyboardGlobally={true} />,
|
|
|
|
+ );
|
|
const canvas = container.querySelector("canvas.interactive")!;
|
|
const canvas = container.querySelector("canvas.interactive")!;
|
|
{
|
|
{
|
|
// create element
|
|
// create element
|
|
@@ -464,7 +474,7 @@ describe("select single element on the scene", () => {
|
|
|
|
|
|
describe("tool locking & selection", () => {
|
|
describe("tool locking & selection", () => {
|
|
it("should not select newly created element while tool is locked", async () => {
|
|
it("should not select newly created element while tool is locked", async () => {
|
|
- await render(<ExcalidrawApp />);
|
|
|
|
|
|
+ await render(<Excalidraw />);
|
|
|
|
|
|
UI.clickTool("lock");
|
|
UI.clickTool("lock");
|
|
expect(h.state.activeTool.locked).toBe(true);
|
|
expect(h.state.activeTool.locked).toBe(true);
|
|
@@ -480,7 +490,7 @@ describe("tool locking & selection", () => {
|
|
|
|
|
|
describe("selectedElementIds stability", () => {
|
|
describe("selectedElementIds stability", () => {
|
|
beforeEach(async () => {
|
|
beforeEach(async () => {
|
|
- await render(<ExcalidrawApp />);
|
|
|
|
|
|
+ await render(<Excalidraw />);
|
|
});
|
|
});
|
|
|
|
|
|
it("box-selection should be stable when not changing selection", () => {
|
|
it("box-selection should be stable when not changing selection", () => {
|