Skip to content

Commit

Permalink
#4 Initial commit of Karma Unit Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcel Birkner committed Oct 20, 2014
1 parent 13f7124 commit 5abb172
Show file tree
Hide file tree
Showing 10 changed files with 273 additions and 122 deletions.
1 change: 1 addition & 0 deletions client/js/controller/project_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
var activity = {timestamp: new Date(), subject: user, action: msg, object: this.project.name};
$http.post(url + '/api/mongo/activities', JSON.stringify(activity));
};

});

})();
6 changes: 6 additions & 0 deletions client/js/controller/skill_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,10 @@
};
});

angular.module('project-staffing').filter('firstLetterUppercase', function() {
return function(input) {
return input.charAt(0).toUpperCase() + input.slice(1);
};
});

})();
76 changes: 76 additions & 0 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
// Karma configuration
// Generated on Mon Oct 20 2014 09:35:40 GMT+0200 (Mitteleuropäische Sommerzeit)

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

// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',


// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine', 'requirejs'],


// list of files / patterns to load in the browser
files: [
'test/requirejs-main.js',
{pattern: 'test/*.spec.js', included: false},
{pattern: 'node_modules/requirejs/require.js', included: false},
{pattern: 'static/js/app.js', included: false},
{pattern: 'static/js/lib/angular-animate.js', included: false},
{pattern: 'static/js/lib/angular-route.js', included: false},
{pattern: 'static/js/lib/angular.js', included: false},
{pattern: 'static/js/lib/bootstrap.js', included: false},
{pattern: 'static/js/lib/docs.min.js', included: false},
{pattern: 'static/js/lib/jquery-2.1.1.js', included: false},
{pattern: 'static/js/lib/ngAutocomplete.js', included: false}
],


// list of files to exclude
exclude: [
// 'client/js/app.js' // we don't want to actually start the application in our tests
],


// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
},


// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress'],


// 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
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['Chrome'],


// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false
});
};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"devDependencies": {
"karma": "^0.12.24",
"karma-chrome-launcher": "^0.1.5",
"karma-firefox-launcher": "^0.1.3",
"karma-jasmine": "^0.1.5",
"karma-requirejs": "^0.2.2",
"requirejs": "^2.1.15"
Expand Down
247 changes: 127 additions & 120 deletions static/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,126 @@

})();

(function(){
'use strict';

var app = angular.module('employee-directives', []);

app.directive('navigation', function(){
return {
restrict: 'E',
templateUrl: 'navigation.html'
};
});
app.directive('employeeTable', function(){
return {
restrict: 'E',
templateUrl: 'employee-table.html'
};
});
app.directive('employeeList', function(){
return {
restrict: 'E',
templateUrl: 'employee-list.html'
};
});
app.directive('employeeForm', function(){
return {
restrict: 'E',
templateUrl: 'employee-form.html'
};
});
app.directive('skillForm', function(){
return {
restrict: 'E',
templateUrl: 'skill-form.html'
};
});
app.directive('projectForm', function(){
return {
restrict: 'E',
templateUrl: 'project-form.html'
};
});
app.directive('homeaddressForm', function(){
return {
restrict: 'E',
templateUrl: 'homeaddress-form.html'
};
});
app.directive('searchaddressForm', function(){
return {
restrict: 'E',
templateUrl: 'searchaddress-form.html'
};
});
app.directive('customerTable', function() {
return {
restrict : 'E',
templateUrl : 'customer-table.html'
};
});
app.directive('searchCustomerAddressForm', function(){
return {
restrict: 'E',
templateUrl: 'searchcustomeraddress-form.html'
};
});
})();

