mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
refactor: rename elementType to activeTool and make it an object (#4968)
* refactor: rename elementType to activeTool * update docs * fix snap * update activeToll to be an object and review fixes * fix tests * fix
This commit is contained in:
parent
2209e2c1e8
commit
127af9db23
25 changed files with 364 additions and 207 deletions
|
@ -297,12 +297,12 @@ describe("restoreElements", () => {
|
|||
describe("restoreAppState", () => {
|
||||
it("should restore with imported data", () => {
|
||||
const stubImportedAppState = getDefaultAppState();
|
||||
stubImportedAppState.elementType = "selection";
|
||||
stubImportedAppState.activeTool.type = "selection";
|
||||
stubImportedAppState.cursorButton = "down";
|
||||
stubImportedAppState.name = "imported app state";
|
||||
|
||||
const stubLocalAppState = getDefaultAppState();
|
||||
stubLocalAppState.elementType = "rectangle";
|
||||
stubLocalAppState.activeTool.type = "rectangle";
|
||||
stubLocalAppState.cursorButton = "up";
|
||||
stubLocalAppState.name = "local app state";
|
||||
|
||||
|
@ -310,7 +310,7 @@ describe("restoreAppState", () => {
|
|||
stubImportedAppState,
|
||||
stubLocalAppState,
|
||||
);
|
||||
expect(restoredAppState.elementType).toBe(stubImportedAppState.elementType);
|
||||
expect(restoredAppState.activeTool).toBe(stubImportedAppState.activeTool);
|
||||
expect(restoredAppState.cursorButton).toBe(
|
||||
stubImportedAppState.cursorButton,
|
||||
);
|
||||
|
@ -391,14 +391,14 @@ describe("restoreAppState", () => {
|
|||
it("when imported data state has a not allowed Excalidraw Element Types", () => {
|
||||
const stubImportedAppState: any = getDefaultAppState();
|
||||
|
||||
stubImportedAppState.elementType = "not allowed Excalidraw Element Types";
|
||||
stubImportedAppState.activeTool = "not allowed Excalidraw Element Types";
|
||||
const stubLocalAppState = getDefaultAppState();
|
||||
|
||||
const restoredAppState = restore.restoreAppState(
|
||||
stubImportedAppState,
|
||||
stubLocalAppState,
|
||||
);
|
||||
expect(restoredAppState.elementType).toBe("selection");
|
||||
expect(restoredAppState.activeTool.type).toBe("selection");
|
||||
});
|
||||
|
||||
describe("with zoom in imported data state", () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue