Add loader and strategy to ol.source.Vector
This commit is contained in:
1
test/spec/ol/data/point.json
Normal file
1
test/spec/ol/data/point.json
Normal file
@@ -0,0 +1 @@
|
||||
{"type":"FeatureCollection","features":[{"type":"Feature","id":"01","properties":{},"geometry":{"type":"Point","coordinates":[-87.359296,35.001181]}}]}
|
||||
30
test/spec/ol/featureloader.test.js
Normal file
30
test/spec/ol/featureloader.test.js
Normal file
@@ -0,0 +1,30 @@
|
||||
goog.provide('ol.test.featureloader');
|
||||
|
||||
describe('ol.featureloader', function() {
|
||||
describe('ol.featureloader.xhr', function() {
|
||||
var loader;
|
||||
var source;
|
||||
|
||||
beforeEach(function() {
|
||||
var url = 'spec/ol/data/point.json';
|
||||
var format = new ol.format.GeoJSON();
|
||||
|
||||
loader = ol.featureloader.xhr(url, format);
|
||||
source = new ol.source.Vector();
|
||||
});
|
||||
|
||||
it('adds features to the source', function(done) {
|
||||
source.on(ol.source.VectorEventType.ADDFEATURE, function(e) {
|
||||
expect(source.getFeatures().length).to.be.greaterThan(0);
|
||||
done();
|
||||
});
|
||||
loader.call(source, [], 1, 'EPSG:3857');
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
goog.require('ol.featureloader');
|
||||
goog.require('ol.format.GeoJSON');
|
||||
goog.require('ol.source.Vector');
|
||||
goog.require('ol.source.VectorEventType');
|
||||
Reference in New Issue
Block a user