Skip to content

Commit

Permalink
Merge pull request speced#259 from dandehavilland/tests
Browse files Browse the repository at this point in the history
Test suite setup
  • Loading branch information
almossawi committed Dec 13, 2014
2 parents 9256ef9 + abcbdfd commit 32ec145
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 3 deletions.
8 changes: 8 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ var
//sass = require('gulp-sass'), // for building css from scss
//minifycss = require('gulp-minify-css'), // for minifiing css
jslint = require('gulp-jslint');
testem = require('gulp-testem');

// paths
var
Expand Down Expand Up @@ -69,3 +70,10 @@ gulp.task('jslint', function () {
nomen: false // true if there are variable names with leading _
}));
});

gulp.task('test', function() {
return gulp.src([''])
.pipe(testem({
configFile: 'testem.json'
}));
});
10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,14 @@
},
"devDependencies": {
"gulp": ">=3.8.10",
"gulp-rimraf": ">=0.1.1",
"gulp-concat": ">=2.4.2",
"gulp-rename": ">=1.2.0",
"gulp-jslint": ">=0.1.9",
"gulp-uglify": ">=1.0.1"
"gulp-rename": ">=1.2.0",
"gulp-rimraf": ">=0.1.1",
"gulp-testem": "0.0.1",
"gulp-uglify": ">=1.0.1",
"gulp-util": "^3.0.1",
"qunitjs": "^1.16.0",
"testem": "^0.6.23"
}
}
30 changes: 30 additions & 0 deletions testem.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"framework": "qunit",
"src_files": [
"node_modules/jquery/dist/jquery.js",
"node_modules/d3/d3.js",

"src/common/data_graphic.js",
"src/common/chart_title.js",
"src/common/y_axis.js",
"src/common/x_axis.js",
"src/common/init.js",
"src/common/markers.js",
"src/layout/button.js",
"src/charts/line.js",
"src/charts/histogram.js",
"src/charts/point.js",
"src/charts/bar.js",
"src/charts/table.js",
"src/charts/missing.js",
"src/misc/process.js",
"src/misc/smoothers.js",
"src/misc/utility.js",
"src/misc/error.js",

"tests/**/*_test.js"
],
"launch_in_dev": [
"PhantomJS"
]
}
20 changes: 20 additions & 0 deletions tests/charts/bar_test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module('Bar Chart');

test('correct number of bars', function() {
data_graphic({
target: '#qunit-fixture',
chart_type: 'bar',
data: [{
label: 'Bar 1',
value: 100
},{
label: 'Bar 2',
value: 200
},{
label: 'Bar 3',
value: 300
}]
});

equal($('#qunit-fixture svg .bar').length, 3, 'should have 3 bars');
});
Empty file added tests/common/.gitkeep
Empty file.
Empty file added tests/misc/.gitkeep
Empty file.

0 comments on commit 32ec145

Please sign in to comment.