Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fabric

Package Overview
Dependencies
Maintainers
1
Versions
304
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fabric - npm Package Compare versions

Comparing version 1.3.12 to 1.4.0

test/unit/itext.js

2

component.json

@@ -5,3 +5,3 @@ {

"description": "Object model for HTML5 canvas, and SVG-to-canvas parser. Backed by jsdom and node-canvas.",
"version": "1.3.12",
"version": "1.4.0",
"keywords": ["canvas", "graphic", "graphics", "SVG", "node-canvas", "parser", "HTML5", "object model"],

@@ -8,0 +8,0 @@ "dependencies": {},

{
"name": "fabric",
"description": "Object model for HTML5 canvas, and SVG-to-canvas parser. Backed by jsdom and node-canvas.",
"version": "1.3.12",
"version": "1.4.0",
"author": "Juriy Zaytsev <kangax@gmail.com>",

@@ -6,0 +6,0 @@ "keywords": ["canvas", "graphic", "graphics", "SVG", "node-canvas", "parser", "HTML5", "object model"],

@@ -7,2 +7,5 @@ <a href="http://fabricjs.challengepost.com/?utm_source=partner&utm_medium=banner&utm_campaign=fabricjs" style="display: block">

[![Build Status](https://secure.travis-ci.org/kangax/fabric.js.png?branch=master)](http://travis-ci.org/#!/kangax/fabric.js)
[![Code Climate](https://codeclimate.com/repos/526a0ed089af7e6cf2001389/badges/d1c922dd1511ffa8a72f/gpa.png)](https://codeclimate.com/repos/526a0ed089af7e6cf2001389/feed)
<a href="https://npmjs.org/package/fabric"><img src="https://badge.fury.io/js/fabric.png"></a>

@@ -20,3 +23,3 @@

- Unit tested (2200+ tests at the moment)
- Unit tested (2300+ tests at the moment)
- Modular (~60 small ["classes", modules, mixins](http://fabricjs.com/docs/))

@@ -23,0 +26,0 @@ - Cross-browser

@@ -33,3 +33,4 @@ var testrunner = require('qunit');

'./test/unit/shadow.js',
'./test/unit/object_interactivity.js'
'./test/unit/object_interactivity.js',
'./test/unit/itext.js'
]

@@ -36,0 +37,0 @@ }, function(err, report) {

@@ -101,3 +101,3 @@ (function() {

function createImageObject(callback) {
return _createImageObject(IMG_WIDTH, IMG_HEIGHT, callback)
return _createImageObject(IMG_WIDTH, IMG_HEIGHT, callback);
}

@@ -345,3 +345,3 @@

equal(canvas.centerObjectH(rect), canvas, 'should be chainable');
equal(rect.get('left'), lowerCanvasEl.width / 2, 'object\'s "left" property should correspond to canvas element\'s center');
equal(rect.getCenterPoint().x, lowerCanvasEl.width / 2, 'object\'s "left" property should correspond to canvas element\'s center');
});

@@ -354,3 +354,3 @@

equal(canvas.centerObjectV(rect), canvas, 'should be chainable');
equal(rect.get('top'), lowerCanvasEl.height / 2, 'object\'s "top" property should correspond to canvas element\'s center');
equal(rect.getCenterPoint().y, lowerCanvasEl.height / 2, 'object\'s "top" property should correspond to canvas element\'s center');
});

@@ -364,4 +364,4 @@

equal(rect.get('top'), lowerCanvasEl.height / 2, 'object\'s "top" property should correspond to canvas element\'s center');
equal(rect.get('left'), lowerCanvasEl.height / 2, 'object\'s "left" property should correspond to canvas element\'s center');
equal(rect.getCenterPoint().y, lowerCanvasEl.height / 2, 'object\'s "top" property should correspond to canvas element\'s center');
equal(rect.getCenterPoint().x, lowerCanvasEl.height / 2, 'object\'s "left" property should correspond to canvas element\'s center');
});

@@ -371,3 +371,3 @@

ok(typeof canvas.straightenObject == 'function');
var rect = makeRect({ angle: 10 })
var rect = makeRect({ angle: 10 });
canvas.add(rect);

@@ -666,3 +666,3 @@ equal(canvas.straightenObject(rect), canvas, 'should be chainable');

equal(150, canvas.item(0).left);
equal(200, canvas.item(0).top)
equal(200, canvas.item(0).top);
equal('NAME HERE', canvas.item(0).text);

@@ -669,0 +669,0 @@

@@ -210,3 +210,3 @@ (function() {

equal(canvas.centerObjectH(rect), canvas, 'should be chainable');
equal(rect.get('left'), upperCanvasEl.width / 2, 'object\'s "left" property should correspond to canvas element\'s center');
equal(rect.getCenterPoint().x, upperCanvasEl.width / 2, 'object\'s "left" property should correspond to canvas element\'s center');
});

@@ -219,3 +219,3 @@

equal(canvas.centerObjectV(rect), canvas, 'should be chainable');
equal(rect.get('top'), upperCanvasEl.height / 2, 'object\'s "top" property should correspond to canvas element\'s center');
equal(rect.getCenterPoint().y, upperCanvasEl.height / 2, 'object\'s "top" property should correspond to canvas element\'s center');
});

@@ -229,4 +229,4 @@

equal(rect.get('top'), upperCanvasEl.height / 2, 'object\'s "top" property should correspond to canvas element\'s center');
equal(rect.get('left'), upperCanvasEl.height / 2, 'object\'s "left" property should correspond to canvas element\'s center');
equal(rect.getCenterPoint().y, upperCanvasEl.height / 2, 'object\'s "top" property should correspond to canvas element\'s center');
equal(rect.getCenterPoint().x, upperCanvasEl.width / 2, 'object\'s "left" property should correspond to canvas element\'s center');
});

