Skip to content

Commit 8387cdb

Browse files
added additional tests for angular 1.3
1 parent b550d75 commit 8387cdb

File tree

5 files changed

+113
-12
lines changed

5 files changed

+113
-12
lines changed

Gruntfile.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,23 @@ module.exports = function(grunt) {
3636

3737
karma: {
3838
unit: {
39-
configFile: 'test/karma.conf.js',
39+
configFile: 'test/karma-angular-1.2.conf.js',
40+
singleRun: true,
41+
coverageReporter: {
42+
type: 'text',
43+
dir: 'coverage/'
44+
}
45+
},
46+
unit13: {
47+
configFile: 'test/karma-angular-1.3.conf.js',
4048
singleRun: true,
4149
coverageReporter: {
4250
type: 'text',
4351
dir: 'coverage/'
4452
}
4553
},
4654
watch: {
47-
configFile: 'test/karma.conf.js',
55+
configFile: 'test/karma-angular-1.2.conf.js',
4856
singleRun: false,
4957
reporters: ['progress'] // Don't display coverage
5058
}
@@ -79,7 +87,7 @@ module.exports = function(grunt) {
7987
grunt.loadNpmTasks('grunt-contrib-concat');
8088
grunt.loadNpmTasks('grunt-karma');
8189

82-
grunt.registerTask('default', ['jshint', 'karma:unit', 'uglify', 'cssmin', 'concat:build']);
90+
grunt.registerTask('default', ['jshint', 'karma:unit', 'karma:unit13', 'uglify', 'cssmin', 'concat:build']);
8391
grunt.registerTask('test', ['karma:watch']);
8492
grunt.registerTask('build', ['default']);
8593

bower.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
{
22
"name": "angular-loading-bar",
33
"version": "0.5.1",
4-
"main": ["build/loading-bar.js", "build/loading-bar.css"],
4+
"main": [
5+
"build/loading-bar.js",
6+
"build/loading-bar.css"
7+
],
58
"ignore": [
69
"**/.*",
710
"node_modules",
@@ -10,7 +13,14 @@
1013
"example"
1114
],
1215
"devDependencies": {
16+
"angular": "^1.2.9",
17+
"angular-1.3": "angular#1.3",
1318
"angular-mocks": "^1.2.9",
14-
"angular-animate": "^1.2.9"
19+
"angular-mocks-1.3": "angular-mocks#1.3",
20+
"angular-animate": "^1.2.9",
21+
"angular-animate-1.3": "angular-animate#1.3"
22+
},
23+
"resolutions": {
24+
"angular": "1.2.23"
1525
}
1626
}

src/loading-bar.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,9 @@ angular.module('cfp.loadingBar', [])
178178
*/
179179
function _start() {
180180
if (!$animate) {
181-
$animate = $injector.get('$animate');
181+
$animate = $injector.get('$animate');
182182
}
183-
183+
184184
var $parent = $document.find($parentSelector);
185185
$timeout.cancel(completeTimeout);
186186

@@ -264,25 +264,26 @@ angular.module('cfp.loadingBar', [])
264264
return status;
265265
}
266266

267-
function _complete_animation() {
267+
function _completeAnimation() {
268268
status = 0;
269269
started = false;
270270
}
271271

272272
function _complete() {
273273
if (!$animate) {
274-
$animate = $injector.get('$animate');
274+
$animate = $injector.get('$animate');
275275
}
276+
276277
$rootScope.$broadcast('cfpLoadingBar:completed');
277278
_set(1);
278279

279280
$timeout.cancel(completeTimeout);
280281

281282
// Attempt to aggregate any start/complete calls within 500ms:
282283
completeTimeout = $timeout(function() {
283-
var promise = $animate.leave(loadingBarContainer, _complete_animation);
284-
if(promise){
285-
promise.then(_complete_animation);
284+
var promise = $animate.leave(loadingBarContainer, _completeAnimation);
285+
if (promise && promise.then) {
286+
promise.then(_completeAnimation);
286287
}
287288
$animate.leave(spinner);
288289
}, 500);
File renamed without changes.

test/karma-angular-1.3.conf.js

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
// Karma configuration
2+
// Generated on Sun Sep 15 2013 20:18:09 GMT-0400 (EDT)
3+
4+
module.exports = function(config) {
5+
config.set({
6+
7+
// base path, that will be used to resolve files and exclude
8+
basePath: '',
9+
10+
11+
// frameworks to use
12+
frameworks: ['jasmine'],
13+
14+
15+
// list of files / patterns to load in the browser
16+
files: [
17+
'../bower_components/angular-1.3/angular.js',
18+
'../bower_components/angular-animate-1.3/angular-animate.js',
19+
'../bower_components/angular-mocks-1.3/angular-mocks.js',
20+
'../src/*.js',
21+
'*.coffee'
22+
],
23+
24+
25+
// list of files to exclude
26+
exclude: [
27+
28+
],
29+
30+
31+
// test results reporter to use
32+
// possible values: 'dots', 'progress', 'junit', 'growl', 'coverage'
33+
reporters: ['progress', 'coverage'],
34+
35+
36+
// web server port
37+
port: 9876,
38+
39+
40+
// enable / disable colors in the output (reporters and logs)
41+
colors: true,
42+
43+
44+
// level of logging
45+
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
46+
logLevel: config.LOG_INFO,
47+
48+
49+
// enable / disable watching file and executing tests whenever any file changes
50+
autoWatch: true,
51+
52+
53+
// Start these browsers, currently available:
54+
// - Chrome
55+
// - ChromeCanary
56+
// - Firefox
57+
// - Opera
58+
// - Safari (only Mac)
59+
// - PhantomJS
60+
// - IE (only Windows)
61+
browsers: ['PhantomJS'],
62+
63+
coverageReporter: {
64+
type : 'html',
65+
dir : 'coverage/',
66+
},
67+
68+
preprocessors: {
69+
'../src/*.js': ['coverage'],
70+
'*.coffee': 'coffee'
71+
},
72+
73+
74+
// If browser does not capture in given timeout [ms], kill it
75+
captureTimeout: 60000,
76+
77+
78+
// Continuous Integration mode
79+
// if true, it capture browsers, run tests and exit
80+
singleRun: false
81+
});
82+
};

0 commit comments

Comments
 (0)