diff --git a/.gitignore b/.gitignore index f3aab501..1ae63f61 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ demos docs node_modules +report .grunt npm-debug.log diff --git a/.travis.yml b/.travis.yml index 661cc572..59fc266f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,13 @@ language: node_js node_js: -- '4.4.5' +- '6.3.0' before_script: - npm install grunt-cli -g +- npm install codecov -g script: -- grunt test deploy +- npm test +- npm run codecov +- npm run deploy branches: only: - master diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..b8c222db --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,130 @@ +# Contributing to TableFilter +:+1::tada: First off, thanks for taking the time to contribute! :tada::+1: + +## Reporting bugs +Bugs are tracked as [GitHub issues](https://guides.github.com/features/issues/). +Create an issue and provide the following information. + +Explain the problem and include additional details to help maintainers reproduce +the problem: + +* **Use a clear, concise and descriptive title** for the issue to identify the +problem. +* **Describe the exact steps which reproduce the problem** in as many details +as possible. +* **Provide specific examples to demonstrate the steps**. Include links to +files or GitHub projects, or copy/pasteable snippets, which you use in those +examples. If you're providing snippets in the issue, use +[Markdown code blocks](https://guides.github.com/features/mastering-markdown/#GitHub-flavored-markdown). +Do not paste large snippets completely unrelated to the issue. +* **Describe the behavior you observed after following the steps** and point +out what exactly is the problem with that behavior. +* **Explain which behavior you expected to see instead and why.** +* Do not hesitate to **include screenshots and animated GIFs** which show you +following the described steps and clearly demonstrate the problem. +You can use [this tool](http://www.cockos.com/licecap/) to record GIFs on macOS +and Windows, and [this tool](https://github.com/colinkeenan/silentcast) or +[this tool](https://github.com/GNOME/byzanz) on Linux. + +### Template for submitting bug reports + + [Short description of problem here] + + **Reproduction steps:** + + 1. [First Step] + 2. [Second Step] + 3. [Other Steps...] + + **Expected behavior:** + + [Describe expected behavior here] + + **Observed behavior:** + + [Describe observed behavior here] + + **Screenshots and GIFs** + + ![Screenshots and GIFs which follow reproduction steps to demonstrate the + problem](url) + + **TableFilter version:** [Enter TableFilter version here] + **Browser and version:** [Enter Browser name and version here] + **OS and version:** [Enter OS name and version here] + + **Additional information:** + + * Problem started happening recently, didn't happen in an older version of + TableFilter: [Yes/No] + * Problem can be reliably reproduced, doesn't happen randomly: [Yes/No] + +## Suggesting enhancements and features +Enhancement and feature suggestions are tracked as +[GitHub issues](https://guides.github.com/features/issues/). +Create an issue and provide the following information: + +* **Use a clear and descriptive title** for the issue to identify the +suggestion. +* **Provide a step-by-step description of the suggested enhancement/feature** +in as many details as possible. +* When applicable **describe the current behavior** and +**explain which behavior you expected to see instead** and why. +* **Include screenshots and animated GIFs** which help you demonstrate the +steps or point out the part of TableFilter which the suggestion is related to. +You can use [this tool](http://www.cockos.com/licecap/) to record GIFs on macOS +and Windows, and [this tool](https://github.com/colinkeenan/silentcast) or +[this tool](https://github.com/GNOME/byzanz) on Linux. +* **Explain why this enhancement would be useful** to most TableFilter users. + +### Template for submitting enhancement and feature suggestions + + [Short description of suggestion] + + **Steps which explain the enhancement/feature** + + 1. [First Step] + 2. [Second Step] + 3. [Other Steps...] + + **Current and suggested behavior** + + [Describe current and suggested behavior here] + + **Why would the enhancement be useful to most users** + + [Explain why the enhancement would be useful to most users] + + **Screenshots and GIFs** + + ![Screenshots and GIFs which demonstrate the steps or part of TableFilter + the enhancement suggestion is related to](url) + + **TableFilter Version:** [Enter TableFilter version here] + **Browser and version:** [Enter Browser name and version here] + **OS and version:** [Enter OS name and version here] + +## Code contribution +TableFilter welcomes contributions from anyone and everyone. If you want to get +your hands dirty: + +### Pull requests +In general, we follow the "fork-and-pull" Git workflow. + + 1. **Fork** the repo on GitHub + 2. **Clone** the project to your own machine + 3. **Commit** changes to your own branch + - 3.1. **Add** unit tests covering your change in the `test` folder + - 3.2. **Run** the tests with the `npm run eslint test` command + - 3.3. **Ensure** build is working with `npm run build-all` command + 4. **Push** your work back up to your fork + 5. Submit a **Pull request** so that we can review your changes + +NOTE: Be sure to merge the latest from "upstream" before making a pull request! + +## Donations +To support this project simply locate the `Donate` button in the [project's +website](http://koalyptus.github.io/TableFilter/) +which points to PayPal. +Thanks to all those who supported this project in the past and to those who will +in the future! diff --git a/Gruntfile.js b/Gruntfile.js index b851a19e..cb93bb45 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -2,12 +2,14 @@ module.exports = function (grunt) { var webpack = require('webpack'); var webpackConfig = require('./webpack.config.js'); + var webpackTestConfig = require('./webpack.test.config.js'); var fs = require('fs'); var path = require('path'); var testDir = 'test'; var testHost = 'http://localhost:8000/'; var pkg = grunt.file.readJSON('package.json'); var repo = 'github.com/koalyptus/TableFilter'; + var styleDirDist = 'dist/tablefilter/style/'; grunt.initConfig({ @@ -24,6 +26,19 @@ module.exports = function (grunt) { }, qunit: { + options: { + '--web-security': 'no', + coverage: { + disposeCollector: true, + src: ['dist/tablefilter/*.js'], + instrumentedFiles: 'temp/', + htmlReport: 'report/coverage', + coberturaReport: 'report/', + lcovReport: 'report/', + jsonReport: 'report', + linesThresholdPct: 80 + } + }, all: { options: { urls: getTestFiles(testDir, testHost) @@ -127,7 +142,8 @@ module.exports = function (grunt) { webpack: { options: webpackConfig, build: webpackConfig.build, - dev: webpackConfig.dev + dev: webpackConfig.dev, + test: webpackTestConfig }, watch: { @@ -187,25 +203,26 @@ module.exports = function (grunt) { files: [ { src: ['static/style/*.styl'], - dest: 'dist/tablefilter/style/tablefilter.css' + dest: styleDirDist + 'tablefilter.css' }, { src: ['static/style/extensions/colsVisibility.styl'], - dest: 'dist/tablefilter/style/colsVisibility.css' + dest: styleDirDist + 'colsVisibility.css' }, { src: ['static/style/extensions/filtersVisibility.styl'], - dest: 'dist/tablefilter/style/filtersVisibility.css' + dest: styleDirDist + 'filtersVisibility.css' }, { src: ['static/style/themes/default/*.styl'], - dest: - 'dist/tablefilter/style/themes/default/default.css' + dest: styleDirDist + 'themes/default/default.css' }, { src: ['static/style/themes/mytheme/*.styl'], - dest: - 'dist/tablefilter/style/themes/mytheme/mytheme.css' + dest: styleDirDist + 'themes/mytheme/mytheme.css' }, { src: ['static/style/themes/skyblue/*.styl'], + dest: styleDirDist + 'themes/skyblue/skyblue.css' + }, { + src: ['static/style/themes/transparent/*.styl'], dest: - 'dist/tablefilter/style/themes/skyblue/skyblue.css' + styleDirDist + 'themes/transparent/transparent.css' } ] } @@ -284,7 +301,6 @@ module.exports = function (grunt) { }); grunt.loadNpmTasks('grunt-eslint'); - grunt.loadNpmTasks('grunt-contrib-qunit'); grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-contrib-watch'); @@ -293,10 +309,11 @@ module.exports = function (grunt) { grunt.loadNpmTasks('grunt-webpack'); grunt.loadNpmTasks('grunt-babel'); grunt.loadNpmTasks('grunt-esdoc'); + grunt.loadNpmTasks('grunt-qunit-istanbul'); grunt.loadNpmTasks('grunt-contrib-stylus'); grunt.loadNpmTasks('grunt-gh-pages'); - grunt.registerTask('default', ['build', 'test', 'build-demos']); + grunt.registerTask('default', ['test', 'build', 'build-demos']); // Development server grunt.registerTask('server', ['webpack-dev-server:start']); @@ -314,11 +331,15 @@ module.exports = function (grunt) { grunt.registerTask('build-demos', ['copy:templates', 'copy:assets', 'string-replace:demos', 'copy:starter', 'clean']); + // Build tests + grunt.registerTask('build-test', + ['eslint', 'webpack:test', 'copy:dist', 'stylus:compile']); + // Transpile with Babel grunt.registerTask('dev-modules', ['babel', 'copy:dist']); - // Tests - grunt.registerTask('test', ['eslint', 'connect', 'qunit:all']); + // Tests with coverage + grunt.registerTask('test', ['build-test', 'connect', 'qunit:all']); // Publish to gh-pages grunt.registerTask('publish', 'Publish from CLI', [ @@ -374,7 +395,6 @@ module.exports = function (grunt) { // Returns the list of test files from the test folder for qunit task function getTestFiles(testDir, host) { - var getFiles = function (dir, host) { var res = []; var items = fs.readdirSync(dir); diff --git a/README.md b/README.md index 99c0956a..14cd5a5e 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ [![Build Status](https://api.travis-ci.org/koalyptus/TableFilter.svg?branch=master)](https://travis-ci.org/koalyptus/TableFilter) [![Document](http://koalyptus.github.io/TableFilter/docs/badge.svg)](https://koalyptus.github.io/TableFilter/docs/source) +[![codecov](https://codecov.io/gh/koalyptus/TableFilter/branch/master/graph/badge.svg)](https://codecov.io/gh/koalyptus/TableFilter) # TableFilter @@ -12,7 +13,7 @@ users to filter and limit the data displayed within a long table. By default, th ## Features * Convert a regular HTML table into an advanced grid component providing: * Advanced columns filtering model - * Sorting and pagination facilities + * Sorting and pagination capabilities * Complete selection model ([ezEditTable](http://codecanyon.net/item/ezedittable-enhance-html-tables/2425123?ref=koalyptus) extension) * Extended keyboard navigation ([ezEditTable](http://codecanyon.net/item/ezedittable-enhance-html-tables/2425123?ref=koalyptus) extension) * Inline cell or row editing ([ezEditTable](http://codecanyon.net/item/ezedittable-enhance-html-tables/2425123?ref=koalyptus) extension) @@ -26,7 +27,7 @@ solution ## Getting started * Clone the repo using Git: ```shell -git clone --bare https://github.com/koalyptus/TableFilter.git +git clone https://github.com/koalyptus/TableFilter.git ``` * You can [download](https://github.com/koalyptus/TableFilter/archive/master.zip) this repository. @@ -76,46 +77,52 @@ Start by installing any dependencies. ```shell npm install ``` -Use the Grunt ``dev`` task to launch a build / watch cycle and start the local -sever on port ``8080``: +Use +```shell +npm run dev +``` +command to launch a build / watch cycle and start the local +sever on port ``8080``. + +Use +```shell +npm run build +``` +command to generate a production build. + +The +```shell +npm run build-all +``` +command will create a production build, run the tests and finally generate +the demos: + +To run all the tests and generate the coverage report: ```shell -grunt dev +npm test ``` -Use the ``build`` task to generate a production build: - -```shell -grunt build -``` - -The ``default`` Grunt task will create a production build, run the tests and finally generate the demos: - -```shell -grunt -``` - -To run all the tests: - -```shell -grunt test -``` - -and to run specific test(s): +or to run specific test(s): ```shell grunt test-only:test.html grunt test-only:test.html,test-sort.html ``` +to view the coverage report(s), open the `index.html` under the +`report/coverage` folder or +[online](https://codecov.io/gh/koalyptus/TableFilter). + ## Demos -Check out the online [examples](http://koalyptus.github.io/TableFilter/examples) or generate the demos locally: +Check out the online [examples](http://koalyptus.github.io/TableFilter/examples) +or generate the demos locally: ```shell -grunt build-demos +npm run build-demos ``` then run the local webserver: ```shell -grunt server +npm start ``` then pick a demo from: ```shell @@ -132,7 +139,7 @@ options you are using are still supported: [Obsolete](https://github.com/koalypt Run this task to generate the documentation in the ``docs/docs`` directory: ```shell -grunt esdoc +npm run esdoc ``` ## Support diff --git a/dist/starter.html b/dist/starter.html index e1adc775..79a81384 100644 --- a/dist/starter.html +++ b/dist/starter.html @@ -1,10 +1,10 @@
-