Skip to content

Commit 44a75a3

Browse files
authored
test(FabricObject): add a snapshot of the default values so that reordering and shuffling is verified. (#9492)
1 parent 6721aec commit 44a75a3

File tree

3 files changed

+89
-3
lines changed

3 files changed

+89
-3
lines changed

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
## [next]
44

5-
- BREAKING: remove calculate true/false from the api. [#9483](https://github.com/fabricjs/fabric.js/pull/9483)
5+
- test(FabricObject): add a snapshot of the default values so that reordering and shuffling is verified. [#9492](https://github.com/fabricjs/fabric.js/pull/9492)
6+
- feat(FabricObject, Canvas) BREAKING: remove calculate true/false from the api. [#9483](https://github.com/fabricjs/fabric.js/pull/9483)
67
- chore(): remove some Type assertions [#8950](https://github.com/fabricjs/fabric.js/pull/8950)
78
- chore(): expose `sendVectorToPlane` [#9479](https://github.com/fabricjs/fabric.js/pull/9479)
8-
- BREAKING: remove absolute true/false from the api. [#9395](https://github.com/fabricjs/fabric.js/pull/9395)
9+
- feat(FabricObject, Canvas) BREAKING: remove absolute true/false from the api. [#9395](https://github.com/fabricjs/fabric.js/pull/9395)
910
- refactor(Canvas): BREAKING deprecate `getPointer`, add new getScenePoint and getViewportPoint methods, removed `restorePointerVpt`, extended mouse events data [#9175](https://github.com/fabricjs/fabric.js/pull/9175)
1011
- chore(): rm isClick artifacts leftovers from #9434 [#9478](https://github.com/fabricjs/fabric.js/pull/9478)
1112
- fix(Object): Fix detection of falsy shadows in Object.needsItsOwnCache method [#9469](https://github.com/fabricjs/fabric.js/pull/9469)

src/shapes/Object/InteractiveObject.spec.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ import { Canvas } from '../../canvas/Canvas';
44
import { FabricObject } from './FabricObject';
55
import type { TOCoord } from './InteractiveObject';
66

7-
describe('Object', () => {
7+
describe('FabricObject', () => {
8+
it('Interactive + BaseObject default values', () => {
9+
const { controls, ...defaults } = FabricObject.getDefaults();
10+
expect(defaults).toMatchSnapshot();
11+
});
812
describe('setCoords for objects inside group with rotation', () => {
913
it('all corners are rotated as much as the object total angle', () => {
1014
const canvas = new Canvas();
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`FabricObject Interactive + BaseObject default values 1`] = `
4+
{
5+
"FX_DURATION": 500,
6+
"absolutePositioned": false,
7+
"activeOn": "down",
8+
"angle": 0,
9+
"backgroundColor": "",
10+
"borderColor": "rgb(178,204,255)",
11+
"borderDashArray": null,
12+
"borderOpacityWhenMoving": 0.4,
13+
"borderScaleFactor": 1,
14+
"centeredRotation": true,
15+
"centeredScaling": false,
16+
"clipPath": undefined,
17+
"colorProperties": [
18+
"fill",
19+
"stroke",
20+
"backgroundColor",
21+
],
22+
"cornerColor": "rgb(178,204,255)",
23+
"cornerDashArray": null,
24+
"cornerSize": 13,
25+
"cornerStrokeColor": "",
26+
"cornerStyle": "rect",
27+
"dirty": true,
28+
"evented": true,
29+
"excludeFromExport": false,
30+
"fill": "rgb(0,0,0)",
31+
"fillRule": "nonzero",
32+
"flipX": false,
33+
"flipY": false,
34+
"globalCompositeOperation": "source-over",
35+
"hasBorders": true,
36+
"hasControls": true,
37+
"height": 0,
38+
"hoverCursor": null,
39+
"includeDefaultValues": true,
40+
"inverted": false,
41+
"left": 0,
42+
"lockMovementX": false,
43+
"lockMovementY": false,
44+
"lockRotation": false,
45+
"lockScalingFlip": false,
46+
"lockScalingX": false,
47+
"lockScalingY": false,
48+
"lockSkewingX": false,
49+
"lockSkewingY": false,
50+
"minScaleLimit": 0,
51+
"moveCursor": null,
52+
"noScaleCache": true,
53+
"objectCaching": true,
54+
"opacity": 1,
55+
"originX": "left",
56+
"originY": "top",
57+
"padding": 0,
58+
"paintFirst": "fill",
59+
"perPixelTargetFind": false,
60+
"scaleX": 1,
61+
"scaleY": 1,
62+
"selectable": true,
63+
"selectionBackgroundColor": "",
64+
"shadow": null,
65+
"skewX": 0,
66+
"skewY": 0,
67+
"stroke": null,
68+
"strokeDashArray": null,
69+
"strokeDashOffset": 0,
70+
"strokeLineCap": "butt",
71+
"strokeLineJoin": "miter",
72+
"strokeMiterLimit": 4,
73+
"strokeUniform": false,
74+
"strokeWidth": 1,
75+
"top": 0,
76+
"touchCornerSize": 24,
77+
"transparentCorners": true,
78+
"visible": true,
79+
"width": 0,
80+
}
81+
`;

0 commit comments

Comments
 (0)