WIP Mocha tests.

This commit is contained in:
Olly Smith 2012-06-26 07:15:54 +01:00
parent 67525d5735
commit 07716fadd0
14 changed files with 53 additions and 31 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
build/
node_modules/

33
grunt.js Normal file
View File

@ -0,0 +1,33 @@
module.exports = function (grunt) {
grunt.initConfig({
coffee: {
lib: {
src: ['lib/morris.coffee'],
dest: 'build/lib',
options: { bare: false }
},
spec: {
src: ['spec/lib/*.coffee'],
dest: 'build/spec/lib',
options: { bare: false }
}
},
concat: {
'morris.js': ['build/lib/*.js']
},
min: {
'morris.min.js': 'morris.js'
},
mocha: {
spec: {
runner: ['spec/spec_runner.html'],
specs: ['build/spec/**/*.js']
}
}
});
grunt.loadNpmTasks('grunt-coffee');
grunt.loadNpmTasks('grunt-mocha');
grunt.registerTask('default', 'coffee concat min mocha');
};

View File

@ -1,4 +1,3 @@
// Generated by CoffeeScript 1.3.3
(function() { (function() {
var $, Morris, minutesSpecHelper, secondsSpecHelper, var $, Morris, minutesSpecHelper, secondsSpecHelper,
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };

1
morris.min.js vendored

File diff suppressed because one or more lines are too long

18
spec/spec_runner.html Normal file
View File

@ -0,0 +1,18 @@
<!doctype html>
<head>
<meta charset="utf-8">
<script src="vendor/jquery-1.7.2.min.js"></script>
<link rel="stylesheet" href="vendor/mocha-1.1.0.css" type="text/css" media="screen" />
<script type="text/javascript" src="vendor/mocha-1.1.0.js"></script>
<script type="text/javascript" src="vendor/chai-1.0.4.js"></script>
<script type="text/javascript" src="vendor/raphael-2.1.0.min.js"></script>
<script type="text/javascript" src="../morris.js"></script>
<script>
should = chai.should();
</script>
</head>
<body>
<div id="mocha"></div>
<div id="test" style="visibility: hidden"></div>
</body>
</html>

View File

@ -1,29 +0,0 @@
<!doctype html>
<head>
<meta charset="utf-8">
<script src="lib/jquery-1.7.2.min.js"></script>
<script src="lib/coffee-script-1.3.3.js"></script>
<link rel="stylesheet" href="lib/mocha-1.1.0.css" type="text/css" media="screen" />
<script type="text/javascript" src="lib/mocha-1.1.0.js"></script>
<script type="text/javascript" src="lib/chai-1.0.4.js"></script>
<script type="text/javascript" src="lib/raphael-2.1.0.min.js"></script>
<script type="text/javascript" src="../morris.js"></script>
<script>
mocha.setup('bdd')
should = chai.should()
</script>
<script src="test.unit.js"></script>
<script>
$(function () {
mocha.run()
})
</script>
</head>
<body>
<div id="mocha"></div>
<div id="test" style="visibility: hidden"></div>
</body>
</html>