diff --git a/src/ngTouch/directive/ngClick.js b/src/ngTouch/directive/ngClick.js index 90274aba7322..57650a3f7ad3 100644 --- a/src/ngTouch/directive/ngClick.js +++ b/src/ngTouch/directive/ngClick.js @@ -66,7 +66,7 @@ ngTouch.directive('ngClick', ['$parse', '$timeout', '$rootElement', // double-tapping, and then fire a click event. // // This delay sucks and makes mobile apps feel unresponsive. - // So we detect touchstart, touchmove, touchcancel and touchend ourselves and determine when + // So we detect touchstart, touchcancel and touchend ourselves and determine when // the user has tapped on something. // // What happens when the browser then generates a click event? @@ -78,7 +78,7 @@ ngTouch.directive('ngClick', ['$parse', '$timeout', '$rootElement', // So the sequence for a tap is: // - global touchstart: Sets an "allowable region" at the point touched. // - element's touchstart: Starts a touch - // (- touchmove or touchcancel ends the touch, no click follows) + // (- touchcancel ends the touch, no click follows) // - element's touchend: Determines if the tap is valid (didn't move too far away, didn't hold // too long) and fires the user's tap handler. The touchend also calls preventGhostClick(). // - preventGhostClick() removes the allowable region the global touchstart created. @@ -227,10 +227,6 @@ ngTouch.directive('ngClick', ['$parse', '$timeout', '$rootElement', touchStartY = e.clientY; }); - element.on('touchmove', function(event) { - resetState(); - }); - element.on('touchcancel', function(event) { resetState(); }); diff --git a/test/ngTouch/directive/ngClickSpec.js b/test/ngTouch/directive/ngClickSpec.js index 921c64578b2b..4a7900cebecf 100644 --- a/test/ngTouch/directive/ngClickSpec.js +++ b/test/ngTouch/directive/ngClickSpec.js @@ -97,7 +97,7 @@ describe('ngClick (touch)', function() { })); - it('should not click if a touchmove comes before touchend', inject(function($rootScope, $compile, $rootElement) { + it('should not prevent click if a touchmove comes before touchend', inject(function($rootScope, $compile, $rootElement) { element = $compile('
')($rootScope); $rootElement.append(element); $rootScope.$digest(); @@ -112,11 +112,11 @@ describe('ngClick (touch)', function() { browserTrigger(element, 'touchmove'); browserTrigger(element, 'touchend',{ keys: [], - x: 400, - y: 400 + x: 15, + y: 15 }); - expect($rootScope.tapped).toBeUndefined(); + expect($rootScope.tapped).toEqual(true); })); it('should add the CSS class while the element is held down, and then remove it', inject(function($rootScope, $compile, $rootElement) {