Use Image.prototype.decode only when src is already set

This commit is contained in:
ahocevar
2019-07-19 17:09:24 +02:00
parent ff063caa4e
commit 3cef9f2e00
2 changed files with 12 additions and 1 deletions

View File

@@ -21,6 +21,17 @@ describe('HTML Image loading', function() {
}, 200);
});
it('handles load event when src is set later', function(done) {
listenImage(img, handleLoad, handleError);
img.src = 'spec/ol/data/dot.png';
setTimeout(function() {
expect(handleLoad).to.be.called();
expect(handleError).not.to.be.called();
done();
}, 200);
});
it('handles error event', function(done) {
img.src = 'invalid.jpeg';
listenImage(img, handleLoad, handleError);