diff --git a/src/mixins/canvas_serialization.mixin.js b/src/mixins/canvas_serialization.mixin.js
index 615ba677..8788bf22 100644
--- a/src/mixins/canvas_serialization.mixin.js
+++ b/src/mixins/canvas_serialization.mixin.js
@@ -100,8 +100,6 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, /** @lends fabric.Stati
this.__setBgOverlay('overlayImage', serialized.overlayImage, loaded, cbIfLoaded);
this.__setBgOverlay('backgroundColor', serialized.background, loaded, cbIfLoaded);
this.__setBgOverlay('overlayColor', serialized.overlay, loaded, cbIfLoaded);
-
- cbIfLoaded();
},
/**
@@ -117,6 +115,7 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, /** @lends fabric.Stati
if (!value) {
loaded[property] = true;
callback && callback();
+ return;
}
if (property === 'backgroundImage' || property === 'overlayImage') {
diff --git a/test/unit/canvas.js b/test/unit/canvas.js
index 08e30aac..4c322646 100644
--- a/test/unit/canvas.js
+++ b/test/unit/canvas.js
@@ -700,9 +700,8 @@
ok(!canvas.isEmpty());
});
- asyncTest('loadFromJSON with json string', function() {
+ asyncTest('loadFromJSON with json string Canvas', function() {
ok(typeof canvas.loadFromJSON == 'function');
-
canvas.loadFromJSON(PATH_JSON, function() {
var obj = canvas.item(0);
@@ -730,8 +729,6 @@
});
asyncTest('loadFromJSON with json object', function() {
- ok(typeof canvas.loadFromJSON == 'function');
-
canvas.loadFromJSON(JSON.parse(PATH_JSON), function(){
var obj = canvas.item(0);
@@ -759,8 +756,6 @@
});
asyncTest('loadFromJSON with reviver function', function() {
- ok(typeof canvas.loadFromJSON == 'function');
-
function reviver(obj, instance) {
deepEqual(obj, JSON.parse(PATH_OBJ_JSON));
diff --git a/test/unit/canvas_static.js b/test/unit/canvas_static.js
index a975e5f4..70400637 100644
--- a/test/unit/canvas_static.js
+++ b/test/unit/canvas_static.js
@@ -923,7 +923,7 @@
ok(!canvas.isEmpty());
});
- asyncTest('loadFromJSON with json string', function() {
+ asyncTest('loadFromJSON with json string staticCanvas', function() {
ok(typeof canvas.loadFromJSON == 'function');
canvas.loadFromJSON(PATH_JSON, function(){
diff --git a/test/unit/group.js b/test/unit/group.js
index e697a584..090fb81a 100644
--- a/test/unit/group.js
+++ b/test/unit/group.js
@@ -548,9 +548,9 @@
});
test('test group transformMatrix', function() {
- var rect1 = new fabric.Rect({ top: 1, left: 1, width: 2, height: 2, strokeWidth: 0, fill: 'red', opacity: 1}),
- rect2 = new fabric.Rect({ top: 5, left: 5, width: 2, height: 2, strokeWidth: 0, fill: 'red', opacity: 1}),
- group = new fabric.Group([rect1, rect2], {opacity: 1, fill: 'blue', strokeWidth: 0}),
+ var rect1 = new fabric.Rect({ top: 1, left: 1, width: 2, height: 2, strokeWidth: 0, fill: 'red', opacity: 1, objectCaching: false}),
+ rect2 = new fabric.Rect({ top: 5, left: 5, width: 2, height: 2, strokeWidth: 0, fill: 'red', opacity: 1, objectCaching: false}),
+ group = new fabric.Group([rect1, rect2], {opacity: 1, fill: 'blue', strokeWidth: 0, objectCaching: false}),
isTransparent = fabric.util.isTransparent,
ctx = canvas.contextContainer;
canvas.add(group);
diff --git a/test/unit/itext.js b/test/unit/itext.js
index e8839a32..a0d8dfb7 100644
--- a/test/unit/itext.js
+++ b/test/unit/itext.js
@@ -756,7 +756,10 @@
});
equal(typeof iText.toSVG, 'function');
if (!fabric.isLikelyNode) {
- equal(iText.toSVG(), '\t\n\t\t\n\t\t\tt\n\t\t\te\n\t\t\ts\n\t\t\tt\n\t\t\n\t\n');
+ equal(iText.toSVG(), '\t\n\t\t\n\t\t\tt\n\t\t\te\n\t\t\ts\n\t\t\tt\n\t\t\n\t\n');
+ }
+ else {
+ equal(iText.toSVG(), '\t\n\t\t\n\t\t\tt\n\t\t\te\n\t\t\ts\n\t\t\tt\n\t\t\n\t\n');
}
// TODO: more SVG tests here?
});
diff --git a/test/unit/object.js b/test/unit/object.js
index 7ce30aab..520c0982 100644
--- a/test/unit/object.js
+++ b/test/unit/object.js
@@ -755,11 +755,9 @@
test('_setLineDash', function() {
var object = new fabric.Rect({ left: 100, top: 124, width: 210, height: 66, stroke: 'black', strokeWidth: 2});
ok(typeof object._setLineDash === 'function');
-
- canvas.add(object);
object.strokeDashArray = [3, 2, 1];
equal(object.strokeDashArray.length, 3, 'strokeDash array is odd');
- canvas.renderAll();
+ object._setLineDash(canvas.contextContainer, object.strokeDashArray, null);
equal(object.strokeDashArray.length, 6, 'strokeDash array now is even');
});
diff --git a/test/unit/pattern.js b/test/unit/pattern.js
index 62570fea..fcdbedf6 100644
--- a/test/unit/pattern.js
+++ b/test/unit/pattern.js
@@ -40,7 +40,12 @@
asyncTest('constructor with source string and with callback', function() {
function callback(pattern) {
- equal(pattern.source._src, IMG_SRC, 'pattern source has been loaded');
+ if (fabric.isLikelyNode) {
+ equal(pattern.source._src, IMG_SRC, 'pattern source has been loaded');
+ }
+ else {
+ equal(pattern.source.complete, true, 'pattern source has been loaded');
+ }
start();
}
new fabric.Pattern({