mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-03-16 22:10:32 +00:00
parent
ffe01ab9f6
commit
5482ac350a
3 changed files with 10 additions and 26 deletions
|
|
@ -64,10 +64,8 @@ jobs:
|
|||
apt:
|
||||
packages: # avoid installing packages
|
||||
- stage: Unit Tests
|
||||
env: LAUNCHER=Node CANFAIL=TRUE
|
||||
env: LAUNCHER=Node
|
||||
node_js: "10"
|
||||
- stage: Unit Tests
|
||||
node_js: "9"
|
||||
- stage: Unit Tests
|
||||
node_js: "8"
|
||||
- stage: Unit Tests
|
||||
|
|
|
|||
|
|
@ -26,25 +26,8 @@
|
|||
var elImage = _createImageElement();
|
||||
elImage.width = IMG_WIDTH;
|
||||
elImage.height = IMG_HEIGHT;
|
||||
setSrc(elImage, IMG_SRC, function() {
|
||||
callback(elImage);
|
||||
});
|
||||
}
|
||||
|
||||
function setSrc(img, src, callback) {
|
||||
if (fabric.isLikelyNode) {
|
||||
require('fs').readFile(src, function(err, imgData) {
|
||||
if (err) {
|
||||
throw err;
|
||||
};
|
||||
img.src = imgData;
|
||||
callback && callback();
|
||||
});
|
||||
}
|
||||
else {
|
||||
img.src = src;
|
||||
callback && callback();
|
||||
}
|
||||
elImage.onload = callback;
|
||||
elImage.src = IMG_SRC;
|
||||
}
|
||||
|
||||
QUnit.module('fabric.Object', {
|
||||
|
|
|
|||
|
|
@ -483,10 +483,13 @@
|
|||
|
||||
QUnit.test('fabric.util.loadImage with url for a non exsiting image', function(assert) {
|
||||
var done = assert.async();
|
||||
fabric.util.loadImage(IMG_URL_NON_EXISTING, function(img, error) {
|
||||
assert.equal(error, true, 'callback should be invoked with error set to true');
|
||||
done();
|
||||
});
|
||||
try {
|
||||
fabric.util.loadImage(IMG_URL_NON_EXISTING, function(img, error) {
|
||||
assert.equal(error, true, 'callback should be invoked with error set to true');
|
||||
done();
|
||||
}, this);
|
||||
}
|
||||
catch (e) { }
|
||||
});
|
||||
|
||||
var SVG_WITH_1_ELEMENT = '<?xml version="1.0"?>\
|
||||
|
|
|
|||
Loading…
Reference in a new issue