@@ -233,0 +233,0 @@

@@ -27,2 +27,9 @@ (function(){

test('empty args', function() {
var oColor = new fabric.Color();
ok(oColor);
ok(oColor instanceof fabric.Color);
equal(oColor.toHex(), '000000');
});
test('getSource', function() {

@@ -310,2 +317,2 @@ var oColor = new fabric.Color('ffffff');

});
})();
})();

@@ -139,4 +139,4 @@ (function() {

'originY': 'top',
'left': 90.5,
'top': 130.5,
'left': 90,
'top': 130,
'width': 80,

@@ -178,4 +178,4 @@ 'height': 60,

'type': 'group',
'left': 90.5,
'top': 130.5,
'left': 90,
'top': 130,
'width': 80,

@@ -368,3 +368,3 @@ 'height': 60,

var expectedSVG = '<g transform="translate(131 161)"><rect x="-15" y="-5" rx="0" ry="0" width="30" height="10" style="stroke: none; stroke-width: 1; stroke-dasharray: ; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: rgb(0,0,0); opacity: 1;" transform="translate(25 -25)"/><rect x="-5" y="-20" rx="0" ry="0" width="10" height="40" style="stroke: none; stroke-width: 1; stroke-dasharray: ; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: rgb(0,0,0); opacity: 1;" transform="translate(-35 10)"/></g>';
var expectedSVG = '<g transform="translate(130 160)"><rect x="-15" y="-5" rx="0" ry="0" width="30" height="10" style="stroke: none; stroke-width: 1; stroke-dasharray: ; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: rgb(0,0,0); opacity: 1;" transform="translate(25 -25)"/><rect x="-5" y="-20" rx="0" ry="0" width="10" height="40" style="stroke: none; stroke-width: 1; stroke-dasharray: ; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: rgb(0,0,0); opacity: 1;" transform="translate(-35 10)"/></g>';
equal(group.toSVG(), expectedSVG);

@@ -371,0 +371,0 @@ });

@@ -333,4 +333,4 @@ (function(){

boundingRect = cObj.getBoundingRect();
equal(boundingRect.left, 0.5);
equal(boundingRect.top, 0.5);
equal(boundingRect.left, 0);
equal(boundingRect.top, 0);
equal(boundingRect.width, 0);

@@ -341,4 +341,4 @@ equal(boundingRect.height, 0);

boundingRect = cObj.getBoundingRect();
equal(boundingRect.left, 0.5);
equal(boundingRect.top, 0.5);
equal(boundingRect.left, 0);
equal(boundingRect.top, 0);
equal(boundingRect.width, 123);

@@ -349,4 +349,4 @@ equal(boundingRect.height, 0);

boundingRect = cObj.getBoundingRect();
equal(boundingRect.left, 0.5);
equal(boundingRect.top, 0.5);
equal(boundingRect.left, 0);
equal(boundingRect.top, 0);
equal(boundingRect.width, 123);

@@ -357,4 +357,4 @@ equal(boundingRect.height, 167);

boundingRect = cObj.getBoundingRect();
equal(boundingRect.left, 1);
equal(boundingRect.top, 1);
equal(boundingRect.left, 0);
equal(boundingRect.top, 0);
equal(boundingRect.width, 246);

@@ -466,10 +466,10 @@ equal(boundingRect.height, 334);

// coords should still correspond to initial one, even after invoking `set`
equal(cObj.oCoords.tl.x, 150.5);
equal(cObj.oCoords.tl.y, 150.5);
equal(cObj.oCoords.tr.x, 250.5);
equal(cObj.oCoords.tr.y, 150.5);
equal(cObj.oCoords.bl.x, 150.5);
equal(cObj.oCoords.bl.y, 250.5);
equal(cObj.oCoords.br.x, 250.5);
equal(cObj.oCoords.br.y, 250.5);
equal(cObj.oCoords.tl.x, 150);
equal(cObj.oCoords.tl.y, 150);
equal(cObj.oCoords.tr.x, 250);
equal(cObj.oCoords.tr.y, 150);
equal(cObj.oCoords.bl.x, 150);
equal(cObj.oCoords.bl.y, 250);
equal(cObj.oCoords.br.x, 250);
equal(cObj.oCoords.br.y, 250);

@@ -480,10 +480,10 @@ // recalculate coords

// check that coords are now updated
equal(cObj.oCoords.tl.x, 250.5);
equal(cObj.oCoords.tl.y, 250.5);
equal(cObj.oCoords.tr.x, 350.5);
equal(cObj.oCoords.tr.y, 250.5);
equal(cObj.oCoords.bl.x, 250.5);
equal(cObj.oCoords.bl.y, 350.5);
equal(cObj.oCoords.br.x, 350.5);
equal(cObj.oCoords.br.y, 350.5);
equal(cObj.oCoords.tl.x, 250);
equal(cObj.oCoords.tl.y, 250);
equal(cObj.oCoords.tr.x, 350);
equal(cObj.oCoords.tr.y, 250);
equal(cObj.oCoords.bl.x, 250);
equal(cObj.oCoords.bl.y, 350);
equal(cObj.oCoords.br.x, 350);
equal(cObj.oCoords.br.y, 350);
});