(function() {
'use strict';

angular
.module('project-staffing')
.config(function($routeProvider) {
$routeProvider.when('/', {
templateUrl: 'views/index.html',
})
.when('/timeline', {
templateUrl: 'views/timeline.html',
controller: 'TimelineController',
controllerAs: 'timelineCtrl',
})
.when('/dashboard', {
templateUrl: 'views/dashboard.html',
controller: 'DashboardController',
controllerAs: 'dashboardCtrl',
})
.when('/list-employees', {
templateUrl: 'views/list_employees.html',
controller: 'EmployeeController',
controllerAs: 'employeeCtrl',
})
.when('/add-employee', {
templateUrl: 'views/add_employee.html',
controller: 'EmployeeController',
controllerAs: 'employeeCtrl',
})
.when('/list-customers', {
templateUrl: 'views/list_customers.html',
controller: 'CustomerController',
controllerAs: 'customerCtrl',
})
.when('/staffing', {
templateUrl: 'views/staff_project.html',
controller: 'StaffingController',
controllerAs: 'staffingCtrl',
})
.when('/add-customer', {
templateUrl: 'views/add_customer.html',
controller: 'CustomerController',
controllerAs: 'customerCtrl',
})
.when('/help', {
templateUrl: 'views/help.html',
})
.otherwise({
redirectTo: '/',
});
});
})();

(function() {
'use strict';

Expand Down Expand Up @@ -496,6 +616,7 @@
var activity = {timestamp: new Date(), subject: user, action: msg, object: this.project.name};
$http.post(url + '/api/mongo/activities', JSON.stringify(activity));
};

});

})();
Expand Down Expand Up @@ -546,6 +667,12 @@
};
});

angular.module('project-staffing').filter('firstLetterUppercase', function() {
return function(input) {
return input.charAt(0).toUpperCase() + input.slice(1);
};
});

})();

/* global google */
Expand Down Expand Up @@ -724,123 +851,3 @@
});

})();

(function() {
'use strict';

angular
.module('project-staffing')
.config(function($routeProvider) {
$routeProvider.when('/', {
templateUrl: 'views/index.html',
})
.when('/timeline', {
templateUrl: 'views/timeline.html',
controller: 'TimelineController',
controllerAs: 'timelineCtrl',
})
.when('/dashboard', {
templateUrl: 'views/dashboard.html',
controller: 'DashboardController',
controllerAs: 'dashboardCtrl',
})
.when('/list-employees', {
templateUrl: 'views/list_employees.html',
controller: 'EmployeeController',
controllerAs: 'employeeCtrl',
})
.when('/add-employee', {
templateUrl: 'views/add_employee.html',
controller: 'EmployeeController',
controllerAs: 'employeeCtrl',
})
.when('/list-customers', {
templateUrl: 'views/list_customers.html',
controller: 'CustomerController',
controllerAs: 'customerCtrl',
})
.when('/staffing', {
templateUrl: 'views/staff_project.html',
controller: 'StaffingController',
controllerAs: 'staffingCtrl',
})
.when('/add-customer', {
templateUrl: 'views/add_customer.html',
controller: 'CustomerController',
controllerAs: 'customerCtrl',
})
.when('/help', {
templateUrl: 'views/help.html',
})
.otherwise({
redirectTo: '/',
});
});
})();

(function(){
'use strict';

var app = angular.module('employee-directives', []);

app.directive('navigation', function(){
return {
restrict: 'E',
templateUrl: 'navigation.html'
};
});
app.directive('employeeTable', function(){
return {
restrict: 'E',
templateUrl: 'employee-table.html'
};
});
app.directive('employeeList', function(){
return {
restrict: 'E',
templateUrl: 'employee-list.html'
};
});
app.directive('employeeForm', function(){
return {
restrict: 'E',
templateUrl: 'employee-form.html'
};
});
app.directive('skillForm', function(){
return {
restrict: 'E',
templateUrl: 'skill-form.html'
};
});
app.directive('projectForm', function(){
return {
restrict: 'E',
templateUrl: 'project-form.html'
};
});
app.directive('homeaddressForm', function(){
return {
restrict: 'E',
templateUrl: 'homeaddress-form.html'
};
});
app.directive('searchaddressForm', function(){
return {
restrict: 'E',
templateUrl: 'searchaddress-form.html'
};
});
app.directive('customerTable', function() {
return {
restrict : 'E',
templateUrl : 'customer-table.html'
};
});
app.directive('searchCustomerAddressForm', function(){
return {
restrict: 'E',
templateUrl: 'searchcustomeraddress-form.html'
};
});
})();
Loading

0 comments on commit 5abb172

Please sign in to comment.