diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..d5a072936 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,11 @@ +language: node_js + +before_script: +- npm install -g grunt-cli +- npm install -g bower +- bower install +- npm install + +script: +- npm run build +- npm test \ No newline at end of file diff --git a/karma.conf.js b/karma.conf.js index c59bab7e2..bda01b007 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -2,73 +2,74 @@ // Generated on Thu Feb 18 2016 22:00:23 GMT+0100 (CET) module.exports = function(config) { - config.set({ + config.set({ - // base path that will be used to resolve all patterns (eg. files, exclude) - basePath: '', + // 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'], + // frameworks to use + // available frameworks: https://npmjs.org/browse/keyword/karma-adapter + frameworks: ['jasmine'], - // list of files / patterns to load in the browser - files: [ - 'bower_components/jquery/dist/jquery.min.js', - 'bower_components/jquery-ui/jquery-ui.min.js', - 'bower_components/lodash/dist/lodash.min.js', - 'src/gridstack.js', - 'spec/*-spec.js' - ], + // list of files / patterns to load in the browser + files: [ + 'bower_components/jquery/dist/jquery.min.js', + 'bower_components/jquery-ui/jquery-ui.min.js', + 'bower_components/lodash/dist/lodash.min.js', + 'src/gridstack.js', + 'spec/*-spec.js' + ], - // list of files to exclude - exclude: [ - ], + // 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: { - 'src/gridstack.js': ['coverage'] - }, + // preprocess matching files before serving them to the browser + // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor + preprocessors: { + 'src/gridstack.js': ['coverage'] + }, - // test results reporter to use - // possible values: 'dots', 'progress' - // available reporters: https://npmjs.org/browse/keyword/karma-reporter - reporters: ['progress', 'coverage'], + // test results reporter to use + // possible values: 'dots', 'progress' + // available reporters: https://npmjs.org/browse/keyword/karma-reporter + reporters: ['progress', 'coverage'], - // web server port - port: 9876, + // web server port + port: 9876, - // enable / disable colors in the output (reporters and logs) - colors: true, + // 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, + // 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, + // 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: ['PhantomJS'], + // start these browsers + // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher + browsers: ['PhantomJS'], - // Continuous Integration mode - // if true, Karma captures browsers, runs the tests and exits - singleRun: false, + // Continuous Integration mode + // if true, Karma captures browsers, runs the tests and exits + singleRun: true, - // Concurrency level - // how many browser should be started simultaneous - concurrency: Infinity - }) + // Concurrency level + // how many browser should be started simultaneous + concurrency: Infinity + }); } diff --git a/package.json b/package.json index 10014170d..84168f055 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,10 @@ "type": "git", "url": "git+https://github.com/troolee/gridstack.js.git" }, + "scripts": { + "build": "grunt", + "test": "karma start karma.conf.js" + }, "keywords": [ "gridstack", "grid", diff --git a/spec/gridstack-spec.js b/spec/gridstack-spec.js index 84026fe0a..a96bd7c55 100644 --- a/spec/gridstack-spec.js +++ b/spec/gridstack-spec.js @@ -73,16 +73,16 @@ describe('gridstack', function() { it('should sort ascending without width.', function() { w.width = false; - w.nodes = [{x: 7, y: 0}, {x: 4, y: 4}, {x: 9, y: 0}, {x: 0, y: 1}]; + w.nodes = [{x: 7, y: 0, width: 1}, {x: 4, y: 4, width: 1}, {x: 9, y: 0, width: 1}, {x: 0, y: 1, width: 1}]; e.prototype._sortNodes.call(w, 1); - expect(w.nodes).toEqual([{x: 0, y: 1}, {x: 7, y: 0}, {x: 4, y: 4}, {x: 9, y: 0}]); + expect(w.nodes).toEqual([{x: 7, y: 0, width: 1}, {x: 9, y: 0, width: 1}, {x: 0, y: 1, width: 1}, {x: 4, y: 4, width: 1}]); }); it('should sort descending without width.', function() { w.width = false; - w.nodes = [{x: 7, y: 0}, {x: 4, y: 4}, {x: 9, y: 0}, {x: 0, y: 1}]; + w.nodes = [{x: 7, y: 0, width: 1}, {x: 4, y: 4, width: 1}, {x: 9, y: 0, width: 1}, {x: 0, y: 1, width: 1}]; e.prototype._sortNodes.call(w, -1); - expect(w.nodes).toEqual([{x: 9, y: 0}, {x: 4, y: 4}, {x: 7, y: 0}, {x: 0, y: 1}]); + expect(w.nodes).toEqual([{x: 4, y: 4, width: 1}, {x: 0, y: 1, width: 1}, {x: 9, y: 0, width: 1}, {x: 7, y: 0, width: 1}]); }); });