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)
30 lines
730 B
JavaScript
30 lines
730 B
JavaScript
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');
|