test(gesture): fix gesture directive tests

This commit is contained in:
Andrew
2014-07-24 11:15:26 -06:00
parent 2dce7a74f7
commit 79bcfb149f
2 changed files with 8 additions and 11 deletions

View File

@@ -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));
});
/**

View File

@@ -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);