From 6ec259a0e71174651bae95d4628138bf6fd68742 Mon Sep 17 00:00:00 2001 From: kj_sh604 Date: Sun, 15 Mar 2026 16:19:35 -0400 Subject: refactor: packages/ --- packages/excalidraw/tests/App.test.tsx | 45 + .../excalidraw/tests/MermaidToExcalidraw.test.tsx | 117 + .../tests/__snapshots__/App.test.tsx.snap | 50 + .../MermaidToExcalidraw.test.tsx.snap | 19 + .../tests/__snapshots__/MobileMenu.test.tsx.snap | 257 + .../tests/__snapshots__/charts.test.tsx.snap | 20 + .../tests/__snapshots__/contextmenu.test.tsx.snap | 9977 +++++++++ .../tests/__snapshots__/dragCreate.test.tsx.snap | 210 + .../tests/__snapshots__/excalidraw.test.tsx.snap | 654 + .../tests/__snapshots__/export.test.tsx.snap | 11 + .../tests/__snapshots__/history.test.tsx.snap | 20131 +++++++++++++++++++ .../linearElementEditor.test.tsx.snap | 57 + .../tests/__snapshots__/move.test.tsx.snap | 239 + .../__snapshots__/multiPointCreate.test.tsx.snap | 114 + .../__snapshots__/regressionTests.test.tsx.snap | 14782 ++++++++++++++ .../tests/__snapshots__/selection.test.tsx.snap | 202 + packages/excalidraw/tests/actionStyles.test.tsx | 84 + packages/excalidraw/tests/align.test.tsx | 579 + packages/excalidraw/tests/appState.test.tsx | 81 + packages/excalidraw/tests/binding.test.tsx | 481 + packages/excalidraw/tests/charts.test.tsx | 13 + packages/excalidraw/tests/clients.test.ts | 39 + packages/excalidraw/tests/clipboard.test.tsx | 521 + packages/excalidraw/tests/contextmenu.test.tsx | 625 + packages/excalidraw/tests/cropElement.test.tsx | 342 + .../tests/data/__snapshots__/restore.test.ts.snap | 397 + packages/excalidraw/tests/data/reconcile.test.ts | 382 + packages/excalidraw/tests/data/restore.test.ts | 815 + packages/excalidraw/tests/dragCreate.test.tsx | 347 + packages/excalidraw/tests/elementLocking.test.tsx | 388 + packages/excalidraw/tests/excalidraw.test.tsx | 409 + packages/excalidraw/tests/export.test.tsx | 197 + packages/excalidraw/tests/fitToContent.test.tsx | 191 + packages/excalidraw/tests/fixtures/deer.png | Bin 0 -> 12468 bytes .../excalidraw/tests/fixtures/diagramFixture.ts | 33 + .../excalidraw/tests/fixtures/elementFixture.ts | 67 + .../tests/fixtures/fixture_library.excalidrawlib | 31 + packages/excalidraw/tests/fixtures/smiley.png | Bin 0 -> 1255 bytes .../tests/fixtures/smiley_embedded_v2.png | Bin 0 -> 2097 bytes .../tests/fixtures/smiley_embedded_v2.svg | 16 + .../fixtures/svg-image-exporting-reference.svg | 16 + .../excalidraw/tests/fixtures/test_embedded_v1.png | Bin 0 -> 1768 bytes .../excalidraw/tests/fixtures/test_embedded_v1.svg | 16 + packages/excalidraw/tests/flip.test.tsx | 895 + packages/excalidraw/tests/fractionalIndex.test.ts | 807 + packages/excalidraw/tests/helpers/api.ts | 511 + packages/excalidraw/tests/helpers/colorize.ts | 2 + packages/excalidraw/tests/helpers/mocks.ts | 32 + packages/excalidraw/tests/helpers/polyfills.ts | 95 + packages/excalidraw/tests/helpers/ui.ts | 647 + packages/excalidraw/tests/history.test.tsx | 4938 +++++ packages/excalidraw/tests/library.test.tsx | 341 + .../excalidraw/tests/linearElementEditor.test.tsx | 1380 ++ packages/excalidraw/tests/move.test.tsx | 180 + .../excalidraw/tests/multiPointCreate.test.tsx | 177 + .../__snapshots__/excalidraw.test.tsx.snap | 616 + .../packages/__snapshots__/utils.test.ts.snap | 103 + packages/excalidraw/tests/packages/events.test.tsx | 65 + packages/excalidraw/tests/queries/dom.ts | 19 + packages/excalidraw/tests/queries/toolQueries.ts | 25 + packages/excalidraw/tests/regressionTests.test.tsx | 1183 ++ packages/excalidraw/tests/resize.test.tsx | 1344 ++ packages/excalidraw/tests/rotate.test.tsx | 81 + .../tests/scene/__snapshots__/export.test.ts.snap | 251 + packages/excalidraw/tests/scene/export.test.ts | 521 + packages/excalidraw/tests/scroll.test.tsx | 112 + packages/excalidraw/tests/search.test.tsx | 148 + packages/excalidraw/tests/selection.test.tsx | 536 + packages/excalidraw/tests/shortcuts.test.tsx | 31 + packages/excalidraw/tests/test-utils.ts | 425 + packages/excalidraw/tests/tool.test.tsx | 64 + packages/excalidraw/tests/utils.test.ts | 13 + packages/excalidraw/tests/viewMode.test.tsx | 68 + packages/excalidraw/tests/zindex.test.tsx | 1502 ++ 74 files changed, 70067 insertions(+) create mode 100644 packages/excalidraw/tests/App.test.tsx create mode 100644 packages/excalidraw/tests/MermaidToExcalidraw.test.tsx create mode 100644 packages/excalidraw/tests/__snapshots__/App.test.tsx.snap create mode 100644 packages/excalidraw/tests/__snapshots__/MermaidToExcalidraw.test.tsx.snap create mode 100644 packages/excalidraw/tests/__snapshots__/MobileMenu.test.tsx.snap create mode 100644 packages/excalidraw/tests/__snapshots__/charts.test.tsx.snap create mode 100644 packages/excalidraw/tests/__snapshots__/contextmenu.test.tsx.snap create mode 100644 packages/excalidraw/tests/__snapshots__/dragCreate.test.tsx.snap create mode 100644 packages/excalidraw/tests/__snapshots__/excalidraw.test.tsx.snap create mode 100644 packages/excalidraw/tests/__snapshots__/export.test.tsx.snap create mode 100644 packages/excalidraw/tests/__snapshots__/history.test.tsx.snap create mode 100644 packages/excalidraw/tests/__snapshots__/linearElementEditor.test.tsx.snap create mode 100644 packages/excalidraw/tests/__snapshots__/move.test.tsx.snap create mode 100644 packages/excalidraw/tests/__snapshots__/multiPointCreate.test.tsx.snap create mode 100644 packages/excalidraw/tests/__snapshots__/regressionTests.test.tsx.snap create mode 100644 packages/excalidraw/tests/__snapshots__/selection.test.tsx.snap create mode 100644 packages/excalidraw/tests/actionStyles.test.tsx create mode 100644 packages/excalidraw/tests/align.test.tsx create mode 100644 packages/excalidraw/tests/appState.test.tsx create mode 100644 packages/excalidraw/tests/binding.test.tsx create mode 100644 packages/excalidraw/tests/charts.test.tsx create mode 100644 packages/excalidraw/tests/clients.test.ts create mode 100644 packages/excalidraw/tests/clipboard.test.tsx create mode 100644 packages/excalidraw/tests/contextmenu.test.tsx create mode 100644 packages/excalidraw/tests/cropElement.test.tsx create mode 100644 packages/excalidraw/tests/data/__snapshots__/restore.test.ts.snap create mode 100644 packages/excalidraw/tests/data/reconcile.test.ts create mode 100644 packages/excalidraw/tests/data/restore.test.ts create mode 100644 packages/excalidraw/tests/dragCreate.test.tsx create mode 100644 packages/excalidraw/tests/elementLocking.test.tsx create mode 100644 packages/excalidraw/tests/excalidraw.test.tsx create mode 100644 packages/excalidraw/tests/export.test.tsx create mode 100644 packages/excalidraw/tests/fitToContent.test.tsx create mode 100644 packages/excalidraw/tests/fixtures/deer.png create mode 100644 packages/excalidraw/tests/fixtures/diagramFixture.ts create mode 100644 packages/excalidraw/tests/fixtures/elementFixture.ts create mode 100644 packages/excalidraw/tests/fixtures/fixture_library.excalidrawlib create mode 100644 packages/excalidraw/tests/fixtures/smiley.png create mode 100644 packages/excalidraw/tests/fixtures/smiley_embedded_v2.png create mode 100644 packages/excalidraw/tests/fixtures/smiley_embedded_v2.svg create mode 100644 packages/excalidraw/tests/fixtures/svg-image-exporting-reference.svg create mode 100644 packages/excalidraw/tests/fixtures/test_embedded_v1.png create mode 100644 packages/excalidraw/tests/fixtures/test_embedded_v1.svg create mode 100644 packages/excalidraw/tests/flip.test.tsx create mode 100644 packages/excalidraw/tests/fractionalIndex.test.ts create mode 100644 packages/excalidraw/tests/helpers/api.ts create mode 100644 packages/excalidraw/tests/helpers/colorize.ts create mode 100644 packages/excalidraw/tests/helpers/mocks.ts create mode 100644 packages/excalidraw/tests/helpers/polyfills.ts create mode 100644 packages/excalidraw/tests/helpers/ui.ts create mode 100644 packages/excalidraw/tests/history.test.tsx create mode 100644 packages/excalidraw/tests/library.test.tsx create mode 100644 packages/excalidraw/tests/linearElementEditor.test.tsx create mode 100644 packages/excalidraw/tests/move.test.tsx create mode 100644 packages/excalidraw/tests/multiPointCreate.test.tsx create mode 100644 packages/excalidraw/tests/packages/__snapshots__/excalidraw.test.tsx.snap create mode 100644 packages/excalidraw/tests/packages/__snapshots__/utils.test.ts.snap create mode 100644 packages/excalidraw/tests/packages/events.test.tsx create mode 100644 packages/excalidraw/tests/queries/dom.ts create mode 100644 packages/excalidraw/tests/queries/toolQueries.ts create mode 100644 packages/excalidraw/tests/regressionTests.test.tsx create mode 100644 packages/excalidraw/tests/resize.test.tsx create mode 100644 packages/excalidraw/tests/rotate.test.tsx create mode 100644 packages/excalidraw/tests/scene/__snapshots__/export.test.ts.snap create mode 100644 packages/excalidraw/tests/scene/export.test.ts create mode 100644 packages/excalidraw/tests/scroll.test.tsx create mode 100644 packages/excalidraw/tests/search.test.tsx create mode 100644 packages/excalidraw/tests/selection.test.tsx create mode 100644 packages/excalidraw/tests/shortcuts.test.tsx create mode 100644 packages/excalidraw/tests/test-utils.ts create mode 100644 packages/excalidraw/tests/tool.test.tsx create mode 100644 packages/excalidraw/tests/utils.test.ts create mode 100644 packages/excalidraw/tests/viewMode.test.tsx create mode 100644 packages/excalidraw/tests/zindex.test.tsx (limited to 'packages/excalidraw/tests') diff --git a/packages/excalidraw/tests/App.test.tsx b/packages/excalidraw/tests/App.test.tsx new file mode 100644 index 0000000..ad62706 --- /dev/null +++ b/packages/excalidraw/tests/App.test.tsx @@ -0,0 +1,45 @@ +import React from "react"; +import * as StaticScene from "../renderer/staticScene"; +import { reseed } from "../random"; +import { render, queryByTestId, unmountComponent } from "../tests/test-utils"; + +import { Excalidraw } from "../index"; +import { vi } from "vitest"; + +const renderStaticScene = vi.spyOn(StaticScene, "renderStaticScene"); + +describe("Test ", () => { + beforeEach(async () => { + unmountComponent(); + localStorage.clear(); + renderStaticScene.mockClear(); + reseed(7); + }); + + it("should show error modal when using brave and measureText API is not working", async () => { + (global.navigator as any).brave = { + isBrave: { + name: "isBrave", + }, + }; + + const originalContext = global.HTMLCanvasElement.prototype.getContext("2d"); + //@ts-ignore + global.HTMLCanvasElement.prototype.getContext = (contextId) => { + return { + ...originalContext, + measureText: () => ({ + width: 0, + }), + }; + }; + + await render(); + expect( + queryByTestId( + document.querySelector(".excalidraw-modal-container")!, + "brave-measure-text-error", + ), + ).toMatchSnapshot(); + }); +}); diff --git a/packages/excalidraw/tests/MermaidToExcalidraw.test.tsx b/packages/excalidraw/tests/MermaidToExcalidraw.test.tsx new file mode 100644 index 0000000..05727a0 --- /dev/null +++ b/packages/excalidraw/tests/MermaidToExcalidraw.test.tsx @@ -0,0 +1,117 @@ +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 { mockMermaidToExcalidraw } from "./helpers/mocks"; + +mockMermaidToExcalidraw({ + mockRef: true, + parseMermaidToExcalidraw: async (definition) => { + const firstLine = definition.split("\n")[0]; + return new Promise((resolve, reject) => { + if (firstLine === "flowchart TD") { + resolve({ + elements: [ + { + id: "Start", + type: "rectangle", + groupIds: [], + x: 0, + y: 0, + width: 69.703125, + height: 44, + strokeWidth: 2, + label: { + groupIds: [], + text: "Start", + fontSize: 20, + }, + link: null, + }, + { + id: "Stop", + type: "rectangle", + groupIds: [], + x: 2.7109375, + y: 94, + width: 64.28125, + height: 44, + strokeWidth: 2, + label: { + groupIds: [], + text: "Stop", + fontSize: 20, + }, + link: null, + }, + { + id: "Start_Stop", + type: "arrow", + groupIds: [], + x: 34.852, + y: 44, + strokeWidth: 2, + points: [ + [0, 0], + [0, 50], + ], + roundness: { + type: 2, + }, + start: { + id: "Start", + }, + end: { + id: "Stop", + }, + }, + ], + }); + } else { + reject(new Error("ERROR")); + } + }); + }, +}); + +describe("Test ", () => { + beforeEach(async () => { + await render( + , + ); + }); + + it("should open mermaid popup when active tool is mermaid", async () => { + const dialog = document.querySelector(".ttd-dialog")!; + await waitFor(() => expect(dialog.querySelector("canvas")).not.toBeNull()); + expect(dialog.outerHTML).toMatchSnapshot(); + }); + + it("should show error in preview when mermaid library throws error", async () => { + const dialog = document.querySelector(".ttd-dialog")!; + + expect(dialog).not.toBeNull(); + + const selector = ".ttd-dialog-input"; + let editor = await getTextEditor(selector, true); + + expect(dialog.querySelector('[data-testid="mermaid-error"]')).toBeNull(); + + expect(editor.textContent).toMatchSnapshot(); + + updateTextEditor(editor, "flowchart TD1"); + editor = await getTextEditor(selector, false); + + expect(editor.textContent).toBe("flowchart TD1"); + expect( + dialog.querySelector('[data-testid="mermaid-error"]'), + ).toMatchInlineSnapshot("null"); + }); +}); diff --git a/packages/excalidraw/tests/__snapshots__/App.test.tsx.snap b/packages/excalidraw/tests/__snapshots__/App.test.tsx.snap new file mode 100644 index 0000000..49c2fd0 --- /dev/null +++ b/packages/excalidraw/tests/__snapshots__/App.test.tsx.snap @@ -0,0 +1,50 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`Test > should show error modal when using brave and measureText API is not working 1`] = ` +
+

+ Looks like you are using Brave browser with the + + Aggressively Block Fingerprinting + + setting enabled. +

+

+ This could result in breaking the + + Text Elements + + in your drawings. +

+

+ We strongly recommend disabling this setting. You can follow + + these steps + + on how to do so. +

+

+ If disabling this setting doesn't fix the display of text elements, please open an + + issue + + on our GitHub, or write us on + + Discord + . + +

+
+`; diff --git a/packages/excalidraw/tests/__snapshots__/MermaidToExcalidraw.test.tsx.snap b/packages/excalidraw/tests/__snapshots__/MermaidToExcalidraw.test.tsx.snap new file mode 100644 index 0000000..2943aee --- /dev/null +++ b/packages/excalidraw/tests/__snapshots__/MermaidToExcalidraw.test.tsx.snap @@ -0,0 +1,19 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`Test > should open mermaid popup when active tool is mermaid 1`] = ` +"" +`; + +exports[`Test > should show error in preview when mermaid library throws error 1`] = ` +"flowchart TD + A[Christmas] -->|Get money| B(Go shopping) + B --> C{Let me think} + C -->|One| D[Laptop] + C -->|Two| E[iPhone] + C -->|Three| F[Car]" +`; diff --git a/packages/excalidraw/tests/__snapshots__/MobileMenu.test.tsx.snap b/packages/excalidraw/tests/__snapshots__/MobileMenu.test.tsx.snap new file mode 100644 index 0000000..ad0c9f0 --- /dev/null +++ b/packages/excalidraw/tests/__snapshots__/MobileMenu.test.tsx.snap @@ -0,0 +1,257 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`Test MobileMenu > should initialize with welcome screen and hide once user interacts 1`] = ` +
+ +
+ All your data is saved locally in your browser. +
+
+ + + + +
+ +
+
+ Try Excalidraw Plus! +
+
+
+
+`; diff --git a/packages/excalidraw/tests/__snapshots__/charts.test.tsx.snap b/packages/excalidraw/tests/__snapshots__/charts.test.tsx.snap new file mode 100644 index 0000000..868e27e --- /dev/null +++ b/packages/excalidraw/tests/__snapshots__/charts.test.tsx.snap @@ -0,0 +1,20 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`tryParseSpreadsheet > works for numbers with comma in them 1`] = ` +{ + "spreadsheet": { + "labels": [ + "Week 1", + "Week 2", + "Week 3", + ], + "title": "Users", + "values": [ + 814, + 10301, + 4264, + ], + }, + "type": "VALID_SPREADSHEET", +} +`; diff --git a/packages/excalidraw/tests/__snapshots__/contextmenu.test.tsx.snap b/packages/excalidraw/tests/__snapshots__/contextmenu.test.tsx.snap new file mode 100644 index 0000000..f77eb8d --- /dev/null +++ b/packages/excalidraw/tests/__snapshots__/contextmenu.test.tsx.snap @@ -0,0 +1,9977 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`contextMenu element > right-clicking on a group should select whole group > [end of test] appState 1`] = ` +{ + "activeEmbeddable": null, + "activeTool": { + "customType": null, + "lastActiveTool": null, + "locked": false, + "type": "selection", + }, + "collaborators": Map {}, + "contextMenu": { + "items": [ + "separator", + { + "icon": , + "keyTest": [Function], + "label": "labels.cut", + "name": "cut", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "icon": , + "keyTest": undefined, + "label": "labels.copy", + "name": "copy", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "keyTest": undefined, + "label": "labels.paste", + "name": "paste", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "label": "labels.selectAllElementsInFrame", + "name": "selectAllElementsInFrame", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "canvas", + }, + }, + { + "label": "labels.removeAllElementsFromFrame", + "name": "removeAllElementsFromFrame", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "history", + }, + }, + { + "label": "labels.wrapSelectionInFrame", + "name": "wrapSelectionInFrame", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "PanelComponent": [Function], + "icon": , + "keywords": [ + "image", + "crop", + ], + "label": "helpDialog.cropStart", + "name": "cropEditor", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "menu", + }, + "viewMode": true, + }, + "separator", + { + "icon": , + "keyTest": [Function], + "keywords": [ + "png", + "clipboard", + "copy", + ], + "label": "labels.copyAsPng", + "name": "copyAsPng", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "icon": , + "keywords": [ + "svg", + "clipboard", + "copy", + ], + "label": "labels.copyAsSvg", + "name": "copyAsSvg", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "keywords": [ + "text", + "clipboard", + "copy", + ], + "label": "labels.copyText", + "name": "copyText", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "icon": , + "keyTest": [Function], + "label": "labels.copyStyles", + "name": "copyStyles", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "icon": , + "keyTest": [Function], + "label": "labels.pasteStyles", + "name": "pasteStyles", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "PanelComponent": [Function], + "icon": [Function], + "keyTest": [Function], + "label": "labels.group", + "name": "group", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "icon": null, + "label": "labels.autoResize", + "name": "autoResize", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "label": "labels.unbindText", + "name": "unbindText", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "label": "labels.bindText", + "name": "bindText", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "label": "labels.createContainerFromText", + "name": "wrapTextInContainer", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "PanelComponent": [Function], + "icon": [Function], + "keyTest": [Function], + "label": "labels.ungroup", + "name": "ungroup", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "label": "labels.addToLibrary", + "name": "addToLibrary", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "PanelComponent": [Function], + "icon": , + "keyPriority": 40, + "keyTest": [Function], + "keywords": [ + "move down", + "zindex", + "layer", + ], + "label": "labels.sendBackward", + "name": "sendBackward", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "PanelComponent": [Function], + "icon": , + "keyPriority": 40, + "keyTest": [Function], + "keywords": [ + "move up", + "zindex", + "layer", + ], + "label": "labels.bringForward", + "name": "bringForward", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "PanelComponent": [Function], + "icon": , + "keyTest": [Function], + "keywords": [ + "move down", + "zindex", + "layer", + ], + "label": "labels.sendToBack", + "name": "sendToBack", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "PanelComponent": [Function], + "icon": , + "keyTest": [Function], + "keywords": [ + "move up", + "zindex", + "layer", + ], + "label": "labels.bringToFront", + "name": "bringToFront", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "icon": , + "keyTest": [Function], + "label": "labels.flipHorizontal", + "name": "flipHorizontal", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "icon": , + "keyTest": [Function], + "label": "labels.flipVertical", + "name": "flipVertical", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "PanelComponent": [Function], + "category": "Elements", + "keywords": [ + "line", + ], + "label": [Function], + "name": "toggleLinearEditor", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "PanelComponent": [Function], + "icon": , + "keyTest": [Function], + "label": [Function], + "name": "hyperlink", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "action": "click", + "category": "hyperlink", + }, + }, + { + "icon": , + "label": "labels.copyElementLink", + "name": "copyElementLink", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "PanelComponent": [Function], + "icon": , + "keyTest": [Function], + "label": "labels.duplicateSelection", + "name": "duplicateSelection", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "icon": [Function], + "keyTest": [Function], + "label": [Function], + "name": "toggleElementLock", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "PanelComponent": [Function], + "icon": , + "keyTest": [Function], + "label": "labels.delete", + "name": "deleteSelectedElements", + "perform": [Function], + "trackEvent": { + "action": "delete", + "category": "element", + }, + }, + ], + "left": 30, + "top": 40, + }, + "croppingElementId": null, + "currentChartType": "bar", + "currentHoveredFontFamily": null, + "currentItemArrowType": "round", + "currentItemBackgroundColor": "transparent", + "currentItemEndArrowhead": "arrow", + "currentItemFillStyle": "solid", + "currentItemFontFamily": 5, + "currentItemFontSize": 20, + "currentItemOpacity": 100, + "currentItemRoughness": 1, + "currentItemRoundness": "round", + "currentItemStartArrowhead": null, + "currentItemStrokeColor": "#1e1e1e", + "currentItemStrokeStyle": "solid", + "currentItemStrokeWidth": 2, + "currentItemTextAlign": "left", + "cursorButton": "up", + "defaultSidebarDockedPreference": false, + "editingFrame": null, + "editingGroupId": null, + "editingLinearElement": null, + "editingTextElement": null, + "elementsToHighlight": null, + "errorMessage": null, + "exportBackground": true, + "exportEmbedScene": false, + "exportScale": 1, + "exportWithDarkMode": false, + "fileHandle": null, + "followedBy": Set {}, + "frameRendering": { + "clip": true, + "enabled": true, + "name": true, + "outline": true, + }, + "frameToHighlight": null, + "gridModeEnabled": false, + "gridSize": 20, + "gridStep": 5, + "height": 100, + "hoveredElementIds": {}, + "isBindingEnabled": true, + "isCropping": false, + "isLoading": false, + "isResizing": false, + "isRotating": false, + "lastPointerDownWith": "mouse", + "multiElement": null, + "name": "Untitled-201933152653", + "newElement": null, + "objectsSnapModeEnabled": false, + "offsetLeft": 20, + "offsetTop": 10, + "openDialog": null, + "openMenu": null, + "openPopup": null, + "openSidebar": null, + "originSnapOffset": { + "x": 0, + "y": 0, + }, + "pasteDialog": { + "data": null, + "shown": false, + }, + "penDetected": false, + "penMode": false, + "pendingImageElementId": null, + "previousSelectedElementIds": {}, + "resizingElement": null, + "scrollX": 0, + "scrollY": 0, + "scrolledOutside": false, + "searchMatches": [], + "selectedElementIds": { + "id0": true, + "id1": true, + }, + "selectedElementsAreBeingDragged": false, + "selectedGroupIds": { + "g1": true, + }, + "selectedLinearElement": null, + "selectionElement": null, + "shouldCacheIgnoreZoom": false, + "showHyperlinkPopup": false, + "showWelcomeScreen": true, + "snapLines": [], + "startBoundElement": null, + "stats": { + "open": false, + "panels": 3, + }, + "suggestedBindings": [], + "theme": "light", + "toast": null, + "userToFollow": null, + "viewBackgroundColor": "#ffffff", + "viewModeEnabled": false, + "width": 200, + "zenModeEnabled": false, + "zoom": { + "value": 1, + }, +} +`; + +exports[`contextMenu element > right-clicking on a group should select whole group > [end of test] element 0 1`] = ` +{ + "angle": 0, + "backgroundColor": "red", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [ + "g1", + ], + "height": 100, + "id": "id0", + "index": "a0", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 3, + }, + "seed": 1, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "updated": 1, + "version": 2, + "versionNonce": 1278240551, + "width": 100, + "x": 0, + "y": 0, +} +`; + +exports[`contextMenu element > right-clicking on a group should select whole group > [end of test] element 1 1`] = ` +{ + "angle": 0, + "backgroundColor": "red", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [ + "g1", + ], + "height": 100, + "id": "id1", + "index": "a1", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 3, + }, + "seed": 1, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "updated": 1, + "version": 2, + "versionNonce": 449462985, + "width": 100, + "x": 0, + "y": 0, +} +`; + +exports[`contextMenu element > right-clicking on a group should select whole group > [end of test] history 1`] = ` +History { + "onHistoryChangedEmitter": Emitter { + "subscribers": [ + [Function], + [Function], + ], + }, + "redoStack": [], + "undoStack": [], +} +`; + +exports[`contextMenu element > right-clicking on a group should select whole group > [end of test] number of elements 1`] = `2`; + +exports[`contextMenu element > right-clicking on a group should select whole group > [end of test] number of renders 1`] = `5`; + +exports[`contextMenu element > selecting 'Add to library' in context menu adds element to library > [end of test] appState 1`] = ` +{ + "activeEmbeddable": null, + "activeTool": { + "customType": null, + "lastActiveTool": null, + "locked": false, + "type": "selection", + }, + "collaborators": Map {}, + "contextMenu": null, + "croppingElementId": null, + "currentChartType": "bar", + "currentHoveredFontFamily": null, + "currentItemArrowType": "round", + "currentItemBackgroundColor": "transparent", + "currentItemEndArrowhead": "arrow", + "currentItemFillStyle": "solid", + "currentItemFontFamily": 5, + "currentItemFontSize": 20, + "currentItemOpacity": 100, + "currentItemRoughness": 1, + "currentItemRoundness": "round", + "currentItemStartArrowhead": null, + "currentItemStrokeColor": "#1e1e1e", + "currentItemStrokeStyle": "solid", + "currentItemStrokeWidth": 2, + "currentItemTextAlign": "left", + "cursorButton": "up", + "defaultSidebarDockedPreference": false, + "editingFrame": null, + "editingGroupId": null, + "editingLinearElement": null, + "editingTextElement": null, + "elementsToHighlight": null, + "errorMessage": null, + "exportBackground": true, + "exportEmbedScene": false, + "exportScale": 1, + "exportWithDarkMode": false, + "fileHandle": null, + "followedBy": Set {}, + "frameRendering": { + "clip": true, + "enabled": true, + "name": true, + "outline": true, + }, + "frameToHighlight": null, + "gridModeEnabled": false, + "gridSize": 20, + "gridStep": 5, + "height": 100, + "hoveredElementIds": {}, + "isBindingEnabled": true, + "isCropping": false, + "isLoading": false, + "isResizing": false, + "isRotating": false, + "lastPointerDownWith": "mouse", + "multiElement": null, + "name": "Untitled-201933152653", + "newElement": null, + "objectsSnapModeEnabled": false, + "offsetLeft": 20, + "offsetTop": 10, + "openDialog": null, + "openMenu": null, + "openPopup": null, + "openSidebar": null, + "originSnapOffset": null, + "pasteDialog": { + "data": null, + "shown": false, + }, + "penDetected": false, + "penMode": false, + "pendingImageElementId": null, + "previousSelectedElementIds": {}, + "resizingElement": null, + "scrollX": 0, + "scrollY": 0, + "scrolledOutside": false, + "searchMatches": [], + "selectedElementIds": { + "id0": true, + }, + "selectedElementsAreBeingDragged": false, + "selectedGroupIds": {}, + "selectedLinearElement": null, + "selectionElement": null, + "shouldCacheIgnoreZoom": false, + "showHyperlinkPopup": false, + "showWelcomeScreen": true, + "snapLines": [], + "startBoundElement": null, + "stats": { + "open": false, + "panels": 3, + }, + "suggestedBindings": [], + "theme": "light", + "toast": { + "message": "Added to library", + }, + "userToFollow": null, + "viewBackgroundColor": "#ffffff", + "viewModeEnabled": false, + "width": 200, + "zenModeEnabled": false, + "zoom": { + "value": 1, + }, +} +`; + +exports[`contextMenu element > selecting 'Add to library' in context menu adds element to library > [end of test] element 0 1`] = ` +{ + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 20, + "id": "id0", + "index": "a0", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 3, + }, + "seed": 449462985, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "updated": 1, + "version": 3, + "versionNonce": 1150084233, + "width": 20, + "x": -10, + "y": 0, +} +`; + +exports[`contextMenu element > selecting 'Add to library' in context menu adds element to library > [end of test] history 1`] = ` +History { + "onHistoryChangedEmitter": Emitter { + "subscribers": [ + [Function], + [Function], + ], + }, + "redoStack": [], + "undoStack": [ + HistoryEntry { + "appStateChange": AppStateChange { + "delta": Delta { + "deleted": { + "selectedElementIds": { + "id0": true, + }, + }, + "inserted": { + "selectedElementIds": {}, + }, + }, + }, + "elementsChange": ElementsChange { + "added": Map {}, + "removed": Map { + "id0" => Delta { + "deleted": { + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 20, + "index": "a0", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 3, + }, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "width": 20, + "x": -10, + "y": 0, + }, + "inserted": { + "isDeleted": true, + }, + }, + }, + "updated": Map {}, + }, + }, + ], +} +`; + +exports[`contextMenu element > selecting 'Add to library' in context menu adds element to library > [end of test] number of elements 1`] = `1`; + +exports[`contextMenu element > selecting 'Add to library' in context menu adds element to library > [end of test] number of renders 1`] = `5`; + +exports[`contextMenu element > selecting 'Bring forward' in context menu brings element forward > [end of test] appState 1`] = ` +{ + "activeEmbeddable": null, + "activeTool": { + "customType": null, + "lastActiveTool": null, + "locked": false, + "type": "selection", + }, + "collaborators": Map {}, + "contextMenu": null, + "croppingElementId": null, + "currentChartType": "bar", + "currentHoveredFontFamily": null, + "currentItemArrowType": "round", + "currentItemBackgroundColor": "transparent", + "currentItemEndArrowhead": "arrow", + "currentItemFillStyle": "solid", + "currentItemFontFamily": 5, + "currentItemFontSize": 20, + "currentItemOpacity": 100, + "currentItemRoughness": 1, + "currentItemRoundness": "round", + "currentItemStartArrowhead": null, + "currentItemStrokeColor": "#1e1e1e", + "currentItemStrokeStyle": "solid", + "currentItemStrokeWidth": 2, + "currentItemTextAlign": "left", + "cursorButton": "up", + "defaultSidebarDockedPreference": false, + "editingFrame": null, + "editingGroupId": null, + "editingLinearElement": null, + "editingTextElement": null, + "elementsToHighlight": null, + "errorMessage": null, + "exportBackground": true, + "exportEmbedScene": false, + "exportScale": 1, + "exportWithDarkMode": false, + "fileHandle": null, + "followedBy": Set {}, + "frameRendering": { + "clip": true, + "enabled": true, + "name": true, + "outline": true, + }, + "frameToHighlight": null, + "gridModeEnabled": false, + "gridSize": 20, + "gridStep": 5, + "height": 100, + "hoveredElementIds": {}, + "isBindingEnabled": true, + "isCropping": false, + "isLoading": false, + "isResizing": false, + "isRotating": false, + "lastPointerDownWith": "mouse", + "multiElement": null, + "name": "Untitled-201933152653", + "newElement": null, + "objectsSnapModeEnabled": false, + "offsetLeft": 20, + "offsetTop": 10, + "openDialog": null, + "openMenu": null, + "openPopup": null, + "openSidebar": null, + "originSnapOffset": null, + "pasteDialog": { + "data": null, + "shown": false, + }, + "penDetected": false, + "penMode": false, + "pendingImageElementId": null, + "previousSelectedElementIds": {}, + "resizingElement": null, + "scrollX": 0, + "scrollY": 0, + "scrolledOutside": false, + "searchMatches": [], + "selectedElementIds": { + "id0": true, + }, + "selectedElementsAreBeingDragged": false, + "selectedGroupIds": {}, + "selectedLinearElement": null, + "selectionElement": null, + "shouldCacheIgnoreZoom": false, + "showHyperlinkPopup": false, + "showWelcomeScreen": true, + "snapLines": [], + "startBoundElement": null, + "stats": { + "open": false, + "panels": 3, + }, + "suggestedBindings": [], + "theme": "light", + "toast": null, + "userToFollow": null, + "viewBackgroundColor": "#ffffff", + "viewModeEnabled": false, + "width": 200, + "zenModeEnabled": false, + "zoom": { + "value": 1, + }, +} +`; + +exports[`contextMenu element > selecting 'Bring forward' in context menu brings element forward > [end of test] element 0 1`] = ` +{ + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 20, + "id": "id1", + "index": "a1", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 3, + }, + "seed": 1014066025, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "updated": 1, + "version": 3, + "versionNonce": 1604849351, + "width": 20, + "x": 20, + "y": 30, +} +`; + +exports[`contextMenu element > selecting 'Bring forward' in context menu brings element forward > [end of test] element 1 1`] = ` +{ + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 20, + "id": "id0", + "index": "a2", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 3, + }, + "seed": 449462985, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "updated": 1, + "version": 4, + "versionNonce": 23633383, + "width": 20, + "x": -10, + "y": 0, +} +`; + +exports[`contextMenu element > selecting 'Bring forward' in context menu brings element forward > [end of test] history 1`] = ` +History { + "onHistoryChangedEmitter": Emitter { + "subscribers": [ + [Function], + [Function], + ], + }, + "redoStack": [], + "undoStack": [ + HistoryEntry { + "appStateChange": AppStateChange { + "delta": Delta { + "deleted": { + "selectedElementIds": { + "id0": true, + }, + }, + "inserted": { + "selectedElementIds": {}, + }, + }, + }, + "elementsChange": ElementsChange { + "added": Map {}, + "removed": Map { + "id0" => Delta { + "deleted": { + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 20, + "index": "a0", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 3, + }, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "width": 20, + "x": -10, + "y": 0, + }, + "inserted": { + "isDeleted": true, + }, + }, + }, + "updated": Map {}, + }, + }, + HistoryEntry { + "appStateChange": AppStateChange { + "delta": Delta { + "deleted": { + "selectedElementIds": { + "id1": true, + }, + }, + "inserted": { + "selectedElementIds": { + "id0": true, + }, + }, + }, + }, + "elementsChange": ElementsChange { + "added": Map {}, + "removed": Map { + "id1" => Delta { + "deleted": { + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 20, + "index": "a1", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 3, + }, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "width": 20, + "x": 20, + "y": 30, + }, + "inserted": { + "isDeleted": true, + }, + }, + }, + "updated": Map {}, + }, + }, + HistoryEntry { + "appStateChange": AppStateChange { + "delta": Delta { + "deleted": { + "selectedElementIds": { + "id0": true, + }, + }, + "inserted": { + "selectedElementIds": { + "id1": true, + }, + }, + }, + }, + "elementsChange": ElementsChange { + "added": Map {}, + "removed": Map {}, + "updated": Map { + "id0" => Delta { + "deleted": { + "index": "a2", + }, + "inserted": { + "index": "a0", + }, + }, + }, + }, + }, + ], +} +`; + +exports[`contextMenu element > selecting 'Bring forward' in context menu brings element forward > [end of test] number of elements 1`] = `2`; + +exports[`contextMenu element > selecting 'Bring forward' in context menu brings element forward > [end of test] number of renders 1`] = `10`; + +exports[`contextMenu element > selecting 'Bring to front' in context menu brings element to front > [end of test] appState 1`] = ` +{ + "activeEmbeddable": null, + "activeTool": { + "customType": null, + "lastActiveTool": null, + "locked": false, + "type": "selection", + }, + "collaborators": Map {}, + "contextMenu": null, + "croppingElementId": null, + "currentChartType": "bar", + "currentHoveredFontFamily": null, + "currentItemArrowType": "round", + "currentItemBackgroundColor": "transparent", + "currentItemEndArrowhead": "arrow", + "currentItemFillStyle": "solid", + "currentItemFontFamily": 5, + "currentItemFontSize": 20, + "currentItemOpacity": 100, + "currentItemRoughness": 1, + "currentItemRoundness": "round", + "currentItemStartArrowhead": null, + "currentItemStrokeColor": "#1e1e1e", + "currentItemStrokeStyle": "solid", + "currentItemStrokeWidth": 2, + "currentItemTextAlign": "left", + "cursorButton": "up", + "defaultSidebarDockedPreference": false, + "editingFrame": null, + "editingGroupId": null, + "editingLinearElement": null, + "editingTextElement": null, + "elementsToHighlight": null, + "errorMessage": null, + "exportBackground": true, + "exportEmbedScene": false, + "exportScale": 1, + "exportWithDarkMode": false, + "fileHandle": null, + "followedBy": Set {}, + "frameRendering": { + "clip": true, + "enabled": true, + "name": true, + "outline": true, + }, + "frameToHighlight": null, + "gridModeEnabled": false, + "gridSize": 20, + "gridStep": 5, + "height": 100, + "hoveredElementIds": {}, + "isBindingEnabled": true, + "isCropping": false, + "isLoading": false, + "isResizing": false, + "isRotating": false, + "lastPointerDownWith": "mouse", + "multiElement": null, + "name": "Untitled-201933152653", + "newElement": null, + "objectsSnapModeEnabled": false, + "offsetLeft": 20, + "offsetTop": 10, + "openDialog": null, + "openMenu": null, + "openPopup": null, + "openSidebar": null, + "originSnapOffset": null, + "pasteDialog": { + "data": null, + "shown": false, + }, + "penDetected": false, + "penMode": false, + "pendingImageElementId": null, + "previousSelectedElementIds": {}, + "resizingElement": null, + "scrollX": 0, + "scrollY": 0, + "scrolledOutside": false, + "searchMatches": [], + "selectedElementIds": { + "id0": true, + }, + "selectedElementsAreBeingDragged": false, + "selectedGroupIds": {}, + "selectedLinearElement": null, + "selectionElement": null, + "shouldCacheIgnoreZoom": false, + "showHyperlinkPopup": false, + "showWelcomeScreen": true, + "snapLines": [], + "startBoundElement": null, + "stats": { + "open": false, + "panels": 3, + }, + "suggestedBindings": [], + "theme": "light", + "toast": null, + "userToFollow": null, + "viewBackgroundColor": "#ffffff", + "viewModeEnabled": false, + "width": 200, + "zenModeEnabled": false, + "zoom": { + "value": 1, + }, +} +`; + +exports[`contextMenu element > selecting 'Bring to front' in context menu brings element to front > [end of test] element 0 1`] = ` +{ + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 20, + "id": "id1", + "index": "a1", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 3, + }, + "seed": 1014066025, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "updated": 1, + "version": 3, + "versionNonce": 1604849351, + "width": 20, + "x": 20, + "y": 30, +} +`; + +exports[`contextMenu element > selecting 'Bring to front' in context menu brings element to front > [end of test] element 1 1`] = ` +{ + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 20, + "id": "id0", + "index": "a2", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 3, + }, + "seed": 449462985, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "updated": 1, + "version": 4, + "versionNonce": 23633383, + "width": 20, + "x": -10, + "y": 0, +} +`; + +exports[`contextMenu element > selecting 'Bring to front' in context menu brings element to front > [end of test] history 1`] = ` +History { + "onHistoryChangedEmitter": Emitter { + "subscribers": [ + [Function], + [Function], + ], + }, + "redoStack": [], + "undoStack": [ + HistoryEntry { + "appStateChange": AppStateChange { + "delta": Delta { + "deleted": { + "selectedElementIds": { + "id0": true, + }, + }, + "inserted": { + "selectedElementIds": {}, + }, + }, + }, + "elementsChange": ElementsChange { + "added": Map {}, + "removed": Map { + "id0" => Delta { + "deleted": { + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 20, + "index": "a0", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 3, + }, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "width": 20, + "x": -10, + "y": 0, + }, + "inserted": { + "isDeleted": true, + }, + }, + }, + "updated": Map {}, + }, + }, + HistoryEntry { + "appStateChange": AppStateChange { + "delta": Delta { + "deleted": { + "selectedElementIds": { + "id1": true, + }, + }, + "inserted": { + "selectedElementIds": { + "id0": true, + }, + }, + }, + }, + "elementsChange": ElementsChange { + "added": Map {}, + "removed": Map { + "id1" => Delta { + "deleted": { + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 20, + "index": "a1", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 3, + }, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "width": 20, + "x": 20, + "y": 30, + }, + "inserted": { + "isDeleted": true, + }, + }, + }, + "updated": Map {}, + }, + }, + HistoryEntry { + "appStateChange": AppStateChange { + "delta": Delta { + "deleted": { + "selectedElementIds": { + "id0": true, + }, + }, + "inserted": { + "selectedElementIds": { + "id1": true, + }, + }, + }, + }, + "elementsChange": ElementsChange { + "added": Map {}, + "removed": Map {}, + "updated": Map { + "id0" => Delta { + "deleted": { + "index": "a2", + }, + "inserted": { + "index": "a0", + }, + }, + }, + }, + }, + ], +} +`; + +exports[`contextMenu element > selecting 'Bring to front' in context menu brings element to front > [end of test] number of elements 1`] = `2`; + +exports[`contextMenu element > selecting 'Bring to front' in context menu brings element to front > [end of test] number of renders 1`] = `10`; + +exports[`contextMenu element > selecting 'Copy styles' in context menu copies styles > [end of test] appState 1`] = ` +{ + "activeEmbeddable": null, + "activeTool": { + "customType": null, + "lastActiveTool": null, + "locked": false, + "type": "selection", + }, + "collaborators": Map {}, + "contextMenu": null, + "croppingElementId": null, + "currentChartType": "bar", + "currentHoveredFontFamily": null, + "currentItemArrowType": "round", + "currentItemBackgroundColor": "transparent", + "currentItemEndArrowhead": "arrow", + "currentItemFillStyle": "solid", + "currentItemFontFamily": 5, + "currentItemFontSize": 20, + "currentItemOpacity": 100, + "currentItemRoughness": 1, + "currentItemRoundness": "round", + "currentItemStartArrowhead": null, + "currentItemStrokeColor": "#1e1e1e", + "currentItemStrokeStyle": "solid", + "currentItemStrokeWidth": 2, + "currentItemTextAlign": "left", + "cursorButton": "up", + "defaultSidebarDockedPreference": false, + "editingFrame": null, + "editingGroupId": null, + "editingLinearElement": null, + "editingTextElement": null, + "elementsToHighlight": null, + "errorMessage": null, + "exportBackground": true, + "exportEmbedScene": false, + "exportScale": 1, + "exportWithDarkMode": false, + "fileHandle": null, + "followedBy": Set {}, + "frameRendering": { + "clip": true, + "enabled": true, + "name": true, + "outline": true, + }, + "frameToHighlight": null, + "gridModeEnabled": false, + "gridSize": 20, + "gridStep": 5, + "height": 100, + "hoveredElementIds": {}, + "isBindingEnabled": true, + "isCropping": false, + "isLoading": false, + "isResizing": false, + "isRotating": false, + "lastPointerDownWith": "mouse", + "multiElement": null, + "name": "Untitled-201933152653", + "newElement": null, + "objectsSnapModeEnabled": false, + "offsetLeft": 20, + "offsetTop": 10, + "openDialog": null, + "openMenu": null, + "openPopup": null, + "openSidebar": null, + "originSnapOffset": null, + "pasteDialog": { + "data": null, + "shown": false, + }, + "penDetected": false, + "penMode": false, + "pendingImageElementId": null, + "previousSelectedElementIds": {}, + "resizingElement": null, + "scrollX": 0, + "scrollY": 0, + "scrolledOutside": false, + "searchMatches": [], + "selectedElementIds": { + "id0": true, + }, + "selectedElementsAreBeingDragged": false, + "selectedGroupIds": {}, + "selectedLinearElement": null, + "selectionElement": null, + "shouldCacheIgnoreZoom": false, + "showHyperlinkPopup": false, + "showWelcomeScreen": true, + "snapLines": [], + "startBoundElement": null, + "stats": { + "open": false, + "panels": 3, + }, + "suggestedBindings": [], + "theme": "light", + "toast": { + "message": "Copied styles.", + }, + "userToFollow": null, + "viewBackgroundColor": "#ffffff", + "viewModeEnabled": false, + "width": 200, + "zenModeEnabled": false, + "zoom": { + "value": 1, + }, +} +`; + +exports[`contextMenu element > selecting 'Copy styles' in context menu copies styles > [end of test] element 0 1`] = ` +{ + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 20, + "id": "id0", + "index": "a0", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 3, + }, + "seed": 449462985, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "updated": 1, + "version": 3, + "versionNonce": 1150084233, + "width": 20, + "x": -10, + "y": 0, +} +`; + +exports[`contextMenu element > selecting 'Copy styles' in context menu copies styles > [end of test] history 1`] = ` +History { + "onHistoryChangedEmitter": Emitter { + "subscribers": [ + [Function], + [Function], + ], + }, + "redoStack": [], + "undoStack": [ + HistoryEntry { + "appStateChange": AppStateChange { + "delta": Delta { + "deleted": { + "selectedElementIds": { + "id0": true, + }, + }, + "inserted": { + "selectedElementIds": {}, + }, + }, + }, + "elementsChange": ElementsChange { + "added": Map {}, + "removed": Map { + "id0" => Delta { + "deleted": { + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 20, + "index": "a0", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 3, + }, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "width": 20, + "x": -10, + "y": 0, + }, + "inserted": { + "isDeleted": true, + }, + }, + }, + "updated": Map {}, + }, + }, + ], +} +`; + +exports[`contextMenu element > selecting 'Copy styles' in context menu copies styles > [end of test] number of elements 1`] = `1`; + +exports[`contextMenu element > selecting 'Copy styles' in context menu copies styles > [end of test] number of renders 1`] = `5`; + +exports[`contextMenu element > selecting 'Delete' in context menu deletes element > [end of test] appState 1`] = ` +{ + "activeEmbeddable": null, + "activeTool": { + "customType": null, + "lastActiveTool": null, + "locked": false, + "type": "selection", + }, + "collaborators": Map {}, + "contextMenu": null, + "croppingElementId": null, + "currentChartType": "bar", + "currentHoveredFontFamily": null, + "currentItemArrowType": "round", + "currentItemBackgroundColor": "transparent", + "currentItemEndArrowhead": "arrow", + "currentItemFillStyle": "solid", + "currentItemFontFamily": 5, + "currentItemFontSize": 20, + "currentItemOpacity": 100, + "currentItemRoughness": 1, + "currentItemRoundness": "round", + "currentItemStartArrowhead": null, + "currentItemStrokeColor": "#1e1e1e", + "currentItemStrokeStyle": "solid", + "currentItemStrokeWidth": 2, + "currentItemTextAlign": "left", + "cursorButton": "up", + "defaultSidebarDockedPreference": false, + "editingFrame": null, + "editingGroupId": null, + "editingLinearElement": null, + "editingTextElement": null, + "elementsToHighlight": null, + "errorMessage": null, + "exportBackground": true, + "exportEmbedScene": false, + "exportScale": 1, + "exportWithDarkMode": false, + "fileHandle": null, + "followedBy": Set {}, + "frameRendering": { + "clip": true, + "enabled": true, + "name": true, + "outline": true, + }, + "frameToHighlight": null, + "gridModeEnabled": false, + "gridSize": 20, + "gridStep": 5, + "height": 100, + "hoveredElementIds": {}, + "isBindingEnabled": true, + "isCropping": false, + "isLoading": false, + "isResizing": false, + "isRotating": false, + "lastPointerDownWith": "mouse", + "multiElement": null, + "name": "Untitled-201933152653", + "newElement": null, + "objectsSnapModeEnabled": false, + "offsetLeft": 20, + "offsetTop": 10, + "openDialog": null, + "openMenu": null, + "openPopup": null, + "openSidebar": null, + "originSnapOffset": null, + "pasteDialog": { + "data": null, + "shown": false, + }, + "penDetected": false, + "penMode": false, + "pendingImageElementId": null, + "previousSelectedElementIds": {}, + "resizingElement": null, + "scrollX": 0, + "scrollY": 0, + "scrolledOutside": false, + "searchMatches": [], + "selectedElementIds": {}, + "selectedElementsAreBeingDragged": false, + "selectedGroupIds": {}, + "selectedLinearElement": null, + "selectionElement": null, + "shouldCacheIgnoreZoom": false, + "showHyperlinkPopup": false, + "showWelcomeScreen": true, + "snapLines": [], + "startBoundElement": null, + "stats": { + "open": false, + "panels": 3, + }, + "suggestedBindings": [], + "theme": "light", + "toast": null, + "userToFollow": null, + "viewBackgroundColor": "#ffffff", + "viewModeEnabled": false, + "width": 200, + "zenModeEnabled": false, + "zoom": { + "value": 1, + }, +} +`; + +exports[`contextMenu element > selecting 'Delete' in context menu deletes element > [end of test] element 0 1`] = ` +{ + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 20, + "id": "id0", + "index": "a0", + "isDeleted": true, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 3, + }, + "seed": 449462985, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "updated": 1, + "version": 4, + "versionNonce": 1014066025, + "width": 20, + "x": -10, + "y": 0, +} +`; + +exports[`contextMenu element > selecting 'Delete' in context menu deletes element > [end of test] history 1`] = ` +History { + "onHistoryChangedEmitter": Emitter { + "subscribers": [ + [Function], + [Function], + ], + }, + "redoStack": [], + "undoStack": [ + HistoryEntry { + "appStateChange": AppStateChange { + "delta": Delta { + "deleted": { + "selectedElementIds": { + "id0": true, + }, + }, + "inserted": { + "selectedElementIds": {}, + }, + }, + }, + "elementsChange": ElementsChange { + "added": Map {}, + "removed": Map { + "id0" => Delta { + "deleted": { + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 20, + "index": "a0", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 3, + }, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "width": 20, + "x": -10, + "y": 0, + }, + "inserted": { + "isDeleted": true, + }, + }, + }, + "updated": Map {}, + }, + }, + HistoryEntry { + "appStateChange": AppStateChange { + "delta": Delta { + "deleted": { + "selectedElementIds": {}, + }, + "inserted": { + "selectedElementIds": { + "id0": true, + }, + }, + }, + }, + "elementsChange": ElementsChange { + "added": Map { + "id0" => Delta { + "deleted": { + "isDeleted": true, + }, + "inserted": { + "isDeleted": false, + }, + }, + }, + "removed": Map {}, + "updated": Map {}, + }, + }, + ], +} +`; + +exports[`contextMenu element > selecting 'Delete' in context menu deletes element > [end of test] number of elements 1`] = `1`; + +exports[`contextMenu element > selecting 'Delete' in context menu deletes element > [end of test] number of renders 1`] = `6`; + +exports[`contextMenu element > selecting 'Duplicate' in context menu duplicates element > [end of test] appState 1`] = ` +{ + "activeEmbeddable": null, + "activeTool": { + "customType": null, + "lastActiveTool": null, + "locked": false, + "type": "selection", + }, + "collaborators": Map {}, + "contextMenu": null, + "croppingElementId": null, + "currentChartType": "bar", + "currentHoveredFontFamily": null, + "currentItemArrowType": "round", + "currentItemBackgroundColor": "transparent", + "currentItemEndArrowhead": "arrow", + "currentItemFillStyle": "solid", + "currentItemFontFamily": 5, + "currentItemFontSize": 20, + "currentItemOpacity": 100, + "currentItemRoughness": 1, + "currentItemRoundness": "round", + "currentItemStartArrowhead": null, + "currentItemStrokeColor": "#1e1e1e", + "currentItemStrokeStyle": "solid", + "currentItemStrokeWidth": 2, + "currentItemTextAlign": "left", + "cursorButton": "up", + "defaultSidebarDockedPreference": false, + "editingFrame": null, + "editingGroupId": null, + "editingLinearElement": null, + "editingTextElement": null, + "elementsToHighlight": null, + "errorMessage": null, + "exportBackground": true, + "exportEmbedScene": false, + "exportScale": 1, + "exportWithDarkMode": false, + "fileHandle": null, + "followedBy": Set {}, + "frameRendering": { + "clip": true, + "enabled": true, + "name": true, + "outline": true, + }, + "frameToHighlight": null, + "gridModeEnabled": false, + "gridSize": 20, + "gridStep": 5, + "height": 100, + "hoveredElementIds": {}, + "isBindingEnabled": true, + "isCropping": false, + "isLoading": false, + "isResizing": false, + "isRotating": false, + "lastPointerDownWith": "mouse", + "multiElement": null, + "name": "Untitled-201933152653", + "newElement": null, + "objectsSnapModeEnabled": false, + "offsetLeft": 20, + "offsetTop": 10, + "openDialog": null, + "openMenu": null, + "openPopup": null, + "openSidebar": null, + "originSnapOffset": null, + "pasteDialog": { + "data": null, + "shown": false, + }, + "penDetected": false, + "penMode": false, + "pendingImageElementId": null, + "previousSelectedElementIds": {}, + "resizingElement": null, + "scrollX": 0, + "scrollY": 0, + "scrolledOutside": false, + "searchMatches": [], + "selectedElementIds": { + "id1": true, + }, + "selectedElementsAreBeingDragged": false, + "selectedGroupIds": {}, + "selectedLinearElement": null, + "selectionElement": null, + "shouldCacheIgnoreZoom": false, + "showHyperlinkPopup": false, + "showWelcomeScreen": true, + "snapLines": [], + "startBoundElement": null, + "stats": { + "open": false, + "panels": 3, + }, + "suggestedBindings": [], + "theme": "light", + "toast": null, + "userToFollow": null, + "viewBackgroundColor": "#ffffff", + "viewModeEnabled": false, + "width": 200, + "zenModeEnabled": false, + "zoom": { + "value": 1, + }, +} +`; + +exports[`contextMenu element > selecting 'Duplicate' in context menu duplicates element > [end of test] element 0 1`] = ` +{ + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 20, + "id": "id0", + "index": "a0", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 3, + }, + "seed": 449462985, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "updated": 1, + "version": 3, + "versionNonce": 1150084233, + "width": 20, + "x": -10, + "y": 0, +} +`; + +exports[`contextMenu element > selecting 'Duplicate' in context menu duplicates element > [end of test] element 1 1`] = ` +{ + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 20, + "id": "id1", + "index": "a1", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 3, + }, + "seed": 1014066025, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "updated": 1, + "version": 4, + "versionNonce": 238820263, + "width": 20, + "x": 0, + "y": 10, +} +`; + +exports[`contextMenu element > selecting 'Duplicate' in context menu duplicates element > [end of test] history 1`] = ` +History { + "onHistoryChangedEmitter": Emitter { + "subscribers": [ + [Function], + [Function], + ], + }, + "redoStack": [], + "undoStack": [ + HistoryEntry { + "appStateChange": AppStateChange { + "delta": Delta { + "deleted": { + "selectedElementIds": { + "id0": true, + }, + }, + "inserted": { + "selectedElementIds": {}, + }, + }, + }, + "elementsChange": ElementsChange { + "added": Map {}, + "removed": Map { + "id0" => Delta { + "deleted": { + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 20, + "index": "a0", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 3, + }, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "width": 20, + "x": -10, + "y": 0, + }, + "inserted": { + "isDeleted": true, + }, + }, + }, + "updated": Map {}, + }, + }, + HistoryEntry { + "appStateChange": AppStateChange { + "delta": Delta { + "deleted": { + "selectedElementIds": { + "id1": true, + }, + }, + "inserted": { + "selectedElementIds": { + "id0": true, + }, + }, + }, + }, + "elementsChange": ElementsChange { + "added": Map {}, + "removed": Map { + "id1" => Delta { + "deleted": { + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 20, + "index": "a1", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 3, + }, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "width": 20, + "x": 0, + "y": 10, + }, + "inserted": { + "isDeleted": true, + }, + }, + }, + "updated": Map {}, + }, + }, + ], +} +`; + +exports[`contextMenu element > selecting 'Duplicate' in context menu duplicates element > [end of test] number of elements 1`] = `2`; + +exports[`contextMenu element > selecting 'Duplicate' in context menu duplicates element > [end of test] number of renders 1`] = `6`; + +exports[`contextMenu element > selecting 'Group selection' in context menu groups selected elements > [end of test] appState 1`] = ` +{ + "activeEmbeddable": null, + "activeTool": { + "customType": null, + "lastActiveTool": null, + "locked": false, + "type": "selection", + }, + "collaborators": Map {}, + "contextMenu": null, + "croppingElementId": null, + "currentChartType": "bar", + "currentHoveredFontFamily": null, + "currentItemArrowType": "round", + "currentItemBackgroundColor": "transparent", + "currentItemEndArrowhead": "arrow", + "currentItemFillStyle": "solid", + "currentItemFontFamily": 5, + "currentItemFontSize": 20, + "currentItemOpacity": 100, + "currentItemRoughness": 1, + "currentItemRoundness": "round", + "currentItemStartArrowhead": null, + "currentItemStrokeColor": "#1e1e1e", + "currentItemStrokeStyle": "solid", + "currentItemStrokeWidth": 2, + "currentItemTextAlign": "left", + "cursorButton": "up", + "defaultSidebarDockedPreference": false, + "editingFrame": null, + "editingGroupId": null, + "editingLinearElement": null, + "editingTextElement": null, + "elementsToHighlight": null, + "errorMessage": null, + "exportBackground": true, + "exportEmbedScene": false, + "exportScale": 1, + "exportWithDarkMode": false, + "fileHandle": null, + "followedBy": Set {}, + "frameRendering": { + "clip": true, + "enabled": true, + "name": true, + "outline": true, + }, + "frameToHighlight": null, + "gridModeEnabled": false, + "gridSize": 20, + "gridStep": 5, + "height": 100, + "hoveredElementIds": {}, + "isBindingEnabled": true, + "isCropping": false, + "isLoading": false, + "isResizing": false, + "isRotating": false, + "lastPointerDownWith": "mouse", + "multiElement": null, + "name": "Untitled-201933152653", + "newElement": null, + "objectsSnapModeEnabled": false, + "offsetLeft": 20, + "offsetTop": 10, + "openDialog": null, + "openMenu": null, + "openPopup": null, + "openSidebar": null, + "originSnapOffset": null, + "pasteDialog": { + "data": null, + "shown": false, + }, + "penDetected": false, + "penMode": false, + "pendingImageElementId": null, + "previousSelectedElementIds": { + "id1": true, + }, + "resizingElement": null, + "scrollX": 0, + "scrollY": 0, + "scrolledOutside": false, + "searchMatches": [], + "selectedElementIds": { + "id0": true, + "id1": true, + }, + "selectedElementsAreBeingDragged": false, + "selectedGroupIds": { + "id3": true, + }, + "selectedLinearElement": null, + "selectionElement": null, + "shouldCacheIgnoreZoom": false, + "showHyperlinkPopup": false, + "showWelcomeScreen": true, + "snapLines": [], + "startBoundElement": null, + "stats": { + "open": false, + "panels": 3, + }, + "suggestedBindings": [], + "theme": "light", + "toast": null, + "userToFollow": null, + "viewBackgroundColor": "#ffffff", + "viewModeEnabled": false, + "width": 200, + "zenModeEnabled": false, + "zoom": { + "value": 1, + }, +} +`; + +exports[`contextMenu element > selecting 'Group selection' in context menu groups selected elements > [end of test] element 0 1`] = ` +{ + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [ + "id3", + ], + "height": 20, + "id": "id0", + "index": "a0", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 3, + }, + "seed": 449462985, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "updated": 1, + "version": 4, + "versionNonce": 493213705, + "width": 20, + "x": -10, + "y": 0, +} +`; + +exports[`contextMenu element > selecting 'Group selection' in context menu groups selected elements > [end of test] element 1 1`] = ` +{ + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [ + "id3", + ], + "height": 20, + "id": "id1", + "index": "a1", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 3, + }, + "seed": 1014066025, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "updated": 1, + "version": 4, + "versionNonce": 915032327, + "width": 20, + "x": 20, + "y": 30, +} +`; + +exports[`contextMenu element > selecting 'Group selection' in context menu groups selected elements > [end of test] history 1`] = ` +History { + "onHistoryChangedEmitter": Emitter { + "subscribers": [ + [Function], + [Function], + ], + }, + "redoStack": [], + "undoStack": [ + HistoryEntry { + "appStateChange": AppStateChange { + "delta": Delta { + "deleted": { + "selectedElementIds": { + "id0": true, + }, + }, + "inserted": { + "selectedElementIds": {}, + }, + }, + }, + "elementsChange": ElementsChange { + "added": Map {}, + "removed": Map { + "id0" => Delta { + "deleted": { + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 20, + "index": "a0", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 3, + }, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "width": 20, + "x": -10, + "y": 0, + }, + "inserted": { + "isDeleted": true, + }, + }, + }, + "updated": Map {}, + }, + }, + HistoryEntry { + "appStateChange": AppStateChange { + "delta": Delta { + "deleted": { + "selectedElementIds": { + "id1": true, + }, + }, + "inserted": { + "selectedElementIds": { + "id0": true, + }, + }, + }, + }, + "elementsChange": ElementsChange { + "added": Map {}, + "removed": Map { + "id1" => Delta { + "deleted": { + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 20, + "index": "a1", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 3, + }, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "width": 20, + "x": 20, + "y": 30, + }, + "inserted": { + "isDeleted": true, + }, + }, + }, + "updated": Map {}, + }, + }, + HistoryEntry { + "appStateChange": AppStateChange { + "delta": Delta { + "deleted": { + "selectedElementIds": { + "id0": true, + }, + }, + "inserted": { + "selectedElementIds": {}, + }, + }, + }, + "elementsChange": ElementsChange { + "added": Map {}, + "removed": Map {}, + "updated": Map {}, + }, + }, + HistoryEntry { + "appStateChange": AppStateChange { + "delta": Delta { + "deleted": { + "selectedGroupIds": { + "id3": true, + }, + }, + "inserted": { + "selectedGroupIds": {}, + }, + }, + }, + "elementsChange": ElementsChange { + "added": Map {}, + "removed": Map {}, + "updated": Map { + "id0" => Delta { + "deleted": { + "groupIds": [ + "id3", + ], + }, + "inserted": { + "groupIds": [], + }, + }, + "id1" => Delta { + "deleted": { + "groupIds": [ + "id3", + ], + }, + "inserted": { + "groupIds": [], + }, + }, + }, + }, + }, + ], +} +`; + +exports[`contextMenu element > selecting 'Group selection' in context menu groups selected elements > [end of test] number of elements 1`] = `2`; + +exports[`contextMenu element > selecting 'Group selection' in context menu groups selected elements > [end of test] number of renders 1`] = `10`; + +exports[`contextMenu element > selecting 'Paste styles' in context menu pastes styles > [end of test] appState 1`] = ` +{ + "activeEmbeddable": null, + "activeTool": { + "customType": null, + "lastActiveTool": null, + "locked": false, + "type": "selection", + }, + "collaborators": Map {}, + "contextMenu": null, + "croppingElementId": null, + "currentChartType": "bar", + "currentHoveredFontFamily": null, + "currentItemArrowType": "round", + "currentItemBackgroundColor": "#a5d8ff", + "currentItemEndArrowhead": "arrow", + "currentItemFillStyle": "cross-hatch", + "currentItemFontFamily": 5, + "currentItemFontSize": 20, + "currentItemOpacity": 60, + "currentItemRoughness": 2, + "currentItemRoundness": "round", + "currentItemStartArrowhead": null, + "currentItemStrokeColor": "#e03131", + "currentItemStrokeStyle": "dotted", + "currentItemStrokeWidth": 2, + "currentItemTextAlign": "left", + "cursorButton": "up", + "defaultSidebarDockedPreference": false, + "editingFrame": null, + "editingGroupId": null, + "editingLinearElement": null, + "editingTextElement": null, + "elementsToHighlight": null, + "errorMessage": null, + "exportBackground": true, + "exportEmbedScene": false, + "exportScale": 1, + "exportWithDarkMode": false, + "fileHandle": null, + "followedBy": Set {}, + "frameRendering": { + "clip": true, + "enabled": true, + "name": true, + "outline": true, + }, + "frameToHighlight": null, + "gridModeEnabled": false, + "gridSize": 20, + "gridStep": 5, + "height": 100, + "hoveredElementIds": {}, + "isBindingEnabled": true, + "isCropping": false, + "isLoading": false, + "isResizing": false, + "isRotating": false, + "lastPointerDownWith": "mouse", + "multiElement": null, + "name": "Untitled-201933152653", + "newElement": null, + "objectsSnapModeEnabled": false, + "offsetLeft": 20, + "offsetTop": 10, + "openDialog": null, + "openMenu": null, + "openPopup": null, + "openSidebar": null, + "originSnapOffset": null, + "pasteDialog": { + "data": null, + "shown": false, + }, + "penDetected": false, + "penMode": false, + "pendingImageElementId": null, + "previousSelectedElementIds": {}, + "resizingElement": null, + "scrollX": 0, + "scrollY": 0, + "scrolledOutside": false, + "searchMatches": [], + "selectedElementIds": { + "id0": true, + }, + "selectedElementsAreBeingDragged": false, + "selectedGroupIds": {}, + "selectedLinearElement": null, + "selectionElement": null, + "shouldCacheIgnoreZoom": false, + "showHyperlinkPopup": false, + "showWelcomeScreen": true, + "snapLines": [], + "startBoundElement": null, + "stats": { + "open": false, + "panels": 3, + }, + "suggestedBindings": [], + "theme": "light", + "toast": { + "message": "Copied styles.", + }, + "userToFollow": null, + "viewBackgroundColor": "#ffffff", + "viewModeEnabled": false, + "width": 200, + "zenModeEnabled": false, + "zoom": { + "value": 1, + }, +} +`; + +exports[`contextMenu element > selecting 'Paste styles' in context menu pastes styles > [end of test] element 0 1`] = ` +{ + "angle": 0, + "backgroundColor": "#a5d8ff", + "boundElements": null, + "customData": undefined, + "fillStyle": "cross-hatch", + "frameId": null, + "groupIds": [], + "height": 20, + "id": "id0", + "index": "a0", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 60, + "roughness": 2, + "roundness": { + "type": 3, + }, + "seed": 449462985, + "strokeColor": "#e03131", + "strokeStyle": "dotted", + "strokeWidth": 2, + "type": "rectangle", + "updated": 1, + "version": 4, + "versionNonce": 941653321, + "width": 20, + "x": -10, + "y": 0, +} +`; + +exports[`contextMenu element > selecting 'Paste styles' in context menu pastes styles > [end of test] element 1 1`] = ` +{ + "angle": 0, + "backgroundColor": "#a5d8ff", + "boundElements": null, + "customData": undefined, + "fillStyle": "cross-hatch", + "frameId": null, + "groupIds": [], + "height": 20, + "id": "id1", + "index": "a1", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 60, + "roughness": 2, + "roundness": { + "type": 3, + }, + "seed": 289600103, + "strokeColor": "#e03131", + "strokeStyle": "dotted", + "strokeWidth": 2, + "type": "rectangle", + "updated": 1, + "version": 9, + "versionNonce": 640725609, + "width": 20, + "x": 20, + "y": 30, +} +`; + +exports[`contextMenu element > selecting 'Paste styles' in context menu pastes styles > [end of test] history 1`] = ` +History { + "onHistoryChangedEmitter": Emitter { + "subscribers": [ + [Function], + [Function], + ], + }, + "redoStack": [], + "undoStack": [ + HistoryEntry { + "appStateChange": AppStateChange { + "delta": Delta { + "deleted": { + "selectedElementIds": { + "id0": true, + }, + }, + "inserted": { + "selectedElementIds": {}, + }, + }, + }, + "elementsChange": ElementsChange { + "added": Map {}, + "removed": Map { + "id0" => Delta { + "deleted": { + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 20, + "index": "a0", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 3, + }, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "width": 20, + "x": -10, + "y": 0, + }, + "inserted": { + "isDeleted": true, + }, + }, + }, + "updated": Map {}, + }, + }, + HistoryEntry { + "appStateChange": AppStateChange { + "delta": Delta { + "deleted": { + "selectedElementIds": { + "id1": true, + }, + }, + "inserted": { + "selectedElementIds": { + "id0": true, + }, + }, + }, + }, + "elementsChange": ElementsChange { + "added": Map {}, + "removed": Map { + "id1" => Delta { + "deleted": { + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 20, + "index": "a1", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 3, + }, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "width": 20, + "x": 20, + "y": 30, + }, + "inserted": { + "isDeleted": true, + }, + }, + }, + "updated": Map {}, + }, + }, + HistoryEntry { + "appStateChange": AppStateChange { + "delta": Delta { + "deleted": {}, + "inserted": {}, + }, + }, + "elementsChange": ElementsChange { + "added": Map {}, + "removed": Map {}, + "updated": Map { + "id1" => Delta { + "deleted": { + "strokeColor": "#e03131", + }, + "inserted": { + "strokeColor": "#1e1e1e", + }, + }, + }, + }, + }, + HistoryEntry { + "appStateChange": AppStateChange { + "delta": Delta { + "deleted": {}, + "inserted": {}, + }, + }, + "elementsChange": ElementsChange { + "added": Map {}, + "removed": Map {}, + "updated": Map { + "id1" => Delta { + "deleted": { + "backgroundColor": "#a5d8ff", + }, + "inserted": { + "backgroundColor": "transparent", + }, + }, + }, + }, + }, + HistoryEntry { + "appStateChange": AppStateChange { + "delta": Delta { + "deleted": {}, + "inserted": {}, + }, + }, + "elementsChange": ElementsChange { + "added": Map {}, + "removed": Map {}, + "updated": Map { + "id1" => Delta { + "deleted": { + "fillStyle": "cross-hatch", + }, + "inserted": { + "fillStyle": "solid", + }, + }, + }, + }, + }, + HistoryEntry { + "appStateChange": AppStateChange { + "delta": Delta { + "deleted": {}, + "inserted": {}, + }, + }, + "elementsChange": ElementsChange { + "added": Map {}, + "removed": Map {}, + "updated": Map { + "id1" => Delta { + "deleted": { + "strokeStyle": "dotted", + }, + "inserted": { + "strokeStyle": "solid", + }, + }, + }, + }, + }, + HistoryEntry { + "appStateChange": AppStateChange { + "delta": Delta { + "deleted": {}, + "inserted": {}, + }, + }, + "elementsChange": ElementsChange { + "added": Map {}, + "removed": Map {}, + "updated": Map { + "id1" => Delta { + "deleted": { + "roughness": 2, + }, + "inserted": { + "roughness": 1, + }, + }, + }, + }, + }, + HistoryEntry { + "appStateChange": AppStateChange { + "delta": Delta { + "deleted": {}, + "inserted": {}, + }, + }, + "elementsChange": ElementsChange { + "added": Map {}, + "removed": Map {}, + "updated": Map { + "id1" => Delta { + "deleted": { + "opacity": 60, + }, + "inserted": { + "opacity": 100, + }, + }, + }, + }, + }, + HistoryEntry { + "appStateChange": AppStateChange { + "delta": Delta { + "deleted": { + "selectedElementIds": { + "id0": true, + }, + }, + "inserted": { + "selectedElementIds": { + "id1": true, + }, + }, + }, + }, + "elementsChange": ElementsChange { + "added": Map {}, + "removed": Map {}, + "updated": Map { + "id0" => Delta { + "deleted": { + "backgroundColor": "#a5d8ff", + "fillStyle": "cross-hatch", + "opacity": 60, + "roughness": 2, + "strokeColor": "#e03131", + "strokeStyle": "dotted", + }, + "inserted": { + "backgroundColor": "transparent", + "fillStyle": "solid", + "opacity": 100, + "roughness": 1, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + }, + }, + }, + }, + }, + ], +} +`; + +exports[`contextMenu element > selecting 'Paste styles' in context menu pastes styles > [end of test] number of elements 1`] = `2`; + +exports[`contextMenu element > selecting 'Paste styles' in context menu pastes styles > [end of test] number of renders 1`] = `16`; + +exports[`contextMenu element > selecting 'Send backward' in context menu sends element backward > [end of test] appState 1`] = ` +{ + "activeEmbeddable": null, + "activeTool": { + "customType": null, + "lastActiveTool": null, + "locked": false, + "type": "selection", + }, + "collaborators": Map {}, + "contextMenu": null, + "croppingElementId": null, + "currentChartType": "bar", + "currentHoveredFontFamily": null, + "currentItemArrowType": "round", + "currentItemBackgroundColor": "transparent", + "currentItemEndArrowhead": "arrow", + "currentItemFillStyle": "solid", + "currentItemFontFamily": 5, + "currentItemFontSize": 20, + "currentItemOpacity": 100, + "currentItemRoughness": 1, + "currentItemRoundness": "round", + "currentItemStartArrowhead": null, + "currentItemStrokeColor": "#1e1e1e", + "currentItemStrokeStyle": "solid", + "currentItemStrokeWidth": 2, + "currentItemTextAlign": "left", + "cursorButton": "up", + "defaultSidebarDockedPreference": false, + "editingFrame": null, + "editingGroupId": null, + "editingLinearElement": null, + "editingTextElement": null, + "elementsToHighlight": null, + "errorMessage": null, + "exportBackground": true, + "exportEmbedScene": false, + "exportScale": 1, + "exportWithDarkMode": false, + "fileHandle": null, + "followedBy": Set {}, + "frameRendering": { + "clip": true, + "enabled": true, + "name": true, + "outline": true, + }, + "frameToHighlight": null, + "gridModeEnabled": false, + "gridSize": 20, + "gridStep": 5, + "height": 100, + "hoveredElementIds": {}, + "isBindingEnabled": true, + "isCropping": false, + "isLoading": false, + "isResizing": false, + "isRotating": false, + "lastPointerDownWith": "mouse", + "multiElement": null, + "name": "Untitled-201933152653", + "newElement": null, + "objectsSnapModeEnabled": false, + "offsetLeft": 20, + "offsetTop": 10, + "openDialog": null, + "openMenu": null, + "openPopup": null, + "openSidebar": null, + "originSnapOffset": null, + "pasteDialog": { + "data": null, + "shown": false, + }, + "penDetected": false, + "penMode": false, + "pendingImageElementId": null, + "previousSelectedElementIds": {}, + "resizingElement": null, + "scrollX": 0, + "scrollY": 0, + "scrolledOutside": false, + "searchMatches": [], + "selectedElementIds": { + "id1": true, + }, + "selectedElementsAreBeingDragged": false, + "selectedGroupIds": {}, + "selectedLinearElement": null, + "selectionElement": null, + "shouldCacheIgnoreZoom": false, + "showHyperlinkPopup": false, + "showWelcomeScreen": true, + "snapLines": [], + "startBoundElement": null, + "stats": { + "open": false, + "panels": 3, + }, + "suggestedBindings": [], + "theme": "light", + "toast": null, + "userToFollow": null, + "viewBackgroundColor": "#ffffff", + "viewModeEnabled": false, + "width": 200, + "zenModeEnabled": false, + "zoom": { + "value": 1, + }, +} +`; + +exports[`contextMenu element > selecting 'Send backward' in context menu sends element backward > [end of test] element 0 1`] = ` +{ + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 20, + "id": "id1", + "index": "Zz", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 3, + }, + "seed": 1014066025, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "updated": 1, + "version": 4, + "versionNonce": 23633383, + "width": 20, + "x": 20, + "y": 30, +} +`; + +exports[`contextMenu element > selecting 'Send backward' in context menu sends element backward > [end of test] element 1 1`] = ` +{ + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 20, + "id": "id0", + "index": "a0", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 3, + }, + "seed": 449462985, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "updated": 1, + "version": 3, + "versionNonce": 1150084233, + "width": 20, + "x": -10, + "y": 0, +} +`; + +exports[`contextMenu element > selecting 'Send backward' in context menu sends element backward > [end of test] history 1`] = ` +History { + "onHistoryChangedEmitter": Emitter { + "subscribers": [ + [Function], + [Function], + ], + }, + "redoStack": [], + "undoStack": [ + HistoryEntry { + "appStateChange": AppStateChange { + "delta": Delta { + "deleted": { + "selectedElementIds": { + "id0": true, + }, + }, + "inserted": { + "selectedElementIds": {}, + }, + }, + }, + "elementsChange": ElementsChange { + "added": Map {}, + "removed": Map { + "id0" => Delta { + "deleted": { + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 20, + "index": "a0", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 3, + }, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "width": 20, + "x": -10, + "y": 0, + }, + "inserted": { + "isDeleted": true, + }, + }, + }, + "updated": Map {}, + }, + }, + HistoryEntry { + "appStateChange": AppStateChange { + "delta": Delta { + "deleted": { + "selectedElementIds": { + "id1": true, + }, + }, + "inserted": { + "selectedElementIds": { + "id0": true, + }, + }, + }, + }, + "elementsChange": ElementsChange { + "added": Map {}, + "removed": Map { + "id1" => Delta { + "deleted": { + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 20, + "index": "a1", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 3, + }, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "width": 20, + "x": 20, + "y": 30, + }, + "inserted": { + "isDeleted": true, + }, + }, + }, + "updated": Map {}, + }, + }, + HistoryEntry { + "appStateChange": AppStateChange { + "delta": Delta { + "deleted": {}, + "inserted": {}, + }, + }, + "elementsChange": ElementsChange { + "added": Map {}, + "removed": Map {}, + "updated": Map { + "id1" => Delta { + "deleted": { + "index": "Zz", + }, + "inserted": { + "index": "a1", + }, + }, + }, + }, + }, + ], +} +`; + +exports[`contextMenu element > selecting 'Send backward' in context menu sends element backward > [end of test] number of elements 1`] = `2`; + +exports[`contextMenu element > selecting 'Send backward' in context menu sends element backward > [end of test] number of renders 1`] = `9`; + +exports[`contextMenu element > selecting 'Send to back' in context menu sends element to back > [end of test] appState 1`] = ` +{ + "activeEmbeddable": null, + "activeTool": { + "customType": null, + "lastActiveTool": null, + "locked": false, + "type": "selection", + }, + "collaborators": Map {}, + "contextMenu": null, + "croppingElementId": null, + "currentChartType": "bar", + "currentHoveredFontFamily": null, + "currentItemArrowType": "round", + "currentItemBackgroundColor": "transparent", + "currentItemEndArrowhead": "arrow", + "currentItemFillStyle": "solid", + "currentItemFontFamily": 5, + "currentItemFontSize": 20, + "currentItemOpacity": 100, + "currentItemRoughness": 1, + "currentItemRoundness": "round", + "currentItemStartArrowhead": null, + "currentItemStrokeColor": "#1e1e1e", + "currentItemStrokeStyle": "solid", + "currentItemStrokeWidth": 2, + "currentItemTextAlign": "left", + "cursorButton": "up", + "defaultSidebarDockedPreference": false, + "editingFrame": null, + "editingGroupId": null, + "editingLinearElement": null, + "editingTextElement": null, + "elementsToHighlight": null, + "errorMessage": null, + "exportBackground": true, + "exportEmbedScene": false, + "exportScale": 1, + "exportWithDarkMode": false, + "fileHandle": null, + "followedBy": Set {}, + "frameRendering": { + "clip": true, + "enabled": true, + "name": true, + "outline": true, + }, + "frameToHighlight": null, + "gridModeEnabled": false, + "gridSize": 20, + "gridStep": 5, + "height": 100, + "hoveredElementIds": {}, + "isBindingEnabled": true, + "isCropping": false, + "isLoading": false, + "isResizing": false, + "isRotating": false, + "lastPointerDownWith": "mouse", + "multiElement": null, + "name": "Untitled-201933152653", + "newElement": null, + "objectsSnapModeEnabled": false, + "offsetLeft": 20, + "offsetTop": 10, + "openDialog": null, + "openMenu": null, + "openPopup": null, + "openSidebar": null, + "originSnapOffset": null, + "pasteDialog": { + "data": null, + "shown": false, + }, + "penDetected": false, + "penMode": false, + "pendingImageElementId": null, + "previousSelectedElementIds": {}, + "resizingElement": null, + "scrollX": 0, + "scrollY": 0, + "scrolledOutside": false, + "searchMatches": [], + "selectedElementIds": { + "id1": true, + }, + "selectedElementsAreBeingDragged": false, + "selectedGroupIds": {}, + "selectedLinearElement": null, + "selectionElement": null, + "shouldCacheIgnoreZoom": false, + "showHyperlinkPopup": false, + "showWelcomeScreen": true, + "snapLines": [], + "startBoundElement": null, + "stats": { + "open": false, + "panels": 3, + }, + "suggestedBindings": [], + "theme": "light", + "toast": null, + "userToFollow": null, + "viewBackgroundColor": "#ffffff", + "viewModeEnabled": false, + "width": 200, + "zenModeEnabled": false, + "zoom": { + "value": 1, + }, +} +`; + +exports[`contextMenu element > selecting 'Send to back' in context menu sends element to back > [end of test] element 0 1`] = ` +{ + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 20, + "id": "id1", + "index": "Zz", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 3, + }, + "seed": 1014066025, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "updated": 1, + "version": 4, + "versionNonce": 23633383, + "width": 20, + "x": 20, + "y": 30, +} +`; + +exports[`contextMenu element > selecting 'Send to back' in context menu sends element to back > [end of test] element 1 1`] = ` +{ + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 20, + "id": "id0", + "index": "a0", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 3, + }, + "seed": 449462985, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "updated": 1, + "version": 3, + "versionNonce": 1150084233, + "width": 20, + "x": -10, + "y": 0, +} +`; + +exports[`contextMenu element > selecting 'Send to back' in context menu sends element to back > [end of test] history 1`] = ` +History { + "onHistoryChangedEmitter": Emitter { + "subscribers": [ + [Function], + [Function], + ], + }, + "redoStack": [], + "undoStack": [ + HistoryEntry { + "appStateChange": AppStateChange { + "delta": Delta { + "deleted": { + "selectedElementIds": { + "id0": true, + }, + }, + "inserted": { + "selectedElementIds": {}, + }, + }, + }, + "elementsChange": ElementsChange { + "added": Map {}, + "removed": Map { + "id0" => Delta { + "deleted": { + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 20, + "index": "a0", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 3, + }, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "width": 20, + "x": -10, + "y": 0, + }, + "inserted": { + "isDeleted": true, + }, + }, + }, + "updated": Map {}, + }, + }, + HistoryEntry { + "appStateChange": AppStateChange { + "delta": Delta { + "deleted": { + "selectedElementIds": { + "id1": true, + }, + }, + "inserted": { + "selectedElementIds": { + "id0": true, + }, + }, + }, + }, + "elementsChange": ElementsChange { + "added": Map {}, + "removed": Map { + "id1" => Delta { + "deleted": { + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 20, + "index": "a1", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 3, + }, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "width": 20, + "x": 20, + "y": 30, + }, + "inserted": { + "isDeleted": true, + }, + }, + }, + "updated": Map {}, + }, + }, + HistoryEntry { + "appStateChange": AppStateChange { + "delta": Delta { + "deleted": {}, + "inserted": {}, + }, + }, + "elementsChange": ElementsChange { + "added": Map {}, + "removed": Map {}, + "updated": Map { + "id1" => Delta { + "deleted": { + "index": "Zz", + }, + "inserted": { + "index": "a1", + }, + }, + }, + }, + }, + ], +} +`; + +exports[`contextMenu element > selecting 'Send to back' in context menu sends element to back > [end of test] number of elements 1`] = `2`; + +exports[`contextMenu element > selecting 'Send to back' in context menu sends element to back > [end of test] number of renders 1`] = `9`; + +exports[`contextMenu element > selecting 'Ungroup selection' in context menu ungroups selected group > [end of test] appState 1`] = ` +{ + "activeEmbeddable": null, + "activeTool": { + "customType": null, + "lastActiveTool": null, + "locked": false, + "type": "selection", + }, + "collaborators": Map {}, + "contextMenu": null, + "croppingElementId": null, + "currentChartType": "bar", + "currentHoveredFontFamily": null, + "currentItemArrowType": "round", + "currentItemBackgroundColor": "transparent", + "currentItemEndArrowhead": "arrow", + "currentItemFillStyle": "solid", + "currentItemFontFamily": 5, + "currentItemFontSize": 20, + "currentItemOpacity": 100, + "currentItemRoughness": 1, + "currentItemRoundness": "round", + "currentItemStartArrowhead": null, + "currentItemStrokeColor": "#1e1e1e", + "currentItemStrokeStyle": "solid", + "currentItemStrokeWidth": 2, + "currentItemTextAlign": "left", + "cursorButton": "up", + "defaultSidebarDockedPreference": false, + "editingFrame": null, + "editingGroupId": null, + "editingLinearElement": null, + "editingTextElement": null, + "elementsToHighlight": null, + "errorMessage": null, + "exportBackground": true, + "exportEmbedScene": false, + "exportScale": 1, + "exportWithDarkMode": false, + "fileHandle": null, + "followedBy": Set {}, + "frameRendering": { + "clip": true, + "enabled": true, + "name": true, + "outline": true, + }, + "frameToHighlight": null, + "gridModeEnabled": false, + "gridSize": 20, + "gridStep": 5, + "height": 100, + "hoveredElementIds": {}, + "isBindingEnabled": true, + "isCropping": false, + "isLoading": false, + "isResizing": false, + "isRotating": false, + "lastPointerDownWith": "mouse", + "multiElement": null, + "name": "Untitled-201933152653", + "newElement": null, + "objectsSnapModeEnabled": false, + "offsetLeft": 20, + "offsetTop": 10, + "openDialog": null, + "openMenu": null, + "openPopup": null, + "openSidebar": null, + "originSnapOffset": null, + "pasteDialog": { + "data": null, + "shown": false, + }, + "penDetected": false, + "penMode": false, + "pendingImageElementId": null, + "previousSelectedElementIds": { + "id1": true, + }, + "resizingElement": null, + "scrollX": 0, + "scrollY": 0, + "scrolledOutside": false, + "searchMatches": [], + "selectedElementIds": { + "id0": true, + "id1": true, + }, + "selectedElementsAreBeingDragged": false, + "selectedGroupIds": {}, + "selectedLinearElement": null, + "selectionElement": null, + "shouldCacheIgnoreZoom": false, + "showHyperlinkPopup": false, + "showWelcomeScreen": true, + "snapLines": [], + "startBoundElement": null, + "stats": { + "open": false, + "panels": 3, + }, + "suggestedBindings": [], + "theme": "light", + "toast": null, + "userToFollow": null, + "viewBackgroundColor": "#ffffff", + "viewModeEnabled": false, + "width": 200, + "zenModeEnabled": false, + "zoom": { + "value": 1, + }, +} +`; + +exports[`contextMenu element > selecting 'Ungroup selection' in context menu ungroups selected group > [end of test] element 0 1`] = ` +{ + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 20, + "id": "id0", + "index": "a0", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 3, + }, + "seed": 449462985, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "updated": 1, + "version": 5, + "versionNonce": 1723083209, + "width": 20, + "x": -10, + "y": 0, +} +`; + +exports[`contextMenu element > selecting 'Ungroup selection' in context menu ungroups selected group > [end of test] element 1 1`] = ` +{ + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 20, + "id": "id1", + "index": "a1", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 3, + }, + "seed": 238820263, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "updated": 1, + "version": 5, + "versionNonce": 760410951, + "width": 20, + "x": 20, + "y": 30, +} +`; + +exports[`contextMenu element > selecting 'Ungroup selection' in context menu ungroups selected group > [end of test] history 1`] = ` +History { + "onHistoryChangedEmitter": Emitter { + "subscribers": [ + [Function], + [Function], + ], + }, + "redoStack": [], + "undoStack": [ + HistoryEntry { + "appStateChange": AppStateChange { + "delta": Delta { + "deleted": { + "selectedElementIds": { + "id0": true, + }, + }, + "inserted": { + "selectedElementIds": {}, + }, + }, + }, + "elementsChange": ElementsChange { + "added": Map {}, + "removed": Map { + "id0" => Delta { + "deleted": { + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 20, + "index": "a0", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 3, + }, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "width": 20, + "x": -10, + "y": 0, + }, + "inserted": { + "isDeleted": true, + }, + }, + }, + "updated": Map {}, + }, + }, + HistoryEntry { + "appStateChange": AppStateChange { + "delta": Delta { + "deleted": { + "selectedElementIds": { + "id1": true, + }, + }, + "inserted": { + "selectedElementIds": { + "id0": true, + }, + }, + }, + }, + "elementsChange": ElementsChange { + "added": Map {}, + "removed": Map { + "id1" => Delta { + "deleted": { + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 20, + "index": "a1", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 3, + }, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "width": 20, + "x": 20, + "y": 30, + }, + "inserted": { + "isDeleted": true, + }, + }, + }, + "updated": Map {}, + }, + }, + HistoryEntry { + "appStateChange": AppStateChange { + "delta": Delta { + "deleted": { + "selectedElementIds": { + "id0": true, + }, + }, + "inserted": { + "selectedElementIds": {}, + }, + }, + }, + "elementsChange": ElementsChange { + "added": Map {}, + "removed": Map {}, + "updated": Map {}, + }, + }, + HistoryEntry { + "appStateChange": AppStateChange { + "delta": Delta { + "deleted": { + "selectedGroupIds": { + "id3": true, + }, + }, + "inserted": { + "selectedGroupIds": {}, + }, + }, + }, + "elementsChange": ElementsChange { + "added": Map {}, + "removed": Map {}, + "updated": Map { + "id0" => Delta { + "deleted": { + "groupIds": [ + "id3", + ], + }, + "inserted": { + "groupIds": [], + }, + }, + "id1" => Delta { + "deleted": { + "groupIds": [ + "id3", + ], + }, + "inserted": { + "groupIds": [], + }, + }, + }, + }, + }, + HistoryEntry { + "appStateChange": AppStateChange { + "delta": Delta { + "deleted": { + "selectedGroupIds": {}, + }, + "inserted": { + "selectedGroupIds": { + "id3": true, + }, + }, + }, + }, + "elementsChange": ElementsChange { + "added": Map {}, + "removed": Map {}, + "updated": Map { + "id0" => Delta { + "deleted": { + "groupIds": [], + }, + "inserted": { + "groupIds": [ + "id3", + ], + }, + }, + "id1" => Delta { + "deleted": { + "groupIds": [], + }, + "inserted": { + "groupIds": [ + "id3", + ], + }, + }, + }, + }, + }, + ], +} +`; + +exports[`contextMenu element > selecting 'Ungroup selection' in context menu ungroups selected group > [end of test] number of elements 1`] = `2`; + +exports[`contextMenu element > selecting 'Ungroup selection' in context menu ungroups selected group > [end of test] number of renders 1`] = `11`; + +exports[`contextMenu element > shows 'Group selection' in context menu for multiple selected elements > [end of test] appState 1`] = ` +{ + "activeEmbeddable": null, + "activeTool": { + "customType": null, + "lastActiveTool": null, + "locked": false, + "type": "selection", + }, + "collaborators": Map {}, + "contextMenu": { + "items": [ + "separator", + { + "icon": , + "keyTest": [Function], + "label": "labels.cut", + "name": "cut", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "icon": , + "keyTest": undefined, + "label": "labels.copy", + "name": "copy", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "keyTest": undefined, + "label": "labels.paste", + "name": "paste", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "label": "labels.selectAllElementsInFrame", + "name": "selectAllElementsInFrame", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "canvas", + }, + }, + { + "label": "labels.removeAllElementsFromFrame", + "name": "removeAllElementsFromFrame", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "history", + }, + }, + { + "label": "labels.wrapSelectionInFrame", + "name": "wrapSelectionInFrame", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "PanelComponent": [Function], + "icon": , + "keywords": [ + "image", + "crop", + ], + "label": "helpDialog.cropStart", + "name": "cropEditor", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "menu", + }, + "viewMode": true, + }, + "separator", + { + "icon": , + "keyTest": [Function], + "keywords": [ + "png", + "clipboard", + "copy", + ], + "label": "labels.copyAsPng", + "name": "copyAsPng", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "icon": , + "keywords": [ + "svg", + "clipboard", + "copy", + ], + "label": "labels.copyAsSvg", + "name": "copyAsSvg", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "keywords": [ + "text", + "clipboard", + "copy", + ], + "label": "labels.copyText", + "name": "copyText", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "icon": , + "keyTest": [Function], + "label": "labels.copyStyles", + "name": "copyStyles", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "icon": , + "keyTest": [Function], + "label": "labels.pasteStyles", + "name": "pasteStyles", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "PanelComponent": [Function], + "icon": [Function], + "keyTest": [Function], + "label": "labels.group", + "name": "group", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "icon": null, + "label": "labels.autoResize", + "name": "autoResize", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "label": "labels.unbindText", + "name": "unbindText", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "label": "labels.bindText", + "name": "bindText", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "label": "labels.createContainerFromText", + "name": "wrapTextInContainer", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "PanelComponent": [Function], + "icon": [Function], + "keyTest": [Function], + "label": "labels.ungroup", + "name": "ungroup", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "label": "labels.addToLibrary", + "name": "addToLibrary", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "PanelComponent": [Function], + "icon": , + "keyPriority": 40, + "keyTest": [Function], + "keywords": [ + "move down", + "zindex", + "layer", + ], + "label": "labels.sendBackward", + "name": "sendBackward", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "PanelComponent": [Function], + "icon": , + "keyPriority": 40, + "keyTest": [Function], + "keywords": [ + "move up", + "zindex", + "layer", + ], + "label": "labels.bringForward", + "name": "bringForward", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "PanelComponent": [Function], + "icon": , + "keyTest": [Function], + "keywords": [ + "move down", + "zindex", + "layer", + ], + "label": "labels.sendToBack", + "name": "sendToBack", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "PanelComponent": [Function], + "icon": , + "keyTest": [Function], + "keywords": [ + "move up", + "zindex", + "layer", + ], + "label": "labels.bringToFront", + "name": "bringToFront", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "icon": , + "keyTest": [Function], + "label": "labels.flipHorizontal", + "name": "flipHorizontal", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "icon": , + "keyTest": [Function], + "label": "labels.flipVertical", + "name": "flipVertical", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "PanelComponent": [Function], + "category": "Elements", + "keywords": [ + "line", + ], + "label": [Function], + "name": "toggleLinearEditor", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "PanelComponent": [Function], + "icon": , + "keyTest": [Function], + "label": [Function], + "name": "hyperlink", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "action": "click", + "category": "hyperlink", + }, + }, + { + "icon": , + "label": "labels.copyElementLink", + "name": "copyElementLink", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "PanelComponent": [Function], + "icon": , + "keyTest": [Function], + "label": "labels.duplicateSelection", + "name": "duplicateSelection", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "icon": [Function], + "keyTest": [Function], + "label": [Function], + "name": "toggleElementLock", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "PanelComponent": [Function], + "icon": , + "keyTest": [Function], + "label": "labels.delete", + "name": "deleteSelectedElements", + "perform": [Function], + "trackEvent": { + "action": "delete", + "category": "element", + }, + }, + ], + "left": -17, + "top": -7, + }, + "croppingElementId": null, + "currentChartType": "bar", + "currentHoveredFontFamily": null, + "currentItemArrowType": "round", + "currentItemBackgroundColor": "transparent", + "currentItemEndArrowhead": "arrow", + "currentItemFillStyle": "solid", + "currentItemFontFamily": 5, + "currentItemFontSize": 20, + "currentItemOpacity": 100, + "currentItemRoughness": 1, + "currentItemRoundness": "round", + "currentItemStartArrowhead": null, + "currentItemStrokeColor": "#1e1e1e", + "currentItemStrokeStyle": "solid", + "currentItemStrokeWidth": 2, + "currentItemTextAlign": "left", + "cursorButton": "up", + "defaultSidebarDockedPreference": false, + "editingFrame": null, + "editingGroupId": null, + "editingLinearElement": null, + "editingTextElement": null, + "elementsToHighlight": null, + "errorMessage": null, + "exportBackground": true, + "exportEmbedScene": false, + "exportScale": 1, + "exportWithDarkMode": false, + "fileHandle": null, + "followedBy": Set {}, + "frameRendering": { + "clip": true, + "enabled": true, + "name": true, + "outline": true, + }, + "frameToHighlight": null, + "gridModeEnabled": false, + "gridSize": 20, + "gridStep": 5, + "height": 100, + "hoveredElementIds": {}, + "isBindingEnabled": true, + "isCropping": false, + "isLoading": false, + "isResizing": false, + "isRotating": false, + "lastPointerDownWith": "mouse", + "multiElement": null, + "name": "Untitled-201933152653", + "newElement": null, + "objectsSnapModeEnabled": false, + "offsetLeft": 20, + "offsetTop": 10, + "openDialog": null, + "openMenu": null, + "openPopup": null, + "openSidebar": null, + "originSnapOffset": null, + "pasteDialog": { + "data": null, + "shown": false, + }, + "penDetected": false, + "penMode": false, + "pendingImageElementId": null, + "previousSelectedElementIds": { + "id0": true, + }, + "resizingElement": null, + "scrollX": 0, + "scrollY": 0, + "scrolledOutside": false, + "searchMatches": [], + "selectedElementIds": { + "id0": true, + "id1": true, + }, + "selectedElementsAreBeingDragged": false, + "selectedGroupIds": {}, + "selectedLinearElement": null, + "selectionElement": null, + "shouldCacheIgnoreZoom": false, + "showHyperlinkPopup": false, + "showWelcomeScreen": true, + "snapLines": [], + "startBoundElement": null, + "stats": { + "open": false, + "panels": 3, + }, + "suggestedBindings": [], + "theme": "light", + "toast": null, + "userToFollow": null, + "viewBackgroundColor": "#ffffff", + "viewModeEnabled": false, + "width": 200, + "zenModeEnabled": false, + "zoom": { + "value": 1, + }, +} +`; + +exports[`contextMenu element > shows 'Group selection' in context menu for multiple selected elements > [end of test] element 0 1`] = ` +{ + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 10, + "id": "id0", + "index": "a0", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 3, + }, + "seed": 453191, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "updated": 1, + "version": 3, + "versionNonce": 1014066025, + "width": 10, + "x": -10, + "y": 0, +} +`; + +exports[`contextMenu element > shows 'Group selection' in context menu for multiple selected elements > [end of test] element 1 1`] = ` +{ + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 10, + "id": "id1", + "index": "a1", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 3, + }, + "seed": 400692809, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "updated": 1, + "version": 3, + "versionNonce": 23633383, + "width": 10, + "x": 12, + "y": 0, +} +`; + +exports[`contextMenu element > shows 'Group selection' in context menu for multiple selected elements > [end of test] history 1`] = ` +History { + "onHistoryChangedEmitter": Emitter { + "subscribers": [ + [Function], + [Function], + ], + }, + "redoStack": [], + "undoStack": [ + HistoryEntry { + "appStateChange": AppStateChange { + "delta": Delta { + "deleted": { + "selectedElementIds": { + "id0": true, + }, + }, + "inserted": { + "selectedElementIds": {}, + }, + }, + }, + "elementsChange": ElementsChange { + "added": Map {}, + "removed": Map { + "id0" => Delta { + "deleted": { + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 10, + "index": "a0", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 3, + }, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "width": 10, + "x": -10, + "y": 0, + }, + "inserted": { + "isDeleted": true, + }, + }, + }, + "updated": Map {}, + }, + }, + HistoryEntry { + "appStateChange": AppStateChange { + "delta": Delta { + "deleted": { + "selectedElementIds": { + "id1": true, + }, + }, + "inserted": { + "selectedElementIds": { + "id0": true, + }, + }, + }, + }, + "elementsChange": ElementsChange { + "added": Map {}, + "removed": Map { + "id1" => Delta { + "deleted": { + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 10, + "index": "a1", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 3, + }, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "width": 10, + "x": 12, + "y": 0, + }, + "inserted": { + "isDeleted": true, + }, + }, + }, + "updated": Map {}, + }, + }, + HistoryEntry { + "appStateChange": AppStateChange { + "delta": Delta { + "deleted": { + "selectedElementIds": { + "id0": true, + }, + }, + "inserted": { + "selectedElementIds": { + "id1": true, + }, + }, + }, + }, + "elementsChange": ElementsChange { + "added": Map {}, + "removed": Map {}, + "updated": Map {}, + }, + }, + HistoryEntry { + "appStateChange": AppStateChange { + "delta": Delta { + "deleted": { + "selectedElementIds": { + "id1": true, + }, + }, + "inserted": { + "selectedElementIds": {}, + }, + }, + }, + "elementsChange": ElementsChange { + "added": Map {}, + "removed": Map {}, + "updated": Map {}, + }, + }, + ], +} +`; + +exports[`contextMenu element > shows 'Group selection' in context menu for multiple selected elements > [end of test] number of elements 1`] = `2`; + +exports[`contextMenu element > shows 'Group selection' in context menu for multiple selected elements > [end of test] number of renders 1`] = `10`; + +exports[`contextMenu element > shows 'Ungroup selection' in context menu for group inside selected elements > [end of test] appState 1`] = ` +{ + "activeEmbeddable": null, + "activeTool": { + "customType": null, + "lastActiveTool": null, + "locked": false, + "type": "selection", + }, + "collaborators": Map {}, + "contextMenu": { + "items": [ + "separator", + { + "icon": , + "keyTest": [Function], + "label": "labels.cut", + "name": "cut", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "icon": , + "keyTest": undefined, + "label": "labels.copy", + "name": "copy", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "keyTest": undefined, + "label": "labels.paste", + "name": "paste", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "label": "labels.selectAllElementsInFrame", + "name": "selectAllElementsInFrame", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "canvas", + }, + }, + { + "label": "labels.removeAllElementsFromFrame", + "name": "removeAllElementsFromFrame", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "history", + }, + }, + { + "label": "labels.wrapSelectionInFrame", + "name": "wrapSelectionInFrame", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "PanelComponent": [Function], + "icon": , + "keywords": [ + "image", + "crop", + ], + "label": "helpDialog.cropStart", + "name": "cropEditor", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "menu", + }, + "viewMode": true, + }, + "separator", + { + "icon": , + "keyTest": [Function], + "keywords": [ + "png", + "clipboard", + "copy", + ], + "label": "labels.copyAsPng", + "name": "copyAsPng", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "icon": , + "keywords": [ + "svg", + "clipboard", + "copy", + ], + "label": "labels.copyAsSvg", + "name": "copyAsSvg", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "keywords": [ + "text", + "clipboard", + "copy", + ], + "label": "labels.copyText", + "name": "copyText", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "icon": , + "keyTest": [Function], + "label": "labels.copyStyles", + "name": "copyStyles", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "icon": , + "keyTest": [Function], + "label": "labels.pasteStyles", + "name": "pasteStyles", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "PanelComponent": [Function], + "icon": [Function], + "keyTest": [Function], + "label": "labels.group", + "name": "group", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "icon": null, + "label": "labels.autoResize", + "name": "autoResize", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "label": "labels.unbindText", + "name": "unbindText", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "label": "labels.bindText", + "name": "bindText", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "label": "labels.createContainerFromText", + "name": "wrapTextInContainer", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "PanelComponent": [Function], + "icon": [Function], + "keyTest": [Function], + "label": "labels.ungroup", + "name": "ungroup", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "label": "labels.addToLibrary", + "name": "addToLibrary", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "PanelComponent": [Function], + "icon": , + "keyPriority": 40, + "keyTest": [Function], + "keywords": [ + "move down", + "zindex", + "layer", + ], + "label": "labels.sendBackward", + "name": "sendBackward", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "PanelComponent": [Function], + "icon": , + "keyPriority": 40, + "keyTest": [Function], + "keywords": [ + "move up", + "zindex", + "layer", + ], + "label": "labels.bringForward", + "name": "bringForward", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "PanelComponent": [Function], + "icon": , + "keyTest": [Function], + "keywords": [ + "move down", + "zindex", + "layer", + ], + "label": "labels.sendToBack", + "name": "sendToBack", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "PanelComponent": [Function], + "icon": , + "keyTest": [Function], + "keywords": [ + "move up", + "zindex", + "layer", + ], + "label": "labels.bringToFront", + "name": "bringToFront", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "icon": , + "keyTest": [Function], + "label": "labels.flipHorizontal", + "name": "flipHorizontal", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "icon": , + "keyTest": [Function], + "label": "labels.flipVertical", + "name": "flipVertical", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "PanelComponent": [Function], + "category": "Elements", + "keywords": [ + "line", + ], + "label": [Function], + "name": "toggleLinearEditor", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "PanelComponent": [Function], + "icon": , + "keyTest": [Function], + "label": [Function], + "name": "hyperlink", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "action": "click", + "category": "hyperlink", + }, + }, + { + "icon": , + "label": "labels.copyElementLink", + "name": "copyElementLink", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "PanelComponent": [Function], + "icon": , + "keyTest": [Function], + "label": "labels.duplicateSelection", + "name": "duplicateSelection", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "icon": [Function], + "keyTest": [Function], + "label": [Function], + "name": "toggleElementLock", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "PanelComponent": [Function], + "icon": , + "keyTest": [Function], + "label": "labels.delete", + "name": "deleteSelectedElements", + "perform": [Function], + "trackEvent": { + "action": "delete", + "category": "element", + }, + }, + ], + "left": -17, + "top": -7, + }, + "croppingElementId": null, + "currentChartType": "bar", + "currentHoveredFontFamily": null, + "currentItemArrowType": "round", + "currentItemBackgroundColor": "transparent", + "currentItemEndArrowhead": "arrow", + "currentItemFillStyle": "solid", + "currentItemFontFamily": 5, + "currentItemFontSize": 20, + "currentItemOpacity": 100, + "currentItemRoughness": 1, + "currentItemRoundness": "round", + "currentItemStartArrowhead": null, + "currentItemStrokeColor": "#1e1e1e", + "currentItemStrokeStyle": "solid", + "currentItemStrokeWidth": 2, + "currentItemTextAlign": "left", + "cursorButton": "up", + "defaultSidebarDockedPreference": false, + "editingFrame": null, + "editingGroupId": null, + "editingLinearElement": null, + "editingTextElement": null, + "elementsToHighlight": null, + "errorMessage": null, + "exportBackground": true, + "exportEmbedScene": false, + "exportScale": 1, + "exportWithDarkMode": false, + "fileHandle": null, + "followedBy": Set {}, + "frameRendering": { + "clip": true, + "enabled": true, + "name": true, + "outline": true, + }, + "frameToHighlight": null, + "gridModeEnabled": false, + "gridSize": 20, + "gridStep": 5, + "height": 100, + "hoveredElementIds": {}, + "isBindingEnabled": true, + "isCropping": false, + "isLoading": false, + "isResizing": false, + "isRotating": false, + "lastPointerDownWith": "mouse", + "multiElement": null, + "name": "Untitled-201933152653", + "newElement": null, + "objectsSnapModeEnabled": false, + "offsetLeft": 20, + "offsetTop": 10, + "openDialog": null, + "openMenu": null, + "openPopup": null, + "openSidebar": null, + "originSnapOffset": null, + "pasteDialog": { + "data": null, + "shown": false, + }, + "penDetected": false, + "penMode": false, + "pendingImageElementId": null, + "previousSelectedElementIds": { + "id0": true, + }, + "resizingElement": null, + "scrollX": 0, + "scrollY": 0, + "scrolledOutside": false, + "searchMatches": [], + "selectedElementIds": { + "id0": true, + "id1": true, + }, + "selectedElementsAreBeingDragged": false, + "selectedGroupIds": { + "id4": true, + }, + "selectedLinearElement": null, + "selectionElement": null, + "shouldCacheIgnoreZoom": false, + "showHyperlinkPopup": false, + "showWelcomeScreen": true, + "snapLines": [], + "startBoundElement": null, + "stats": { + "open": false, + "panels": 3, + }, + "suggestedBindings": [], + "theme": "light", + "toast": null, + "userToFollow": null, + "viewBackgroundColor": "#ffffff", + "viewModeEnabled": false, + "width": 200, + "zenModeEnabled": false, + "zoom": { + "value": 1, + }, +} +`; + +exports[`contextMenu element > shows 'Ungroup selection' in context menu for group inside selected elements > [end of test] element 0 1`] = ` +{ + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [ + "id4", + ], + "height": 10, + "id": "id0", + "index": "a0", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 3, + }, + "seed": 449462985, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "updated": 1, + "version": 4, + "versionNonce": 81784553, + "width": 10, + "x": -10, + "y": 0, +} +`; + +exports[`contextMenu element > shows 'Ungroup selection' in context menu for group inside selected elements > [end of test] element 1 1`] = ` +{ + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [ + "id4", + ], + "height": 10, + "id": "id1", + "index": "a1", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 3, + }, + "seed": 238820263, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "updated": 1, + "version": 4, + "versionNonce": 747212839, + "width": 10, + "x": 12, + "y": 0, +} +`; + +exports[`contextMenu element > shows 'Ungroup selection' in context menu for group inside selected elements > [end of test] history 1`] = ` +History { + "onHistoryChangedEmitter": Emitter { + "subscribers": [ + [Function], + [Function], + ], + }, + "redoStack": [], + "undoStack": [ + HistoryEntry { + "appStateChange": AppStateChange { + "delta": Delta { + "deleted": { + "selectedElementIds": { + "id0": true, + }, + }, + "inserted": { + "selectedElementIds": {}, + }, + }, + }, + "elementsChange": ElementsChange { + "added": Map {}, + "removed": Map { + "id0" => Delta { + "deleted": { + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 10, + "index": "a0", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 3, + }, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "width": 10, + "x": -10, + "y": 0, + }, + "inserted": { + "isDeleted": true, + }, + }, + }, + "updated": Map {}, + }, + }, + HistoryEntry { + "appStateChange": AppStateChange { + "delta": Delta { + "deleted": { + "selectedElementIds": { + "id1": true, + }, + }, + "inserted": { + "selectedElementIds": { + "id0": true, + }, + }, + }, + }, + "elementsChange": ElementsChange { + "added": Map {}, + "removed": Map { + "id1" => Delta { + "deleted": { + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 10, + "index": "a1", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 3, + }, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "width": 10, + "x": 12, + "y": 0, + }, + "inserted": { + "isDeleted": true, + }, + }, + }, + "updated": Map {}, + }, + }, + HistoryEntry { + "appStateChange": AppStateChange { + "delta": Delta { + "deleted": { + "selectedElementIds": { + "id0": true, + }, + }, + "inserted": { + "selectedElementIds": { + "id1": true, + }, + }, + }, + }, + "elementsChange": ElementsChange { + "added": Map {}, + "removed": Map {}, + "updated": Map {}, + }, + }, + HistoryEntry { + "appStateChange": AppStateChange { + "delta": Delta { + "deleted": { + "selectedElementIds": { + "id1": true, + }, + }, + "inserted": { + "selectedElementIds": {}, + }, + }, + }, + "elementsChange": ElementsChange { + "added": Map {}, + "removed": Map {}, + "updated": Map {}, + }, + }, + HistoryEntry { + "appStateChange": AppStateChange { + "delta": Delta { + "deleted": { + "selectedGroupIds": { + "id4": true, + }, + }, + "inserted": { + "selectedGroupIds": {}, + }, + }, + }, + "elementsChange": ElementsChange { + "added": Map {}, + "removed": Map {}, + "updated": Map { + "id0" => Delta { + "deleted": { + "groupIds": [ + "id4", + ], + }, + "inserted": { + "groupIds": [], + }, + }, + "id1" => Delta { + "deleted": { + "groupIds": [ + "id4", + ], + }, + "inserted": { + "groupIds": [], + }, + }, + }, + }, + }, + ], +} +`; + +exports[`contextMenu element > shows 'Ungroup selection' in context menu for group inside selected elements > [end of test] number of elements 1`] = `2`; + +exports[`contextMenu element > shows 'Ungroup selection' in context menu for group inside selected elements > [end of test] number of renders 1`] = `11`; + +exports[`contextMenu element > shows context menu for canvas > [end of test] appState 1`] = ` +{ + "activeEmbeddable": null, + "activeTool": { + "customType": null, + "lastActiveTool": null, + "locked": false, + "type": "selection", + }, + "collaborators": Map {}, + "contextMenu": { + "items": [ + { + "keyTest": undefined, + "label": "labels.paste", + "name": "paste", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "icon": , + "keyTest": [Function], + "keywords": [ + "png", + "clipboard", + "copy", + ], + "label": "labels.copyAsPng", + "name": "copyAsPng", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "icon": , + "keywords": [ + "svg", + "clipboard", + "copy", + ], + "label": "labels.copyAsSvg", + "name": "copyAsSvg", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "keywords": [ + "text", + "clipboard", + "copy", + ], + "label": "labels.copyText", + "name": "copyText", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "icon": , + "keyTest": [Function], + "label": "labels.selectAll", + "name": "selectAll", + "perform": [Function], + "trackEvent": { + "category": "canvas", + }, + "viewMode": false, + }, + { + "icon": , + "label": "labels.elementLock.unlockAll", + "name": "unlockAllElements", + "paletteName": "Unlock all elements", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "canvas", + }, + "viewMode": false, + }, + "separator", + { + "checked": [Function], + "icon": , + "keyTest": [Function], + "keywords": [ + "snap", + ], + "label": "labels.toggleGrid", + "name": "gridMode", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "canvas", + "predicate": [Function], + }, + "viewMode": true, + }, + { + "checked": [Function], + "icon": , + "keyTest": [Function], + "label": "buttons.objectsSnapMode", + "name": "objectsSnapMode", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "canvas", + "predicate": [Function], + }, + "viewMode": false, + }, + { + "checked": [Function], + "icon": , + "keyTest": [Function], + "label": "buttons.zenMode", + "name": "zenMode", + "paletteName": "Toggle zen mode", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "canvas", + "predicate": [Function], + }, + "viewMode": true, + }, + { + "checked": [Function], + "icon": , + "keyTest": [Function], + "label": "labels.viewMode", + "name": "viewMode", + "paletteName": "Toggle view mode", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "canvas", + "predicate": [Function], + }, + "viewMode": true, + }, + { + "checked": [Function], + "icon": , + "keyTest": [Function], + "keywords": [ + "edit", + "attributes", + "customize", + ], + "label": "stats.fullTitle", + "name": "stats", + "paletteName": "Toggle stats", + "perform": [Function], + "trackEvent": { + "category": "menu", + }, + "viewMode": true, + }, + ], + "left": -19, + "top": -9, + }, + "croppingElementId": null, + "currentChartType": "bar", + "currentHoveredFontFamily": null, + "currentItemArrowType": "round", + "currentItemBackgroundColor": "transparent", + "currentItemEndArrowhead": "arrow", + "currentItemFillStyle": "solid", + "currentItemFontFamily": 5, + "currentItemFontSize": 20, + "currentItemOpacity": 100, + "currentItemRoughness": 1, + "currentItemRoundness": "round", + "currentItemStartArrowhead": null, + "currentItemStrokeColor": "#1e1e1e", + "currentItemStrokeStyle": "solid", + "currentItemStrokeWidth": 2, + "currentItemTextAlign": "left", + "cursorButton": "up", + "defaultSidebarDockedPreference": false, + "editingFrame": null, + "editingGroupId": null, + "editingLinearElement": null, + "editingTextElement": null, + "elementsToHighlight": null, + "errorMessage": null, + "exportBackground": true, + "exportEmbedScene": false, + "exportScale": 1, + "exportWithDarkMode": false, + "fileHandle": null, + "followedBy": Set {}, + "frameRendering": { + "clip": true, + "enabled": true, + "name": true, + "outline": true, + }, + "frameToHighlight": null, + "gridModeEnabled": false, + "gridSize": 20, + "gridStep": 5, + "height": 100, + "hoveredElementIds": {}, + "isBindingEnabled": true, + "isCropping": false, + "isLoading": false, + "isResizing": false, + "isRotating": false, + "lastPointerDownWith": "mouse", + "multiElement": null, + "name": "Untitled-201933152653", + "newElement": null, + "objectsSnapModeEnabled": false, + "offsetLeft": 20, + "offsetTop": 10, + "openDialog": null, + "openMenu": null, + "openPopup": null, + "openSidebar": null, + "originSnapOffset": { + "x": 0, + "y": 0, + }, + "pasteDialog": { + "data": null, + "shown": false, + }, + "penDetected": false, + "penMode": false, + "pendingImageElementId": null, + "previousSelectedElementIds": {}, + "resizingElement": null, + "scrollX": 0, + "scrollY": 0, + "scrolledOutside": false, + "searchMatches": [], + "selectedElementIds": {}, + "selectedElementsAreBeingDragged": false, + "selectedGroupIds": {}, + "selectedLinearElement": null, + "selectionElement": null, + "shouldCacheIgnoreZoom": false, + "showHyperlinkPopup": false, + "showWelcomeScreen": true, + "snapLines": [], + "startBoundElement": null, + "stats": { + "open": false, + "panels": 3, + }, + "suggestedBindings": [], + "theme": "light", + "toast": null, + "userToFollow": null, + "viewBackgroundColor": "#ffffff", + "viewModeEnabled": false, + "width": 200, + "zenModeEnabled": false, + "zoom": { + "value": 1, + }, +} +`; + +exports[`contextMenu element > shows context menu for canvas > [end of test] history 1`] = ` +History { + "onHistoryChangedEmitter": Emitter { + "subscribers": [ + [Function], + [Function], + ], + }, + "redoStack": [], + "undoStack": [], +} +`; + +exports[`contextMenu element > shows context menu for canvas > [end of test] number of elements 1`] = `0`; + +exports[`contextMenu element > shows context menu for canvas > [end of test] number of renders 1`] = `3`; + +exports[`contextMenu element > shows context menu for element > [end of test] appState 1`] = ` +{ + "activeEmbeddable": null, + "activeTool": { + "customType": null, + "lastActiveTool": null, + "locked": false, + "type": "selection", + }, + "collaborators": Map {}, + "contextMenu": { + "items": [ + "separator", + { + "icon": , + "keyTest": [Function], + "label": "labels.cut", + "name": "cut", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "icon": , + "keyTest": undefined, + "label": "labels.copy", + "name": "copy", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "keyTest": undefined, + "label": "labels.paste", + "name": "paste", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "label": "labels.selectAllElementsInFrame", + "name": "selectAllElementsInFrame", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "canvas", + }, + }, + { + "label": "labels.removeAllElementsFromFrame", + "name": "removeAllElementsFromFrame", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "history", + }, + }, + { + "label": "labels.wrapSelectionInFrame", + "name": "wrapSelectionInFrame", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "PanelComponent": [Function], + "icon": , + "keywords": [ + "image", + "crop", + ], + "label": "helpDialog.cropStart", + "name": "cropEditor", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "menu", + }, + "viewMode": true, + }, + "separator", + { + "icon": , + "keyTest": [Function], + "keywords": [ + "png", + "clipboard", + "copy", + ], + "label": "labels.copyAsPng", + "name": "copyAsPng", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "icon": , + "keywords": [ + "svg", + "clipboard", + "copy", + ], + "label": "labels.copyAsSvg", + "name": "copyAsSvg", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "keywords": [ + "text", + "clipboard", + "copy", + ], + "label": "labels.copyText", + "name": "copyText", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "icon": , + "keyTest": [Function], + "label": "labels.copyStyles", + "name": "copyStyles", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "icon": , + "keyTest": [Function], + "label": "labels.pasteStyles", + "name": "pasteStyles", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "PanelComponent": [Function], + "icon": [Function], + "keyTest": [Function], + "label": "labels.group", + "name": "group", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "icon": null, + "label": "labels.autoResize", + "name": "autoResize", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "label": "labels.unbindText", + "name": "unbindText", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "label": "labels.bindText", + "name": "bindText", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "label": "labels.createContainerFromText", + "name": "wrapTextInContainer", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "PanelComponent": [Function], + "icon": [Function], + "keyTest": [Function], + "label": "labels.ungroup", + "name": "ungroup", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "label": "labels.addToLibrary", + "name": "addToLibrary", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "PanelComponent": [Function], + "icon": , + "keyPriority": 40, + "keyTest": [Function], + "keywords": [ + "move down", + "zindex", + "layer", + ], + "label": "labels.sendBackward", + "name": "sendBackward", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "PanelComponent": [Function], + "icon": , + "keyPriority": 40, + "keyTest": [Function], + "keywords": [ + "move up", + "zindex", + "layer", + ], + "label": "labels.bringForward", + "name": "bringForward", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "PanelComponent": [Function], + "icon": , + "keyTest": [Function], + "keywords": [ + "move down", + "zindex", + "layer", + ], + "label": "labels.sendToBack", + "name": "sendToBack", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "PanelComponent": [Function], + "icon": , + "keyTest": [Function], + "keywords": [ + "move up", + "zindex", + "layer", + ], + "label": "labels.bringToFront", + "name": "bringToFront", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "icon": , + "keyTest": [Function], + "label": "labels.flipHorizontal", + "name": "flipHorizontal", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "icon": , + "keyTest": [Function], + "label": "labels.flipVertical", + "name": "flipVertical", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "PanelComponent": [Function], + "category": "Elements", + "keywords": [ + "line", + ], + "label": [Function], + "name": "toggleLinearEditor", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "PanelComponent": [Function], + "icon": , + "keyTest": [Function], + "label": [Function], + "name": "hyperlink", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "action": "click", + "category": "hyperlink", + }, + }, + { + "icon": , + "label": "labels.copyElementLink", + "name": "copyElementLink", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "PanelComponent": [Function], + "icon": , + "keyTest": [Function], + "label": "labels.duplicateSelection", + "name": "duplicateSelection", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "icon": [Function], + "keyTest": [Function], + "label": [Function], + "name": "toggleElementLock", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "PanelComponent": [Function], + "icon": , + "keyTest": [Function], + "label": "labels.delete", + "name": "deleteSelectedElements", + "perform": [Function], + "trackEvent": { + "action": "delete", + "category": "element", + }, + }, + ], + "left": -17, + "top": -7, + }, + "croppingElementId": null, + "currentChartType": "bar", + "currentHoveredFontFamily": null, + "currentItemArrowType": "round", + "currentItemBackgroundColor": "transparent", + "currentItemEndArrowhead": "arrow", + "currentItemFillStyle": "solid", + "currentItemFontFamily": 5, + "currentItemFontSize": 20, + "currentItemOpacity": 100, + "currentItemRoughness": 1, + "currentItemRoundness": "round", + "currentItemStartArrowhead": null, + "currentItemStrokeColor": "#1e1e1e", + "currentItemStrokeStyle": "solid", + "currentItemStrokeWidth": 2, + "currentItemTextAlign": "left", + "cursorButton": "up", + "defaultSidebarDockedPreference": false, + "editingFrame": null, + "editingGroupId": null, + "editingLinearElement": null, + "editingTextElement": null, + "elementsToHighlight": null, + "errorMessage": null, + "exportBackground": true, + "exportEmbedScene": false, + "exportScale": 1, + "exportWithDarkMode": false, + "fileHandle": null, + "followedBy": Set {}, + "frameRendering": { + "clip": true, + "enabled": true, + "name": true, + "outline": true, + }, + "frameToHighlight": null, + "gridModeEnabled": false, + "gridSize": 20, + "gridStep": 5, + "height": 100, + "hoveredElementIds": {}, + "isBindingEnabled": true, + "isCropping": false, + "isLoading": false, + "isResizing": false, + "isRotating": false, + "lastPointerDownWith": "mouse", + "multiElement": null, + "name": "Untitled-201933152653", + "newElement": null, + "objectsSnapModeEnabled": false, + "offsetLeft": 20, + "offsetTop": 10, + "openDialog": null, + "openMenu": null, + "openPopup": null, + "openSidebar": null, + "originSnapOffset": null, + "pasteDialog": { + "data": null, + "shown": false, + }, + "penDetected": false, + "penMode": false, + "pendingImageElementId": null, + "previousSelectedElementIds": {}, + "resizingElement": null, + "scrollX": 0, + "scrollY": 0, + "scrolledOutside": false, + "searchMatches": [], + "selectedElementIds": { + "id0": true, + }, + "selectedElementsAreBeingDragged": false, + "selectedGroupIds": {}, + "selectedLinearElement": null, + "selectionElement": null, + "shouldCacheIgnoreZoom": false, + "showHyperlinkPopup": false, + "showWelcomeScreen": true, + "snapLines": [], + "startBoundElement": null, + "stats": { + "open": false, + "panels": 3, + }, + "suggestedBindings": [], + "theme": "light", + "toast": null, + "userToFollow": null, + "viewBackgroundColor": "#ffffff", + "viewModeEnabled": false, + "width": 200, + "zenModeEnabled": false, + "zoom": { + "value": 1, + }, +} +`; + +exports[`contextMenu element > shows context menu for element > [end of test] appState 2`] = ` +{ + "activeEmbeddable": null, + "activeTool": { + "customType": null, + "lastActiveTool": null, + "locked": false, + "type": "selection", + }, + "collaborators": Map {}, + "contextMenu": { + "items": [ + "separator", + { + "icon": , + "keyTest": [Function], + "label": "labels.cut", + "name": "cut", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "icon": , + "keyTest": undefined, + "label": "labels.copy", + "name": "copy", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "keyTest": undefined, + "label": "labels.paste", + "name": "paste", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "label": "labels.selectAllElementsInFrame", + "name": "selectAllElementsInFrame", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "canvas", + }, + }, + { + "label": "labels.removeAllElementsFromFrame", + "name": "removeAllElementsFromFrame", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "history", + }, + }, + { + "label": "labels.wrapSelectionInFrame", + "name": "wrapSelectionInFrame", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "PanelComponent": [Function], + "icon": , + "keywords": [ + "image", + "crop", + ], + "label": "helpDialog.cropStart", + "name": "cropEditor", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "menu", + }, + "viewMode": true, + }, + "separator", + { + "icon": , + "keyTest": [Function], + "keywords": [ + "png", + "clipboard", + "copy", + ], + "label": "labels.copyAsPng", + "name": "copyAsPng", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "icon": , + "keywords": [ + "svg", + "clipboard", + "copy", + ], + "label": "labels.copyAsSvg", + "name": "copyAsSvg", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "keywords": [ + "text", + "clipboard", + "copy", + ], + "label": "labels.copyText", + "name": "copyText", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "icon": , + "keyTest": [Function], + "label": "labels.copyStyles", + "name": "copyStyles", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "icon": , + "keyTest": [Function], + "label": "labels.pasteStyles", + "name": "pasteStyles", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "PanelComponent": [Function], + "icon": [Function], + "keyTest": [Function], + "label": "labels.group", + "name": "group", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "icon": null, + "label": "labels.autoResize", + "name": "autoResize", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "label": "labels.unbindText", + "name": "unbindText", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "label": "labels.bindText", + "name": "bindText", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "label": "labels.createContainerFromText", + "name": "wrapTextInContainer", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "PanelComponent": [Function], + "icon": [Function], + "keyTest": [Function], + "label": "labels.ungroup", + "name": "ungroup", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "label": "labels.addToLibrary", + "name": "addToLibrary", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "PanelComponent": [Function], + "icon": , + "keyPriority": 40, + "keyTest": [Function], + "keywords": [ + "move down", + "zindex", + "layer", + ], + "label": "labels.sendBackward", + "name": "sendBackward", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "PanelComponent": [Function], + "icon": , + "keyPriority": 40, + "keyTest": [Function], + "keywords": [ + "move up", + "zindex", + "layer", + ], + "label": "labels.bringForward", + "name": "bringForward", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "PanelComponent": [Function], + "icon": , + "keyTest": [Function], + "keywords": [ + "move down", + "zindex", + "layer", + ], + "label": "labels.sendToBack", + "name": "sendToBack", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "PanelComponent": [Function], + "icon": , + "keyTest": [Function], + "keywords": [ + "move up", + "zindex", + "layer", + ], + "label": "labels.bringToFront", + "name": "bringToFront", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "icon": , + "keyTest": [Function], + "label": "labels.flipHorizontal", + "name": "flipHorizontal", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "icon": , + "keyTest": [Function], + "label": "labels.flipVertical", + "name": "flipVertical", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "PanelComponent": [Function], + "category": "Elements", + "keywords": [ + "line", + ], + "label": [Function], + "name": "toggleLinearEditor", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "PanelComponent": [Function], + "icon": , + "keyTest": [Function], + "label": [Function], + "name": "hyperlink", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "action": "click", + "category": "hyperlink", + }, + }, + { + "icon": , + "label": "labels.copyElementLink", + "name": "copyElementLink", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "PanelComponent": [Function], + "icon": , + "keyTest": [Function], + "label": "labels.duplicateSelection", + "name": "duplicateSelection", + "perform": [Function], + "trackEvent": { + "category": "element", + }, + }, + { + "icon": [Function], + "keyTest": [Function], + "label": [Function], + "name": "toggleElementLock", + "perform": [Function], + "predicate": [Function], + "trackEvent": { + "category": "element", + }, + }, + "separator", + { + "PanelComponent": [Function], + "icon": , + "keyTest": [Function], + "label": "labels.delete", + "name": "deleteSelectedElements", + "perform": [Function], + "trackEvent": { + "action": "delete", + "category": "element", + }, + }, + ], + "left": 80, + "top": 90, + }, + "croppingElementId": null, + "currentChartType": "bar", + "currentHoveredFontFamily": null, + "currentItemArrowType": "round", + "currentItemBackgroundColor": "transparent", + "currentItemEndArrowhead": "arrow", + "currentItemFillStyle": "solid", + "currentItemFontFamily": 5, + "currentItemFontSize": 20, + "currentItemOpacity": 100, + "currentItemRoughness": 1, + "currentItemRoundness": "round", + "currentItemStartArrowhead": null, + "currentItemStrokeColor": "#1e1e1e", + "currentItemStrokeStyle": "solid", + "currentItemStrokeWidth": 2, + "currentItemTextAlign": "left", + "cursorButton": "up", + "defaultSidebarDockedPreference": false, + "editingFrame": null, + "editingGroupId": null, + "editingLinearElement": null, + "editingTextElement": null, + "elementsToHighlight": null, + "errorMessage": null, + "exportBackground": true, + "exportEmbedScene": false, + "exportScale": 1, + "exportWithDarkMode": false, + "fileHandle": null, + "followedBy": Set {}, + "frameRendering": { + "clip": true, + "enabled": true, + "name": true, + "outline": true, + }, + "frameToHighlight": null, + "gridModeEnabled": false, + "gridSize": 20, + "gridStep": 5, + "height": 100, + "hoveredElementIds": {}, + "isBindingEnabled": true, + "isCropping": false, + "isLoading": false, + "isResizing": false, + "isRotating": false, + "lastPointerDownWith": "mouse", + "multiElement": null, + "name": "Untitled-201933152653", + "newElement": null, + "objectsSnapModeEnabled": false, + "offsetLeft": 20, + "offsetTop": 10, + "openDialog": null, + "openMenu": null, + "openPopup": null, + "openSidebar": null, + "originSnapOffset": { + "x": 0, + "y": 0, + }, + "pasteDialog": { + "data": null, + "shown": false, + }, + "penDetected": false, + "penMode": false, + "pendingImageElementId": null, + "previousSelectedElementIds": {}, + "resizingElement": null, + "scrollX": 0, + "scrollY": 0, + "scrolledOutside": false, + "searchMatches": [], + "selectedElementIds": { + "id1": true, + }, + "selectedElementsAreBeingDragged": false, + "selectedGroupIds": {}, + "selectedLinearElement": null, + "selectionElement": null, + "shouldCacheIgnoreZoom": false, + "showHyperlinkPopup": false, + "showWelcomeScreen": true, + "snapLines": [], + "startBoundElement": null, + "stats": { + "open": false, + "panels": 3, + }, + "suggestedBindings": [], + "theme": "light", + "toast": null, + "userToFollow": null, + "viewBackgroundColor": "#ffffff", + "viewModeEnabled": false, + "width": 200, + "zenModeEnabled": false, + "zoom": { + "value": 1, + }, +} +`; + +exports[`contextMenu element > shows context menu for element > [end of test] element 0 1`] = ` +{ + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 20, + "id": "id0", + "index": "a0", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 3, + }, + "seed": 449462985, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "updated": 1, + "version": 3, + "versionNonce": 1150084233, + "width": 20, + "x": -10, + "y": 0, +} +`; + +exports[`contextMenu element > shows context menu for element > [end of test] element 0 2`] = ` +{ + "angle": 0, + "backgroundColor": "red", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 200, + "id": "id0", + "index": "a0", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 3, + }, + "seed": 1, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "updated": 1, + "version": 2, + "versionNonce": 1278240551, + "width": 200, + "x": 0, + "y": 0, +} +`; + +exports[`contextMenu element > shows context menu for element > [end of test] element 1 1`] = ` +{ + "angle": 0, + "backgroundColor": "red", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 200, + "id": "id1", + "index": "a1", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 3, + }, + "seed": 1, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "updated": 1, + "version": 2, + "versionNonce": 449462985, + "width": 200, + "x": 0, + "y": 0, +} +`; + +exports[`contextMenu element > shows context menu for element > [end of test] history 1`] = ` +History { + "onHistoryChangedEmitter": Emitter { + "subscribers": [ + [Function], + [Function], + ], + }, + "redoStack": [], + "undoStack": [ + HistoryEntry { + "appStateChange": AppStateChange { + "delta": Delta { + "deleted": { + "selectedElementIds": { + "id0": true, + }, + }, + "inserted": { + "selectedElementIds": {}, + }, + }, + }, + "elementsChange": ElementsChange { + "added": Map {}, + "removed": Map { + "id0" => Delta { + "deleted": { + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 20, + "index": "a0", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 3, + }, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "width": 20, + "x": -10, + "y": 0, + }, + "inserted": { + "isDeleted": true, + }, + }, + }, + "updated": Map {}, + }, + }, + ], +} +`; + +exports[`contextMenu element > shows context menu for element > [end of test] history 2`] = ` +History { + "onHistoryChangedEmitter": Emitter { + "subscribers": [ + [Function], + [Function], + ], + }, + "redoStack": [], + "undoStack": [], +} +`; + +exports[`contextMenu element > shows context menu for element > [end of test] number of elements 1`] = `1`; + +exports[`contextMenu element > shows context menu for element > [end of test] number of elements 2`] = `2`; + +exports[`contextMenu element > shows context menu for element > [end of test] number of renders 1`] = `5`; + +exports[`contextMenu element > shows context menu for element > [end of test] number of renders 2`] = `6`; diff --git a/packages/excalidraw/tests/__snapshots__/dragCreate.test.tsx.snap b/packages/excalidraw/tests/__snapshots__/dragCreate.test.tsx.snap new file mode 100644 index 0000000..acc9b79 --- /dev/null +++ b/packages/excalidraw/tests/__snapshots__/dragCreate.test.tsx.snap @@ -0,0 +1,210 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`Test dragCreate > add element to the scene when pointer dragging long enough > arrow 3`] = `1`; + +exports[`Test dragCreate > add element to the scene when pointer dragging long enough > arrow 4`] = ` +{ + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "elbowed": false, + "endArrowhead": "arrow", + "endBinding": null, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 50, + "id": "id0", + "index": "a0", + "isDeleted": false, + "lastCommittedPoint": null, + "link": null, + "locked": false, + "opacity": 100, + "points": [ + [ + 0, + 0, + ], + [ + 30, + 50, + ], + ], + "roughness": 1, + "roundness": { + "type": 2, + }, + "seed": 1278240551, + "startArrowhead": null, + "startBinding": null, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "arrow", + "updated": 1, + "version": 4, + "versionNonce": 2019559783, + "width": 30, + "x": 30, + "y": 20, +} +`; + +exports[`Test dragCreate > add element to the scene when pointer dragging long enough > diamond 3`] = `1`; + +exports[`Test dragCreate > add element to the scene when pointer dragging long enough > diamond 4`] = ` +{ + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 50, + "id": "id0", + "index": "a0", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 2, + }, + "seed": 1278240551, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "diamond", + "updated": 1, + "version": 3, + "versionNonce": 401146281, + "width": 30, + "x": 30, + "y": 20, +} +`; + +exports[`Test dragCreate > add element to the scene when pointer dragging long enough > ellipse 3`] = `1`; + +exports[`Test dragCreate > add element to the scene when pointer dragging long enough > ellipse 4`] = ` +{ + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 50, + "id": "id0", + "index": "a0", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 2, + }, + "seed": 1278240551, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "ellipse", + "updated": 1, + "version": 3, + "versionNonce": 401146281, + "width": 30, + "x": 30, + "y": 20, +} +`; + +exports[`Test dragCreate > add element to the scene when pointer dragging long enough > line 3`] = ` +{ + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "endArrowhead": null, + "endBinding": null, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 50, + "id": "id0", + "index": "a0", + "isDeleted": false, + "lastCommittedPoint": null, + "link": null, + "locked": false, + "opacity": 100, + "points": [ + [ + 0, + 0, + ], + [ + 30, + 50, + ], + ], + "roughness": 1, + "roundness": { + "type": 2, + }, + "seed": 1278240551, + "startArrowhead": null, + "startBinding": null, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "line", + "updated": 1, + "version": 4, + "versionNonce": 2019559783, + "width": 30, + "x": 30, + "y": 20, +} +`; + +exports[`Test dragCreate > add element to the scene when pointer dragging long enough > rectangle 3`] = `1`; + +exports[`Test dragCreate > add element to the scene when pointer dragging long enough > rectangle 4`] = ` +{ + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "customData": undefined, + "fillStyle": "solid", + "frameId": null, + "groupIds": [], + "height": 50, + "id": "id0", + "index": "a0", + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": { + "type": 3, + }, + "seed": 1278240551, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "rectangle", + "updated": 1, + "version": 3, + "versionNonce": 401146281, + "width": 30, + "x": 30, + "y": 20, +} +`; diff --git a/packages/excalidraw/tests/__snapshots__/excalidraw.test.tsx.snap b/packages/excalidraw/tests/__snapshots__/excalidraw.test.tsx.snap new file mode 100644 index 0000000..e5e431d --- /dev/null +++ b/packages/excalidraw/tests/__snapshots__/excalidraw.test.tsx.snap @@ -0,0 +1,654 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[` > > should render main menu with host menu items if passed from host 1`] = ` + +`; + +exports[` > Test UIOptions prop > Test canvasActions > should render menu with default items when "UIOPtions" is "undefined" 1`] = ` +