@@ -490,0 +490,0 @@

@@ -138,3 +138,3 @@ (function() {

equal(svg, '<rect x="-50" y="-50" rx="20" ry="30" width="100" height="100" style="stroke: none; stroke-width: 1; stroke-dasharray: ; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: rgb(0,0,0); opacity: 1;" transform="translate(50.5 50.5)"/>');
equal(svg, '<rect x="-50" y="-50" rx="20" ry="30" width="100" height="100" style="stroke: none; stroke-width: 1; stroke-dasharray: ; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: rgb(0,0,0); opacity: 1;" transform="translate(50 50)"/>');
});

@@ -141,0 +141,0 @@

@@ -47,3 +47,3 @@ (function() {

var TEXT_SVG = '<g transform="translate(10.5 26.5)"><text font-family="Times New Roman" font-size="40" font-weight="normal" style="stroke: none; stroke-width: 1; stroke-dasharray: ; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: rgb(0,0,0); opacity: 1;" transform="translate(-10 39)"><tspan x="0" y="-26" fill="rgb(0,0,0)">x</tspan></text></g>';
var TEXT_SVG = '<g transform="translate(10 26)"><text font-family="Times New Roman" font-size="40" font-weight="normal" style="stroke: none; stroke-width: 1; stroke-dasharray: ; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: rgb(0,0,0); opacity: 1;" transform="translate(-10 39)"><tspan x="0" y="-26" fill="rgb(0,0,0)">x</tspan></text></g>';

@@ -50,0 +50,0 @@ test('constructor', function() {

@@ -79,2 +79,12 @@ (function() {

test('fabric.util.radiansToDegrees', function(){
ok(typeof fabric.util.radiansToDegrees == 'function');
equal(fabric.util.radiansToDegrees(0), 0);
equal(fabric.util.radiansToDegrees(Math.PI / 2), 90);
equal(fabric.util.radiansToDegrees(Math.PI), 180);
deepEqual(fabric.util.radiansToDegrees(), NaN);
});
test('fabric.util.getRandomInt', function() {

@@ -431,2 +441,22 @@ ok(typeof fabric.util.getRandomInt == 'function');

asyncTest('fabric.util.loadImage with no args', function() {
var callbackInvoked = false;
if (IMG_URL.indexOf('/home/travis') === 0) {
// image can not be accessed on travis so we're returning early
expect(0);
start();
return;
}
fabric.util.loadImage('', function() {
callbackInvoked = true;
});
setTimeout(function() {
ok(callbackInvoked, 'callback should be invoked');
start();
}, 1000);
});
var SVG_WITH_1_ELEMENT = '<?xml version="1.0"?>\

@@ -648,5 +678,15 @@ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\

// test('fabric.util.setStyle', function() {
// });
// element doesn't seem to have style on node
if (!fabric.isLikelyNode) {
test('fabric.util.setStyle', function() {
ok(typeof fabric.util.setStyle === 'function');
var el = fabric.document.createElement('div');
fabric.util.setStyle(el, 'color:red');
equal(el.style.color, 'red');
});
}
// test('fabric.util.request', function() {

@@ -664,2 +704,15 @@ // });

test('fabric.util.drawDashedLine', function() {
ok(typeof fabric.util.drawDashedLine === 'function');
var el = fabric.document.createElement('canvas');
var canvas = fabric.isLikelyNode
? fabric.createCanvasForNode()
: new fabric.Canvas(el);
var ctx = canvas.getContext('2d');
fabric.util.drawDashedLine(ctx, 0, 0, 100, 100, [5, 5]);
});
test('fabric.util.array.invoke', function() {

@@ -666,0 +719,0 @@ ok(typeof fabric.util.array.invoke === 'function');

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc