Use XHR by default to load TileJSON in ol.source.TileJSON
This commit is contained in:
@@ -21,23 +21,9 @@ describe('ol.source.TileJSON', function() {
|
||||
var source, tileGrid;
|
||||
|
||||
beforeEach(function(done) {
|
||||
var googNetJsonp = goog.net.Jsonp;
|
||||
// mock goog.net.Jsonp (used in the ol.source.TileJSON constructor)
|
||||
goog.net.Jsonp = function() {
|
||||
this.send = function() {
|
||||
var callback = arguments[1];
|
||||
var client = new XMLHttpRequest();
|
||||
client.open('GET', 'spec/ol/data/tilejson.json', true);
|
||||
client.onload = function() {
|
||||
callback(JSON.parse(client.responseText));
|
||||
};
|
||||
client.send();
|
||||
};
|
||||
};
|
||||
source = new ol.source.TileJSON({
|
||||
url: 'http://api.tiles.mapbox.com/v3/mapbox.geography-class.jsonp'
|
||||
url: 'spec/ol/data/tilejson.json'
|
||||
});
|
||||
goog.net.Jsonp = googNetJsonp;
|
||||
var key = source.on('change', function() {
|
||||
if (source.getState() === 'ready') {
|
||||
ol.Observable.unByKey(key);
|
||||
@@ -88,7 +74,6 @@ describe('ol.source.TileJSON', function() {
|
||||
});
|
||||
|
||||
goog.require('goog.events');
|
||||
goog.require('goog.net.Jsonp');
|
||||
goog.require('ol.source.State');
|
||||
goog.require('ol.source.TileJSON');
|
||||
goog.require('ol.Observable');
|
||||
|
||||
Reference in New Issue
Block a user