mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Extend tests
This commit is contained in:
parent
224a69aa10
commit
045dc9cc3e
1 changed files with 11 additions and 3 deletions
|
@ -1,5 +1,4 @@
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { vi } from "vitest";
|
|
||||||
|
|
||||||
import { pointFrom } from "@excalidraw/math";
|
import { pointFrom } from "@excalidraw/math";
|
||||||
|
|
||||||
|
@ -7,7 +6,6 @@ import { Excalidraw } from "../index";
|
||||||
|
|
||||||
import { KEYS } from "../keys";
|
import { KEYS } from "../keys";
|
||||||
|
|
||||||
import { API } from "./helpers/api";
|
|
||||||
import { UI } from "./helpers/ui";
|
import { UI } from "./helpers/ui";
|
||||||
import { Keyboard, Pointer } from "./helpers/ui";
|
import { Keyboard, Pointer } from "./helpers/ui";
|
||||||
import { render } from "./test-utils";
|
import { render } from "./test-utils";
|
||||||
|
@ -21,7 +19,7 @@ describe("arrow undo/redo", () => {
|
||||||
|
|
||||||
it("should maintain arrow shape after undo/redo", () => {
|
it("should maintain arrow shape after undo/redo", () => {
|
||||||
// Create a rectangle
|
// Create a rectangle
|
||||||
const rectangle = UI.createElement("rectangle", {
|
UI.createElement("rectangle", {
|
||||||
x: 100,
|
x: 100,
|
||||||
y: 100,
|
y: 100,
|
||||||
width: 100,
|
width: 100,
|
||||||
|
@ -52,5 +50,15 @@ describe("arrow undo/redo", () => {
|
||||||
|
|
||||||
// Verify arrow points are exactly the same after redo
|
// Verify arrow points are exactly the same after redo
|
||||||
expect(arrow.points).toEqual(originalPoints);
|
expect(arrow.points).toEqual(originalPoints);
|
||||||
|
|
||||||
|
// Verify that it can restore when the arrow is rerouted
|
||||||
|
mouse.downAt(100, 100);
|
||||||
|
mouse.moveTo(103, 100);
|
||||||
|
mouse.moveTo(100, 100);
|
||||||
|
mouse.up();
|
||||||
|
|
||||||
|
Keyboard.undo();
|
||||||
|
|
||||||
|
expect(arrow.points).toEqual(originalPoints);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue