Don't dispatch select event if a selected feature is selected again

This commit is contained in:
Frederic Junod
2016-06-02 17:38:47 +02:00
parent e7c2d9ab32
commit b562f4d68a
2 changed files with 16 additions and 2 deletions

View File

@@ -144,6 +144,20 @@ describe('ol.interaction.Select', function() {
expect(features.getLength()).to.equal(0);
});
it('select twice with single-click', function() {
var listenerSpy = sinon.spy(function(e) {
expect(e.selected).to.have.length(1);
});
select.on('select', listenerSpy);
simulateEvent(ol.MapBrowserEvent.EventType.SINGLECLICK, 10, -20);
simulateEvent(ol.MapBrowserEvent.EventType.SINGLECLICK, 9, -21);
expect(listenerSpy.callCount).to.be(1);
var features = select.getFeatures();
expect(features.getLength()).to.equal(1);
});
it('select with shift single-click', function() {
var listenerSpy = sinon.spy(function(e) {