Skip to content

Commit

Permalink
added additional tests for angular 1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
chieffancypants committed Sep 4, 2014
1 parent b550d75 commit 8387cdb
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 12 deletions.
14 changes: 11 additions & 3 deletions Gruntfile.js
Expand Up @@ -36,15 +36,23 @@ module.exports = function(grunt) {

karma: {
unit: {
configFile: 'test/karma.conf.js',
configFile: 'test/karma-angular-1.2.conf.js',
singleRun: true,
coverageReporter: {
type: 'text',
dir: 'coverage/'
}
},
unit13: {
configFile: 'test/karma-angular-1.3.conf.js',
singleRun: true,
coverageReporter: {
type: 'text',
dir: 'coverage/'
}
},
watch: {
configFile: 'test/karma.conf.js',
configFile: 'test/karma-angular-1.2.conf.js',
singleRun: false,
reporters: ['progress'] // Don't display coverage
}
Expand Down Expand Up @@ -79,7 +87,7 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-karma');

grunt.registerTask('default', ['jshint', 'karma:unit', 'uglify', 'cssmin', 'concat:build']);
grunt.registerTask('default', ['jshint', 'karma:unit', 'karma:unit13', 'uglify', 'cssmin', 'concat:build']);
grunt.registerTask('test', ['karma:watch']);
grunt.registerTask('build', ['default']);

Expand Down
14 changes: 12 additions & 2 deletions bower.json
@@ -1,7 +1,10 @@
{
"name": "angular-loading-bar",
"version": "0.5.1",
"main": ["build/loading-bar.js", "build/loading-bar.css"],
"main": [
"build/loading-bar.js",
"build/loading-bar.css"
],
"ignore": [
"**/.*",
"node_modules",
Expand All @@ -10,7 +13,14 @@
"example"
],
"devDependencies": {
"angular": "^1.2.9",
"angular-1.3": "angular#1.3",
"angular-mocks": "^1.2.9",
"angular-animate": "^1.2.9"
"angular-mocks-1.3": "angular-mocks#1.3",
"angular-animate": "^1.2.9",
"angular-animate-1.3": "angular-animate#1.3"
},
"resolutions": {
"angular": "1.2.23"
}
}
15 changes: 8 additions & 7 deletions src/loading-bar.js
Expand Up @@ -178,9 +178,9 @@ angular.module('cfp.loadingBar', [])
*/
function _start() {
if (!$animate) {
$animate = $injector.get('$animate');
$animate = $injector.get('$animate');
}

var $parent = $document.find($parentSelector);
$timeout.cancel(completeTimeout);

Expand Down Expand Up @@ -264,25 +264,26 @@ angular.module('cfp.loadingBar', [])
return status;
}

function _complete_animation() {
function _completeAnimation() {
status = 0;
started = false;
}

function _complete() {
if (!$animate) {
$animate = $injector.get('$animate');
$animate = $injector.get('$animate');
}

$rootScope.$broadcast('cfpLoadingBar:completed');
_set(1);

$timeout.cancel(completeTimeout);

// Attempt to aggregate any start/complete calls within 500ms:
completeTimeout = $timeout(function() {
var promise = $animate.leave(loadingBarContainer, _complete_animation);
if(promise){
promise.then(_complete_animation);
var promise = $animate.leave(loadingBarContainer, _completeAnimation);
if (promise && promise.then) {
promise.then(_completeAnimation);
}
$animate.leave(spinner);
}, 500);
Expand Down
File renamed without changes.
82 changes: 82 additions & 0 deletions test/karma-angular-1.3.conf.js
@@ -0,0 +1,82 @@
// Karma configuration
// Generated on Sun Sep 15 2013 20:18:09 GMT-0400 (EDT)

module.exports = function(config) {
config.set({

// base path, that will be used to resolve files and exclude
basePath: '',


// frameworks to use
frameworks: ['jasmine'],


// list of files / patterns to load in the browser
files: [
'../bower_components/angular-1.3/angular.js',
'../bower_components/angular-animate-1.3/angular-animate.js',
'../bower_components/angular-mocks-1.3/angular-mocks.js',
'../src/*.js',
'*.coffee'
],


// list of files to exclude
exclude: [

],


// test results reporter to use
// possible values: 'dots', 'progress', 'junit', 'growl', 'coverage'
reporters: ['progress', 'coverage'],


// web server port
port: 9876,


// enable / disable colors in the output (reporters and logs)
colors: true,


// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,


// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,


// Start these browsers, currently available:
// - Chrome
// - ChromeCanary
// - Firefox
// - Opera
// - Safari (only Mac)
// - PhantomJS
// - IE (only Windows)
browsers: ['PhantomJS'],

coverageReporter: {
type : 'html',
dir : 'coverage/',
},

preprocessors: {
'../src/*.js': ['coverage'],
'*.coffee': 'coffee'
},


// If browser does not capture in given timeout [ms], kill it
captureTimeout: 60000,


// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun: false
});
};

0 comments on commit 8387cdb

Please sign in to comment.