Allow to refresh a source and reload its data.
Provide an API to refresh a source and reload its data in an associated layer, as for example already loaded tiles in a ol.source.Tile source are not refreshed. Additionally a test for the new ol.source.Source.refresh() function is provided. Currently internal state is not cleaned up, e.g. already loaded tiles in a `ol.source.Tile` source are still cached and not reloaded at all. github issue #4867 (https://github.com/openlayers/ol3/issues/4867)
This commit is contained in:
29
test/spec/ol/source/source.test.js
Normal file
29
test/spec/ol/source/source.test.js
Normal file
@@ -0,0 +1,29 @@
|
||||
goog.provide('ol.test.source.Source');
|
||||
|
||||
describe('ol.source.Source', function() {
|
||||
|
||||
describe('constructor', function() {
|
||||
it('returns a source', function() {
|
||||
var source = new ol.source.Source({
|
||||
projection: ol.proj.get('EPSG:4326')
|
||||
});
|
||||
expect(source).to.be.a(ol.source.Source);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#refresh()', function() {
|
||||
it('dispatches the change event', function() {
|
||||
var source = new ol.source.Source({
|
||||
projection: ol.proj.get('EPSG:4326')
|
||||
});
|
||||
var changedSpy = sinon.spy();
|
||||
source.on('change', changedSpy);
|
||||
source.refresh();
|
||||
expect(changedSpy.called).to.be.ok();
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
goog.require('ol.proj');
|
||||
goog.require('ol.source.Source');
|
||||
Reference in New Issue
Block a user