Merge pull request #1896 from ahocevar/nodragclick
Add click event as responsive alternative to singleclick
This commit is contained in:
@@ -4,6 +4,7 @@ describe('ol.MapBrowserEventHandler', function() {
|
||||
describe('#emulateClick_', function() {
|
||||
var clock;
|
||||
var handler;
|
||||
var clickSpy;
|
||||
var singleclickSpy;
|
||||
var dblclickSpy;
|
||||
var target;
|
||||
@@ -15,6 +16,9 @@ describe('ol.MapBrowserEventHandler', function() {
|
||||
target: target
|
||||
}));
|
||||
|
||||
clickSpy = sinon.spy();
|
||||
goog.events.listen(handler, 'click', clickSpy);
|
||||
|
||||
singleclickSpy = sinon.spy();
|
||||
goog.events.listen(handler, 'singleclick', singleclickSpy);
|
||||
|
||||
@@ -28,6 +32,17 @@ describe('ol.MapBrowserEventHandler', function() {
|
||||
});
|
||||
|
||||
it('emulates click', function() {
|
||||
handler.emulateClick_(new ol.pointer.PointerEvent('pointerdown',
|
||||
new goog.events.BrowserEvent({
|
||||
type: 'mousedown',
|
||||
target: target,
|
||||
clientX: 0,
|
||||
clientY: 0
|
||||
})));
|
||||
expect(clickSpy.called).to.be.ok();
|
||||
});
|
||||
|
||||
it('emulates singleclick', function() {
|
||||
handler.emulateClick_(new ol.pointer.PointerEvent('pointerdown',
|
||||
new goog.events.BrowserEvent({
|
||||
type: 'mousedown',
|
||||
@@ -54,12 +69,13 @@ describe('ol.MapBrowserEventHandler', function() {
|
||||
});
|
||||
|
||||
it('emulates dblclick', function() {
|
||||
handler.emulateClick_({
|
||||
type: 'mousedown',
|
||||
target: target,
|
||||
clientX: 0,
|
||||
clientY: 0
|
||||
});
|
||||
handler.emulateClick_(new ol.pointer.PointerEvent('pointerdown',
|
||||
new goog.events.BrowserEvent({
|
||||
type: 'mousedown',
|
||||
target: target,
|
||||
clientX: 0,
|
||||
clientY: 0
|
||||
})));
|
||||
expect(singleclickSpy.called).to.not.be.ok();
|
||||
expect(dblclickSpy.called).to.not.be.ok();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user