diff --git a/src/data/__snapshots__/transform.test.ts.snap b/src/data/__snapshots__/transform.test.ts.snap index 4528505ea0..81935ec271 100644 --- a/src/data/__snapshots__/transform.test.ts.snap +++ b/src/data/__snapshots__/transform.test.ts.snap @@ -1,698 +1,729 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Test Transform Test arrow bindings should bind arrows to existing text elements when start / end provided with ids 1`] = ` -Array [ - Object { - "angle": 0, - "backgroundColor": "transparent", - "baseline": 0, - "boundElements": Array [ - Object { - "id": "id43", - "type": "arrow", - }, - ], - "containerId": null, - "fillStyle": "hachure", - "fontFamily": 1, - "fontSize": 20, - "groupIds": Array [], - "height": 25, - "id": "text-1", - "isDeleted": false, - "lineHeight": 1.25, - "link": null, - "locked": false, - "opacity": 100, - "originalText": "HEYYYYY", - "roughness": 1, - "roundness": null, - "seed": 494893524, - "strokeColor": "#c2255c", - "strokeStyle": "solid", - "strokeWidth": 1, - "text": "HEYYYYY", - "textAlign": "left", - "type": "text", - "updated": 1, - "version": 3, - "versionNonce": 1955213292, - "verticalAlign": "top", - "width": 70, - "x": 185, - "y": 226.5, - }, - Object { - "angle": 0, - "backgroundColor": "#bac8ff", - "boundElements": Array [ - Object { - "id": "id43", - "type": "arrow", - }, - ], - "fillStyle": "hachure", - "groupIds": Array [], - "height": 200, - "id": "rect-1", - "isDeleted": false, - "link": null, - "locked": false, - "opacity": 100, - "roughness": 1, - "roundness": null, - "seed": 341972180, - "strokeColor": "#1e1e1e", - "strokeStyle": "solid", - "strokeWidth": 1, - "type": "rectangle", - "updated": 1, - "version": 2, - "versionNonce": 1785748052, - "width": 100, - "x": 560, - "y": 139, - }, - Object { - "angle": 0, - "backgroundColor": "transparent", - "boundElements": Array [ - Object { - "id": "id44", - "type": "text", - }, - ], - "endArrowhead": "arrow", - "endBinding": Object { - "elementId": "rect-1", - "focus": 0, - "gap": 5, +Object { + "angle": 0, + "backgroundColor": "transparent", + "baseline": 0, + "boundElements": Array [ + Object { + "id": "id43", + "type": "arrow", }, - "fillStyle": "hachure", - "groupIds": Array [], - "height": 0, - "id": "id43", - "isDeleted": false, - "lastCommittedPoint": null, - "link": null, - "locked": false, - "opacity": 100, - "points": Array [ - Array [ - 0, - 0, - ], - Array [ - 300, - 0, - ], - ], - "roughness": 1, - "roundness": null, - "seed": 1430396628, - "startArrowhead": null, - "startBinding": Object { - "elementId": "text-1", - "focus": 0, - "gap": 1, + ], + "containerId": null, + "fillStyle": "hachure", + "fontFamily": 1, + "fontSize": 20, + "groupIds": Array [], + "height": 25, + "id": Any, + "isDeleted": false, + "lineHeight": 1.25, + "link": null, + "locked": false, + "opacity": 100, + "originalText": "HEYYYYY", + "roughness": 1, + "roundness": null, + "seed": Any, + "strokeColor": "#c2255c", + "strokeStyle": "solid", + "strokeWidth": 1, + "text": "HEYYYYY", + "textAlign": "left", + "type": "text", + "updated": 1, + "version": 3, + "versionNonce": Any, + "verticalAlign": "top", + "width": 70, + "x": 185, + "y": 226.5, +} +`; + +exports[`Test Transform Test arrow bindings should bind arrows to existing text elements when start / end provided with ids 2`] = ` +Object { + "angle": 0, + "backgroundColor": "#bac8ff", + "boundElements": Array [ + Object { + "id": "id43", + "type": "arrow", }, - "strokeColor": "#1e1e1e", - "strokeStyle": "solid", - "strokeWidth": 1, - "type": "arrow", - "updated": 1, - "version": 4, - "versionNonce": 1779782252, - "width": 300, - "x": 255, - "y": 239, + ], + "fillStyle": "hachure", + "groupIds": Array [], + "height": 200, + "id": Any, + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": null, + "seed": Any, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 1, + "type": "rectangle", + "updated": 1, + "version": 2, + "versionNonce": Any, + "width": 100, + "x": 560, + "y": 139, +} +`; + +exports[`Test Transform Test arrow bindings should bind arrows to existing text elements when start / end provided with ids 3`] = ` +Object { + "angle": 0, + "backgroundColor": "transparent", + "boundElements": Array [ + Object { + "id": "id44", + "type": "text", + }, + ], + "endArrowhead": "arrow", + "endBinding": Object { + "elementId": "rect-1", + "focus": 0, + "gap": 5, }, - Object { - "angle": 0, - "backgroundColor": "transparent", - "baseline": 0, - "boundElements": null, - "containerId": "id43", - "fillStyle": "hachure", - "fontFamily": 1, - "fontSize": 20, - "groupIds": Array [], - "height": 25, - "id": "id44", - "isDeleted": false, - "lineHeight": 1.25, - "link": null, - "locked": false, - "opacity": 100, - "originalText": "HELLO WORLD!!", - "roughness": 1, - "roundness": null, - "seed": 781379692, - "strokeColor": "#1e1e1e", - "strokeStyle": "solid", - "strokeWidth": 1, - "text": "HELLO WORLD!!", - "textAlign": "center", - "type": "text", - "updated": 1, - "version": 2, - "versionNonce": 1131608812, - "verticalAlign": "middle", - "width": 130, - "x": 340, - "y": 226.5, + "fillStyle": "hachure", + "groupIds": Array [], + "height": 0, + "id": Any, + "isDeleted": false, + "lastCommittedPoint": null, + "link": null, + "locked": false, + "opacity": 100, + "points": Array [ + Array [ + 0, + 0, + ], + Array [ + 300, + 0, + ], + ], + "roughness": 1, + "roundness": null, + "seed": Any, + "startArrowhead": null, + "startBinding": Object { + "elementId": "text-1", + "focus": 0, + "gap": 1, }, -] + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 1, + "type": "arrow", + "updated": 1, + "version": 4, + "versionNonce": Any, + "width": 300, + "x": 255, + "y": 239, +} +`; + +exports[`Test Transform Test arrow bindings should bind arrows to existing text elements when start / end provided with ids 4`] = ` +Object { + "angle": 0, + "backgroundColor": "transparent", + "baseline": 0, + "boundElements": null, + "containerId": "id43", + "fillStyle": "hachure", + "fontFamily": 1, + "fontSize": 20, + "groupIds": Array [], + "height": 25, + "id": Any, + "isDeleted": false, + "lineHeight": 1.25, + "link": null, + "locked": false, + "opacity": 100, + "originalText": "HELLO WORLD!!", + "roughness": 1, + "roundness": null, + "seed": Any, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 1, + "text": "HELLO WORLD!!", + "textAlign": "center", + "type": "text", + "updated": 1, + "version": 2, + "versionNonce": Any, + "verticalAlign": "middle", + "width": 130, + "x": 340, + "y": 226.5, +} `; exports[`Test Transform Test arrow bindings should bind arrows to existinging shapes when start / end provided with ids 1`] = ` -Array [ - Object { - "angle": 0, - "backgroundColor": "#d8f5a2", - "boundElements": Array [ - Object { - "id": "id40", - "type": "arrow", - }, - Object { - "id": "id42", - "type": "arrow", - }, - ], - "fillStyle": "hachure", - "groupIds": Array [], - "height": 300, - "id": "ellipse-1", - "isDeleted": false, - "link": null, - "locked": false, - "opacity": 100, - "roughness": 1, - "roundness": null, - "seed": 534109164, - "strokeColor": "#66a80f", - "strokeStyle": "solid", - "strokeWidth": 1, - "type": "ellipse", - "updated": 1, - "version": 3, - "versionNonce": 780305900, - "width": 300, - "x": 630, - "y": 316, - }, - Object { - "angle": 0, - "backgroundColor": "transparent", - "boundElements": Array [ - Object { - "id": "id42", - "type": "arrow", - }, - ], - "fillStyle": "hachure", - "groupIds": Array [], - "height": 100, - "id": "diamond-1", - "isDeleted": false, - "link": null, - "locked": false, - "opacity": 100, - "roughness": 1, - "roundness": null, - "seed": 1818808556, - "strokeColor": "#9c36b5", - "strokeStyle": "solid", - "strokeWidth": 1, - "type": "diamond", - "updated": 1, - "version": 2, - "versionNonce": 259511148, - "width": 140, - "x": 96, - "y": 400, - }, - Object { - "angle": 0, - "backgroundColor": "transparent", - "boundElements": null, - "endArrowhead": "arrow", - "endBinding": Object { - "elementId": "ellipse-1", - "focus": -0.008153707962747813, - "gap": 1, +Object { + "angle": 0, + "backgroundColor": "#d8f5a2", + "boundElements": Array [ + Object { + "id": "id40", + "type": "arrow", }, - "fillStyle": "hachure", - "groupIds": Array [], - "height": 35, - "id": "id40", - "isDeleted": false, - "lastCommittedPoint": null, - "link": null, - "locked": false, - "opacity": 100, - "points": Array [ - Array [ - 0, - 0, - ], - Array [ - 395, - 35, - ], - ], - "roughness": 1, - "roundness": null, - "seed": 1467590380, - "startArrowhead": null, - "startBinding": Object { - "elementId": "id41", - "focus": -0.08139534883720931, - "gap": 1, + Object { + "id": "id42", + "type": "arrow", }, - "strokeColor": "#1864ab", - "strokeStyle": "solid", - "strokeWidth": 1, - "type": "arrow", - "updated": 1, - "version": 3, - "versionNonce": 1442261204, - "width": 395, - "x": 247, - "y": 420, - }, - Object { - "angle": 0, - "backgroundColor": "transparent", - "boundElements": Array [ - Object { - "id": "id40", - "type": "arrow", - }, - ], - "fillStyle": "hachure", - "groupIds": Array [], - "height": 300, - "id": "id41", - "isDeleted": false, - "link": null, - "locked": false, - "opacity": 100, - "roughness": 1, - "roundness": null, - "seed": 864652756, - "strokeColor": "#1e1e1e", - "strokeStyle": "solid", - "strokeWidth": 1, - "type": "rectangle", - "updated": 1, - "version": 2, - "versionNonce": 138457940, - "width": 300, - "x": -53, - "y": 270, - }, - Object { - "angle": 0, - "backgroundColor": "transparent", - "boundElements": null, - "endArrowhead": "arrow", - "endBinding": Object { - "elementId": "ellipse-1", - "focus": 0.10666666666666667, - "gap": 3.834326468444573, + ], + "fillStyle": "hachure", + "groupIds": Array [], + "height": 300, + "id": Any, + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": null, + "seed": Any, + "strokeColor": "#66a80f", + "strokeStyle": "solid", + "strokeWidth": 1, + "type": "ellipse", + "updated": 1, + "version": 3, + "versionNonce": Any, + "width": 300, + "x": 630, + "y": 316, +} +`; + +exports[`Test Transform Test arrow bindings should bind arrows to existinging shapes when start / end provided with ids 2`] = ` +Object { + "angle": 0, + "backgroundColor": "transparent", + "boundElements": Array [ + Object { + "id": "id42", + "type": "arrow", }, - "fillStyle": "hachure", - "groupIds": Array [], - "height": 0, - "id": "id42", - "isDeleted": false, - "lastCommittedPoint": null, - "link": null, - "locked": false, - "opacity": 100, - "points": Array [ - Array [ - 0, - 0, - ], - Array [ - 400, - 0, - ], - ], - "roughness": 1, - "roundness": null, - "seed": 1614999124, - "startArrowhead": null, - "startBinding": Object { - "elementId": "diamond-1", - "focus": 0, - "gap": 1, - }, - "strokeColor": "#e67700", - "strokeStyle": "solid", - "strokeWidth": 1, - "type": "arrow", - "updated": 1, - "version": 3, - "versionNonce": 590506324, - "width": 400, - "x": 227, - "y": 450, + ], + "fillStyle": "hachure", + "groupIds": Array [], + "height": 100, + "id": Any, + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": null, + "seed": Any, + "strokeColor": "#9c36b5", + "strokeStyle": "solid", + "strokeWidth": 1, + "type": "diamond", + "updated": 1, + "version": 2, + "versionNonce": Any, + "width": 140, + "x": 96, + "y": 400, +} +`; + +exports[`Test Transform Test arrow bindings should bind arrows to existinging shapes when start / end provided with ids 3`] = ` +Object { + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "endArrowhead": "arrow", + "endBinding": Object { + "elementId": "ellipse-1", + "focus": -0.008153707962747813, + "gap": 1, }, -] + "fillStyle": "hachure", + "groupIds": Array [], + "height": 35, + "id": Any, + "isDeleted": false, + "lastCommittedPoint": null, + "link": null, + "locked": false, + "opacity": 100, + "points": Array [ + Array [ + 0, + 0, + ], + Array [ + 395, + 35, + ], + ], + "roughness": 1, + "roundness": null, + "seed": Any, + "startArrowhead": null, + "startBinding": Object { + "elementId": "id41", + "focus": -0.08139534883720931, + "gap": 1, + }, + "strokeColor": "#1864ab", + "strokeStyle": "solid", + "strokeWidth": 1, + "type": "arrow", + "updated": 1, + "version": 3, + "versionNonce": Any, + "width": 395, + "x": 247, + "y": 420, +} +`; + +exports[`Test Transform Test arrow bindings should bind arrows to existinging shapes when start / end provided with ids 4`] = ` +Object { + "angle": 0, + "backgroundColor": "transparent", + "boundElements": Array [ + Object { + "id": "id40", + "type": "arrow", + }, + ], + "fillStyle": "hachure", + "groupIds": Array [], + "height": 300, + "id": Any, + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": null, + "seed": Any, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 1, + "type": "rectangle", + "updated": 1, + "version": 2, + "versionNonce": Any, + "width": 300, + "x": -53, + "y": 270, +} +`; + +exports[`Test Transform Test arrow bindings should bind arrows to existinging shapes when start / end provided with ids 5`] = ` +Object { + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "endArrowhead": "arrow", + "endBinding": Object { + "elementId": "ellipse-1", + "focus": 0.10666666666666667, + "gap": 3.834326468444573, + }, + "fillStyle": "hachure", + "groupIds": Array [], + "height": 0, + "id": Any, + "isDeleted": false, + "lastCommittedPoint": null, + "link": null, + "locked": false, + "opacity": 100, + "points": Array [ + Array [ + 0, + 0, + ], + Array [ + 400, + 0, + ], + ], + "roughness": 1, + "roundness": null, + "seed": Any, + "startArrowhead": null, + "startBinding": Object { + "elementId": "diamond-1", + "focus": 0, + "gap": 1, + }, + "strokeColor": "#e67700", + "strokeStyle": "solid", + "strokeWidth": 1, + "type": "arrow", + "updated": 1, + "version": 3, + "versionNonce": Any, + "width": 400, + "x": 227, + "y": 450, +} `; exports[`Test Transform Test arrow bindings should bind arrows to shapes when start / end provided without ids 1`] = ` -Array [ - Object { - "angle": 0, - "backgroundColor": "transparent", - "boundElements": Array [ - Object { - "id": "id33", - "type": "text", - }, - ], - "endArrowhead": "arrow", - "endBinding": Object { - "elementId": "id35", - "focus": 0, - "gap": 1, +Object { + "angle": 0, + "backgroundColor": "transparent", + "boundElements": Array [ + Object { + "id": "id33", + "type": "text", }, - "fillStyle": "hachure", - "groupIds": Array [], - "height": 0, - "id": "id32", - "isDeleted": false, - "lastCommittedPoint": null, - "link": null, - "locked": false, - "opacity": 100, - "points": Array [ - Array [ - 0, - 0, - ], - Array [ - 300, - 0, - ], + ], + "endArrowhead": "arrow", + "endBinding": Object { + "elementId": "id35", + "focus": 0, + "gap": 1, + }, + "fillStyle": "hachure", + "groupIds": Array [], + "height": 0, + "id": Any, + "isDeleted": false, + "lastCommittedPoint": null, + "link": null, + "locked": false, + "opacity": 100, + "points": Array [ + Array [ + 0, + 0, ], - "roughness": 1, - "roundness": null, - "seed": 150088556, - "startArrowhead": null, - "startBinding": Object { - "elementId": "id34", - "focus": 0, - "gap": 1, + Array [ + 300, + 0, + ], + ], + "roughness": 1, + "roundness": null, + "seed": Any, + "startArrowhead": null, + "startBinding": Object { + "elementId": "id34", + "focus": 0, + "gap": 1, + }, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 1, + "type": "arrow", + "updated": 1, + "version": 4, + "versionNonce": Any, + "width": 300, + "x": 255, + "y": 239, +} +`; + +exports[`Test Transform Test arrow bindings should bind arrows to shapes when start / end provided without ids 2`] = ` +Object { + "angle": 0, + "backgroundColor": "transparent", + "baseline": 0, + "boundElements": null, + "containerId": "id32", + "fillStyle": "hachure", + "fontFamily": 1, + "fontSize": 20, + "groupIds": Array [], + "height": 25, + "id": Any, + "isDeleted": false, + "lineHeight": 1.25, + "link": null, + "locked": false, + "opacity": 100, + "originalText": "HELLO WORLD!!", + "roughness": 1, + "roundness": null, + "seed": Any, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 1, + "text": "HELLO WORLD!!", + "textAlign": "center", + "type": "text", + "updated": 1, + "version": 2, + "versionNonce": Any, + "verticalAlign": "middle", + "width": 130, + "x": 340, + "y": 226.5, +} +`; + +exports[`Test Transform Test arrow bindings should bind arrows to shapes when start / end provided without ids 3`] = ` +Object { + "angle": 0, + "backgroundColor": "transparent", + "boundElements": Array [ + Object { + "id": "id32", + "type": "arrow", }, - "strokeColor": "#1e1e1e", - "strokeStyle": "solid", - "strokeWidth": 1, - "type": "arrow", - "updated": 1, - "version": 4, - "versionNonce": 893064556, - "width": 300, - "x": 255, - "y": 239, - }, - Object { - "angle": 0, - "backgroundColor": "transparent", - "baseline": 0, - "boundElements": null, - "containerId": "id32", - "fillStyle": "hachure", - "fontFamily": 1, - "fontSize": 20, - "groupIds": Array [], - "height": 25, - "id": "id33", - "isDeleted": false, - "lineHeight": 1.25, - "link": null, - "locked": false, - "opacity": 100, - "originalText": "HELLO WORLD!!", - "roughness": 1, - "roundness": null, - "seed": 1462341972, - "strokeColor": "#1e1e1e", - "strokeStyle": "solid", - "strokeWidth": 1, - "text": "HELLO WORLD!!", - "textAlign": "center", - "type": "text", - "updated": 1, - "version": 2, - "versionNonce": 1343506132, - "verticalAlign": "middle", - "width": 130, - "x": 340, - "y": 226.5, - }, - Object { - "angle": 0, - "backgroundColor": "transparent", - "boundElements": Array [ - Object { - "id": "id32", - "type": "arrow", - }, - ], - "fillStyle": "hachure", - "groupIds": Array [], - "height": 100, - "id": "id34", - "isDeleted": false, - "link": null, - "locked": false, - "opacity": 100, - "roughness": 1, - "roundness": null, - "seed": 525811820, - "strokeColor": "#1e1e1e", - "strokeStyle": "solid", - "strokeWidth": 1, - "type": "rectangle", - "updated": 1, - "version": 2, - "versionNonce": 1240224492, - "width": 100, - "x": 155, - "y": 189, - }, - Object { - "angle": 0, - "backgroundColor": "transparent", - "boundElements": Array [ - Object { - "id": "id32", - "type": "arrow", - }, - ], - "fillStyle": "hachure", - "groupIds": Array [], - "height": 100, - "id": "id35", - "isDeleted": false, - "link": null, - "locked": false, - "opacity": 100, - "roughness": 1, - "roundness": null, - "seed": 1474798036, - "strokeColor": "#1e1e1e", - "strokeStyle": "solid", - "strokeWidth": 1, - "type": "ellipse", - "updated": 1, - "version": 2, - "versionNonce": 532432724, - "width": 100, - "x": 555, - "y": 189, - }, -] + ], + "fillStyle": "hachure", + "groupIds": Array [], + "height": 100, + "id": Any, + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": null, + "seed": Any, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 1, + "type": "rectangle", + "updated": 1, + "version": 2, + "versionNonce": Any, + "width": 100, + "x": 155, + "y": 189, +} +`; + +exports[`Test Transform Test arrow bindings should bind arrows to shapes when start / end provided without ids 4`] = ` +Object { + "angle": 0, + "backgroundColor": "transparent", + "boundElements": Array [ + Object { + "id": "id32", + "type": "arrow", + }, + ], + "fillStyle": "hachure", + "groupIds": Array [], + "height": 100, + "id": Any, + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": null, + "seed": Any, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 1, + "type": "ellipse", + "updated": 1, + "version": 2, + "versionNonce": Any, + "width": 100, + "x": 555, + "y": 189, +} `; exports[`Test Transform Test arrow bindings should bind arrows to text when start / end provided without ids 1`] = ` -Array [ - Object { - "angle": 0, - "backgroundColor": "transparent", - "boundElements": Array [ - Object { - "id": "id37", - "type": "text", - }, - ], - "endArrowhead": "arrow", - "endBinding": Object { - "elementId": "id39", - "focus": 0, - "gap": 1, +Object { + "angle": 0, + "backgroundColor": "transparent", + "boundElements": Array [ + Object { + "id": "id37", + "type": "text", }, - "fillStyle": "hachure", - "groupIds": Array [], - "height": 0, - "id": "id36", - "isDeleted": false, - "lastCommittedPoint": null, - "link": null, - "locked": false, - "opacity": 100, - "points": Array [ - Array [ - 0, - 0, - ], - Array [ - 300, - 0, - ], + ], + "endArrowhead": "arrow", + "endBinding": Object { + "elementId": "id39", + "focus": 0, + "gap": 1, + }, + "fillStyle": "hachure", + "groupIds": Array [], + "height": 0, + "id": Any, + "isDeleted": false, + "lastCommittedPoint": null, + "link": null, + "locked": false, + "opacity": 100, + "points": Array [ + Array [ + 0, + 0, ], - "roughness": 1, - "roundness": null, - "seed": 2123204588, - "startArrowhead": null, - "startBinding": Object { - "elementId": "id38", - "focus": 0, - "gap": 1, + Array [ + 300, + 0, + ], + ], + "roughness": 1, + "roundness": null, + "seed": Any, + "startArrowhead": null, + "startBinding": Object { + "elementId": "id38", + "focus": 0, + "gap": 1, + }, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 1, + "type": "arrow", + "updated": 1, + "version": 4, + "versionNonce": Any, + "width": 300, + "x": 255, + "y": 239, +} +`; + +exports[`Test Transform Test arrow bindings should bind arrows to text when start / end provided without ids 2`] = ` +Object { + "angle": 0, + "backgroundColor": "transparent", + "baseline": 0, + "boundElements": null, + "containerId": "id36", + "fillStyle": "hachure", + "fontFamily": 1, + "fontSize": 20, + "groupIds": Array [], + "height": 25, + "id": Any, + "isDeleted": false, + "lineHeight": 1.25, + "link": null, + "locked": false, + "opacity": 100, + "originalText": "HELLO WORLD!!", + "roughness": 1, + "roundness": null, + "seed": Any, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 1, + "text": "HELLO WORLD!!", + "textAlign": "center", + "type": "text", + "updated": 1, + "version": 2, + "versionNonce": Any, + "verticalAlign": "middle", + "width": 130, + "x": 340, + "y": 226.5, +} +`; + +exports[`Test Transform Test arrow bindings should bind arrows to text when start / end provided without ids 3`] = ` +Object { + "angle": 0, + "backgroundColor": "transparent", + "baseline": 0, + "boundElements": Array [ + Object { + "id": "id36", + "type": "arrow", }, - "strokeColor": "#1e1e1e", - "strokeStyle": "solid", - "strokeWidth": 1, - "type": "arrow", - "updated": 1, - "version": 4, - "versionNonce": 150934636, - "width": 300, - "x": 255, - "y": 239, - }, - Object { - "angle": 0, - "backgroundColor": "transparent", - "baseline": 0, - "boundElements": null, - "containerId": "id36", - "fillStyle": "hachure", - "fontFamily": 1, - "fontSize": 20, - "groupIds": Array [], - "height": 25, - "id": "id37", - "isDeleted": false, - "lineHeight": 1.25, - "link": null, - "locked": false, - "opacity": 100, - "originalText": "HELLO WORLD!!", - "roughness": 1, - "roundness": null, - "seed": 551566548, - "strokeColor": "#1e1e1e", - "strokeStyle": "solid", - "strokeWidth": 1, - "text": "HELLO WORLD!!", - "textAlign": "center", - "type": "text", - "updated": 1, - "version": 2, - "versionNonce": 350847572, - "verticalAlign": "middle", - "width": 130, - "x": 340, - "y": 226.5, - }, - Object { - "angle": 0, - "backgroundColor": "transparent", - "baseline": 0, - "boundElements": Array [ - Object { - "id": "id36", - "type": "arrow", - }, - ], - "containerId": null, - "fillStyle": "hachure", - "fontFamily": 1, - "fontSize": 20, - "groupIds": Array [], - "height": 25, - "id": "id38", - "isDeleted": false, - "lineHeight": 1.25, - "link": null, - "locked": false, - "opacity": 100, - "originalText": "HEYYYYY", - "roughness": 1, - "roundness": null, - "seed": 707099884, - "strokeColor": "#1e1e1e", - "strokeStyle": "solid", - "strokeWidth": 1, - "text": "HEYYYYY", - "textAlign": "left", - "type": "text", - "updated": 1, - "version": 3, - "versionNonce": 1715731796, - "verticalAlign": "top", - "width": 70, - "x": 185, - "y": 226.5, - }, - Object { - "angle": 0, - "backgroundColor": "transparent", - "baseline": 0, - "boundElements": Array [ - Object { - "id": "id36", - "type": "arrow", - }, - ], - "containerId": null, - "fillStyle": "hachure", - "fontFamily": 1, - "fontSize": 20, - "groupIds": Array [], - "height": 25, - "id": "id39", - "isDeleted": false, - "lineHeight": 1.25, - "link": null, - "locked": false, - "opacity": 100, - "originalText": "WHATS UP ?", - "roughness": 1, - "roundness": null, - "seed": 235155948, - "strokeColor": "#1e1e1e", - "strokeStyle": "solid", - "strokeWidth": 1, - "text": "WHATS UP ?", - "textAlign": "left", - "type": "text", - "updated": 1, - "version": 3, - "versionNonce": 1501280340, - "verticalAlign": "top", - "width": 100, - "x": 555, - "y": 226.5, - }, -] + ], + "containerId": null, + "fillStyle": "hachure", + "fontFamily": 1, + "fontSize": 20, + "groupIds": Array [], + "height": 25, + "id": Any, + "isDeleted": false, + "lineHeight": 1.25, + "link": null, + "locked": false, + "opacity": 100, + "originalText": "HEYYYYY", + "roughness": 1, + "roundness": null, + "seed": Any, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 1, + "text": "HEYYYYY", + "textAlign": "left", + "type": "text", + "updated": 1, + "version": 3, + "versionNonce": Any, + "verticalAlign": "top", + "width": 70, + "x": 185, + "y": 226.5, +} +`; + +exports[`Test Transform Test arrow bindings should bind arrows to text when start / end provided without ids 4`] = ` +Object { + "angle": 0, + "backgroundColor": "transparent", + "baseline": 0, + "boundElements": Array [ + Object { + "id": "id36", + "type": "arrow", + }, + ], + "containerId": null, + "fillStyle": "hachure", + "fontFamily": 1, + "fontSize": 20, + "groupIds": Array [], + "height": 25, + "id": Any, + "isDeleted": false, + "lineHeight": 1.25, + "link": null, + "locked": false, + "opacity": 100, + "originalText": "WHATS UP ?", + "roughness": 1, + "roundness": null, + "seed": Any, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 1, + "text": "WHATS UP ?", + "textAlign": "left", + "type": "text", + "updated": 1, + "version": 3, + "versionNonce": Any, + "verticalAlign": "top", + "width": 100, + "x": 555, + "y": 226.5, +} `; exports[`Test Transform should generate new ids if multiple elements contain same ids 1`] = ` @@ -717,172 +748,179 @@ Array [ `; exports[`Test Transform should transform linear elements 1`] = ` -Array [ - Object { - "angle": 0, - "backgroundColor": "transparent", - "boundElements": null, - "endArrowhead": "arrow", - "endBinding": null, - "fillStyle": "hachure", - "groupIds": Array [], - "height": 0, - "id": "id8", - "isDeleted": false, - "lastCommittedPoint": null, - "link": null, - "locked": false, - "opacity": 100, - "points": Array [ - Array [ - 0, - 0, - ], - Array [ - 300, - 0, - ], +Object { + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "endArrowhead": "arrow", + "endBinding": null, + "fillStyle": "hachure", + "groupIds": Array [], + "height": 0, + "id": Any, + "isDeleted": false, + "lastCommittedPoint": null, + "link": null, + "locked": false, + "opacity": 100, + "points": Array [ + Array [ + 0, + 0, ], - "roughness": 1, - "roundness": null, - "seed": 969706708, - "startArrowhead": null, - "startBinding": null, - "strokeColor": "#1e1e1e", - "strokeStyle": "solid", - "strokeWidth": 1, - "type": "arrow", - "updated": 1, - "version": 1, - "versionNonce": 0, - "width": 300, - "x": 100, - "y": 20, - }, - Object { - "angle": 0, - "backgroundColor": "transparent", - "boundElements": null, - "endArrowhead": "triangle", - "endBinding": null, - "fillStyle": "hachure", - "groupIds": Array [], - "height": 0, - "id": "id9", - "isDeleted": false, - "lastCommittedPoint": null, - "link": null, - "locked": false, - "opacity": 100, - "points": Array [ - Array [ - 0, - 0, - ], - Array [ - 300, - 0, - ], + Array [ + 300, + 0, ], - "roughness": 1, - "roundness": null, - "seed": 11426412, - "startArrowhead": "dot", - "startBinding": null, - "strokeColor": "#1971c2", - "strokeStyle": "solid", - "strokeWidth": 2, - "type": "arrow", - "updated": 1, - "version": 1, - "versionNonce": 0, - "width": 300, - "x": 450, - "y": 20, - }, - Object { - "angle": 0, - "backgroundColor": "transparent", - "boundElements": null, - "endArrowhead": null, - "endBinding": null, - "fillStyle": "hachure", - "groupIds": Array [], - "height": 0, - "id": "id10", - "isDeleted": false, - "lastCommittedPoint": null, - "link": null, - "locked": false, - "opacity": 100, - "points": Array [ - Array [ - 0, - 0, - ], - Array [ - 300, - 0, - ], + ], + "roughness": 1, + "roundness": null, + "seed": Any, + "startArrowhead": null, + "startBinding": null, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 1, + "type": "arrow", + "updated": 1, + "version": 1, + "versionNonce": Any, + "width": 300, + "x": 100, + "y": 20, +} +`; + +exports[`Test Transform should transform linear elements 2`] = ` +Object { + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "endArrowhead": "triangle", + "endBinding": null, + "fillStyle": "hachure", + "groupIds": Array [], + "height": 0, + "id": Any, + "isDeleted": false, + "lastCommittedPoint": null, + "link": null, + "locked": false, + "opacity": 100, + "points": Array [ + Array [ + 0, + 0, ], - "roughness": 1, - "roundness": null, - "seed": 1808519764, - "startArrowhead": null, - "startBinding": null, - "strokeColor": "#1e1e1e", - "strokeStyle": "solid", - "strokeWidth": 1, - "type": "line", - "updated": 1, - "version": 1, - "versionNonce": 0, - "width": 300, - "x": 100, - "y": 60, - }, - Object { - "angle": 0, - "backgroundColor": "transparent", - "boundElements": null, - "endArrowhead": null, - "endBinding": null, - "fillStyle": "hachure", - "groupIds": Array [], - "height": 0, - "id": "id11", - "isDeleted": false, - "lastCommittedPoint": null, - "link": null, - "locked": false, - "opacity": 100, - "points": Array [ - Array [ - 0, - 0, - ], - Array [ - 300, - 0, - ], + Array [ + 300, + 0, ], - "roughness": 1, - "roundness": null, - "seed": 1699753196, - "startArrowhead": null, - "startBinding": null, - "strokeColor": "#2f9e44", - "strokeStyle": "dotted", - "strokeWidth": 2, - "type": "line", - "updated": 1, - "version": 1, - "versionNonce": 0, - "width": 300, - "x": 450, - "y": 60, - }, -] + ], + "roughness": 1, + "roundness": null, + "seed": Any, + "startArrowhead": "dot", + "startBinding": null, + "strokeColor": "#1971c2", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "arrow", + "updated": 1, + "version": 1, + "versionNonce": Any, + "width": 300, + "x": 450, + "y": 20, +} +`; + +exports[`Test Transform should transform linear elements 3`] = ` +Object { + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "endArrowhead": null, + "endBinding": null, + "fillStyle": "hachure", + "groupIds": Array [], + "height": 0, + "id": Any, + "isDeleted": false, + "lastCommittedPoint": null, + "link": null, + "locked": false, + "opacity": 100, + "points": Array [ + Array [ + 0, + 0, + ], + Array [ + 300, + 0, + ], + ], + "roughness": 1, + "roundness": null, + "seed": Any, + "startArrowhead": null, + "startBinding": null, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 1, + "type": "line", + "updated": 1, + "version": 1, + "versionNonce": Any, + "width": 300, + "x": 100, + "y": 60, +} +`; + +exports[`Test Transform should transform linear elements 4`] = ` +Object { + "angle": 0, + "backgroundColor": "transparent", + "boundElements": null, + "endArrowhead": null, + "endBinding": null, + "fillStyle": "hachure", + "groupIds": Array [], + "height": 0, + "id": Any, + "isDeleted": false, + "lastCommittedPoint": null, + "link": null, + "locked": false, + "opacity": 100, + "points": Array [ + Array [ + 0, + 0, + ], + Array [ + 300, + 0, + ], + ], + "roughness": 1, + "roundness": null, + "seed": Any, + "startArrowhead": null, + "startBinding": null, + "strokeColor": "#2f9e44", + "strokeStyle": "dotted", + "strokeWidth": 2, + "type": "line", + "updated": 1, + "version": 1, + "versionNonce": Any, + "width": 300, + "x": 450, + "y": 60, +} `; exports[`Test Transform should transform regular shapes 1`] = ` @@ -978,742 +1016,792 @@ Array [ `; exports[`Test Transform should transform to labelled arrows when label provided for arrows 1`] = ` -Array [ - Object { - "angle": 0, - "backgroundColor": "transparent", - "boundElements": Array [ - Object { - "id": "id25", - "type": "text", - }, +Object { + "angle": 0, + "backgroundColor": "transparent", + "boundElements": Array [ + Object { + "id": "id25", + "type": "text", + }, + ], + "endArrowhead": "arrow", + "endBinding": null, + "fillStyle": "hachure", + "groupIds": Array [], + "height": 0, + "id": Any, + "isDeleted": false, + "lastCommittedPoint": null, + "link": null, + "locked": false, + "opacity": 100, + "points": Array [ + Array [ + 0, + 0, ], - "endArrowhead": "arrow", - "endBinding": null, - "fillStyle": "hachure", - "groupIds": Array [], - "height": 0, - "id": "id24", - "isDeleted": false, - "lastCommittedPoint": null, - "link": null, - "locked": false, - "opacity": 100, - "points": Array [ - Array [ - 0, - 0, - ], - Array [ - 300, - 0, - ], + Array [ + 300, + 0, ], - "roughness": 1, - "roundness": null, - "seed": 786617580, - "startArrowhead": null, - "startBinding": null, - "strokeColor": "#1e1e1e", - "strokeStyle": "solid", - "strokeWidth": 1, - "type": "arrow", - "updated": 1, - "version": 2, - "versionNonce": 2081511276, - "width": 300, - "x": 100, - "y": 100, - }, - Object { - "angle": 0, - "backgroundColor": "transparent", - "baseline": 0, - "boundElements": null, - "containerId": "id24", - "fillStyle": "hachure", - "fontFamily": 1, - "fontSize": 20, - "groupIds": Array [], - "height": 25, - "id": "id25", - "isDeleted": false, - "lineHeight": 1.25, - "link": null, - "locked": false, - "opacity": 100, - "originalText": "LABELED ARROW", - "roughness": 1, - "roundness": null, - "seed": 1158823892, - "strokeColor": "#1e1e1e", - "strokeStyle": "solid", - "strokeWidth": 1, - "text": "LABELED ARROW", - "textAlign": "center", - "type": "text", - "updated": 1, - "version": 2, - "versionNonce": 165881172, - "verticalAlign": "middle", - "width": 130, - "x": 185, - "y": 87.5, - }, - Object { - "angle": 0, - "backgroundColor": "transparent", - "boundElements": Array [ - Object { - "id": "id27", - "type": "text", - }, + ], + "roughness": 1, + "roundness": null, + "seed": Any, + "startArrowhead": null, + "startBinding": null, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 1, + "type": "arrow", + "updated": 1, + "version": 2, + "versionNonce": Any, + "width": 300, + "x": 100, + "y": 100, +} +`; + +exports[`Test Transform should transform to labelled arrows when label provided for arrows 2`] = ` +Object { + "angle": 0, + "backgroundColor": "transparent", + "baseline": 0, + "boundElements": null, + "containerId": "id24", + "fillStyle": "hachure", + "fontFamily": 1, + "fontSize": 20, + "groupIds": Array [], + "height": 25, + "id": Any, + "isDeleted": false, + "lineHeight": 1.25, + "link": null, + "locked": false, + "opacity": 100, + "originalText": "LABELED ARROW", + "roughness": 1, + "roundness": null, + "seed": Any, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 1, + "text": "LABELED ARROW", + "textAlign": "center", + "type": "text", + "updated": 1, + "version": 2, + "versionNonce": Any, + "verticalAlign": "middle", + "width": 130, + "x": 185, + "y": 87.5, +} +`; + +exports[`Test Transform should transform to labelled arrows when label provided for arrows 3`] = ` +Object { + "angle": 0, + "backgroundColor": "transparent", + "boundElements": Array [ + Object { + "id": "id27", + "type": "text", + }, + ], + "endArrowhead": "arrow", + "endBinding": null, + "fillStyle": "hachure", + "groupIds": Array [], + "height": 0, + "id": Any, + "isDeleted": false, + "lastCommittedPoint": null, + "link": null, + "locked": false, + "opacity": 100, + "points": Array [ + Array [ + 0, + 0, ], - "endArrowhead": "arrow", - "endBinding": null, - "fillStyle": "hachure", - "groupIds": Array [], - "height": 0, - "id": "id26", - "isDeleted": false, - "lastCommittedPoint": null, - "link": null, - "locked": false, - "opacity": 100, - "points": Array [ - Array [ - 0, - 0, - ], - Array [ - 300, - 0, - ], + Array [ + 300, + 0, ], - "roughness": 1, - "roundness": null, - "seed": 1431013868, - "startArrowhead": null, - "startBinding": null, - "strokeColor": "#1e1e1e", - "strokeStyle": "solid", - "strokeWidth": 1, - "type": "arrow", - "updated": 1, - "version": 2, - "versionNonce": 496725100, - "width": 300, - "x": 100, - "y": 200, - }, - Object { - "angle": 0, - "backgroundColor": "transparent", - "baseline": 0, - "boundElements": null, - "containerId": "id26", - "fillStyle": "hachure", - "fontFamily": 1, - "fontSize": 20, - "groupIds": Array [], - "height": 25, - "id": "id27", - "isDeleted": false, - "lineHeight": 1.25, - "link": null, - "locked": false, - "opacity": 100, - "originalText": "STYLED LABELED ARROW", - "roughness": 1, - "roundness": null, - "seed": 511400660, - "strokeColor": "#099268", - "strokeStyle": "solid", - "strokeWidth": 1, - "text": "STYLED LABELED ARROW", - "textAlign": "center", - "type": "text", - "updated": 1, - "version": 2, - "versionNonce": 762372180, - "verticalAlign": "middle", - "width": 200, - "x": 150, - "y": 187.5, - }, - Object { - "angle": 0, - "backgroundColor": "transparent", - "boundElements": Array [ - Object { - "id": "id29", - "type": "text", - }, + ], + "roughness": 1, + "roundness": null, + "seed": Any, + "startArrowhead": null, + "startBinding": null, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 1, + "type": "arrow", + "updated": 1, + "version": 2, + "versionNonce": Any, + "width": 300, + "x": 100, + "y": 200, +} +`; + +exports[`Test Transform should transform to labelled arrows when label provided for arrows 4`] = ` +Object { + "angle": 0, + "backgroundColor": "transparent", + "baseline": 0, + "boundElements": null, + "containerId": "id26", + "fillStyle": "hachure", + "fontFamily": 1, + "fontSize": 20, + "groupIds": Array [], + "height": 25, + "id": Any, + "isDeleted": false, + "lineHeight": 1.25, + "link": null, + "locked": false, + "opacity": 100, + "originalText": "STYLED LABELED ARROW", + "roughness": 1, + "roundness": null, + "seed": Any, + "strokeColor": "#099268", + "strokeStyle": "solid", + "strokeWidth": 1, + "text": "STYLED LABELED ARROW", + "textAlign": "center", + "type": "text", + "updated": 1, + "version": 2, + "versionNonce": Any, + "verticalAlign": "middle", + "width": 200, + "x": 150, + "y": 187.5, +} +`; + +exports[`Test Transform should transform to labelled arrows when label provided for arrows 5`] = ` +Object { + "angle": 0, + "backgroundColor": "transparent", + "boundElements": Array [ + Object { + "id": "id29", + "type": "text", + }, + ], + "endArrowhead": "arrow", + "endBinding": null, + "fillStyle": "hachure", + "groupIds": Array [], + "height": 130, + "id": Any, + "isDeleted": false, + "lastCommittedPoint": null, + "link": null, + "locked": false, + "opacity": 100, + "points": Array [ + Array [ + 0, + 0, ], - "endArrowhead": "arrow", - "endBinding": null, - "fillStyle": "hachure", - "groupIds": Array [], - "height": 130, - "id": "id28", - "isDeleted": false, - "lastCommittedPoint": null, - "link": null, - "locked": false, - "opacity": 100, - "points": Array [ - Array [ - 0, - 0, - ], - Array [ - 300, - 0, - ], + Array [ + 300, + 0, ], - "roughness": 1, - "roundness": null, - "seed": 1187708652, - "startArrowhead": null, - "startBinding": null, - "strokeColor": "#1098ad", - "strokeStyle": "solid", - "strokeWidth": 2, - "type": "arrow", - "updated": 1, - "version": 3, - "versionNonce": 1863048020, - "width": 300, - "x": 100, - "y": 300, - }, - Object { - "angle": 0, - "backgroundColor": "transparent", - "baseline": 0, - "boundElements": null, - "containerId": "id28", - "fillStyle": "hachure", - "fontFamily": 1, - "fontSize": 20, - "groupIds": Array [], - "height": 50, - "id": "id29", - "isDeleted": false, - "lineHeight": 1.25, - "link": null, - "locked": false, - "opacity": 100, - "originalText": "ANOTHER STYLED LABELLED ARROW", - "roughness": 1, - "roundness": null, - "seed": 513390036, - "strokeColor": "#1098ad", - "strokeStyle": "solid", - "strokeWidth": 1, - "text": "ANOTHER STYLED + ], + "roughness": 1, + "roundness": null, + "seed": Any, + "startArrowhead": null, + "startBinding": null, + "strokeColor": "#1098ad", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "arrow", + "updated": 1, + "version": 3, + "versionNonce": Any, + "width": 300, + "x": 100, + "y": 300, +} +`; + +exports[`Test Transform should transform to labelled arrows when label provided for arrows 6`] = ` +Object { + "angle": 0, + "backgroundColor": "transparent", + "baseline": 0, + "boundElements": null, + "containerId": "id28", + "fillStyle": "hachure", + "fontFamily": 1, + "fontSize": 20, + "groupIds": Array [], + "height": 50, + "id": Any, + "isDeleted": false, + "lineHeight": 1.25, + "link": null, + "locked": false, + "opacity": 100, + "originalText": "ANOTHER STYLED LABELLED ARROW", + "roughness": 1, + "roundness": null, + "seed": Any, + "strokeColor": "#1098ad", + "strokeStyle": "solid", + "strokeWidth": 1, + "text": "ANOTHER STYLED LABELLED ARROW", - "textAlign": "center", - "type": "text", - "updated": 1, - "version": 2, - "versionNonce": 1018246124, - "verticalAlign": "middle", - "width": 150, - "x": 175, - "y": 275, - }, - Object { - "angle": 0, - "backgroundColor": "transparent", - "boundElements": Array [ - Object { - "id": "id31", - "type": "text", - }, + "textAlign": "center", + "type": "text", + "updated": 1, + "version": 2, + "versionNonce": Any, + "verticalAlign": "middle", + "width": 150, + "x": 175, + "y": 275, +} +`; + +exports[`Test Transform should transform to labelled arrows when label provided for arrows 7`] = ` +Object { + "angle": 0, + "backgroundColor": "transparent", + "boundElements": Array [ + Object { + "id": "id31", + "type": "text", + }, + ], + "endArrowhead": "arrow", + "endBinding": null, + "fillStyle": "hachure", + "groupIds": Array [], + "height": 130, + "id": Any, + "isDeleted": false, + "lastCommittedPoint": null, + "link": null, + "locked": false, + "opacity": 100, + "points": Array [ + Array [ + 0, + 0, ], - "endArrowhead": "arrow", - "endBinding": null, - "fillStyle": "hachure", - "groupIds": Array [], - "height": 130, - "id": "id30", - "isDeleted": false, - "lastCommittedPoint": null, - "link": null, - "locked": false, - "opacity": 100, - "points": Array [ - Array [ - 0, - 0, - ], - Array [ - 300, - 0, - ], + Array [ + 300, + 0, ], - "roughness": 1, - "roundness": null, - "seed": 152916180, - "startArrowhead": null, - "startBinding": null, - "strokeColor": "#1098ad", - "strokeStyle": "solid", - "strokeWidth": 2, - "type": "arrow", - "updated": 1, - "version": 3, - "versionNonce": 1548626156, - "width": 300, - "x": 100, - "y": 400, - }, - Object { - "angle": 0, - "backgroundColor": "transparent", - "baseline": 0, - "boundElements": null, - "containerId": "id30", - "fillStyle": "hachure", - "fontFamily": 1, - "fontSize": 20, - "groupIds": Array [], - "height": 50, - "id": "id31", - "isDeleted": false, - "lineHeight": 1.25, - "link": null, - "locked": false, - "opacity": 100, - "originalText": "ANOTHER STYLED LABELLED ARROW", - "roughness": 1, - "roundness": null, - "seed": 515626604, - "strokeColor": "#099268", - "strokeStyle": "solid", - "strokeWidth": 1, - "text": "ANOTHER STYLED + ], + "roughness": 1, + "roundness": null, + "seed": Any, + "startArrowhead": null, + "startBinding": null, + "strokeColor": "#1098ad", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "arrow", + "updated": 1, + "version": 3, + "versionNonce": Any, + "width": 300, + "x": 100, + "y": 400, +} +`; + +exports[`Test Transform should transform to labelled arrows when label provided for arrows 8`] = ` +Object { + "angle": 0, + "backgroundColor": "transparent", + "baseline": 0, + "boundElements": null, + "containerId": "id30", + "fillStyle": "hachure", + "fontFamily": 1, + "fontSize": 20, + "groupIds": Array [], + "height": 50, + "id": Any, + "isDeleted": false, + "lineHeight": 1.25, + "link": null, + "locked": false, + "opacity": 100, + "originalText": "ANOTHER STYLED LABELLED ARROW", + "roughness": 1, + "roundness": null, + "seed": Any, + "strokeColor": "#099268", + "strokeStyle": "solid", + "strokeWidth": 1, + "text": "ANOTHER STYLED LABELLED ARROW", - "textAlign": "center", - "type": "text", - "updated": 1, - "version": 2, - "versionNonce": 1974873044, - "verticalAlign": "middle", - "width": 150, - "x": 175, - "y": 375, - }, -] + "textAlign": "center", + "type": "text", + "updated": 1, + "version": 2, + "versionNonce": Any, + "verticalAlign": "middle", + "width": 150, + "x": 175, + "y": 375, +} `; exports[`Test Transform should transform to text containers when label provided 1`] = ` -Array [ - Object { - "angle": 0, - "backgroundColor": "transparent", - "boundElements": Array [ - Object { - "id": "id13", - "type": "text", - }, - ], - "fillStyle": "hachure", - "groupIds": Array [], - "height": 35, - "id": "id12", - "isDeleted": false, - "link": null, - "locked": false, - "opacity": 100, - "roughness": 1, - "roundness": null, - "seed": 2026268628, - "strokeColor": "#1e1e1e", - "strokeStyle": "solid", - "strokeWidth": 1, - "type": "rectangle", - "updated": 1, - "version": 4, - "versionNonce": 1095074516, - "width": 250, - "x": 100, - "y": 100, - }, - Object { - "angle": 0, - "backgroundColor": "transparent", - "baseline": 0, - "boundElements": null, - "containerId": "id12", - "fillStyle": "hachure", - "fontFamily": 1, - "fontSize": 20, - "groupIds": Array [], - "height": 25, - "id": "id13", - "isDeleted": false, - "lineHeight": 1.25, - "link": null, - "locked": false, - "opacity": 100, - "originalText": "RECTANGLE TEXT CONTAINER", - "roughness": 1, - "roundness": null, - "seed": 722710380, - "strokeColor": "#1e1e1e", - "strokeStyle": "solid", - "strokeWidth": 1, - "text": "RECTANGLE TEXT CONTAINER", - "textAlign": "center", - "type": "text", - "updated": 1, - "version": 2, - "versionNonce": 31966316, - "verticalAlign": "middle", - "width": 240, - "x": 105, - "y": 105, - }, - Object { - "angle": 0, - "backgroundColor": "transparent", - "boundElements": Array [ - Object { - "id": "id15", - "type": "text", - }, - ], - "fillStyle": "hachure", - "groupIds": Array [], - "height": 85, - "id": "id14", - "isDeleted": false, - "link": null, - "locked": false, - "opacity": 100, - "roughness": 1, - "roundness": null, - "seed": 1152780372, - "strokeColor": "#1e1e1e", - "strokeStyle": "solid", - "strokeWidth": 1, - "type": "ellipse", - "updated": 1, - "version": 3, - "versionNonce": 1215994220, - "width": 200, - "x": 500, - "y": 100, - }, - Object { - "angle": 0, - "backgroundColor": "transparent", - "baseline": 0, - "boundElements": null, - "containerId": "id14", - "fillStyle": "hachure", - "fontFamily": 1, - "fontSize": 20, - "groupIds": Array [], - "height": 50, - "id": "id15", - "isDeleted": false, - "lineHeight": 1.25, - "link": null, - "locked": false, - "opacity": 100, - "originalText": "ELLIPSE TEXT CONTAINER", - "roughness": 1, - "roundness": null, - "seed": 265049836, - "strokeColor": "#1e1e1e", - "strokeStyle": "solid", - "strokeWidth": 1, - "text": "ELLIPSE TEXT +Object { + "angle": 0, + "backgroundColor": "transparent", + "boundElements": Array [ + Object { + "id": "id13", + "type": "text", + }, + ], + "fillStyle": "hachure", + "groupIds": Array [], + "height": 35, + "id": Any, + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": null, + "seed": Any, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 1, + "type": "rectangle", + "updated": 1, + "version": 4, + "versionNonce": Any, + "width": 250, + "x": 100, + "y": 100, +} +`; + +exports[`Test Transform should transform to text containers when label provided 2`] = ` +Object { + "angle": 0, + "backgroundColor": "transparent", + "baseline": 0, + "boundElements": null, + "containerId": "id12", + "fillStyle": "hachure", + "fontFamily": 1, + "fontSize": 20, + "groupIds": Array [], + "height": 25, + "id": Any, + "isDeleted": false, + "lineHeight": 1.25, + "link": null, + "locked": false, + "opacity": 100, + "originalText": "RECTANGLE TEXT CONTAINER", + "roughness": 1, + "roundness": null, + "seed": Any, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 1, + "text": "RECTANGLE TEXT CONTAINER", + "textAlign": "center", + "type": "text", + "updated": 1, + "version": 2, + "versionNonce": Any, + "verticalAlign": "middle", + "width": 240, + "x": 105, + "y": 105, +} +`; + +exports[`Test Transform should transform to text containers when label provided 3`] = ` +Object { + "angle": 0, + "backgroundColor": "transparent", + "boundElements": Array [ + Object { + "id": "id15", + "type": "text", + }, + ], + "fillStyle": "hachure", + "groupIds": Array [], + "height": 85, + "id": Any, + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": null, + "seed": Any, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 1, + "type": "ellipse", + "updated": 1, + "version": 3, + "versionNonce": Any, + "width": 200, + "x": 500, + "y": 100, +} +`; + +exports[`Test Transform should transform to text containers when label provided 4`] = ` +Object { + "angle": 0, + "backgroundColor": "transparent", + "baseline": 0, + "boundElements": null, + "containerId": "id14", + "fillStyle": "hachure", + "fontFamily": 1, + "fontSize": 20, + "groupIds": Array [], + "height": 50, + "id": Any, + "isDeleted": false, + "lineHeight": 1.25, + "link": null, + "locked": false, + "opacity": 100, + "originalText": "ELLIPSE TEXT CONTAINER", + "roughness": 1, + "roundness": null, + "seed": Any, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 1, + "text": "ELLIPSE TEXT CONTAINER", - "textAlign": "center", - "type": "text", - "updated": 1, - "version": 2, - "versionNonce": 86442836, - "verticalAlign": "middle", - "width": 130, - "x": 534.7893218813452, - "y": 117.44796179957173, - }, - Object { - "angle": 0, - "backgroundColor": "transparent", - "boundElements": Array [ - Object { - "id": "id17", - "type": "text", - }, - ], - "fillStyle": "hachure", - "groupIds": Array [], - "height": 170, - "id": "id16", - "isDeleted": false, - "link": null, - "locked": false, - "opacity": 100, - "roughness": 1, - "roundness": null, - "seed": 121408492, - "strokeColor": "#1e1e1e", - "strokeStyle": "solid", - "strokeWidth": 1, - "type": "diamond", - "updated": 1, - "version": 3, - "versionNonce": 1943354964, - "width": 280, - "x": 100, - "y": 150, - }, - Object { - "angle": 0, - "backgroundColor": "transparent", - "baseline": 0, - "boundElements": null, - "containerId": "id16", - "fillStyle": "hachure", - "fontFamily": 1, - "fontSize": 20, - "groupIds": Array [], - "height": 75, - "id": "id17", - "isDeleted": false, - "lineHeight": 1.25, - "link": null, - "locked": false, - "opacity": 100, - "originalText": "DIAMOND + "textAlign": "center", + "type": "text", + "updated": 1, + "version": 2, + "versionNonce": Any, + "verticalAlign": "middle", + "width": 130, + "x": 534.7893218813452, + "y": 117.44796179957173, +} +`; + +exports[`Test Transform should transform to text containers when label provided 5`] = ` +Object { + "angle": 0, + "backgroundColor": "transparent", + "boundElements": Array [ + Object { + "id": "id17", + "type": "text", + }, + ], + "fillStyle": "hachure", + "groupIds": Array [], + "height": 170, + "id": Any, + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": null, + "seed": Any, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 1, + "type": "diamond", + "updated": 1, + "version": 3, + "versionNonce": Any, + "width": 280, + "x": 100, + "y": 150, +} +`; + +exports[`Test Transform should transform to text containers when label provided 6`] = ` +Object { + "angle": 0, + "backgroundColor": "transparent", + "baseline": 0, + "boundElements": null, + "containerId": "id16", + "fillStyle": "hachure", + "fontFamily": 1, + "fontSize": 20, + "groupIds": Array [], + "height": 75, + "id": Any, + "isDeleted": false, + "lineHeight": 1.25, + "link": null, + "locked": false, + "opacity": 100, + "originalText": "DIAMOND TEXT CONTAINER", - "roughness": 1, - "roundness": null, - "seed": 26441940, - "strokeColor": "#1e1e1e", - "strokeStyle": "solid", - "strokeWidth": 1, - "text": "DIAMOND + "roughness": 1, + "roundness": null, + "seed": Any, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 1, + "text": "DIAMOND TEXT CONTAINER", - "textAlign": "center", - "type": "text", - "updated": 1, - "version": 2, - "versionNonce": 1306755308, - "verticalAlign": "middle", - "width": 90, - "x": 195, - "y": 197.5, - }, - Object { - "angle": 0, - "backgroundColor": "#fff3bf", - "boundElements": Array [ - Object { - "id": "id19", - "type": "text", - }, - ], - "fillStyle": "hachure", - "groupIds": Array [], - "height": 120, - "id": "id18", - "isDeleted": false, - "link": null, - "locked": false, - "opacity": 100, - "roughness": 1, - "roundness": null, - "seed": 348279764, - "strokeColor": "#1e1e1e", - "strokeStyle": "solid", - "strokeWidth": 2, - "type": "diamond", - "updated": 1, - "version": 3, - "versionNonce": 353449452, - "width": 300, - "x": 100, - "y": 400, - }, - Object { - "angle": 0, - "backgroundColor": "transparent", - "baseline": 0, - "boundElements": null, - "containerId": "id18", - "fillStyle": "hachure", - "fontFamily": 1, - "fontSize": 20, - "groupIds": Array [], - "height": 50, - "id": "id19", - "isDeleted": false, - "lineHeight": 1.25, - "link": null, - "locked": false, - "opacity": 100, - "originalText": "STYLED DIAMOND TEXT CONTAINER", - "roughness": 1, - "roundness": null, - "seed": 1310491500, - "strokeColor": "#099268", - "strokeStyle": "solid", - "strokeWidth": 1, - "text": "STYLED DIAMOND + "textAlign": "center", + "type": "text", + "updated": 1, + "version": 2, + "versionNonce": Any, + "verticalAlign": "middle", + "width": 90, + "x": 195, + "y": 197.5, +} +`; + +exports[`Test Transform should transform to text containers when label provided 7`] = ` +Object { + "angle": 0, + "backgroundColor": "#fff3bf", + "boundElements": Array [ + Object { + "id": "id19", + "type": "text", + }, + ], + "fillStyle": "hachure", + "groupIds": Array [], + "height": 120, + "id": Any, + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": null, + "seed": Any, + "strokeColor": "#1e1e1e", + "strokeStyle": "solid", + "strokeWidth": 2, + "type": "diamond", + "updated": 1, + "version": 3, + "versionNonce": Any, + "width": 300, + "x": 100, + "y": 400, +} +`; + +exports[`Test Transform should transform to text containers when label provided 8`] = ` +Object { + "angle": 0, + "backgroundColor": "transparent", + "baseline": 0, + "boundElements": null, + "containerId": "id18", + "fillStyle": "hachure", + "fontFamily": 1, + "fontSize": 20, + "groupIds": Array [], + "height": 50, + "id": Any, + "isDeleted": false, + "lineHeight": 1.25, + "link": null, + "locked": false, + "opacity": 100, + "originalText": "STYLED DIAMOND TEXT CONTAINER", + "roughness": 1, + "roundness": null, + "seed": Any, + "strokeColor": "#099268", + "strokeStyle": "solid", + "strokeWidth": 1, + "text": "STYLED DIAMOND TEXT CONTAINER", - "textAlign": "center", - "type": "text", - "updated": 1, - "version": 2, - "versionNonce": 1748397780, - "verticalAlign": "middle", - "width": 140, - "x": 180, - "y": 435, - }, - Object { - "angle": 0, - "backgroundColor": "transparent", - "boundElements": Array [ - Object { - "id": "id21", - "type": "text", - }, - ], - "fillStyle": "hachure", - "groupIds": Array [], - "height": 85, - "id": "id20", - "isDeleted": false, - "link": null, - "locked": false, - "opacity": 100, - "roughness": 1, - "roundness": null, - "seed": 801871980, - "strokeColor": "#c2255c", - "strokeStyle": "solid", - "strokeWidth": 1, - "type": "rectangle", - "updated": 1, - "version": 3, - "versionNonce": 463456724, - "width": 200, - "x": 500, - "y": 300, - }, - Object { - "angle": 0, - "backgroundColor": "transparent", - "baseline": 0, - "boundElements": null, - "containerId": "id20", - "fillStyle": "hachure", - "fontFamily": 1, - "fontSize": 20, - "groupIds": Array [], - "height": 75, - "id": "id21", - "isDeleted": false, - "lineHeight": 1.25, - "link": null, - "locked": false, - "opacity": 100, - "originalText": "TOP LEFT ALIGNED RECTANGLE TEXT CONTAINER", - "roughness": 1, - "roundness": null, - "seed": 917075028, - "strokeColor": "#c2255c", - "strokeStyle": "solid", - "strokeWidth": 1, - "text": "TOP LEFT ALIGNED + "textAlign": "center", + "type": "text", + "updated": 1, + "version": 2, + "versionNonce": Any, + "verticalAlign": "middle", + "width": 140, + "x": 180, + "y": 435, +} +`; + +exports[`Test Transform should transform to text containers when label provided 9`] = ` +Object { + "angle": 0, + "backgroundColor": "transparent", + "boundElements": Array [ + Object { + "id": "id21", + "type": "text", + }, + ], + "fillStyle": "hachure", + "groupIds": Array [], + "height": 85, + "id": Any, + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": null, + "seed": Any, + "strokeColor": "#c2255c", + "strokeStyle": "solid", + "strokeWidth": 1, + "type": "rectangle", + "updated": 1, + "version": 3, + "versionNonce": Any, + "width": 200, + "x": 500, + "y": 300, +} +`; + +exports[`Test Transform should transform to text containers when label provided 10`] = ` +Object { + "angle": 0, + "backgroundColor": "transparent", + "baseline": 0, + "boundElements": null, + "containerId": "id20", + "fillStyle": "hachure", + "fontFamily": 1, + "fontSize": 20, + "groupIds": Array [], + "height": 75, + "id": Any, + "isDeleted": false, + "lineHeight": 1.25, + "link": null, + "locked": false, + "opacity": 100, + "originalText": "TOP LEFT ALIGNED RECTANGLE TEXT CONTAINER", + "roughness": 1, + "roundness": null, + "seed": Any, + "strokeColor": "#c2255c", + "strokeStyle": "solid", + "strokeWidth": 1, + "text": "TOP LEFT ALIGNED RECTANGLE TEXT CONTAINER", - "textAlign": "left", - "type": "text", - "updated": 1, - "version": 2, - "versionNonce": 1182362988, - "verticalAlign": "top", - "width": 170, - "x": 505, - "y": 305, - }, - Object { - "angle": 0, - "backgroundColor": "#ffec99", - "boundElements": Array [ - Object { - "id": "id23", - "type": "text", - }, - ], - "fillStyle": "hachure", - "groupIds": Array [], - "height": 120, - "id": "id22", - "isDeleted": false, - "link": null, - "locked": false, - "opacity": 100, - "roughness": 1, - "roundness": null, - "seed": 170880852, - "strokeColor": "#f08c00", - "strokeStyle": "solid", - "strokeWidth": 1, - "type": "ellipse", - "updated": 1, - "version": 3, - "versionNonce": 1903559276, - "width": 200, - "x": 500, - "y": 500, - }, - Object { - "angle": 0, - "backgroundColor": "transparent", - "baseline": 0, - "boundElements": null, - "containerId": "id22", - "fillStyle": "hachure", - "fontFamily": 1, - "fontSize": 20, - "groupIds": Array [], - "height": 75, - "id": "id23", - "isDeleted": false, - "lineHeight": 1.25, - "link": null, - "locked": false, - "opacity": 100, - "originalText": "STYLED ELLIPSE TEXT CONTAINER", - "roughness": 1, - "roundness": null, - "seed": 104914924, - "strokeColor": "#c2255c", - "strokeStyle": "solid", - "strokeWidth": 1, - "text": "STYLED + "textAlign": "left", + "type": "text", + "updated": 1, + "version": 2, + "versionNonce": Any, + "verticalAlign": "top", + "width": 170, + "x": 505, + "y": 305, +} +`; + +exports[`Test Transform should transform to text containers when label provided 11`] = ` +Object { + "angle": 0, + "backgroundColor": "#ffec99", + "boundElements": Array [ + Object { + "id": "id23", + "type": "text", + }, + ], + "fillStyle": "hachure", + "groupIds": Array [], + "height": 120, + "id": Any, + "isDeleted": false, + "link": null, + "locked": false, + "opacity": 100, + "roughness": 1, + "roundness": null, + "seed": Any, + "strokeColor": "#f08c00", + "strokeStyle": "solid", + "strokeWidth": 1, + "type": "ellipse", + "updated": 1, + "version": 3, + "versionNonce": Any, + "width": 200, + "x": 500, + "y": 500, +} +`; + +exports[`Test Transform should transform to text containers when label provided 12`] = ` +Object { + "angle": 0, + "backgroundColor": "transparent", + "baseline": 0, + "boundElements": null, + "containerId": "id22", + "fillStyle": "hachure", + "fontFamily": 1, + "fontSize": 20, + "groupIds": Array [], + "height": 75, + "id": Any, + "isDeleted": false, + "lineHeight": 1.25, + "link": null, + "locked": false, + "opacity": 100, + "originalText": "STYLED ELLIPSE TEXT CONTAINER", + "roughness": 1, + "roundness": null, + "seed": Any, + "strokeColor": "#c2255c", + "strokeStyle": "solid", + "strokeWidth": 1, + "text": "STYLED ELLIPSE TEXT CONTAINER", - "textAlign": "center", - "type": "text", - "updated": 1, - "version": 2, - "versionNonce": 179481172, - "verticalAlign": "middle", - "width": 130, - "x": 534.7893218813452, - "y": 522.5735931288071, - }, -] + "textAlign": "center", + "type": "text", + "updated": 1, + "version": 2, + "versionNonce": Any, + "verticalAlign": "middle", + "width": 130, + "x": 534.7893218813452, + "y": 522.5735931288071, +} `; diff --git a/src/data/transform.test.ts b/src/data/transform.test.ts index b30cb206ed..ddbe2f638b 100644 --- a/src/data/transform.test.ts +++ b/src/data/transform.test.ts @@ -110,9 +110,19 @@ describe("Test Transform", () => { strokeStyle: "dotted", }, ]; - expect( - convertToExcalidrawElements(elements as ImportedDataState["elements"]), - ).toMatchSnapshot(); + const excaldrawElements = convertToExcalidrawElements( + elements as ImportedDataState["elements"], + ); + + expect(excaldrawElements.length).toBe(4); + + excaldrawElements.forEach((ele) => { + expect(ele).toMatchSnapshot({ + seed: expect.any(Number), + versionNonce: expect.any(Number), + id: expect.any(String), + }); + }); }); it("should transform to text containers when label provided", () => { @@ -182,9 +192,19 @@ describe("Test Transform", () => { }, }, ]; - expect( - convertToExcalidrawElements(elements as ImportedDataState["elements"]), - ).toMatchSnapshot(); + const excaldrawElements = convertToExcalidrawElements( + elements as ImportedDataState["elements"], + ); + + expect(excaldrawElements.length).toBe(12); + + excaldrawElements.forEach((ele) => { + expect(ele).toMatchSnapshot({ + seed: expect.any(Number), + versionNonce: expect.any(Number), + id: expect.any(String), + }); + }); }); it("should transform to labelled arrows when label provided for arrows", () => { const elements = [ @@ -228,9 +248,19 @@ describe("Test Transform", () => { }, }, ]; - expect( - convertToExcalidrawElements(elements as ImportedDataState["elements"]), - ).toMatchSnapshot(); + const excaldrawElements = convertToExcalidrawElements( + elements as ImportedDataState["elements"], + ); + + expect(excaldrawElements.length).toBe(8); + + excaldrawElements.forEach((ele) => { + expect(ele).toMatchSnapshot({ + seed: expect.any(Number), + versionNonce: expect.any(Number), + id: expect.any(String), + }); + }); }); describe("Test arrow bindings", () => { @@ -251,9 +281,67 @@ describe("Test Transform", () => { }, }, ]; - expect( - convertToExcalidrawElements(elements as ImportedDataState["elements"]), - ).toMatchSnapshot(); + const excaldrawElements = convertToExcalidrawElements( + elements as ImportedDataState["elements"], + ); + + expect(excaldrawElements.length).toBe(4); + const [arrow, text, rectangle, ellipse] = excaldrawElements; + expect(arrow).toMatchObject({ + type: "arrow", + x: 255, + y: 239, + boundElements: [{ id: text.id, type: "text" }], + startBinding: { + elementId: rectangle.id, + focus: 0, + gap: 1, + }, + endBinding: { + elementId: ellipse.id, + focus: 0, + }, + }); + + expect(text).toMatchObject({ + x: 340, + y: 226.5, + type: "text", + text: "HELLO WORLD!!", + containerId: arrow.id, + }); + + expect(rectangle).toMatchObject({ + x: 155, + y: 189, + type: "rectangle", + boundElements: [ + { + id: arrow.id, + type: "arrow", + }, + ], + }); + + expect(ellipse).toMatchObject({ + x: 555, + y: 189, + type: "ellipse", + boundElements: [ + { + id: arrow.id, + type: "arrow", + }, + ], + }); + + excaldrawElements.forEach((ele) => { + expect(ele).toMatchSnapshot({ + seed: expect.any(Number), + versionNonce: expect.any(Number), + id: expect.any(String), + }); + }); }); it("should bind arrows to text when start / end provided without ids", () => { @@ -275,9 +363,70 @@ describe("Test Transform", () => { }, }, ]; - expect( - convertToExcalidrawElements(elements as ImportedDataState["elements"]), - ).toMatchSnapshot(); + + const excaldrawElements = convertToExcalidrawElements( + elements as ImportedDataState["elements"], + ); + + expect(excaldrawElements.length).toBe(4); + + const [arrow, text1, text2, text3] = excaldrawElements; + + expect(arrow).toMatchObject({ + type: "arrow", + x: 255, + y: 239, + boundElements: [{ id: text1.id, type: "text" }], + startBinding: { + elementId: text2.id, + focus: 0, + gap: 1, + }, + endBinding: { + elementId: text3.id, + focus: 0, + }, + }); + + expect(text1).toMatchObject({ + x: 340, + y: 226.5, + type: "text", + text: "HELLO WORLD!!", + containerId: arrow.id, + }); + + expect(text2).toMatchObject({ + x: 185, + y: 226.5, + type: "text", + boundElements: [ + { + id: arrow.id, + type: "arrow", + }, + ], + }); + + expect(text3).toMatchObject({ + x: 555, + y: 226.5, + type: "text", + boundElements: [ + { + id: arrow.id, + type: "arrow", + }, + ], + }); + + excaldrawElements.forEach((ele) => { + expect(ele).toMatchSnapshot({ + seed: expect.any(Number), + versionNonce: expect.any(Number), + id: expect.any(String), + }); + }); }); it("should bind arrows to existinging shapes when start / end provided with ids", () => { @@ -333,9 +482,20 @@ describe("Test Transform", () => { }, }, ]; - expect( - convertToExcalidrawElements(elements as ImportedDataState["elements"]), - ).toMatchSnapshot(); + + const excaldrawElements = convertToExcalidrawElements( + elements as ImportedDataState["elements"], + ); + + expect(excaldrawElements.length).toBe(5); + + excaldrawElements.forEach((ele) => { + expect(ele).toMatchSnapshot({ + seed: expect.any(Number), + versionNonce: expect.any(Number), + id: expect.any(String), + }); + }); }); it("should bind arrows to existing text elements when start / end provided with ids", () => { @@ -375,9 +535,19 @@ describe("Test Transform", () => { }, ]; - expect( - convertToExcalidrawElements(elements as ImportedDataState["elements"]), - ).toMatchSnapshot(); + const excaldrawElements = convertToExcalidrawElements( + elements as ImportedDataState["elements"], + ); + + expect(excaldrawElements.length).toBe(4); + + excaldrawElements.forEach((ele) => { + expect(ele).toMatchSnapshot({ + seed: expect.any(Number), + versionNonce: expect.any(Number), + id: expect.any(String), + }); + }); }); });