Fix polyline, polygon tests and JSHint warnings

This commit is contained in:
kangax 2013-07-22 14:39:07 +02:00
parent 6b36e72521
commit 974ed943b8
6 changed files with 12 additions and 31 deletions

4
dist/all.js vendored
View file

@ -14521,9 +14521,7 @@ fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prot
var fabric = global.fabric || (global.fabric = { }),
extend = fabric.util.object.extend,
invoke = fabric.util.array.invoke,
parentToObject = fabric.Object.prototype.toObject,
camelize = fabric.util.string.camelize,
capitalize = fabric.util.string.capitalize;
parentToObject = fabric.Object.prototype.toObject;
if (fabric.PathGroup) {
fabric.warn('fabric.PathGroup is already defined');

4
dist/all.min.js vendored

File diff suppressed because one or more lines are too long

BIN
dist/all.min.js.gz vendored

Binary file not shown.

View file

@ -5,9 +5,7 @@
var fabric = global.fabric || (global.fabric = { }),
extend = fabric.util.object.extend,
invoke = fabric.util.array.invoke,
parentToObject = fabric.Object.prototype.toObject,
camelize = fabric.util.string.camelize,
capitalize = fabric.util.string.capitalize;
parentToObject = fabric.Object.prototype.toObject;
if (fabric.PathGroup) {
fabric.warn('fabric.PathGroup is already defined');

View file

@ -91,9 +91,7 @@
var expected = fabric.util.object.extend(
fabric.util.object.clone(REFERENCE_OBJECT), {
points: [ { x: -5, y: -5 }, { x: 5, y: 5 } ],
left: 15,
top: 17
points: [ { x: 10, y: 12 }, { x: 20, y: 22 } ]
});
deepEqual(polygon.toObject(), expected);
@ -112,10 +110,10 @@
var polygonWithAttrs = fabric.Polygon.fromElement(elPolygonWithAttrs);
var expectedPoints = [
{ x: -10, y: -10 },
{ x: 0, y: 0 },
{ x: 10, y: 10 },
{ x: -10, y: -10 }
{ x: 20, y: 20 },
{ x: 30, y: 30 },
{ x: 10, y: 10 }
];
deepEqual(polygonWithAttrs.toObject(), fabric.util.object.extend(REFERENCE_OBJECT, {
@ -129,9 +127,7 @@
'strokeLineJoin': 'bevil',
'strokeMiterLimit': 5,
'opacity': 0.34,
'points': expectedPoints,
'left': 20,
'top': 20
'points': expectedPoints
}));
deepEqual(polygonWithAttrs.get('transformMatrix'), [ 2, 0, 0, 2, -10, -20 ]);

View file

@ -87,11 +87,7 @@
var polyline = fabric.Polyline.fromElement(elPolyline);
ok(polyline instanceof fabric.Polyline);
deepEqual(polyline.toObject(), fabric.util.object.extend(REFERENCE_OBJECT, {
points: [ { x: -5, y: -5 }, { x: 5, y: 5 } ],
left: 15,
top: 17
}));
deepEqual(polyline.toObject(), REFERENCE_OBJECT);
var elPolylineWithAttrs = fabric.document.createElement('polyline');
elPolylineWithAttrs.setAttribute('points', '10,10 20,20 30,30 10,10');
@ -107,12 +103,7 @@
var polylineWithAttrs = fabric.Polyline.fromElement(elPolylineWithAttrs);
var expectedPoints = [
{ x: -10, y: -10 },
{ x: 0, y: 0 },
{ x: 10, y: 10 },
{ x: -10, y: -10 }
];
var expectedPoints = [{x: 10, y: 10}, {x: 20, y: 20}, {x: 30, y: 30}, {x: 10, y: 10}];
deepEqual(polylineWithAttrs.toObject(), fabric.util.object.extend(REFERENCE_OBJECT, {
'width': 20,
@ -125,9 +116,7 @@
'strokeLineJoin': 'bevil',
'strokeMiterLimit': 5,
'opacity': 0.34,
'points': expectedPoints,
'left': 20,
'top': 20
'points': expectedPoints
}));
deepEqual(polylineWithAttrs.get('transformMatrix'), [ 2, 0, 0, 2, -10, -20 ]);