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

@@ -1,13 +1,3 @@
{
"expr": true,
"browser": true,
"multistr": true,
"globals": {
"jQuery": true,
"ionic": true,
"angular": true,
"console": true,
"module": true,
"document": true
}
"expr": true
}

View File

@@ -48,6 +48,7 @@ if (IS_RELEASE_BUILD) {
gulp.task('default', ['build']);
gulp.task('build', ['bundle', 'sass']);
gulp.task('validate', ['jshint', 'ddescribe-iit', 'karma']);
gulp.task('docs', function(done) {
var docVersion = argv['doc-version'];
@@ -113,18 +114,21 @@ gulp.task('bundle', [
});
gulp.task('jshint', function() {
return gulp.src(['js/**/*.js', 'test/**/*.js'])
return gulp.src(['js/**/*.js'])
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter('jshint-stylish'));
.pipe(jshint.reporter(require('jshint-summary')({
fileColCol: ',bold',
positionCol: ',bold',
codeCol: 'green,bold',
reasonCol: 'cyan'
})))
.pipe(jshint.reporter('fail'));
});
gulp.task('ddescribe-iit', function() {
return gulp.src(['test/**/*.js', 'js/**/*.js'])
.pipe(notContains([
'ddescribe',
'iit',
'xit',
'xdescribe'
'ddescribe', 'iit', 'xit', 'xdescribe'
]));
});

View File

@@ -36,5 +36,5 @@ IonicModule
});
}
};
}])
}]);

View File

