PointerEventHandler test

This commit is contained in:
tsauerwein
2014-02-25 16:35:53 +01:00
parent 3d7ae92f0b
commit 122dac857f
2 changed files with 5 additions and 4 deletions

View File

@@ -280,7 +280,7 @@ ol.pointer.TouchSource.prototype.findTouch_ = function(touchList, searchId) {
*/
ol.pointer.TouchSource.prototype.vacuumTouches_ = function(inEvent) {
var touchList = inEvent.getBrowserEvent().touches;
// pointermap.pointers() should be < touchList.length here,
// pointerMap.getCount() should be < touchList.length here,
// as the touchstart has not been processed yet.
if (this.pointerMap.getCount() >= touchList.length) {
var d = [];
@@ -289,8 +289,7 @@ ol.pointer.TouchSource.prototype.vacuumTouches_ = function(inEvent) {
// Touch identifiers are 2 smaller than their pointerId, which is the
// index in pointermap.
if (key !== 1 && !this.findTouch_(touchList, key - 2)) {
var p = value.out;
d.push(this.touchToPointer_(p));
d.push(value.out);
}
}, this);
goog.array.forEach(d, goog.partial(this.cancelOut_, inEvent), this);

View File

@@ -1,6 +1,6 @@
goog.provide('ol.test.pointer.PointerEventHandler');
describe('ol.test.pointer.PointerEventHandler', function() {
describe('ol.pointer.PointerEventHandler', function() {
var handler;
var target;
var eventSpy;
@@ -47,6 +47,8 @@ describe('ol.test.pointer.PointerEventHandler', function() {
var pointerEvent = eventSpy.firstCall.args[0];
expect(pointerEvent).to.be.a(ol.pointer.PointerEvent);
expect(pointerEvent.type).to.be('pointerdown');
expect(pointerEvent.pointerId).to.be(1);
expect(pointerEvent.pointerType).to.be('mouse');
});
});