Add layer also for programmatically selected features
This commit is contained in:
@@ -233,6 +233,19 @@ describe('ol/Map', function () {
|
||||
});
|
||||
});
|
||||
|
||||
describe('#getAllLayers()', function () {
|
||||
it('returns all layers, also from inside groups', function () {
|
||||
const map = new Map({});
|
||||
const layer = new TileLayer();
|
||||
const group = new LayerGroup({layers: [layer]});
|
||||
map.addLayer(group);
|
||||
|
||||
const allLayers = map.getAllLayers();
|
||||
expect(allLayers.length).to.be(1);
|
||||
expect(allLayers[0]).to.be(layer);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#setLayers()', function () {
|
||||
it('adds an array of layers to the map', function () {
|
||||
const map = new Map({});
|
||||
|
||||
@@ -375,6 +375,13 @@ describe('ol.interaction.Select', function () {
|
||||
// Select again to make sure the style change does not break selection
|
||||
simulateEvent('singleclick', 10, -20);
|
||||
});
|
||||
|
||||
it('returns a layer from a programmatically selected feature', function () {
|
||||
const feature = source.getFeatures()[0];
|
||||
interaction.getFeatures().push(feature);
|
||||
const layerWithSelectedFeature = interaction.getLayer(feature);
|
||||
expect(layerWithSelectedFeature).to.equal(layer);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#setActive()', function () {
|
||||
|
||||
Reference in New Issue
Block a user