@@ -119,10 +119,10 @@ function($timeout, $compile, $ionicSlideBoxDelegate) {
slider.load();
});
}],
template: '<div class="slider">\
<div class="slider-slides" ng-transclude>\
</div>\
</div>',
template: '<div class="slider">' +
'<div class="slider-slides" ng-transclude>' +
'</div>' +
'</div>',
link: function($scope, $element, $attr, slideBoxCtrl) {
// If the pager should show, append it to the slide box

View File

@@ -627,7 +627,7 @@ vec2.str = function (a) {
if(typeof(exports) !== 'undefined') {
exports.vec2 = vec2;
}
;
/* Copyright (c) 2013, Brandon Jones, Colin MacKenzie IV. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
@@ -1120,23 +1120,23 @@ vec3.transformQuat = function(out, a, q) {
* @returns {vec3} out
*/
vec3.rotateX = function(out, a, b, c){
var p = [], r=[];
//Translate point to the origin
p[0] = a[0] - b[0];
p[1] = a[1] - b[1];
p[2] = a[2] - b[2];
var p = [], r=[];
//Translate point to the origin
p[0] = a[0] - b[0];
p[1] = a[1] - b[1];
p[2] = a[2] - b[2];
//perform rotation
r[0] = p[0];
r[1] = p[1]*Math.cos(c) - p[2]*Math.sin(c);
r[2] = p[1]*Math.sin(c) + p[2]*Math.cos(c);
//perform rotation
r[0] = p[0];
r[1] = p[1]*Math.cos(c) - p[2]*Math.sin(c);
r[2] = p[1]*Math.sin(c) + p[2]*Math.cos(c);
//translate to correct position
out[0] = r[0] + b[0];
out[1] = r[1] + b[1];
out[2] = r[2] + b[2];
//translate to correct position
out[0] = r[0] + b[0];
out[1] = r[1] + b[1];
out[2] = r[2] + b[2];
return out;
return out;
};
/*
@@ -1148,23 +1148,23 @@ vec3.rotateX = function(out, a, b, c){
* @returns {vec3} out
*/
vec3.rotateY = function(out, a, b, c){
var p = [], r=[];
//Translate point to the origin
p[0] = a[0] - b[0];
p[1] = a[1] - b[1];
p[2] = a[2] - b[2];
var p = [], r=[];
//Translate point to the origin
p[0] = a[0] - b[0];
p[1] = a[1] - b[1];
p[2] = a[2] - b[2];
//perform rotation
r[0] = p[2]*Math.sin(c) + p[0]*Math.cos(c);
r[1] = p[1];
r[2] = p[2]*Math.cos(c) - p[0]*Math.sin(c);
//perform rotation
r[0] = p[2]*Math.sin(c) + p[0]*Math.cos(c);
r[1] = p[1];
r[2] = p[2]*Math.cos(c) - p[0]*Math.sin(c);
//translate to correct position
out[0] = r[0] + b[0];
out[1] = r[1] + b[1];
out[2] = r[2] + b[2];
//translate to correct position
out[0] = r[0] + b[0];
out[1] = r[1] + b[1];
out[2] = r[2] + b[2];
return out;
return out;
};
/*
@@ -1176,23 +1176,23 @@ vec3.rotateY = function(out, a, b, c){
* @returns {vec3} out
*/
vec3.rotateZ = function(out, a, b, c){
var p = [], r=[];
//Translate point to the origin
p[0] = a[0] - b[0];
p[1] = a[1] - b[1];
p[2] = a[2] - b[2];
var p = [], r=[];
//Translate point to the origin
p[0] = a[0] - b[0];
p[1] = a[1] - b[1];
p[2] = a[2] - b[2];
//perform rotation
r[0] = p[0]*Math.cos(c) - p[1]*Math.sin(c);
r[1] = p[0]*Math.sin(c) + p[1]*Math.cos(c);
r[2] = p[2];
//perform rotation
r[0] = p[0]*Math.cos(c) - p[1]*Math.sin(c);
r[1] = p[0]*Math.sin(c) + p[1]*Math.cos(c);
r[2] = p[2];
//translate to correct position
out[0] = r[0] + b[0];
out[1] = r[1] + b[1];
out[2] = r[2] + b[2];
//translate to correct position
out[0] = r[0] + b[0];
out[1] = r[1] + b[1];
out[2] = r[2] + b[2];
return out;
return out;
};
/**
@@ -1249,7 +1249,7 @@ vec3.str = function (a) {
if(typeof(exports) !== 'undefined') {
exports.vec3 = vec3;
}
;
/* Copyright (c) 2013, Brandon Jones, Colin MacKenzie IV. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
@@ -1774,7 +1774,7 @@ vec4.str = function (a) {
if(typeof(exports) !== 'undefined') {
exports.vec4 = vec4;
}
;
/* Copyright (c) 2013, Brandon Jones, Colin MacKenzie IV. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
@@ -2017,7 +2017,7 @@ mat2.str = function (a) {
* @returns {Number} Frobenius norm
*/
mat2.frob = function (a) {
return(Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2) + Math.pow(a[2], 2) + Math.pow(a[3], 2)))
return(Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2) + Math.pow(a[2], 2) + Math.pow(a[3], 2)));
};
/**
@@ -2039,7 +2039,7 @@ mat2.LDU = function (L, D, U, a) {
if(typeof(exports) !== 'undefined') {
exports.mat2 = mat2;
}
;
/* Copyright (c) 2013, Brandon Jones, Colin MacKenzie IV. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
@@ -2291,13 +2291,13 @@ mat2d.str = function (a) {
* @returns {Number} Frobenius norm
*/
mat2d.frob = function (a) {
return(Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2) + Math.pow(a[2], 2) + Math.pow(a[3], 2) + Math.pow(a[4], 2) + Math.pow(a[5], 2) + 1))
return(Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2) + Math.pow(a[2], 2) + Math.pow(a[3], 2) + Math.pow(a[4], 2) + Math.pow(a[5], 2) + 1));
};
if(typeof(exports) !== 'undefined') {
exports.mat2d = mat2d;
}
;
/* Copyright (c) 2013, Brandon Jones, Colin MacKenzie IV. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
@@ -2781,14 +2781,14 @@ mat3.str = function (a) {
* @returns {Number} Frobenius norm
*/
mat3.frob = function (a) {
return(Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2) + Math.pow(a[2], 2) + Math.pow(a[3], 2) + Math.pow(a[4], 2) + Math.pow(a[5], 2) + Math.pow(a[6], 2) + Math.pow(a[7], 2) + Math.pow(a[8], 2)))
return(Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2) + Math.pow(a[2], 2) + Math.pow(a[3], 2) + Math.pow(a[4], 2) + Math.pow(a[5], 2) + Math.pow(a[6], 2) + Math.pow(a[7], 2) + Math.pow(a[8], 2)));
};
if(typeof(exports) !== 'undefined') {
exports.mat3 = mat3;
}
;
/* Copyright (c) 2013, Brandon Jones, Colin MacKenzie IV. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
@@ -3693,14 +3693,14 @@ mat4.str = function (a) {
* @returns {Number} Frobenius norm
*/
mat4.frob = function (a) {
return(Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2) + Math.pow(a[2], 2) + Math.pow(a[3], 2) + Math.pow(a[4], 2) + Math.pow(a[5], 2) + Math.pow(a[6], 2) + Math.pow(a[6], 2) + Math.pow(a[7], 2) + Math.pow(a[8], 2) + Math.pow(a[9], 2) + Math.pow(a[10], 2) + Math.pow(a[11], 2) + Math.pow(a[12], 2) + Math.pow(a[13], 2) + Math.pow(a[14], 2) + Math.pow(a[15], 2) ))
return(Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2) + Math.pow(a[2], 2) + Math.pow(a[3], 2) + Math.pow(a[4], 2) + Math.pow(a[5], 2) + Math.pow(a[6], 2) + Math.pow(a[6], 2) + Math.pow(a[7], 2) + Math.pow(a[8], 2) + Math.pow(a[9], 2) + Math.pow(a[10], 2) + Math.pow(a[11], 2) + Math.pow(a[12], 2) + Math.pow(a[13], 2) + Math.pow(a[14], 2) + Math.pow(a[15], 2) ));
};
if(typeof(exports) !== 'undefined') {
exports.mat4 = mat4;
}
;
/* Copyright (c) 2013, Brandon Jones, Colin MacKenzie IV. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
@@ -4230,7 +4230,7 @@ quat.str = function (a) {
if(typeof(exports) !== 'undefined') {
exports.quat = quat;
}
;

View File

@@ -8,27 +8,27 @@
'linear': function(duration) {
return function(t) {
return ionic.Animation.Bezier.linear(t, duration);
}
};
},
'ease': function(duration) {
return function(t) {
return ionic.Animation.Bezier.ease(t, duration);
}
};
},
'ease-in': function(duration) {
return function(t) {
return ionic.Animation.Bezier.easeIn(t, duration);
}
};
},
'ease-out': function(duration) {
return function(t) {
return ionic.Animation.Bezier.easeOut(t, duration);
}
};
},
'ease-in-out': function(duration) {
return function(t) {
return ionic.Animation.Bezier.easeInOut(t, duration);
}
};
}
};
})(window);

View File

@@ -117,7 +117,7 @@
// `parent`'s constructor function.
var Surrogate = function(){ this.constructor = child; };
Surrogate.prototype = parent.prototype;
child.prototype = new Surrogate;
child.prototype = new Surrogate();
// Add prototype properties (instance properties) to the subclass,
// if supplied.

View File

@@ -25,7 +25,7 @@ function viewportLoadTag() {
var props = viewportTag.content.toLowerCase().replace(/\s+/g, '').split(',');
var keyValue;
for(x=0; x<props.length; x++) {
if(props[x] != '') {
if(props[x]) {
keyValue = props[x].split('=');
viewportProperties[ keyValue[0] ] = (keyValue.length > 1 ? keyValue[1] : '_');
}

View File

@@ -192,7 +192,7 @@
ReorderDrag.prototype._moveElement = function(e) {
var y = e.gesture.center.pageY -
this._currentDrag.elementHeight +
this._currentDrag.elementHeight +
this.scrollView.getValues().top -
this.listEl.offsetTop;
this.el.style[ionic.CSS.TRANSFORM] = 'translate3d(0, '+y+'px, 0)';
@@ -457,10 +457,11 @@
this._isDragging = false;
var lastDragOp = this._lastDragOp;
var item;
// Check if this is a reorder drag
if(ionic.DomUtil.getParentOrSelfWithClass(e.target, ITEM_REORDER_BTN_CLASS) && (e.gesture.direction == 'up' || e.gesture.direction == 'down')) {
var item = this._getItem(e.target);
item = this._getItem(e.target);
if(item) {
this._dragOp = new ReorderDrag({
@@ -481,7 +482,7 @@
else if(!this._didDragUpOrDown && (e.gesture.direction == 'left' || e.gesture.direction == 'right') && Math.abs(e.gesture.deltaX) > 5) {
// Make sure this is an item with buttons
var item = this._getItem(e.target);
item = this._getItem(e.target);
if(item && item.querySelector('.item-options')) {
this._dragOp = new SlideDrag({ el: this.el, canSwipe: this.canSwipe });
this._dragOp.start(e);

View File

@@ -12,6 +12,8 @@
* License: MIT + Apache (V2)
*/
/* jshint eqnull: true */
/**
* Generic animation class with support for dropped frames both optional easing and duration.
*
@@ -805,12 +807,12 @@ ionic.views.Scroll = ionic.views.View.inherit({
//For Firefox
document.addEventListener('mousewheel', onMouseWheel);
function onMouseWheel(e) {
self.hintResize();
wheelShowBarFn();
self.scrollBy(e.wheelDeltaX/self.options.wheelDampen, -e.wheelDeltaY/self.options.wheelDampen);
wheelHideBarFn();
}
}
function onMouseWheel(e) {
self.hintResize();
wheelShowBarFn();
self.scrollBy(e.wheelDeltaX/self.options.wheelDampen, -e.wheelDeltaY/self.options.wheelDampen);
wheelHideBarFn();
}
},
@@ -1965,7 +1967,7 @@ ionic.views.Scroll = ionic.views.View.inherit({
self.__maxScrollLeft = Math.max((self.__contentWidth * zoomLevel) - self.__clientWidth, 0);
self.__maxScrollTop = Math.max((self.__contentHeight * zoomLevel) - self.__clientHeight, 0);
if(!self.__didWaitForSize && self.__maxScrollLeft == 0 && self.__maxScrollTop == 0) {
if(!self.__didWaitForSize && !self.__maxScrollLeft && !self.__maxScrollTop) {
self.__didWaitForSize = true;
self.__waitForSize();
}
@@ -1984,7 +1986,7 @@ ionic.views.Scroll = ionic.views.View.inherit({
var sizer = function() {
self.resize();
if((self.options.scrollingX && self.__maxScrollLeft == 0) || (self.options.scrollingY && self.__maxScrollTop == 0)) {
if((self.options.scrollingX && !self.__maxScrollLeft) || (self.options.scrollingY && !self.__maxScrollTop)) {
//self.__sizerTimeout = setTimeout(sizer, 1000);
}
};

View File

@@ -194,11 +194,11 @@ ionic.views.Slider = ionic.views.View.inherit({
}
var start = +new Date;
var start = +new Date();
var timer = setInterval(function() {
var timeElap = +new Date - start;
var timeElap = +new Date() - start;
if (timeElap > speed) {
@@ -283,7 +283,7 @@ ionic.views.Slider = ionic.views.View.inherit({
y: touches.pageY,
// store time to determine touch duration
time: +new Date
time: +new Date()
};
@@ -348,9 +348,9 @@ ionic.views.Slider = ionic.views.View.inherit({
delta.x =
delta.x /
( (!index && delta.x > 0 // if first slide and sliding left
|| index == slides.length - 1 // or if last slide and sliding right
&& delta.x < 0 // and if sliding at all
( (!index && delta.x > 0 || // if first slide and sliding left
index == slides.length - 1 && // or if last slide and sliding right
delta.x < 0 // and if sliding at all
) ?
( Math.abs(delta.x) / width + 1 ) // determine resistance level
: 1 ); // no resistance if false
@@ -367,18 +367,18 @@ ionic.views.Slider = ionic.views.View.inherit({
end: function(event) {
// measure duration
var duration = +new Date - start.time;
var duration = +new Date() - start.time;
// determine if slide attempt triggers next/prev slide
var isValidSlide =
Number(duration) < 250 // if slide duration is less than 250ms
&& Math.abs(delta.x) > 20 // and if slide amt is greater than 20px
|| Math.abs(delta.x) > width/2; // or if slide amt is greater than half the width
Number(duration) < 250 && // if slide duration is less than 250ms
Math.abs(delta.x) > 20 || // and if slide amt is greater than 20px
Math.abs(delta.x) > width/2; // or if slide amt is greater than half the width
// determine if slide attempt is past start and end
var isPastBounds =
!index && delta.x > 0 // if first slide and slide amt is greater than 0
|| index == slides.length - 1 && delta.x < 0; // or if last slide and slide amt is less than 0
!index && delta.x > 0 | // if first slide and slide amt is greater than 0
index == slides.length - 1 && delta.x < 0; // or if last slide and slide amt is less than 0
if (options.continuous) isPastBounds = false;
@@ -465,7 +465,7 @@ ionic.views.Slider = ionic.views.View.inherit({
}
}
};
// Public API
this.update = function() {
@@ -591,7 +591,7 @@ ionic.views.Slider = ionic.views.View.inherit({
window.onresize = function () { setup(); }; // to play nice with old IE
}
}
};
}
});

View File

@@ -16,7 +16,6 @@
"sauce-connect-launcher": "^0.2.2",
"dgeni": "^0.2.0",
"dgeni-packages": "^0.7.1",
"jshint-stylish": "^0.1.5",
"gulp-template": "^0.1.1",
"gulp-concat": "^2.1.7",
"gulp-jshint": "^1.5.0",
@@ -47,7 +46,9 @@
"gulp-footer": "^1.0.4",
"marked": "^0.3.2",
"ircb": "^0.3.1",
"node-twitter-api": "^1.2.2"
"node-twitter-api": "^1.2.2",
"chalk": "^0.4.0",
"jshint-summary": "^0.3.0"
},
"licenses": [
{

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