1
0
mirror of https://github.com/videojs/video.js.git synced 2025-07-15 01:34:23 +02:00

Made tap events on mobile less sensitive to touch moves. closes #1111

This commit is contained in:
Jon Zepernick
2014-05-06 17:22:29 -07:00
committed by Steve Heffernan
parent ef25557577
commit dbff62e3f0
4 changed files with 55 additions and 28 deletions

View File

@ -255,7 +255,7 @@ test('should use a defined content el for appending children', function(){
});
test('should emit a tap event', function(){
expect(1);
expect(2);
// Fake touch support. Real touch support isn't needed for this test.
var origTouch = vjs.TOUCH_ENABLED;
@ -267,13 +267,27 @@ test('should emit a tap event', function(){
comp.on('tap', function(){
ok(true, 'Tap event emitted');
});
comp.trigger('touchstart');
// A touchstart followed by touchend should trigger a tap
vjs.trigger(comp.el(), {type: 'touchstart', touches: [{}]});
comp.trigger('touchend');
// This second test should not trigger another tap event because
// a touchmove is happening
comp.trigger('touchstart');
comp.trigger('touchmove');
// A touchmove with a lot of movement should not trigger a tap
vjs.trigger(comp.el(), {type: 'touchstart', touches: [
{ pageX: 0, pageY: 0 }
]});
vjs.trigger(comp.el(), {type: 'touchmove', touches: [
{ pageX: 100, pageY: 100 }
]});
comp.trigger('touchend');
// A touchmove with not much movement should still allow a tap
vjs.trigger(comp.el(), {type: 'touchstart', touches: [
{ pageX: 0, pageY: 0 }
]});
vjs.trigger(comp.el(), {type: 'touchmove', touches: [
{ pageX: 10, pageY: 10 }
]});
comp.trigger('touchend');
// Reset to orignial value