From 88113aeed2ea3a91dda880d1eed1104ddc5cb4f6 Mon Sep 17 00:00:00 2001 From: Marcel Erz Date: Fri, 5 Dec 2014 18:56:44 -0800 Subject: [PATCH] Published v1.0.6 --- CHANGELOG.md | 2 +- index.js | 11 +++++++---- package.json | 2 +- test/index.js | 4 ++-- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c60f53c..2acb387 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ Changelog ========= -v1.0.5 - 12/05/14 +v1.0.6 - 12/05/14 * Bugfix: Using image as default instead of string when loading image v1.0.4 - 11/28/14 diff --git a/index.js b/index.js index 67f2769..627cda4 100644 --- a/index.js +++ b/index.js @@ -505,12 +505,15 @@ BlinkDiff.prototype = { * @private */ _loadImage: function (path, image) { - if (image instanceof PNGImage) { - return image; - } else if (image instanceof Buffer) { + + if (image instanceof Buffer) { return Promise.denodeify(PNGImage.loadImage)(image); - } else { + + } else if ((typeof path === 'string') && !image) { return Promise.denodeify(PNGImage.readImage)(path); + + } else { + return image; } }, diff --git a/package.json b/package.json index c7253fc..4f6b2cc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "blink-diff", - "version": "1.0.5", + "version": "1.0.6", "description": "A lightweight image comparison tool", "license": "MIT", "main": "index.js", diff --git a/test/index.js b/test/index.js index 450aa4c..bf20a8a 100644 --- a/test/index.js +++ b/test/index.js @@ -264,7 +264,7 @@ describe('Blink-Diff', function () { this.image = generateImage('medium-2'); }); - describe('from Path', function () { + describe('from Image', function () { it('should use already loaded image', function () { var result = this.instance._loadImage("pathToFile", this.image); @@ -274,7 +274,7 @@ describe('Blink-Diff', function () { }); }); - describe('from Image', function () { + describe('from Path', function () { it('should load image when only path given', function (done) { var result = this.instance._loadImage(__dirname + '/test2.png');