From a26c690f4ff2380202a695e9de6730af347b5e82 Mon Sep 17 00:00:00 2001 From: Patrick Date: Sat, 4 Apr 2015 10:41:58 +0200 Subject: [PATCH] feat(tests): adds tests, initial configuration --- demo/app/scripts/app.js | 3 +- gulpfile.js | 12 ++++++++ karma.conf.js | 67 +++++++++++++++++++++++++++++++++++++++++ package.json | 7 +++++ test/gestures.Spec.js | 5 +++ 5 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 gulpfile.js create mode 100644 karma.conf.js create mode 100644 test/gestures.Spec.js diff --git a/demo/app/scripts/app.js b/demo/app/scripts/app.js index 9412630..c01300c 100644 --- a/demo/app/scripts/app.js +++ b/demo/app/scripts/app.js @@ -12,7 +12,8 @@ angular.module('angularGesturesDemoApp', ['angular-gestures', 'ngRoute']) }); hammerDefaultOptsProvider.set({ recognizers: [ - [Hammer.Tap], + [Hammer.Tap,{ event: 'tap'}], + [Hammer.Tap, { event: 'doubletap', taps: 2 }, [], ['tap']], [Hammer.Press], [Hammer.Pan] ] diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..7a22d56 --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,12 @@ +var gulp = require('gulp'); +var karma = require('karma').server; + +/** + * Run test once and exit + */ +gulp.task('test', function (done) { + karma.start({ + configFile: __dirname + '/karma.conf.js', + singleRun: true + }, done); +}); \ No newline at end of file diff --git a/karma.conf.js b/karma.conf.js new file mode 100644 index 0000000..e3a954b --- /dev/null +++ b/karma.conf.js @@ -0,0 +1,67 @@ +// Karma configuration +// Generated on Sat Apr 04 2015 10:33:04 GMT+0200 (CEST) + +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'], + + + // list of files / patterns to load in the browser + files: [ + 'components/**/*.min.js', // dependecies + 'src/**/*.js', + 'test/**/*.Spec.js' + ], + + + // list of files to exclude + exclude: [ + ], + + + // 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 + }); +}; diff --git a/package.json b/package.json index fe133df..ad4ce24 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,13 @@ "grunt-contrib-jshint": "~0.3.0", "grunt-contrib-uglify": "~0.2.0", "grunt-contrib-watch": "^0.6.1", + "gulp": "^3.8.11", + "gulp-karma": "0.0.4", + "jasmine-core": "^2.2.0", + "karma": "^0.12.31", + "karma-chrome-launcher": "^0.1.7", + "karma-cli": "0.0.4", + "karma-jasmine": "^0.3.5", "load-grunt-tasks": "^1.0.0", "matchdep": "~0.1.1", "time-grunt": "^1.0.0" diff --git a/test/gestures.Spec.js b/test/gestures.Spec.js new file mode 100644 index 0000000..522ed91 --- /dev/null +++ b/test/gestures.Spec.js @@ -0,0 +1,5 @@ +describe("A suite", function() { + it("contains spec with an expectation", function() { + expect(true).toBe(true); + }); +}); \ No newline at end of file