mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Much more thorough tests! (#1053)
This commit is contained in:
parent
d4ff5cb926
commit
bd7856adf3
22 changed files with 11883 additions and 24 deletions
136
src/tests/__snapshots__/dragCreate.test.tsx.snap
Normal file
136
src/tests/__snapshots__/dragCreate.test.tsx.snap
Normal file
|
@ -0,0 +1,136 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`add element to the scene when pointer dragging long enough arrow 1`] = `1`;
|
||||
|
||||
exports[`add element to the scene when pointer dragging long enough arrow 2`] = `
|
||||
Object {
|
||||
"backgroundColor": "transparent",
|
||||
"fillStyle": "hachure",
|
||||
"height": 50,
|
||||
"id": "id0",
|
||||
"isDeleted": false,
|
||||
"lastCommittedPoint": null,
|
||||
"opacity": 100,
|
||||
"points": Array [
|
||||
Array [
|
||||
0,
|
||||
0,
|
||||
],
|
||||
Array [
|
||||
30,
|
||||
50,
|
||||
],
|
||||
],
|
||||
"roughness": 1,
|
||||
"seed": 337897,
|
||||
"strokeColor": "#000000",
|
||||
"strokeWidth": 1,
|
||||
"type": "arrow",
|
||||
"version": 3,
|
||||
"versionNonce": 449462985,
|
||||
"width": 30,
|
||||
"x": 30,
|
||||
"y": 20,
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`add element to the scene when pointer dragging long enough diamond 1`] = `1`;
|
||||
|
||||
exports[`add element to the scene when pointer dragging long enough diamond 2`] = `
|
||||
Object {
|
||||
"backgroundColor": "transparent",
|
||||
"fillStyle": "hachure",
|
||||
"height": 50,
|
||||
"id": "id0",
|
||||
"isDeleted": false,
|
||||
"opacity": 100,
|
||||
"roughness": 1,
|
||||
"seed": 337897,
|
||||
"strokeColor": "#000000",
|
||||
"strokeWidth": 1,
|
||||
"type": "diamond",
|
||||
"version": 2,
|
||||
"versionNonce": 1278240551,
|
||||
"width": 30,
|
||||
"x": 30,
|
||||
"y": 20,
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`add element to the scene when pointer dragging long enough ellipse 1`] = `1`;
|
||||
|
||||
exports[`add element to the scene when pointer dragging long enough ellipse 2`] = `
|
||||
Object {
|
||||
"backgroundColor": "transparent",
|
||||
"fillStyle": "hachure",
|
||||
"height": 50,
|
||||
"id": "id0",
|
||||
"isDeleted": false,
|
||||
"opacity": 100,
|
||||
"roughness": 1,
|
||||
"seed": 337897,
|
||||
"strokeColor": "#000000",
|
||||
"strokeWidth": 1,
|
||||
"type": "ellipse",
|
||||
"version": 2,
|
||||
"versionNonce": 1278240551,
|
||||
"width": 30,
|
||||
"x": 30,
|
||||
"y": 20,
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`add element to the scene when pointer dragging long enough line 1`] = `
|
||||
Object {
|
||||
"backgroundColor": "transparent",
|
||||
"fillStyle": "hachure",
|
||||
"height": 50,
|
||||
"id": "id0",
|
||||
"isDeleted": false,
|
||||
"lastCommittedPoint": null,
|
||||
"opacity": 100,
|
||||
"points": Array [
|
||||
Array [
|
||||
0,
|
||||
0,
|
||||
],
|
||||
Array [
|
||||
30,
|
||||
50,
|
||||
],
|
||||
],
|
||||
"roughness": 1,
|
||||
"seed": 337897,
|
||||
"strokeColor": "#000000",
|
||||
"strokeWidth": 1,
|
||||
"type": "line",
|
||||
"version": 3,
|
||||
"versionNonce": 449462985,
|
||||
"width": 30,
|
||||
"x": 30,
|
||||
"y": 20,
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`add element to the scene when pointer dragging long enough rectangle 1`] = `1`;
|
||||
|
||||
exports[`add element to the scene when pointer dragging long enough rectangle 2`] = `
|
||||
Object {
|
||||
"backgroundColor": "transparent",
|
||||
"fillStyle": "hachure",
|
||||
"height": 50,
|
||||
"id": "id0",
|
||||
"isDeleted": false,
|
||||
"opacity": 100,
|
||||
"roughness": 1,
|
||||
"seed": 337897,
|
||||
"strokeColor": "#000000",
|
||||
"strokeWidth": 1,
|
||||
"type": "rectangle",
|
||||
"version": 2,
|
||||
"versionNonce": 1278240551,
|
||||
"width": 30,
|
||||
"x": 30,
|
||||
"y": 20,
|
||||
}
|
||||
`;
|
64
src/tests/__snapshots__/move.test.tsx.snap
Normal file
64
src/tests/__snapshots__/move.test.tsx.snap
Normal file
|
@ -0,0 +1,64 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`duplicate element on move when ALT is clicked rectangle 1`] = `
|
||||
Object {
|
||||
"backgroundColor": "transparent",
|
||||
"fillStyle": "hachure",
|
||||
"height": 50,
|
||||
"id": "id1",
|
||||
"isDeleted": false,
|
||||
"opacity": 100,
|
||||
"roughness": 1,
|
||||
"seed": 453191,
|
||||
"strokeColor": "#000000",
|
||||
"strokeWidth": 1,
|
||||
"type": "rectangle",
|
||||
"version": 2,
|
||||
"versionNonce": 1278240551,
|
||||
"width": 30,
|
||||
"x": 30,
|
||||
"y": 20,
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`duplicate element on move when ALT is clicked rectangle 2`] = `
|
||||
Object {
|
||||
"backgroundColor": "transparent",
|
||||
"fillStyle": "hachure",
|
||||
"height": 50,
|
||||
"id": "id0",
|
||||
"isDeleted": false,
|
||||
"opacity": 100,
|
||||
"roughness": 1,
|
||||
"seed": 337897,
|
||||
"strokeColor": "#000000",
|
||||
"strokeWidth": 1,
|
||||
"type": "rectangle",
|
||||
"version": 3,
|
||||
"versionNonce": 2019559783,
|
||||
"width": 30,
|
||||
"x": 0,
|
||||
"y": 40,
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`move element rectangle 1`] = `
|
||||
Object {
|
||||
"backgroundColor": "transparent",
|
||||
"fillStyle": "hachure",
|
||||
"height": 50,
|
||||
"id": "id0",
|
||||
"isDeleted": false,
|
||||
"opacity": 100,
|
||||
"roughness": 1,
|
||||
"seed": 337897,
|
||||
"strokeColor": "#000000",
|
||||
"strokeWidth": 1,
|
||||
"type": "rectangle",
|
||||
"version": 3,
|
||||
"versionNonce": 401146281,
|
||||
"width": 30,
|
||||
"x": 0,
|
||||
"y": 40,
|
||||
}
|
||||
`;
|
79
src/tests/__snapshots__/multiPointCreate.test.tsx.snap
Normal file
79
src/tests/__snapshots__/multiPointCreate.test.tsx.snap
Normal file
|
@ -0,0 +1,79 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`multi point mode in linear elements arrow 1`] = `
|
||||
Object {
|
||||
"backgroundColor": "transparent",
|
||||
"fillStyle": "hachure",
|
||||
"height": 110,
|
||||
"id": "id0",
|
||||
"isDeleted": false,
|
||||
"lastCommittedPoint": Array [
|
||||
70,
|
||||
110,
|
||||
],
|
||||
"opacity": 100,
|
||||
"points": Array [
|
||||
Array [
|
||||
0,
|
||||
0,
|
||||
],
|
||||
Array [
|
||||
20,
|
||||
30,
|
||||
],
|
||||
Array [
|
||||
70,
|
||||
110,
|
||||
],
|
||||
],
|
||||
"roughness": 1,
|
||||
"seed": 337897,
|
||||
"strokeColor": "#000000",
|
||||
"strokeWidth": 1,
|
||||
"type": "arrow",
|
||||
"version": 7,
|
||||
"versionNonce": 1116226695,
|
||||
"width": 70,
|
||||
"x": 30,
|
||||
"y": 30,
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`multi point mode in linear elements line 1`] = `
|
||||
Object {
|
||||
"backgroundColor": "transparent",
|
||||
"fillStyle": "hachure",
|
||||
"height": 110,
|
||||
"id": "id0",
|
||||
"isDeleted": false,
|
||||
"lastCommittedPoint": Array [
|
||||
70,
|
||||
110,
|
||||
],
|
||||
"opacity": 100,
|
||||
"points": Array [
|
||||
Array [
|
||||
0,
|
||||
0,
|
||||
],
|
||||
Array [
|
||||
20,
|
||||
30,
|
||||
],
|
||||
Array [
|
||||
70,
|
||||
110,
|
||||
],
|
||||
],
|
||||
"roughness": 1,
|
||||
"seed": 337897,
|
||||
"strokeColor": "#000000",
|
||||
"strokeWidth": 1,
|
||||
"type": "line",
|
||||
"version": 7,
|
||||
"versionNonce": 1116226695,
|
||||
"width": 70,
|
||||
"x": 30,
|
||||
"y": 30,
|
||||
}
|
||||
`;
|
10762
src/tests/__snapshots__/regressionTests.test.tsx.snap
Normal file
10762
src/tests/__snapshots__/regressionTests.test.tsx.snap
Normal file
File diff suppressed because it is too large
Load diff
43
src/tests/__snapshots__/resize.test.tsx.snap
Normal file
43
src/tests/__snapshots__/resize.test.tsx.snap
Normal file
|
@ -0,0 +1,43 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`resize element rectangle 1`] = `
|
||||
Object {
|
||||
"backgroundColor": "transparent",
|
||||
"fillStyle": "hachure",
|
||||
"height": 50,
|
||||
"id": "id0",
|
||||
"isDeleted": false,
|
||||
"opacity": 100,
|
||||
"roughness": 1,
|
||||
"seed": 337897,
|
||||
"strokeColor": "#000000",
|
||||
"strokeWidth": 1,
|
||||
"type": "rectangle",
|
||||
"version": 3,
|
||||
"versionNonce": 1150084233,
|
||||
"width": 30,
|
||||
"x": 29,
|
||||
"y": 47,
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`resize element with aspect ratio when SHIFT is clicked rectangle 1`] = `
|
||||
Object {
|
||||
"backgroundColor": "transparent",
|
||||
"fillStyle": "hachure",
|
||||
"height": 50,
|
||||
"id": "id0",
|
||||
"isDeleted": false,
|
||||
"opacity": 100,
|
||||
"roughness": 1,
|
||||
"seed": 337897,
|
||||
"strokeColor": "#000000",
|
||||
"strokeWidth": 1,
|
||||
"type": "rectangle",
|
||||
"version": 3,
|
||||
"versionNonce": 1150084233,
|
||||
"width": 30,
|
||||
"x": 29,
|
||||
"y": 47,
|
||||
}
|
||||
`;
|
128
src/tests/__snapshots__/selection.test.tsx.snap
Normal file
128
src/tests/__snapshots__/selection.test.tsx.snap
Normal file
|
@ -0,0 +1,128 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`select single element on the scene arrow 1`] = `
|
||||
Object {
|
||||
"backgroundColor": "transparent",
|
||||
"fillStyle": "hachure",
|
||||
"height": 50,
|
||||
"id": "id0",
|
||||
"isDeleted": false,
|
||||
"lastCommittedPoint": null,
|
||||
"opacity": 100,
|
||||
"points": Array [
|
||||
Array [
|
||||
0,
|
||||
0,
|
||||
],
|
||||
Array [
|
||||
30,
|
||||
50,
|
||||
],
|
||||
],
|
||||
"roughness": 1,
|
||||
"seed": 337897,
|
||||
"strokeColor": "#000000",
|
||||
"strokeWidth": 1,
|
||||
"type": "arrow",
|
||||
"version": 3,
|
||||
"versionNonce": 449462985,
|
||||
"width": 30,
|
||||
"x": 30,
|
||||
"y": 20,
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`select single element on the scene arrow escape 1`] = `
|
||||
Object {
|
||||
"backgroundColor": "transparent",
|
||||
"fillStyle": "hachure",
|
||||
"height": 50,
|
||||
"id": "id0",
|
||||
"isDeleted": false,
|
||||
"lastCommittedPoint": null,
|
||||
"opacity": 100,
|
||||
"points": Array [
|
||||
Array [
|
||||
0,
|
||||
0,
|
||||
],
|
||||
Array [
|
||||
30,
|
||||
50,
|
||||
],
|
||||
],
|
||||
"roughness": 1,
|
||||
"seed": 337897,
|
||||
"strokeColor": "#000000",
|
||||
"strokeWidth": 1,
|
||||
"type": "line",
|
||||
"version": 3,
|
||||
"versionNonce": 449462985,
|
||||
"width": 30,
|
||||
"x": 30,
|
||||
"y": 20,
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`select single element on the scene diamond 1`] = `
|
||||
Object {
|
||||
"backgroundColor": "transparent",
|
||||
"fillStyle": "hachure",
|
||||
"height": 50,
|
||||
"id": "id0",
|
||||
"isDeleted": false,
|
||||
"opacity": 100,
|
||||
"roughness": 1,
|
||||
"seed": 337897,
|
||||
"strokeColor": "#000000",
|
||||
"strokeWidth": 1,
|
||||
"type": "diamond",
|
||||
"version": 2,
|
||||
"versionNonce": 1278240551,
|
||||
"width": 30,
|
||||
"x": 30,
|
||||
"y": 20,
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`select single element on the scene ellipse 1`] = `
|
||||
Object {
|
||||
"backgroundColor": "transparent",
|
||||
"fillStyle": "hachure",
|
||||
"height": 50,
|
||||
"id": "id0",
|
||||
"isDeleted": false,
|
||||
"opacity": 100,
|
||||
"roughness": 1,
|
||||
"seed": 337897,
|
||||
"strokeColor": "#000000",
|
||||
"strokeWidth": 1,
|
||||
"type": "ellipse",
|
||||
"version": 2,
|
||||
"versionNonce": 1278240551,
|
||||
"width": 30,
|
||||
"x": 30,
|
||||
"y": 20,
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`select single element on the scene rectangle 1`] = `
|
||||
Object {
|
||||
"backgroundColor": "transparent",
|
||||
"fillStyle": "hachure",
|
||||
"height": 50,
|
||||
"id": "id0",
|
||||
"isDeleted": false,
|
||||
"opacity": 100,
|
||||
"roughness": 1,
|
||||
"seed": 337897,
|
||||
"strokeColor": "#000000",
|
||||
"strokeWidth": 1,
|
||||
"type": "rectangle",
|
||||
"version": 2,
|
||||
"versionNonce": 1278240551,
|
||||
"width": 30,
|
||||
"x": 30,
|
||||
"y": 20,
|
||||
}
|
||||
`;
|
Loading…
Add table
Add a link
Reference in a new issue