it('fails to load an image', function () { return ImageLoader.load('bad image src') .then(function () { assert.fail('unexpected success'); }, function () { // nothing to do here return true; }); });
fetch: function () { var self = this; if (! self.has('url')) { return p(); } return ImageLoader.load(self.get('url')) .then(function (img) { self.set('img', img); }, function () { var err = ProfileErrors.toError('IMAGE_LOAD_ERROR'); // Set the context to the image's URL. This will be logged. err.context = self.get('url'); return p.reject(err); }); },
reader.onload = (event) => { var src = event.target.result; ImageLoader.load(src) .then((img) => { var cropImg = new CropperImage({ height: img.height, src: src, type: file.type, width: img.width }); require(['draggable', 'touch-punch'], () => { this.navigate('settings/avatar/crop', { cropImg: cropImg }); }); defer.resolve(); }) .fail(imgOnError); };
it('loads an image', function () { return ImageLoader.load(pngSrc) .then(function (img) { assert.equal(img.src, pngSrc); }); });