Add unit tests for click event
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',
|
||||
|
||||
Reference in New Issue
Block a user