Fix select event always reporting as multi select

This commit is contained in:
Björn Harrtell
2015-03-04 08:43:30 +01:00
parent 7527eddbaf
commit 49c2af165a
2 changed files with 17 additions and 6 deletions

View File

@@ -89,8 +89,15 @@ describe('ol.interaction.Select', function() {
});
it('select 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);
expect(listenerSpy.callCount).to.be(1);
var features = select.getFeatures();
expect(features.getLength()).to.equal(1);
});
@@ -107,8 +114,15 @@ describe('ol.interaction.Select', function() {
});
it('select with single-click', function() {
var listenerSpy = sinon.spy(function(e) {
expect(e.selected).to.have.length(2);
});
select.on('select', listenerSpy);
simulateEvent(ol.MapBrowserEvent.EventType.SINGLECLICK, 10, -20);
expect(listenerSpy.callCount).to.be(1);
var features = select.getFeatures();
expect(features.getLength()).to.equal(2);
});