PointerEventHandler test
This commit is contained in:
@@ -280,7 +280,7 @@ ol.pointer.TouchSource.prototype.findTouch_ = function(touchList, searchId) {
|
|||||||
*/
|
*/
|
||||||
ol.pointer.TouchSource.prototype.vacuumTouches_ = function(inEvent) {
|
ol.pointer.TouchSource.prototype.vacuumTouches_ = function(inEvent) {
|
||||||
var touchList = inEvent.getBrowserEvent().touches;
|
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.
|
// as the touchstart has not been processed yet.
|
||||||
if (this.pointerMap.getCount() >= touchList.length) {
|
if (this.pointerMap.getCount() >= touchList.length) {
|
||||||
var d = [];
|
var d = [];
|
||||||
@@ -289,8 +289,7 @@ ol.pointer.TouchSource.prototype.vacuumTouches_ = function(inEvent) {
|
|||||||
// Touch identifiers are 2 smaller than their pointerId, which is the
|
// Touch identifiers are 2 smaller than their pointerId, which is the
|
||||||
// index in pointermap.
|
// index in pointermap.
|
||||||
if (key !== 1 && !this.findTouch_(touchList, key - 2)) {
|
if (key !== 1 && !this.findTouch_(touchList, key - 2)) {
|
||||||
var p = value.out;
|
d.push(value.out);
|
||||||
d.push(this.touchToPointer_(p));
|
|
||||||
}
|
}
|
||||||
}, this);
|
}, this);
|
||||||
goog.array.forEach(d, goog.partial(this.cancelOut_, inEvent), this);
|
goog.array.forEach(d, goog.partial(this.cancelOut_, inEvent), this);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
goog.provide('ol.test.pointer.PointerEventHandler');
|
goog.provide('ol.test.pointer.PointerEventHandler');
|
||||||
|
|
||||||
describe('ol.test.pointer.PointerEventHandler', function() {
|
describe('ol.pointer.PointerEventHandler', function() {
|
||||||
var handler;
|
var handler;
|
||||||
var target;
|
var target;
|
||||||
var eventSpy;
|
var eventSpy;
|
||||||
@@ -47,6 +47,8 @@ describe('ol.test.pointer.PointerEventHandler', function() {
|
|||||||
var pointerEvent = eventSpy.firstCall.args[0];
|
var pointerEvent = eventSpy.firstCall.args[0];
|
||||||
expect(pointerEvent).to.be.a(ol.pointer.PointerEvent);
|
expect(pointerEvent).to.be.a(ol.pointer.PointerEvent);
|
||||||
expect(pointerEvent.type).to.be('pointerdown');
|
expect(pointerEvent.type).to.be('pointerdown');
|
||||||
|
expect(pointerEvent.pointerId).to.be(1);
|
||||||
|
expect(pointerEvent.pointerType).to.be('mouse');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user