chore(travis): re-enable jshint

This commit is contained in:
Andrew Joslin
2014-05-08 09:10:27 -06:00
parent 6facb8cb86
commit 95d1aea4f1
27 changed files with 197 additions and 194 deletions

View File

@@ -127,7 +127,7 @@ describe('$ionicScroll Controller', function() {
it('should forget on $viewHistory.viewBack after $viewContentLoaded', inject(function($rootScope, $timeout) {
var historyData = { viewId: 'foo' };
setup();
spyOn($rootScope, '$on').andCallThrough();;
spyOn($rootScope, '$on').andCallThrough();
scope.$broadcast('$viewContentLoaded', historyData);
$timeout.flush();
expect(scope.$on).toHaveBeenCalledWith('$viewHistory.viewBack', jasmine.any(Function));

View File

@@ -105,7 +105,7 @@ describe('ionNavBar', function() {
ctrl.setTitle('baz');
expect($scope.title).toBe('baz');
expect($scope.oldTitle).toBe('bar');
})
});
it('should getTitle', function() {
var ctrl = setup();

View File

@@ -53,7 +53,7 @@ describe('ionRefresher directive', function() {
expect(el.controller('$ionicScroll')._setRefresher.callCount).toBe(1);
expect(el.controller('$ionicScroll')._setRefresher).toHaveBeenCalledWith(
el.scope(), el[0]
)
);
});
it('should listen for scroll.refreshComplete', function() {

View File

@@ -92,19 +92,19 @@ describe('Ionic Angular Side Menu', function() {
expect(ctrl.isDraggableTarget(e)).toBe(false);
e.target.isContentEditable = false;
e.target.dataset.preventScroll = true
e.target.dataset.preventScroll = true;
expect(ctrl.isDraggableTarget(e)).toBe(false);
e.target.isContentEditable = false;
e.target.dataset = undefined;
e.target.getAttribute = function(val){
return (val == 'data-prevent-default' ? 'true' : undefined);
}
};
expect(ctrl.isDraggableTarget(e)).toBe(false);
e.target.getAttribute = function(){
return null;
}
};
expect(ctrl.isDraggableTarget(e)).toBe(true);
}));
@@ -195,8 +195,8 @@ describe('menuToggle directive', function() {
var toggleLeftSpy, toggleRightSpy;
function setup(side) {
var el = angular.element('<div menu-toggle="' + (side||'') + '">');
toggleLeftSpy = jasmine.createSpy('toggleLeft')
toggleRightSpy = jasmine.createSpy('toggleRight')
toggleLeftSpy = jasmine.createSpy('toggleLeft');
toggleRightSpy = jasmine.createSpy('toggleRight');
el.data('$ionSideMenusController', {
toggleLeft: toggleLeftSpy,
toggleRight: toggleRightSpy
@@ -242,7 +242,7 @@ describe('menuClose directive', function() {
}));
it('should close on click', inject(function($compile, $rootScope) {
var el = angular.element('<div menu-close>');
var closeSpy = jasmine.createSpy('sideMenuClose')
var closeSpy = jasmine.createSpy('sideMenuClose');
el.data('$ionSideMenusController', {
close: closeSpy
});

View File

@@ -12,21 +12,21 @@ describe('Ionic Angular Slide Box', function() {
rootScope = $rootScope;
compile = $compile;
el = $compile('<ion-slide-box>\
<ion-slide>\
<div class="box blue">\
<h1>BLUE {{slideBox.slideIndex}}</h1>\
</div>\
</ion-slide>\
<ion-slide>\
<div class="box yellow">\
<h1>YELLOW {{slideBox.slideIndex}}</h1>\
</div>\
</ion-slide>\
<ion-slide>\
<div class="box pink"><h1>PINK {{slideBox.slideIndex}}</h1></div>\
</ion-slide>\
</ion-slide-box>')($rootScope);
el = $compile('<ion-slide-box>' +
'<ion-slide>' +
'<div class="box blue">' +
'<h1>BLUE {{slideBox.slideIndex}}</h1>' +
'</div>' +
'</ion-slide>' +
'<ion-slide>' +
'<div class="box yellow">' +
'<h1>YELLOW {{slideBox.slideIndex}}</h1>' +
'</div>' +
'</ion-slide>' +
'<ion-slide>' +
'<div class="box pink"><h1>PINK {{slideBox.slideIndex}}</h1></div>' +
'</ion-slide>' +
'</ion-slide-box>')($rootScope);
}));
it('should register with $ionicSlideBoxDelegate', inject(function($compile, $rootScope, $ionicSlideBoxDelegate) {
@@ -50,21 +50,21 @@ describe('ionSlideBox with active slide', function() {
beforeEach(module('ionic'));
it('Should set initial active slide', inject(function($ionicSlideBoxDelegate, $rootScope, $compile) {
el = $compile('<ion-slide-box active-slide="2">\
<ion-slide>\
<div class="box blue">\
<h1>BLUE {{slideBox.slideIndex}}</h1>\
</div>\
</ion-slide>\
<ion-slide>\
<div class="box yellow">\
<h1>YELLOW {{slideBox.slideIndex}}</h1>\
</div>\
</ion-slide>\
<ion-slide>\
<div class="box pink"><h1>PINK {{slideBox.slideIndex}}</h1></div>\
</ion-slide>\
</ion-slide-box>')($rootScope.$new());
el = $compile('<ion-slide-box active-slide="2">' +
'<ion-slide>' +
'<div class="box blue">' +
'<h1>BLUE {{slideBox.slideIndex}}</h1>' +
'</div>' +
'</ion-slide>' +
'<ion-slide>' +
'<div class="box yellow">' +
'<h1>YELLOW {{slideBox.slideIndex}}</h1>' +
'</div>' +
'</ion-slide>' +
'<ion-slide>' +
'<div class="box pink"><h1>PINK {{slideBox.slideIndex}}</h1></div>' +
'</ion-slide>' +
'</ion-slide-box>')($rootScope.$new());
var scope = el.scope();
scope.$apply();

View File

@@ -69,7 +69,7 @@ describe('tabs', function() {
ctrl.remove(tab1);
expect(ctrl.selectedTab()).toBe(tab2);
expect(ctrl.tabs.indexOf(tab1)).toBe(-1);
ctrl.remove(tab2)
ctrl.remove(tab2);
expect(ctrl.selectedTab()).toBe(null);
expect(ctrl.tabs.indexOf(tab2)).toBe(-1);
expect(ctrl.tabs.length).toBe(0);

View File

@@ -36,7 +36,7 @@ describe('Ionic Toggle', function() {
// Not disabled, we can toggle
expect(toggle.val()).toBe(false);
ionic.trigger('click', {target: label})
ionic.trigger('click', {target: label});
expect(toggle.val()).toBe(true);
// Disable it
@@ -45,7 +45,7 @@ describe('Ionic Toggle', function() {
expect(input.getAttribute('disabled')).toBe('disabled');
// We shouldn't be able to toggle it now
ionic.trigger('click', {target: label})
ionic.trigger('click', {target: label});
expect(toggle.val()).toBe(true);
// Re-enable it
@@ -53,7 +53,7 @@ describe('Ionic Toggle', function() {
rootScope.$apply();
// Should be able to toggle it now
ionic.trigger('click', {target: label})
ionic.trigger('click', {target: label});
expect(toggle.val()).toBe(false);
expect(input.getAttribute('disabled')).not.toBe('disabled');
});
@@ -62,9 +62,9 @@ describe('Ionic Toggle', function() {
var toggle = el.isolateScope().toggle;
var label = el[0].querySelector('label');
expect(toggle.val()).toBe(false);
ionic.trigger('click', {target: label})
ionic.trigger('click', {target: label});
expect(toggle.val()).toBe(true);
ionic.trigger('click', {target: label})
ionic.trigger('click', {target: label});
expect(toggle.val()).toBe(false);
});

View File

@@ -127,7 +127,7 @@ describe('DelegateFactory', function() {
expect(result).toBe('a1');
instance1.a.reset();
var result = delegate.$getByHandle('2').a(2,3,4);
result = delegate.$getByHandle('2').a(2,3,4);
expect(instance2.a).toHaveBeenCalledWith(2,3,4);
expect(instance1.a).not.toHaveBeenCalled();
expect(result).toBe('a2');
@@ -151,7 +151,7 @@ describe('DelegateFactory', function() {
instance1.a.reset();
deregister();
var result = delegateInstance.a(2);
result = delegateInstance.a(2);
expect(instance1.a).not.toHaveBeenCalled();
expect(instance2.a).toHaveBeenCalledWith(2);
expect(instance3.a).not.toHaveBeenCalled();

View File

@@ -165,7 +165,7 @@ describe('Ionic Platform Service', function() {
ionic.Platform.setPlatform('iOS');
ionic.Platform.setVersion('7.0.3');
ionic.Platform._checkPlatforms()
ionic.Platform._checkPlatforms();
expect(ionic.Platform.platforms[0]).toEqual('webview');
expect(ionic.Platform.platforms[1]).toEqual('cordova');
@@ -179,7 +179,7 @@ describe('Ionic Platform Service', function() {
ionic.Platform.setPlatform('android');
ionic.Platform.setVersion('4.2.3');
ionic.Platform._checkPlatforms()
ionic.Platform._checkPlatforms();
expect(ionic.Platform.platforms[0]).toEqual('webview');
expect(ionic.Platform.platforms[1]).toEqual('cordova');
@@ -193,7 +193,7 @@ describe('Ionic Platform Service', function() {
ionic.Platform.setPlatform('');
ionic.Platform.setVersion('');
ionic.Platform._checkPlatforms()
ionic.Platform._checkPlatforms();
expect(ionic.Platform.platforms.length).toEqual(2);
expect(ionic.Platform.platforms[0]).toEqual('webview');
@@ -207,7 +207,7 @@ describe('Ionic Platform Service', function() {
ionic.Platform.setPlatform('');
ionic.Platform.setVersion('');
ionic.Platform._checkPlatforms()
ionic.Platform._checkPlatforms();
expect(ionic.Platform.platforms[0]).toEqual('browser');
});
@@ -216,7 +216,7 @@ describe('Ionic Platform Service', function() {
window.cordova = {};
ionic.Platform.setPlatform('iOS');
ionic.Platform.setVersion('7.1.1');
ionic.Platform._checkPlatforms()
ionic.Platform._checkPlatforms();
expect(ionic.Platform.grade).toEqual('a');
});
@@ -224,7 +224,7 @@ describe('Ionic Platform Service', function() {
window.cordova = {};
ionic.Platform.setPlatform('iOS');
ionic.Platform.setVersion('6.1.1');
ionic.Platform._checkPlatforms()
ionic.Platform._checkPlatforms();
expect(ionic.Platform.grade).toEqual('a');
});
@@ -232,7 +232,7 @@ describe('Ionic Platform Service', function() {
window.cordova = {};
ionic.Platform.setPlatform('android');
ionic.Platform.setVersion('4.4.1');
ionic.Platform._checkPlatforms()
ionic.Platform._checkPlatforms();
expect(ionic.Platform.grade).toEqual('a');
});
@@ -240,7 +240,7 @@ describe('Ionic Platform Service', function() {
window.cordova = {};
ionic.Platform.setPlatform('android');
ionic.Platform.setVersion('4.3.1');
ionic.Platform._checkPlatforms()
ionic.Platform._checkPlatforms();
expect(ionic.Platform.grade).toEqual('b');
});
@@ -248,7 +248,7 @@ describe('Ionic Platform Service', function() {
window.cordova = {};
ionic.Platform.setPlatform('android');
ionic.Platform.setVersion('4.0.0');
ionic.Platform._checkPlatforms()
ionic.Platform._checkPlatforms();
expect(ionic.Platform.grade).toEqual('b');
});
@@ -256,7 +256,7 @@ describe('Ionic Platform Service', function() {
window.cordova = {};
ionic.Platform.setPlatform('android');
ionic.Platform.setVersion('3.0.0');
ionic.Platform._checkPlatforms()
ionic.Platform._checkPlatforms();
expect(ionic.Platform.grade).toEqual('c');
});
@@ -264,7 +264,7 @@ describe('Ionic Platform Service', function() {
window.cordova = {};
ionic.Platform.setPlatform('android');
ionic.Platform.setVersion('2.3.4');
ionic.Platform._checkPlatforms()
ionic.Platform._checkPlatforms();
expect(ionic.Platform.grade).toEqual('c');
});
@@ -272,7 +272,7 @@ describe('Ionic Platform Service', function() {
window.cordova = {};
ionic.Platform.setPlatform('android');
ionic.Platform.setVersion('0');
ionic.Platform._checkPlatforms()
ionic.Platform._checkPlatforms();
expect(ionic.Platform.grade).toEqual('a');
});
@@ -280,7 +280,7 @@ describe('Ionic Platform Service', function() {
window.cordova = {};
ionic.Platform.setPlatform('whatever');
ionic.Platform.setVersion('20.3.4');
ionic.Platform._checkPlatforms()
ionic.Platform._checkPlatforms();
expect(ionic.Platform.grade).toEqual('a');
});

View File

@@ -67,7 +67,7 @@ describe('$ionicPopup service', function() {
});
it('should resolve with return value from button.onTap', function() {
popup.scope.$buttonTapped({
onTap: function() { return '123' }
onTap: function() { return '123'; }
}, {});
expect(popup.responseDeferred.resolve).toHaveBeenCalledWith('123');
});

View File

@@ -30,7 +30,7 @@ describe('Ionic View Service', function() {
.state('tabs.tab3view1', {})
.state('tabs.tab3view2', {})
.state('tabs.tab3view3', {})
.state('tabs.tab3view3', {});
}));
@@ -38,7 +38,7 @@ describe('Ionic View Service', function() {
viewService = $ionicViewService;
rootScope = $rootScope;
window = $window;
window.history.go = function(val) { return val };
window.history.go = function(val) { return val; };
}));
it('should do nothing if the same state happens', inject(function($state) {
@@ -375,7 +375,7 @@ describe('Ionic View Service', function() {
homeViewScope = {};
$state.go('home');
rootScope.$apply();
var homeReg = viewService.register(homeViewScope);
homeReg = viewService.register(homeViewScope);
expect(rootScope.$viewHistory.histories.root.cursor).toEqual(0);
expect(rootScope.$viewHistory.histories.root.stack.length).toEqual(1);
expect(homeReg.historyId).toEqual('root');
@@ -472,7 +472,7 @@ describe('Ionic View Service', function() {
expect(viewService.getCurrentStateName()).toEqual('tabs.tab1view2');
expect(viewService.getBackView().stateName).toEqual('tabs.tab1view1');
expect(viewService.getForwardView()).toEqual(null);
var lastView = viewService.getCurrentView();
lastView = viewService.getCurrentView();
expect(lastView.index).toEqual(1);
expect(tab1view2ScopeReg.viewId).toEqual(lastView.viewId);
expect(tab1view2ScopeReg.navAction).toEqual('newView');
@@ -487,7 +487,7 @@ describe('Ionic View Service', function() {
expect(viewService.getCurrentStateName()).toEqual('tabs.tab1view1');
expect(viewService.getBackView().stateName).toEqual('home');
expect(viewService.getForwardView().stateName).toEqual('tabs.tab1view2');
var lastView = viewService.getCurrentView();
lastView = viewService.getCurrentView();
expect(lastView.index).toEqual(0);
expect(tab1view1Scope2Reg.navAction).toEqual('moveBack');
expect(tab1view1Scope2Reg.navDirection).toEqual('back');
@@ -716,7 +716,7 @@ describe('Ionic View Service', function() {
var result = newView.go();
expect(result).toEqual(null);
$location.url('/nochange')
$location.url('/nochange');
newView = viewService.createView({ url: '/nochange' });
result = newView.go();
expect(result).toEqual(null);
@@ -746,13 +746,13 @@ describe('Ionic View Service', function() {
rootScope.$broadcast("viewState.changeHistory", { url: '/url' });
expect($location.url()).toEqual('/url');
rootScope.$viewHistory.histories['h123'] = { stack: [], cursor: -1 }
rootScope.$viewHistory.histories.h123 = { stack: [], cursor: -1 };
rootScope.$broadcast("viewState.changeHistory", { historyId: 'h123' });
expect($location.url()).toEqual('/url');
var newView = viewService.createView({ stateName: 'about' });
rootScope.$viewHistory.histories['h123'].stack.push(newView);
rootScope.$viewHistory.histories['h123'].cursor++;
rootScope.$viewHistory.histories.h123.stack.push(newView);
rootScope.$viewHistory.histories.h123.cursor++;
rootScope.$broadcast("viewState.changeHistory", { historyId: 'h123' });
rootScope.$apply();
expect($state.current.name).toEqual('about');

View File

@@ -141,7 +141,7 @@ describe('Ionic Keyboard', function() {
expect( ionic.Platform.isFullScreen ).toEqual(false);
keyboardViewportHeight = 480;
window.innerHeight = 280
window.innerHeight = 280;
expect( keyboardGetHeight() ).toEqual(200);
});
@@ -161,14 +161,14 @@ describe('Ionic Keyboard', function() {
ionic.keyboard.landscape = true;
expect( keyboardGetHeight() ).toEqual(206);
})
});
it('keyboardGetHeight() should = 216 if iOS Safari', function(){
ionic.Platform.setPlatform('iOS');
expect( ionic.Platform.isWebView() ).toEqual(false);
expect( keyboardGetHeight() ).toEqual(216);
})
});
it('keyboardGetHeight() should = 260 if iOS Cordova', function(){
ionic.Platform.setPlatform('iOS');
@@ -176,13 +176,13 @@ describe('Ionic Keyboard', function() {
expect( ionic.Platform.isWebView() ).toEqual(true);
expect( keyboardGetHeight() ).toEqual(260);
})
});
it('keyboardGetHeight() should = 275 if not Android or iOS', function(){
ionic.Platform.setPlatform('WP8');
expect( keyboardGetHeight() ).toEqual(275);
})
});
it('keyboardUpdateViewportHeight() should update when window.innerHeight > keyboardViewportHeight', function(){
window.innerHeight = 460;

View File

@@ -301,7 +301,7 @@ describe('Ionic Tap', function() {
var e = {
stopPropagation: function() { this.stoppedPropagation = true; },
preventDefault: function() { this.preventedDefault = true; }
}
};
tapMouseUp(e);
expect( e.stoppedPropagation ).toEqual(true);
expect( e.preventedDefault ).toEqual(true);
@@ -313,7 +313,7 @@ describe('Ionic Tap', function() {
target: document.createElement('select'),
stopPropagation: function() { this.stoppedPropagation = true; },
preventDefault: function() { this.preventedDefault = true; }
}
};
expect( tapMouseUp(e) ).toEqual(false);
expect( e.stoppedPropagation ).toBeUndefined();
expect( e.preventedDefault ).toBeUndefined();
@@ -325,7 +325,7 @@ describe('Ionic Tap', function() {
target: document.createElement('button'),
stopPropagation: function() { this.stoppedPropagation = true; },
preventDefault: function() { this.preventedDefault = true; }
}
};
tapMouseUp(e);
expect( e.stoppedPropagation ).toBeUndefined();
expect( e.preventedDefault ).toBeUndefined();
@@ -783,10 +783,13 @@ describe('Ionic Tap', function() {
it('Should not focus on common elements', function() {
var tags = ['div', 'span', 'i', 'body', 'section', 'article', 'aside', 'li', 'p', 'header', 'button', 'ion-content'];
function setFocus() {
this.hasFocus = true;
}
for(var x=0; x<tags.length; x++) {
var ele = {
tagName: tags[x],
focus: function(){ this.hasFocus=true; }
focus: setFocus
};
tapHandleFocus(ele);
expect( ele.hasFocus ).toBeUndefined();
@@ -808,10 +811,11 @@ describe('Ionic Tap', function() {
it('Should not focus out on common elements', function() {
var tags = ['div', 'span', 'i', 'body', 'section', 'article', 'aside', 'li', 'p', 'header', 'button', 'ion-content'];
function setBlurred() { this.hasBlurred = true; }
for(var x=0; x<tags.length; x++) {
var ele = {
tagName: tags[x],
blur: function(){ this.hasBlurred=true; }
blur: setBlurred
};
tapActiveElement(ele);
tapFocusOutActive(ele);
@@ -821,10 +825,11 @@ describe('Ionic Tap', function() {
it('Should focus out on input elements', function() {
var tags = ['input', 'textarea', 'select'];
function setBlurred() { this.hasBlurred=true; }
for(var x=0; x<tags.length; x++) {
var ele = {
tagName: tags[x],
blur: function(){ this.hasBlurred=true; }
blur: setBlurred
};
tapActiveElement(ele);
tapFocusOutActive(ele);

View File

@@ -483,8 +483,8 @@ describe('Ionic Viewport', function() {
vportTag.content = ' keyonly, , ,, WIDTH=DeViCe-wIDTH , minimal-ui ';
viewportLoadTag();
expect( viewportProperties['keyonly'] ).toEqual('_');
expect( viewportProperties['width'] ).toEqual('device-width');
expect( viewportProperties.keyonly ).toEqual('_');
expect( viewportProperties.width ).toEqual('device-width');
expect( viewportProperties['minimal-ui'] ).toEqual('_');
viewportTagUpdate();

View File

@@ -58,7 +58,7 @@ describe('Scroll View', function() {
keyboardHeight: keyboardHeight,
keyboardTopOffset: 40,
target: element,
}
};
expect( sv.isScrolledIntoView ).toBeFalsy();
ionic.trigger('scrollChildIntoView', details, true);