Skip to content

Commit

Permalink
test(FabricObject): add a snapshot of the default values so that reor…
Browse files Browse the repository at this point in the history
…dering and shuffling is verified. (#9492)
  • Loading branch information
asturur authored Nov 12, 2023
1 parent 6721aec commit 44a75a3
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 3 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

## [next]

- BREAKING: remove calculate true/false from the api. [#9483](https://github.com/fabricjs/fabric.js/pull/9483)
- 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)
- feat(FabricObject, Canvas) BREAKING: remove calculate true/false from the api. [#9483](https://github.com/fabricjs/fabric.js/pull/9483)
- chore(): remove some Type assertions [#8950](https://github.com/fabricjs/fabric.js/pull/8950)
- chore(): expose `sendVectorToPlane` [#9479](https://github.com/fabricjs/fabric.js/pull/9479)
- BREAKING: remove absolute true/false from the api. [#9395](https://github.com/fabricjs/fabric.js/pull/9395)
- feat(FabricObject, Canvas) BREAKING: remove absolute true/false from the api. [#9395](https://github.com/fabricjs/fabric.js/pull/9395)
- 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)
- chore(): rm isClick artifacts leftovers from #9434 [#9478](https://github.com/fabricjs/fabric.js/pull/9478)
- fix(Object): Fix detection of falsy shadows in Object.needsItsOwnCache method [#9469](https://github.com/fabricjs/fabric.js/pull/9469)
Expand Down
6 changes: 5 additions & 1 deletion src/shapes/Object/InteractiveObject.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ import { Canvas } from '../../canvas/Canvas';
import { FabricObject } from './FabricObject';
import type { TOCoord } from './InteractiveObject';

describe('Object', () => {
describe('FabricObject', () => {
it('Interactive + BaseObject default values', () => {
const { controls, ...defaults } = FabricObject.getDefaults();
expect(defaults).toMatchSnapshot();
});
describe('setCoords for objects inside group with rotation', () => {
it('all corners are rotated as much as the object total angle', () => {
const canvas = new Canvas();
Expand Down
81 changes: 81 additions & 0 deletions src/shapes/Object/__snapshots__/InteractiveObject.spec.ts.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`FabricObject Interactive + BaseObject default values 1`] = `
{
"FX_DURATION": 500,
"absolutePositioned": false,
"activeOn": "down",
"angle": 0,
"backgroundColor": "",
"borderColor": "rgb(178,204,255)",
"borderDashArray": null,
"borderOpacityWhenMoving": 0.4,
"borderScaleFactor": 1,
"centeredRotation": true,
"centeredScaling": false,
"clipPath": undefined,
"colorProperties": [
"fill",
"stroke",
"backgroundColor",
],
"cornerColor": "rgb(178,204,255)",
"cornerDashArray": null,
"cornerSize": 13,
"cornerStrokeColor": "",
"cornerStyle": "rect",
"dirty": true,
"evented": true,
"excludeFromExport": false,
"fill": "rgb(0,0,0)",
"fillRule": "nonzero",
"flipX": false,
"flipY": false,
"globalCompositeOperation": "source-over",
"hasBorders": true,
"hasControls": true,
"height": 0,
"hoverCursor": null,
"includeDefaultValues": true,
"inverted": false,
"left": 0,
"lockMovementX": false,
"lockMovementY": false,
"lockRotation": false,
"lockScalingFlip": false,
"lockScalingX": false,
"lockScalingY": false,
"lockSkewingX": false,
"lockSkewingY": false,
"minScaleLimit": 0,
"moveCursor": null,
"noScaleCache": true,
"objectCaching": true,
"opacity": 1,
"originX": "left",
"originY": "top",
"padding": 0,
"paintFirst": "fill",
"perPixelTargetFind": false,
"scaleX": 1,
"scaleY": 1,
"selectable": true,
"selectionBackgroundColor": "",
"shadow": null,
"skewX": 0,
"skewY": 0,
"stroke": null,
"strokeDashArray": null,
"strokeDashOffset": 0,
"strokeLineCap": "butt",
"strokeLineJoin": "miter",
"strokeMiterLimit": 4,
"strokeUniform": false,
"strokeWidth": 1,
"top": 0,
"touchCornerSize": 24,
"transparentCorners": true,
"visible": true,
"width": 0,
}
`;

0 comments on commit 44a75a3

Please sign in to comment.