From 698fce3ac43cfd61cff67ad564360c0dfd22a8e6 Mon Sep 17 00:00:00 2001 From: Pavel Reznikov Date: Mon, 22 Feb 2016 10:48:00 -0800 Subject: [PATCH 1/4] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 2aeab51..8881bc2 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ gridstack.js ============ [![Build Status](https://travis-ci.org/troolee/gridstack.js.svg?branch=master)](https://travis-ci.org/troolee/gridstack.js) +[![Coverage Status](https://coveralls.io/repos/github/troolee/gridstack.js/badge.svg?branch=master)](https://coveralls.io/github/troolee/gridstack.js?branch=master) gridstack.js is a jQuery plugin for widget layout. This is drag-and-drop multi-column grid. It allows you to build draggable responsive bootstrap v3 friendly layouts. It also works great with [knockout.js](http://knockoutjs.com), [angular.js](https://angularjs.org) and touch devices. From 464a8e89822c076f2269db55d3ea0be474fa0dfb Mon Sep 17 00:00:00 2001 From: Kevin Dietrich Date: Mon, 22 Feb 2016 20:36:09 +0100 Subject: [PATCH 2/4] Added travis --- .travis.yml | 11 +++++ karma.conf.js | 91 +++++++++++++++++++++--------------------- package.json | 4 ++ spec/gridstack-spec.js | 8 ++-- 4 files changed, 65 insertions(+), 49 deletions(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..d5a0729 --- /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 c59bab7..bda01b0 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 1001417..84168f0 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 84026fe..a96bd7c 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}]); }); }); From d915030cd6d7dc7dec836ad2ab00b0b5b1e3cc60 Mon Sep 17 00:00:00 2001 From: Pavel Reznikov Date: Mon, 22 Feb 2016 12:52:09 -0800 Subject: [PATCH 3/4] trying to setup coveralls --- package.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 84168f0..68780b6 100644 --- a/package.json +++ b/package.json @@ -25,12 +25,15 @@ }, "homepage": "http://troolee.github.io/gridstack.js/", "devDependencies": { + "coveralls": "^2.11.6", "grunt": "^0.4.5", "grunt-contrib-copy": "^0.8.2", "grunt-contrib-cssmin": "^0.14.0", "grunt-contrib-jshint": "^1.0.0", "grunt-contrib-uglify": "^0.10.1", + "grunt-contrib-watch": "^0.6.1", "grunt-doctoc": "^0.1.1", + "grunt-jscs": "^2.7.0", "grunt-sass": "^1.1.0", "jasmine-core": "^2.4.1", "karma": "^0.13.21", @@ -38,8 +41,6 @@ "karma-jasmine": "^0.3.7", "karma-phantomjs-launcher": "^1.0.0", "phantomjs": "^2.1.3", - "phantomjs-prebuilt": "^2.1.4", - "grunt-contrib-watch": "^0.6.1", - "grunt-jscs": "^2.7.0" + "phantomjs-prebuilt": "^2.1.4" } } From 2247a361c29df03b137b5bdd7b94a646a6db04d8 Mon Sep 17 00:00:00 2001 From: Pavel Reznikov Date: Mon, 22 Feb 2016 13:04:34 -0800 Subject: [PATCH 4/4] coverall --- karma.conf.js | 6 +++++- package.json | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/karma.conf.js b/karma.conf.js index bda01b0..a2472da 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -38,8 +38,12 @@ module.exports = function(config) { // test results reporter to use // possible values: 'dots', 'progress' // available reporters: https://npmjs.org/browse/keyword/karma-reporter - reporters: ['progress', 'coverage'], + reporters: ['progress', 'coverage', 'coveralls'], + coverageReporter: { + type: 'lcov', // lcov or lcovonly are required for generating lcov.info files + dir: 'coverage/' + }, // web server port port: 9876, diff --git a/package.json b/package.json index 68780b6..12d5075 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ "jasmine-core": "^2.4.1", "karma": "^0.13.21", "karma-coverage": "^0.5.3", + "karma-coveralls": "^1.1.2", "karma-jasmine": "^0.3.7", "karma-phantomjs-launcher": "^1.0.0", "phantomjs": "^2.1.3",