From 79bcfb149f26b013f7ab8493705ab47de95319ab Mon Sep 17 00:00:00 2001 From: Andrew Date: Thu, 24 Jul 2014 11:15:26 -0600 Subject: [PATCH] test(gesture): fix gesture directive tests --- js/angular/directive/gesture.js | 10 ++++------ test/unit/angular/directive/gesture.unit.js | 9 ++++----- 2 files changed, 8 insertions(+), 11 deletions(-) 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);