Handle JSONP errors in ol.source.TileJSON

Fixes #3938
This commit is contained in:
Frederic Junod
2015-08-10 14:21:16 +02:00
parent daf85c75c7
commit 0578e8f2f6
2 changed files with 25 additions and 2 deletions

View File

@@ -3,6 +3,19 @@ goog.provide('ol.test.source.TileJSON');
describe('ol.source.TileJSON', function() {
describe('#getState', function() {
it('returns ol.source.State.ERROR on HTTP 404', function() {
var changeSpy = sinon.spy(function(event) {
expect(event.target.getState()).to.eql('error');
});
var source = new ol.source.TileJSON({
url: 'invalid.jsonp'
});
goog.events.listen(source, 'change', changeSpy);
});
});
describe('tileUrlFunction', function() {
var source, tileGrid;
@@ -74,5 +87,7 @@ describe('ol.source.TileJSON', function() {
});
goog.require('goog.events');
goog.require('goog.net.Jsonp');
goog.require('ol.source.State');
goog.require('ol.source.TileJSON');