Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds support for unit test and Adds a widget loading test #663

Merged
merged 1 commit into from Aug 9, 2015
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -1,8 +1,10 @@
sudo : false
language: node_js
node_js:
- "0.10"
before_script:
- npm install -g bower

This comment has been minimized.

@GordonSmith

GordonSmith Aug 9, 2015
Member

Can you also add "sudo: false" to the first line this file?

- npm install -g gulp
- bower install
after_script:
- gulp
@@ -16,14 +16,15 @@ const bump = require('gulp-bump');
const argv = require('yargs').argv;
const filter = require('gulp-filter');
const tag_version = require('gulp-tag-version');
const jscs = require('gulp-jscs');
const jshint = require('gulp-jshint');
const mochaPhantomJS = require('gulp-mocha-phantomjs');

// Consts
const cfg = {
src: 'src',
dist: 'dist',
distamd: 'dist-amd',
test: 'test',
prefix: "hpcc-viz"
};

@@ -85,14 +86,6 @@ gulp.task('build-css', css.bind(null, false));

gulp.task('optimize-css', css.bind(null, true));

gulp.task('jscs', function() {
gutil.log("JSCS the files...." + '\n');
var lintFilter = filter(["**", "!config.js", "!map/us-counties.js", "!map/us-states.js", "!map/countries.js"]);
return gulp.src(cfg.src + '/**/*.js')
.pipe(jscs())
;
});

gulp.task('lint', function () {
var lintFilter = filter(["**", "!config.js", "!map/us-counties.js", "!map/us-states.js", "!map/countries.js"]);
return gulp.src(cfg.src + '/**/*.js')
@@ -103,6 +96,15 @@ gulp.task('lint', function () {
;
});

gulp.task('unitTest', function () {
return gulp
.src(cfg.test + '/runner.html') // This will fail if any HTML file has a BOM.
.pipe(mochaPhantomJS({ reporter: 'dot' }))
;
});

gulp.task("test", ["lint", "unitTest"]);

gulp.task('build-nonamd', ['build-css', 'optimize-css'], function (cb) {
async.each(bundles, buildModule, cb);
});
@@ -223,4 +225,4 @@ gulp.task("tag-release", ["tag"], function (cb) {
var version = require("./package.json").version;
var target = argv.upstream ? "upstream" : "origin"
git.push(target, 'v' + version, cb);
});
});
@@ -3,7 +3,6 @@
"version": "1.3.0",
"description": "HPCC Visualization Framework",
"devDependencies": {
"fs": "^0.0.2",
"async": "^0.9.0",
"gulp": "^3.8.11",
"gulp-concat-css": "^2.2.0",
@@ -21,18 +20,20 @@
"gulp-filter": "^2.0.2",
"gulp-tag-version": "^1.2.1",
"yargs": "^3.8.0",
"jshint-stylish": "~1.0.2",
"gulp-jshint": "~1.10.0",
"gulp-jscs": "~1.6.0"
"jshint-stylish": "^2.0.1",
"gulp-jshint": "^1.11.2",
"gulp-mocha-phantomjs": "^0.8.1",
"mocha": "^2.2.5",
"chai": "^3.2.0"
},
"repository": {
"type": "git",
"url": "https://github.com/hpcc-systems/Visualization"
},
"scripts": {
"test": "gulp lint"
"test": "gulp test"
},
"author": "HPCC Systems",
"license": "Apache",
"homepage": "https://github.com/hpcc-systems/Visualization"
}
}
@@ -122,4 +122,4 @@
};

return Menu;
}));
}));
@@ -0,0 +1,96 @@
<!DOCTYPE html>
<html>
<head>
<title>HPCC Visualization Unit Tests</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="../node_modules/mocha/mocha.css" />
</head>
<body>
<div id="mocha"></div>
<script src="../node_modules/mocha/mocha.js"></script>
<script src="../node_modules/chai/chai.js"></script>

<script src="../bower_components/requirejs/require.js"></script>
<script src="../src/config.js"></script>
<script>
mocha.setup('bdd');
var assert = chai.assert;
var allWidgets = [
{ path: "src/common/FAChar" },
{ path: "src/common/Icon" },
{ path: "src/common/List" },
{ path: "src/common/Menu" },
{ path: "src/common/ResizeSurface" },
{ path: "src/common/Shape" },
{ path: "src/common/Surface" },
{ path: "src/common/Text" },
{ path: "src/common/TextBox" },
{ path: "src/chart/Area" },
{ path: "src/chart/Bubble" },
{ path: "src/chart/Column" },
{ path: "src/chart/Line" },
{ path: "src/chart/MultiChart" },
{ path: "src/chart/MultiChartSurface" },
{ path: "src/chart/Pie" },
{ path: "src/chart/Scatter" },
{ path: "src/chart/Step" },
{ path: "src/chart/Summary" },
{ path: "src/form/Form" },
{ path: "src/form/Input" },
{ path: "src/form/Slider" },
{ path: "src/map/ChoroplethCounties" },
{ path: "src/map/ChoroplethCountries" },
{ path: "src/map/ChoroplethStates" },
{ path: "src/map/GMap" },
{ path: "src/tree/CirclePacking" },
{ path: "src/tree/Dendrogram" },
{ path: "src/tree/SunburstPartition" },
{ path: "src/graph/Edge" },
{ path: "src/graph/Graph" },
{ path: "src/graph/Vertex" },
{ path: "src/other/MorphText" },
{ path: "src/other/Table" },
{ path: "src/other/WordCloud" },
{ path: "src/marshaller/HTML" },
{ path: "src/marshaller/Graph" },
{ path: "src/layout/Surface" },
{ path: "src/layout/Cell" },
{ path: "src/layout/Grid" },
{ path: "src/layout/Border" },
{ path: "src/c3chart/Area" },
{ path: "src/c3chart/Bar" },
{ path: "src/c3chart/Column" },
{ path: "src/c3chart/Donut" },
{ path: "src/c3chart/Gauge" },
{ path: "src/c3chart/Line" },
{ path: "src/c3chart/Pie" },
{ path: "src/c3chart/Scatter" },
{ path: "src/c3chart/Step" },
{ path: "src/google/Area" },
{ path: "src/google/Bar" },
{ path: "src/google/Column" },
{ path: "src/google/Line" },
{ path: "src/google/Pie" },
{ path: "src/google/Scatter" },
{ path: "src/google/Timeline" },
{ path: "src/google/TreeMap" },
{ path: "src/amchart/Area" },
{ path: "src/amchart/Bar" },
{ path: "src/amchart/Bubble" },
{ path: "src/amchart/Candle" },
{ path: "src/amchart/FloatingColumn" },
{ path: "src/amchart/Funnel" },
{ path: "src/amchart/Gauge" },
{ path: "src/amchart/Line" },
{ path: "src/amchart/Pie" },
{ path: "src/amchart/Polar" },
{ path: "src/amchart/Pyramid" },
{ path: "src/amchart/Scatter" }
]
require(["./widgets"], function () {
mocha.run();
});
</script>
</body>
</html>
@@ -0,0 +1,23 @@
"use strict";
define(["require"], function (require) {
describe("widgets", function () {
allWidgets.forEach(function (widget) {
var path = widget.path;
describe(path, function () {
it("require load", function (done) {
require([path], function (Widget) {
done();
});
});

it("features", function (done) {
require([path], function (Widget) {
assert.isFunction(Widget);
assert.isFunction(Widget.prototype.constructor, "constructor");
done();
});
});
});
});
});
});
ProTip! Use n and p to navigate between commits in a pull request.