mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-04-14 16:40:58 -04:00
fix snaps
This commit is contained in:
parent
e49c94f22f
commit
8aed24312f
2 changed files with 336 additions and 119 deletions
|
@ -753,24 +753,63 @@ exports[`Test Transform > Test arrow bindings > should bind arrows to text when
|
|||
`;
|
||||
|
||||
exports[`Test Transform > should generate new ids if multiple elements contain same ids 1`] = `
|
||||
[
|
||||
{
|
||||
"angle": 0,
|
||||
"backgroundColor": "transparent",
|
||||
"boundElements": null,
|
||||
"fillStyle": "hachure",
|
||||
"frameId": null,
|
||||
"groupIds": [],
|
||||
"height": 200,
|
||||
"id": "rect-1",
|
||||
"id": Any<String>,
|
||||
"isDeleted": false,
|
||||
"link": null,
|
||||
"locked": false,
|
||||
"opacity": 100,
|
||||
"roughness": 1,
|
||||
"roundness": null,
|
||||
"seed": Any<Number>,
|
||||
"strokeColor": "#1e1e1e",
|
||||
"strokeStyle": "solid",
|
||||
"strokeWidth": 1,
|
||||
"type": "rectangle",
|
||||
"updated": 1,
|
||||
"version": 1,
|
||||
"versionNonce": Any<Number>,
|
||||
"width": 100,
|
||||
"x": 300,
|
||||
"y": 100,
|
||||
},
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Test Transform > should generate new ids if multiple elements contain same ids 2`] = `
|
||||
{
|
||||
"angle": 0,
|
||||
"backgroundColor": "transparent",
|
||||
"boundElements": null,
|
||||
"fillStyle": "hachure",
|
||||
"frameId": null,
|
||||
"groupIds": [],
|
||||
"height": 200,
|
||||
"id": "rect-1_copy",
|
||||
"id": Any<String>,
|
||||
"isDeleted": false,
|
||||
"link": null,
|
||||
"locked": false,
|
||||
"opacity": 100,
|
||||
"roughness": 1,
|
||||
"roundness": null,
|
||||
"seed": Any<Number>,
|
||||
"strokeColor": "#1e1e1e",
|
||||
"strokeStyle": "solid",
|
||||
"strokeWidth": 1,
|
||||
"type": "rectangle",
|
||||
"updated": 1,
|
||||
"version": 1,
|
||||
"versionNonce": Any<Number>,
|
||||
"width": 100,
|
||||
"x": 100,
|
||||
"y": 200,
|
||||
},
|
||||
]
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Test Transform > should transform linear elements 1`] = `
|
||||
|
@ -954,95 +993,261 @@ exports[`Test Transform > should transform linear elements 4`] = `
|
|||
`;
|
||||
|
||||
exports[`Test Transform > should transform regular shapes 1`] = `
|
||||
[
|
||||
{
|
||||
"angle": 0,
|
||||
"backgroundColor": "transparent",
|
||||
"boundElements": null,
|
||||
"fillStyle": "hachure",
|
||||
"frameId": null,
|
||||
"groupIds": [],
|
||||
"height": 100,
|
||||
"id": "id0",
|
||||
"id": Any<String>,
|
||||
"isDeleted": false,
|
||||
"link": null,
|
||||
"locked": false,
|
||||
"opacity": 100,
|
||||
"roughness": 1,
|
||||
"roundness": null,
|
||||
"seed": Any<Number>,
|
||||
"strokeColor": "#1e1e1e",
|
||||
"strokeStyle": "solid",
|
||||
"strokeWidth": 1,
|
||||
"type": "rectangle",
|
||||
"updated": 1,
|
||||
"version": 1,
|
||||
"versionNonce": Any<Number>,
|
||||
"width": 100,
|
||||
"x": 100,
|
||||
"y": 100,
|
||||
},
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Test Transform > should transform regular shapes 2`] = `
|
||||
{
|
||||
"angle": 0,
|
||||
"backgroundColor": "transparent",
|
||||
"boundElements": null,
|
||||
"fillStyle": "hachure",
|
||||
"frameId": null,
|
||||
"groupIds": [],
|
||||
"height": 100,
|
||||
"id": "id1",
|
||||
"id": Any<String>,
|
||||
"isDeleted": false,
|
||||
"link": null,
|
||||
"locked": false,
|
||||
"opacity": 100,
|
||||
"roughness": 1,
|
||||
"roundness": null,
|
||||
"seed": Any<Number>,
|
||||
"strokeColor": "#1e1e1e",
|
||||
"strokeStyle": "solid",
|
||||
"strokeWidth": 1,
|
||||
"type": "ellipse",
|
||||
"updated": 1,
|
||||
"version": 1,
|
||||
"versionNonce": Any<Number>,
|
||||
"width": 100,
|
||||
"x": 100,
|
||||
"y": 250,
|
||||
},
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Test Transform > should transform regular shapes 3`] = `
|
||||
{
|
||||
"angle": 0,
|
||||
"backgroundColor": "transparent",
|
||||
"boundElements": null,
|
||||
"fillStyle": "hachure",
|
||||
"frameId": null,
|
||||
"groupIds": [],
|
||||
"height": 100,
|
||||
"id": "id2",
|
||||
"id": Any<String>,
|
||||
"isDeleted": false,
|
||||
"link": null,
|
||||
"locked": false,
|
||||
"opacity": 100,
|
||||
"roughness": 1,
|
||||
"roundness": null,
|
||||
"seed": Any<Number>,
|
||||
"strokeColor": "#1e1e1e",
|
||||
"strokeStyle": "solid",
|
||||
"strokeWidth": 1,
|
||||
"type": "diamond",
|
||||
"updated": 1,
|
||||
"version": 1,
|
||||
"versionNonce": Any<Number>,
|
||||
"width": 100,
|
||||
"x": 100,
|
||||
"y": 400,
|
||||
},
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Test Transform > should transform regular shapes 4`] = `
|
||||
{
|
||||
"angle": 0,
|
||||
"backgroundColor": "#c0eb75",
|
||||
"boundElements": null,
|
||||
"fillStyle": "hachure",
|
||||
"frameId": null,
|
||||
"groupIds": [],
|
||||
"height": 100,
|
||||
"id": "id3",
|
||||
"id": Any<String>,
|
||||
"isDeleted": false,
|
||||
"link": null,
|
||||
"locked": false,
|
||||
"opacity": 100,
|
||||
"roughness": 1,
|
||||
"roundness": null,
|
||||
"seed": Any<Number>,
|
||||
"strokeColor": "#1e1e1e",
|
||||
"strokeStyle": "solid",
|
||||
"strokeWidth": 2,
|
||||
"type": "rectangle",
|
||||
"updated": 1,
|
||||
"version": 1,
|
||||
"versionNonce": Any<Number>,
|
||||
"width": 200,
|
||||
"x": 300,
|
||||
"y": 100,
|
||||
},
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Test Transform > should transform regular shapes 5`] = `
|
||||
{
|
||||
"angle": 0,
|
||||
"backgroundColor": "#ffc9c9",
|
||||
"boundElements": null,
|
||||
"fillStyle": "solid",
|
||||
"frameId": null,
|
||||
"groupIds": [],
|
||||
"height": 100,
|
||||
"id": "id4",
|
||||
"id": Any<String>,
|
||||
"isDeleted": false,
|
||||
"link": null,
|
||||
"locked": false,
|
||||
"opacity": 100,
|
||||
"roughness": 1,
|
||||
"roundness": null,
|
||||
"seed": Any<Number>,
|
||||
"strokeColor": "#1e1e1e",
|
||||
"strokeStyle": "dotted",
|
||||
"strokeWidth": 2,
|
||||
"type": "ellipse",
|
||||
"updated": 1,
|
||||
"version": 1,
|
||||
"versionNonce": Any<Number>,
|
||||
"width": 200,
|
||||
"x": 300,
|
||||
"y": 250,
|
||||
},
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Test Transform > should transform regular shapes 6`] = `
|
||||
{
|
||||
"angle": 0,
|
||||
"backgroundColor": "#a5d8ff",
|
||||
"boundElements": null,
|
||||
"fillStyle": "cross-hatch",
|
||||
"frameId": null,
|
||||
"groupIds": [],
|
||||
"height": 100,
|
||||
"id": "id5",
|
||||
"id": Any<String>,
|
||||
"isDeleted": false,
|
||||
"link": null,
|
||||
"locked": false,
|
||||
"opacity": 100,
|
||||
"roughness": 1,
|
||||
"roundness": null,
|
||||
"seed": Any<Number>,
|
||||
"strokeColor": "#1971c2",
|
||||
"strokeStyle": "dashed",
|
||||
"strokeWidth": 2,
|
||||
"type": "diamond",
|
||||
"updated": 1,
|
||||
"version": 1,
|
||||
"versionNonce": Any<Number>,
|
||||
"width": 200,
|
||||
"x": 300,
|
||||
"y": 400,
|
||||
},
|
||||
]
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Test Transform > should transform text element 1`] = `
|
||||
[
|
||||
{
|
||||
"angle": 0,
|
||||
"backgroundColor": "transparent",
|
||||
"baseline": 0,
|
||||
"boundElements": null,
|
||||
"containerId": null,
|
||||
"fillStyle": "hachure",
|
||||
"fontFamily": 1,
|
||||
"fontSize": 20,
|
||||
"frameId": null,
|
||||
"groupIds": [],
|
||||
"height": 25,
|
||||
"id": "id6",
|
||||
"id": Any<String>,
|
||||
"isDeleted": false,
|
||||
"lineHeight": 1.25,
|
||||
"link": null,
|
||||
"locked": false,
|
||||
"opacity": 100,
|
||||
"originalText": "HELLO WORLD!",
|
||||
"roughness": 1,
|
||||
"roundness": null,
|
||||
"seed": Any<Number>,
|
||||
"strokeColor": "#1e1e1e",
|
||||
"strokeStyle": "solid",
|
||||
"strokeWidth": 1,
|
||||
"text": "HELLO WORLD!",
|
||||
"textAlign": "left",
|
||||
"type": "text",
|
||||
"updated": 1,
|
||||
"version": 1,
|
||||
"versionNonce": Any<Number>,
|
||||
"verticalAlign": "top",
|
||||
"width": 120,
|
||||
"x": 100,
|
||||
"y": 100,
|
||||
},
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Test Transform > should transform text element 2`] = `
|
||||
{
|
||||
"angle": 0,
|
||||
"backgroundColor": "transparent",
|
||||
"baseline": 0,
|
||||
"boundElements": null,
|
||||
"containerId": null,
|
||||
"fillStyle": "hachure",
|
||||
"fontFamily": 1,
|
||||
"fontSize": 20,
|
||||
"frameId": null,
|
||||
"groupIds": [],
|
||||
"height": 25,
|
||||
"id": "id7",
|
||||
"id": Any<String>,
|
||||
"isDeleted": false,
|
||||
"lineHeight": 1.25,
|
||||
"link": null,
|
||||
"locked": false,
|
||||
"opacity": 100,
|
||||
"originalText": "STYLED HELLO WORLD!",
|
||||
"roughness": 1,
|
||||
"roundness": null,
|
||||
"seed": Any<Number>,
|
||||
"strokeColor": "#5f3dc4",
|
||||
"strokeStyle": "solid",
|
||||
"strokeWidth": 1,
|
||||
"text": "STYLED HELLO WORLD!",
|
||||
"textAlign": "left",
|
||||
"type": "text",
|
||||
"updated": 1,
|
||||
"version": 1,
|
||||
"versionNonce": Any<Number>,
|
||||
"verticalAlign": "top",
|
||||
"width": 190,
|
||||
"x": 100,
|
||||
"y": 150,
|
||||
},
|
||||
]
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Test Transform > should transform to labelled arrows when label provided for arrows 1`] = `
|
||||
|
|
|
@ -55,11 +55,15 @@ describe("Test Transform", () => {
|
|||
},
|
||||
];
|
||||
|
||||
expect(
|
||||
convertToExcalidrawElements(
|
||||
elements as ExcalidrawProgrammaticAPI["elements"],
|
||||
),
|
||||
).toMatchSnapshot();
|
||||
).forEach((ele) => {
|
||||
expect(ele).toMatchSnapshot({
|
||||
seed: expect.any(Number),
|
||||
versionNonce: expect.any(Number),
|
||||
id: expect.any(String),
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it("should transform text element", () => {
|
||||
|
@ -79,11 +83,15 @@ describe("Test Transform", () => {
|
|||
strokeColor: "#5f3dc4",
|
||||
},
|
||||
];
|
||||
expect(
|
||||
convertToExcalidrawElements(
|
||||
elements as ExcalidrawProgrammaticAPI["elements"],
|
||||
),
|
||||
).toMatchSnapshot();
|
||||
).forEach((ele) => {
|
||||
expect(ele).toMatchSnapshot({
|
||||
seed: expect.any(Number),
|
||||
versionNonce: expect.any(Number),
|
||||
id: expect.any(String),
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it("should transform linear elements", () => {
|
||||
|
@ -627,10 +635,14 @@ describe("Test Transform", () => {
|
|||
height: 200,
|
||||
},
|
||||
];
|
||||
expect(
|
||||
convertToExcalidrawElements(
|
||||
elements as ExcalidrawProgrammaticAPI["elements"],
|
||||
),
|
||||
).toMatchSnapshot();
|
||||
).forEach((ele) => {
|
||||
expect(ele).toMatchSnapshot({
|
||||
seed: expect.any(Number),
|
||||
versionNonce: expect.any(Number),
|
||||
id: expect.any(String),
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue