adding specrunner and its build config for testing in browser

This commit is contained in:
Nelson Omuto 2014-10-03 15:46:35 -04:00
parent 6eaa0295bd
commit 0f78f2894e
5 changed files with 52 additions and 35 deletions

1
.gitignore vendored
View File

@ -7,3 +7,4 @@
Thumbs.db Thumbs.db
.DS_Store .DS_Store
/node_modules/ /node_modules/
.grunt/

View File

@ -80,18 +80,16 @@ module.exports = function(grunt) {
test: { test: {
options: { options: {
port: 8041, port: 8041,
open: 'http://localhost:8041/SpecRunner.html', open: 'http://localhost:8041/_SpecRunner.html',
base: [ base: "."
"scripts",
"test"
]
} }
} }
}, },
jasmine: { jasmine: {
src: 'scripts/**/*.js', scripts: 'scripts/**/*.js',
options: { options: {
build: true,
specs: 'test/*Spec.js', specs: 'test/*Spec.js',
helpers: 'test/*Helper.js', helpers: 'test/*Helper.js',
vendor: [ vendor: [
@ -153,12 +151,12 @@ module.exports = function(grunt) {
buildType = "scss"; buildType = "scss";
} }
grunt.task.run(["newer:jshint", "test", buildType]); grunt.task.run(["newer:jshint", "jasmine:scripts", buildType]);
}); });
grunt.registerTask("test", [ grunt.registerTask("test", [
"connect:test", "jasmine:scripts:build",
"jasmine" "connect:test"
]); ]);
grunt.registerTask("serve", function(target){ grunt.registerTask("serve", function(target){

43
_SpecRunner.html Normal file
View File

@ -0,0 +1,43 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Jasmine Spec Runner</title>
<link rel="shortcut icon" type="image/png" href=".grunt/grunt-contrib-jasmine/jasmine_favicon.png">
<link rel="stylesheet" type="text/css" href=".grunt/grunt-contrib-jasmine/jasmine.css">
</head>
<body>
<script src=".grunt/grunt-contrib-jasmine/es5-shim.js"></script>
<script src=".grunt/grunt-contrib-jasmine/jasmine.js"></script>
<script src=".grunt/grunt-contrib-jasmine/jasmine-html.js"></script>
<script src=".grunt/grunt-contrib-jasmine/json2.js"></script>
<script src=".grunt/grunt-contrib-jasmine/boot.js"></script>
<script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<script src="test/*Helper.js"></script>
<script src="scripts/material.js"></script>
<script src="scripts/ripples.js"></script>
<script src="test/materialSpec.js"></script>
<script src="test/ripplesSpec.js"></script>
<script src=".grunt/grunt-contrib-jasmine/reporter.js"></script>
</body>
</html>

View File

@ -1,26 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Unit Tests Bootstrap Material Design</title>
<link rel="shortcut icon" type="image/png" href="lib/jasmine-2.0.3/jasmine_favicon.png">
<link rel="stylesheet" type="text/css" href="lib/jasmine-2.0.3/jasmine.css">
<script type="text/javascript" src="lib/jasmine-2.0.3/jasmine.js"></script>
<script type="text/javascript" src="lib/jasmine-2.0.3/jasmine-html.js"></script>
<script type="text/javascript" src="lib/jasmine-2.0.3/boot.js"></script>
<!-- include source files here... -->
<script type="text/javascript" src="src/Player.js"></script>
<script type="text/javascript" src="src/Song.js"></script>
<!-- include spec files here... -->
<script type="text/javascript" src="spec/SpecHelper.js"></script>
<script type="text/javascript" src="spec/PlayerSpec.js"></script>
</head>
<body>
</body>
</html>

View File

@ -2,6 +2,7 @@
describe('Material', function (){ describe('Material', function (){
//Dummy test just to ensure tests are accurately configured
it('jquery should be loaded', function () { it('jquery should be loaded', function () {
expect($).toBeDefined(); expect($).toBeDefined();
}); });