Tldraw/packages/tldraw/src/state/__snapshots__/TldrawApp.spec.ts.snap

974 wiersze
26 KiB
Plaintext

// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`TldrawTestApp Copies to JSON: copied json 1`] = `
TldrawTestApp {
"_idbId": undefined,
"_snapshot": Object {
"appState": Object {
"activeTool": "select",
"currentPageId": "page",
"currentStyle": Object {
"color": "black",
"dash": "draw",
"isFilled": false,
"scale": 1,
"size": "small",
},
"disableAssets": false,
"eraseLine": Array [],
"hoveredId": undefined,
"isEmptyCanvas": false,
"isLoading": false,
"isMenuOpen": false,
"isToolLocked": false,
"snapLines": Array [],
"status": "idle",
},
"document": Object {
"assets": Object {},
"id": "doc",
"name": "New Document",
"pageStates": Object {
"page": Object {
"camera": Object {
"point": Array [
0,
0,
],
"zoom": 1,
},
"id": "page",
"selectedIds": Array [],
},
},
"pages": Object {
"page": Object {
"bindings": Object {},
"childIndex": 1,
"id": "page",
"name": "Page 1",
"shapes": Object {},
},
},
"version": 15.5,
},
"settings": Object {
"dockPosition": "bottom",
"exportBackground": "transparent",
"isCadSelectMode": false,
"isDarkMode": false,
"isDebugMode": false,
"isFocusMode": false,
"isPenMode": false,
"isReadonlyMode": false,
"isSnapping": false,
"isZoomSnap": false,
"keepStyleMenuOpen": false,
"language": "en",
"nudgeDistanceLarge": 16,
"nudgeDistanceSmall": 1,
"showBindingHandles": true,
"showCloneHandles": false,
"showGrid": false,
"showRotateHandles": true,
},
},
"_state": Object {
"appState": Object {
"activeTool": "select",
"currentPageId": "page1",
"currentStyle": Object {
"color": "black",
"dash": "draw",
"isFilled": false,
"scale": 1,
"size": "small",
},
"disableAssets": false,
"eraseLine": Array [],
"hoveredId": undefined,
"isEmptyCanvas": false,
"isLoading": false,
"isMenuOpen": false,
"isToolLocked": false,
"snapLines": Array [],
"status": "idle",
},
"document": Object {
"assets": Object {},
"id": "doc",
"name": "New Document",
"pageStates": Object {
"page1": Object {
"bindingId": undefined,
"camera": Object {
"point": Array [
0,
0,
],
"zoom": 1,
},
"editingId": undefined,
"hoveredId": undefined,
"id": "page1",
"pointedId": undefined,
"selectedIds": Array [
"rect1",
"rect2",
"rect3",
],
},
},
"pages": Object {
"page1": Object {
"bindings": Object {},
"id": "page1",
"shapes": Object {
"rect1": Object {
"childIndex": 1,
"id": "rect1",
"label": "",
"labelPoint": Array [
0.5,
0.5,
],
"name": "Rectangle",
"parentId": "page1",
"point": Array [
0,
0,
],
"size": Array [
100,
100,
],
"style": Object {
"color": "blue",
"dash": "draw",
"size": "medium",
},
"type": "rectangle",
},
"rect2": Object {
"childIndex": 2,
"id": "rect2",
"label": "",
"labelPoint": Array [
0.5,
0.5,
],
"name": "Rectangle",
"parentId": "page1",
"point": Array [
100,
100,
],
"size": Array [
100,
100,
],
"style": Object {
"color": "blue",
"dash": "draw",
"size": "medium",
},
"type": "rectangle",
},
"rect3": Object {
"childIndex": 3,
"id": "rect3",
"label": "",
"labelPoint": Array [
0.5,
0.5,
],
"name": "Rectangle",
"parentId": "page1",
"point": Array [
20,
20,
],
"size": Array [
100,
100,
],
"style": Object {
"color": "blue",
"dash": "draw",
"size": "medium",
},
"type": "rectangle",
},
},
},
},
"version": 15.5,
},
"settings": Object {
"dockPosition": "bottom",
"exportBackground": "transparent",
"isCadSelectMode": false,
"isDarkMode": false,
"isDebugMode": false,
"isFocusMode": false,
"isPenMode": false,
"isReadonlyMode": false,
"isSnapping": false,
"isZoomSnap": false,
"keepStyleMenuOpen": false,
"language": "en",
"nudgeDistanceLarge": 16,
"nudgeDistanceSmall": 1,
"showBindingHandles": true,
"showCloneHandles": false,
"showGrid": false,
"showRotateHandles": true,
},
},
"_status": "ready",
"addMediaFromFiles": [Function],
"addToSelectHistory": [Function],
"align": [Function],
"altKey": false,
"applyPatch": [Function],
"broadcastPatch": [Function],
"callbacks": Object {},
"cancel": [Function],
"cancelSession": [Function],
"changePage": [Function],
"cleanup": [Function],
"clearSelectHistory": [Function],
"clickBounds": [Function],
"clickBoundsHandle": [Function],
"clickCanvas": [Function],
"clickShape": [Function],
"completeSession": [Function],
"copy": [Function],
"copyImage": [Function],
"copyJson": [Function],
"copySvg": [Function],
"create": [Function],
"createPage": [Function],
"createShapes": [Function],
"ctrlKey": false,
"currentPoint": Array [
0,
0,
],
"currentTool": SelectTool {
"app": [Circular],
"clonePaint": [Function],
"getNextChildIndex": [Function],
"getShapeClone": [Function],
"onCancel": [Function],
"onDoubleClickBoundsHandle": [Function],
"onDoubleClickCanvas": [Function],
"onDoubleClickHandle": [Function],
"onDoubleClickShape": [Function],
"onEnter": [Function],
"onExit": [Function],
"onHoverShape": [Function],
"onKeyDown": [Function],
"onKeyUp": [Function],
"onPinch": [Function],
"onPinchEnd": [Function],
"onPinchStart": [Function],
"onPointBounds": [Function],
"onPointBoundsHandle": [Function],
"onPointHandle": [Function],
"onPointShape": [Function],
"onPointerDown": [Function],
"onPointerMove": [Function],
"onPointerUp": [Function],
"onReleaseBounds": [Function],
"onReleaseBoundsHandle": [Function],
"onReleaseHandle": [Function],
"onRightPointBounds": [Function],
"onRightPointShape": [Function],
"onShapeClone": [Function],
"onUnhoverShape": [Function],
"setStatus": [Function],
"status": "idle",
"type": "select",
},
"cut": [Function],
"delete": [Function],
"deleteAll": [Function],
"deletePage": [Function],
"distribute": [Function],
"doubleClickBoundHandle": [Function],
"doubleClickCanvas": [Function],
"doubleClickShape": [Function],
"duplicate": [Function],
"duplicatePage": [Function],
"editingStartTime": -1,
"expectSelectedIdsToBe": [Function],
"expectShapesToBeAtPoints": [Function],
"expectShapesToHaveProps": [Function],
"exportImage": [Function],
"exportJson": [Function],
"fileSystemHandle": null,
"flipHorizontal": [Function],
"flipVertical": [Function],
"forceUpdate": [Function],
"getAppState": [Function],
"getBinding": [Function],
"getBindings": [Function],
"getContent": [Function],
"getImage": [Function],
"getPage": [Function],
"getPagePoint": [Function],
"getPageState": [Function],
"getReservedContent": [Function],
"getShape": [Function],
"getShapeBounds": [Function],
"getShapeUtil": [Function],
"getShapes": [Function],
"getSvg": [Function],
"getViewboxFromSVG": [Function],
"group": [Function],
"hoverShape": [Function],
"initialState": Object {
"appState": Object {
"activeTool": "select",
"currentPageId": "page",
"currentStyle": Object {
"color": "black",
"dash": "draw",
"isFilled": false,
"scale": 1,
"size": "small",
},
"disableAssets": false,
"eraseLine": Array [],
"hoveredId": undefined,
"isEmptyCanvas": false,
"isLoading": false,
"isMenuOpen": false,
"isToolLocked": false,
"snapLines": Array [],
"status": "idle",
},
"document": Object {
"assets": Object {},
"id": "doc",
"name": "New Document",
"pageStates": Object {
"page": Object {
"camera": Object {
"point": Array [
0,
0,
],
"zoom": 1,
},
"id": "page",
"selectedIds": Array [],
},
},
"pages": Object {
"page": Object {
"bindings": Object {},
"childIndex": 1,
"id": "page",
"name": "Page 1",
"shapes": Object {},
},
},
"version": 15.5,
},
"settings": Object {
"dockPosition": "bottom",
"exportBackground": "transparent",
"isCadSelectMode": false,
"isDarkMode": false,
"isDebugMode": false,
"isFocusMode": false,
"isPenMode": false,
"isReadonlyMode": false,
"isSnapping": false,
"isZoomSnap": false,
"keepStyleMenuOpen": false,
"language": "en",
"nudgeDistanceLarge": 16,
"nudgeDistanceSmall": 1,
"showBindingHandles": true,
"showCloneHandles": false,
"showGrid": false,
"showRotateHandles": true,
},
},
"insertContent": [Function],
"isCreating": false,
"isDirty": false,
"isForcePanning": false,
"isPaused": false,
"isPointing": false,
"justSent": false,
"loadDocument": [Function],
"loadRoom": [Function],
"mergeDocument": [Function],
"metaKey": false,
"migrate": [Function],
"moveBackward": [Function],
"moveForward": [Function],
"movePage": [Function],
"movePointer": [Function],
"moveToBack": [Function],
"moveToFront": [Function],
"moveToPage": [Function],
"newProject": [Function],
"nudge": [Function],
"onCommand": [Function],
"onDoubleClickBounds": [Function],
"onDoubleClickBoundsHandle": [Function],
"onDoubleClickCanvas": [Function],
"onDoubleClickHandle": [Function],
"onDoubleClickShape": [Function],
"onDragBounds": [Function],
"onDragBoundsHandle": [Function],
"onDragCanvas": [Function],
"onDragHandle": [Function],
"onDragOver": [Function],
"onDragShape": [Function],
"onDrop": [Function],
"onError": [Function],
"onHoverBounds": [Function],
"onHoverBoundsHandle": [Function],
"onHoverHandle": [Function],
"onHoverShape": [Function],
"onKeyDown": [Function],
"onKeyUp": [Function],
"onPan": [Function],
"onPatch": [Function],
"onPersist": [Function],
"onPinch": [Function],
"onPinchEnd": [Function],
"onPinchStart": [Function],
"onPointBounds": [Function],
"onPointBoundsHandle": [Function],
"onPointCanvas": [Function],
"onPointHandle": [Function],
"onPointShape": [Function],
"onPointerDown": [Function],
"onPointerMove": [Function],
"onPointerUp": [Function],
"onReady": [Function],
"onRedo": [Function],
"onReleaseBounds": [Function],
"onReleaseBoundsHandle": [Function],
"onReleaseCanvas": [Function],
"onReleaseHandle": [Function],
"onReleaseShape": [Function],
"onRenderCountChange": [Function],
"onReplace": [Function],
"onRightPointBounds": [Function],
"onRightPointBoundsHandle": [Function],
"onRightPointCanvas": [Function],
"onRightPointHandle": [Function],
"onRightPointShape": [Function],
"onShapeBlur": [Function],
"onShapeChange": [Function],
"onShapeClone": [Function],
"onStateDidChange": [Function],
"onUndo": [Function],
"onUnhoverBounds": [Function],
"onUnhoverBoundsHandle": [Function],
"onUnhoverHandle": [Function],
"onUnhoverShape": [Function],
"onZoom": [Function],
"openAsset": [Function],
"openProject": [Function],
"originPoint": Array [
0,
0,
],
"pan": [Function],
"paste": [Function],
"patchCreate": [Function],
"patchState": [Function],
"persist": [Function],
"pinchZoom": [Function],
"pointBounds": [Function],
"pointBoundsHandle": [Function],
"pointCanvas": [Function],
"pointShape": [Function],
"pointer": -1,
"pressKey": [Function],
"prevSelectedIds": Array [],
"previousPoint": Array [
0,
0,
],
"readOnly": false,
"ready": Promise {},
"redo": [Function],
"redoSelect": [Function],
"refreshBoundingBoxes": [Function],
"releaseKey": [Function],
"removeUser": [Function],
"renamePage": [Function],
"rendererBounds": Object {
"height": 100,
"maxX": 100,
"maxY": 100,
"minX": 0,
"minY": 0,
"width": 100,
},
"replaceHistory": [Function],
"replacePageContent": [Function],
"replaceState": [Function],
"reset": [Function],
"resetBounds": [Function],
"resetCamera": [Function],
"resetDocument": [Function],
"resetHistory": [Function],
"resetZoom": [Function],
"rotate": [Function],
"rotationInfo": Object {
"center": Array [
0,
0,
],
"selectedIds": Array [],
},
"saveProject": [Function],
"saveProjectAs": [Function],
"select": [Function],
"selectAll": [Function],
"selectHistory": Object {
"pointer": 1,
"stack": Array [
Array [],
Array [
"rect1",
"rect2",
"rect3",
],
],
},
"selectNone": [Function],
"selectTool": [Function],
"session": undefined,
"setCamera": [Function],
"setDisableAssets": [Function],
"setEditingId": [Function],
"setHoveredId": [Function],
"setIsLoading": [Function],
"setMenuOpen": [Function],
"setSelectedIds": [Function],
"setSetting": [Function],
"setShapeProps": [Function],
"setSnapshot": [Function],
"setState": [Function],
"shiftKey": false,
"signOut": [Function],
"spaceKey": false,
"stack": Array [],
"startSession": [Function],
"stopPointing": [Function],
"store": Object {
"destroy": [Function],
"getState": [Function],
"setState": [Function],
"subscribe": [Function],
},
"stretch": [Function],
"style": [Function],
"toggleAspectRatioLocked": [Function],
"toggleDarkMode": [Function],
"toggleDebugMode": [Function],
"toggleDecoration": [Function],
"toggleFocusMode": [Function],
"toggleGrid": [Function],
"toggleHidden": [Function],
"toggleLocked": [Function],
"togglePenMode": [Function],
"toggleToolLock": [Function],
"toggleZoomSnap": [Function],
"tools": Object {
"arrow": ArrowTool {
"app": [Circular],
"getNextChildIndex": [Function],
"onCancel": [Function],
"onEnter": [Function],
"onExit": [Function],
"onKeyDown": [Function],
"onKeyUp": [Function],
"onPinch": [Function],
"onPinchEnd": [Function],
"onPinchStart": [Function],
"onPointerDown": [Function],
"onPointerMove": [Function],
"onPointerUp": [Function],
"setStatus": [Function],
"status": "idle",
"type": "arrow",
},
"draw": DrawTool {
"app": [Circular],
"getNextChildIndex": [Function],
"onCancel": [Function],
"onEnter": [Function],
"onExit": [Function],
"onKeyDown": [Function],
"onKeyUp": [Function],
"onPinch": [Function],
"onPinchEnd": [Function],
"onPinchStart": [Function],
"onPointerDown": [Function],
"onPointerMove": [Function],
"onPointerUp": [Function],
"setStatus": [Function],
"status": "idle",
"type": "draw",
},
"ellipse": EllipseTool {
"app": [Circular],
"getNextChildIndex": [Function],
"onCancel": [Function],
"onEnter": [Function],
"onExit": [Function],
"onKeyDown": [Function],
"onKeyUp": [Function],
"onPinch": [Function],
"onPinchEnd": [Function],
"onPinchStart": [Function],
"onPointerDown": [Function],
"onPointerMove": [Function],
"onPointerUp": [Function],
"setStatus": [Function],
"status": "idle",
"type": "ellipse",
},
"erase": EraseTool {
"app": [Circular],
"getNextChildIndex": [Function],
"onCancel": [Function],
"onEnter": [Function],
"onExit": [Function],
"onKeyDown": [Function],
"onKeyUp": [Function],
"onPinch": [Function],
"onPinchEnd": [Function],
"onPinchStart": [Function],
"onPointerDown": [Function],
"onPointerMove": [Function],
"onPointerUp": [Function],
"setStatus": [Function],
"status": "idle",
"type": "erase",
},
"line": LineTool {
"app": [Circular],
"getNextChildIndex": [Function],
"onCancel": [Function],
"onEnter": [Function],
"onExit": [Function],
"onKeyDown": [Function],
"onKeyUp": [Function],
"onPinch": [Function],
"onPinchEnd": [Function],
"onPinchStart": [Function],
"onPointerDown": [Function],
"onPointerMove": [Function],
"onPointerUp": [Function],
"setStatus": [Function],
"status": "idle",
"type": "line",
},
"rectangle": RectangleTool {
"app": [Circular],
"getNextChildIndex": [Function],
"onCancel": [Function],
"onEnter": [Function],
"onExit": [Function],
"onKeyDown": [Function],
"onKeyUp": [Function],
"onPinch": [Function],
"onPinchEnd": [Function],
"onPinchStart": [Function],
"onPointerDown": [Function],
"onPointerMove": [Function],
"onPointerUp": [Function],
"setStatus": [Function],
"status": "idle",
"type": "rectangle",
},
"select": SelectTool {
"app": [Circular],
"clonePaint": [Function],
"getNextChildIndex": [Function],
"getShapeClone": [Function],
"onCancel": [Function],
"onDoubleClickBoundsHandle": [Function],
"onDoubleClickCanvas": [Function],
"onDoubleClickHandle": [Function],
"onDoubleClickShape": [Function],
"onEnter": [Function],
"onExit": [Function],
"onHoverShape": [Function],
"onKeyDown": [Function],
"onKeyUp": [Function],
"onPinch": [Function],
"onPinchEnd": [Function],
"onPinchStart": [Function],
"onPointBounds": [Function],
"onPointBoundsHandle": [Function],
"onPointHandle": [Function],
"onPointShape": [Function],
"onPointerDown": [Function],
"onPointerMove": [Function],
"onPointerUp": [Function],
"onReleaseBounds": [Function],
"onReleaseBoundsHandle": [Function],
"onReleaseHandle": [Function],
"onRightPointBounds": [Function],
"onRightPointShape": [Function],
"onShapeClone": [Function],
"onUnhoverShape": [Function],
"setStatus": [Function],
"status": "idle",
"type": "select",
},
"sticky": StickyTool {
"app": [Circular],
"getNextChildIndex": [Function],
"onCancel": [Function],
"onEnter": [Function],
"onExit": [Function],
"onKeyDown": [Function],
"onKeyUp": [Function],
"onPinch": [Function],
"onPinchEnd": [Function],
"onPinchStart": [Function],
"onPointerDown": [Function],
"onPointerMove": [Function],
"onPointerUp": [Function],
"setStatus": [Function],
"status": "idle",
"type": "sticky",
},
"text": TextTool {
"app": [Circular],
"getNextChildIndex": [Function],
"onCancel": [Function],
"onEnter": [Function],
"onExit": [Function],
"onKeyDown": [Function],
"onKeyUp": [Function],
"onPinch": [Function],
"onPinchEnd": [Function],
"onPinchStart": [Function],
"onPointShape": [Function],
"onPointerDown": [Function],
"onPointerMove": [Function],
"onPointerUp": [Function],
"onShapeBlur": [Function],
"setStatus": [Function],
"status": "idle",
"stopEditingShape": [Function],
"type": "text",
},
"triangle": TriangleTool {
"app": [Circular],
"getNextChildIndex": [Function],
"onCancel": [Function],
"onEnter": [Function],
"onExit": [Function],
"onKeyDown": [Function],
"onKeyUp": [Function],
"onPinch": [Function],
"onPinchEnd": [Function],
"onPinchStart": [Function],
"onPointerDown": [Function],
"onPointerMove": [Function],
"onPointerUp": [Function],
"setStatus": [Function],
"status": "idle",
"type": "triangle",
},
},
"undo": [Function],
"undoSelect": [Function],
"ungroup": [Function],
"updateBounds": [Function],
"updateDocument": [Function],
"updateInputs": [Function],
"updateSession": [Function],
"updateShapes": [Function],
"updateUsers": [Function],
"updateViewport": [Function],
"useStore": [Function],
"viewport": Object {
"height": 100,
"maxX": 100,
"maxY": 100,
"minX": 0,
"minY": 0,
"width": 100,
},
"zoomBy": [Function],
"zoomIn": [Function],
"zoomOut": [Function],
"zoomTo": [Function],
"zoomToContent": [Function],
"zoomToFit": [Function],
"zoomToSelection": [Function],
}
`;
exports[`TldrawTestApp Exposes undo/redo stack: history 1`] = `
Array [
Object {
"after": Object {
"document": Object {
"pageStates": Object {
"page1": Object {
"selectedIds": Array [
"rect1",
],
},
},
"pages": Object {
"page1": Object {
"bindings": Object {},
"shapes": Object {
"rect1": Object {
"childIndex": 1,
"id": "rect1",
"label": "",
"labelPoint": Array [
0.5,
0.5,
],
"name": "Rectangle",
"parentId": "page1",
"point": Array [
0,
0,
],
"rotation": 0,
"size": Array [
100,
200,
],
"style": Object {
"color": "black",
"dash": "draw",
"isFilled": false,
"scale": 1,
"size": "small",
},
"type": "rectangle",
},
},
},
},
},
},
"before": Object {
"document": Object {
"pageStates": Object {
"page1": Object {
"selectedIds": Array [],
},
},
"pages": Object {
"page1": Object {
"bindings": Object {},
"shapes": Object {
"rect1": undefined,
},
},
},
},
},
"id": "create",
},
Object {
"after": Object {
"document": Object {
"pageStates": Object {
"page1": Object {
"selectedIds": Array [
"rect2",
],
},
},
"pages": Object {
"page1": Object {
"bindings": Object {},
"shapes": Object {
"rect2": Object {
"childIndex": 1,
"id": "rect2",
"label": "",
"labelPoint": Array [
0.5,
0.5,
],
"name": "Rectangle",
"parentId": "page1",
"point": Array [
0,
0,
],
"rotation": 0,
"size": Array [
100,
200,
],
"style": Object {
"color": "black",
"dash": "draw",
"isFilled": false,
"scale": 1,
"size": "small",
},
"type": "rectangle",
},
},
},
},
},
},
"before": Object {
"document": Object {
"pageStates": Object {
"page1": Object {
"selectedIds": Array [
"rect1",
],
},
},
"pages": Object {
"page1": Object {
"bindings": Object {},
"shapes": Object {
"rect2": undefined,
},
},
},
},
},
"id": "create",
},
]
`;
exports[`TldrawTestApp Selection When selecting all selects all: selected all 1`] = `
Array [
"rect1",
"rect2",
"rect3",
]
`;
exports[`TldrawTestApp When copying to SVG Copies grouped shapes.: copied svg with group 1`] = `"<svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 232 232\\" width=\\"200\\" height=\\"200\\" style=\\"background-color: transparent;\\"><defs><style>@import url('https://fonts.googleapis.com/css2?family=Caveat+Brush&amp;family=Source+Code+Pro&amp;family=Source+Sans+Pro&amp;family=Crimson+Pro&amp;display=block');</style></defs><g/></svg>"`;
exports[`TldrawTestApp When copying to SVG Copies shapes.: copied svg 1`] = `"<svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 236.74 236.74\\" width=\\"204.74\\" height=\\"204.74\\" style=\\"background-color: transparent;\\"><defs><style>@import url('https://fonts.googleapis.com/css2?family=Caveat+Brush&amp;family=Source+Code+Pro&amp;family=Source+Sans+Pro&amp;family=Crimson+Pro&amp;display=block');</style></defs></svg>"`;
exports[`TldrawTestApp When copying to SVG Respects child index: copied svg with reordered elements 1`] = `"<svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 232 232\\" width=\\"200\\" height=\\"200\\" style=\\"background-color: transparent;\\"><defs><style>@import url('https://fonts.googleapis.com/css2?family=Caveat+Brush&amp;family=Source+Code+Pro&amp;family=Source+Sans+Pro&amp;family=Crimson+Pro&amp;display=block');</style></defs></svg>"`;