diff --git a/js/angular/directive/gesture.js b/js/angular/directive/gesture.js index 70b9c47658..291e8a5589 100644 --- a/js/angular/directive/gesture.js +++ b/js/angular/directive/gesture.js @@ -1,10 +1,8 @@ +var GESTURE_DIRECTIVES = 'onHold onTap onTouch onRelease onDrag onDragUp onDragRight onDragDown onDragLeft onSwipe onSwipeUp onSwipeRight onSwipeDown onSwipeLeft'.split(' '); -forEach( - 'onHold onTap onTouch onRelease onDrag onDragUp onDragRight onDragDown onDragLeft onSwipe onSwipeUp onSwipeRight onSwipeDown onSwipeLeft'.split(' '), - function(name) { - IonicModule.directive(name, gestureDirective(name)); - } -); +GESTURE_DIRECTIVES.forEach(function(name) { + IonicModule.directive(name, gestureDirective(name)); +}); /** diff --git a/test/unit/angular/directive/gesture.unit.js b/test/unit/angular/directive/gesture.unit.js index 7d266dfb44..20c5544375 100644 --- a/test/unit/angular/directive/gesture.unit.js +++ b/test/unit/angular/directive/gesture.unit.js @@ -1,8 +1,7 @@ describe('gesture directive', function() { beforeEach(module('ionic')); - 'onHold onTap onTouch onRelease onDrag onDragUp onDragRight onDragDown onDragLeft onSwipe onSwipeUp onSwipeRight onSwipeBottom onSwipeLeft' - .split(' ') + GESTURE_DIRECTIVES .map(function(directiveName) { return { gestureName: directiveName.substr(2).toLowerCase(), @@ -12,8 +11,8 @@ describe('gesture directive', function() { }) }; }) - .forEach(function(directive){ - it('should compile', inject(function($compile, $rootScope, $ionicGesture) { + .forEach(function(directive){ + iit('should compile', inject(function($compile, $rootScope, $ionicGesture) { var fakeGesture = {}; spyOn($ionicGesture, 'on').andCallFake(function(eventType, listener, el) { callback = listener; @@ -24,7 +23,7 @@ describe('gesture directive', function() { $rootScope.$apply(); el.scope().foo = jasmine.createSpy('foo'); - + expect($ionicGesture.on.mostRecentCall.args[0]).toBe(directive.gestureName); var event = {}; callback(event);