mirror of
https://github.com/mdbootstrap/mdb-ui-kit.git
synced 2025-02-20 13:40:42 +03:00
adding unit testing hooks, connect server, jshint, watch tasks and livereload
This commit is contained in:
parent
f92f3e6ee8
commit
6eaa0295bd
108
Gruntfile.js
108
Gruntfile.js
|
@ -1,8 +1,7 @@
|
||||||
module.exports = function(grunt) {
|
module.exports = function(grunt) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
require('load-grunt-tasks')(grunt);
|
require("load-grunt-tasks")(grunt);
|
||||||
|
|
||||||
grunt.initConfig({
|
grunt.initConfig({
|
||||||
|
|
||||||
|
@ -62,10 +61,115 @@ module.exports = function(grunt) {
|
||||||
dest: "template/material/"
|
dest: "template/material/"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
connect: {
|
||||||
|
options: {
|
||||||
|
port: 8040,
|
||||||
|
hostname: "localhost",
|
||||||
|
livereload: 35740,
|
||||||
|
keepalive: true
|
||||||
|
|
||||||
|
},
|
||||||
|
livereload: {
|
||||||
|
options: {
|
||||||
|
open: true,
|
||||||
|
base: "."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
test: {
|
||||||
|
options: {
|
||||||
|
port: 8041,
|
||||||
|
open: 'http://localhost:8041/SpecRunner.html',
|
||||||
|
base: [
|
||||||
|
"scripts",
|
||||||
|
"test"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
jasmine: {
|
||||||
|
src: 'scripts/**/*.js',
|
||||||
|
options: {
|
||||||
|
specs: 'test/*Spec.js',
|
||||||
|
helpers: 'test/*Helper.js',
|
||||||
|
vendor: [
|
||||||
|
'https://code.jquery.com/jquery-1.10.2.min.js',
|
||||||
|
'https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
jshint: {
|
||||||
|
options: {
|
||||||
|
jshintrc: ".jshintrc",
|
||||||
|
reporter: require("jshint-stylish")
|
||||||
|
},
|
||||||
|
all: [
|
||||||
|
"Gruntfile.js",
|
||||||
|
"scripts/**/*.js",
|
||||||
|
"template/**/*.js",
|
||||||
|
"test/**/*.js"
|
||||||
|
],
|
||||||
|
test: {
|
||||||
|
options: {
|
||||||
|
jshintrc: "test/.jshintrc",
|
||||||
|
src: ["test/**/*.js"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
watch: {
|
||||||
|
js: {
|
||||||
|
files: ["Gruntfile.js", "scripts/**/*.js", "template/**/*.js"],
|
||||||
|
tasks: ["newer:jshint:all"]
|
||||||
|
},
|
||||||
|
jsTest: {
|
||||||
|
files: ["test/**/*.js"],
|
||||||
|
tasks: ["newer:jshint:test", "jasmine"]
|
||||||
|
},
|
||||||
|
livereload: {
|
||||||
|
options: {
|
||||||
|
livereload: "<%= connect.options.livereload %>"
|
||||||
|
},
|
||||||
|
files: [
|
||||||
|
'index.html',
|
||||||
|
'css-compiled/**/*.css',
|
||||||
|
'**/*.{png,jpg,jpeg,gif,webp,svg}'
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
grunt.registerTask("default", ["less", "autoprefixer", "cssmin", "copy"]);
|
grunt.registerTask("default", ["less", "autoprefixer", "cssmin", "copy"]);
|
||||||
|
|
||||||
grunt.registerTask("scss", ["sass", "autoprefixer", "cssmin", "copy"]);
|
grunt.registerTask("scss", ["sass", "autoprefixer", "cssmin", "copy"]);
|
||||||
|
|
||||||
|
grunt.registerTask("build", function(target) {
|
||||||
|
var buildType = "default";
|
||||||
|
if (target && target === "scss") {
|
||||||
|
buildType = "scss";
|
||||||
|
}
|
||||||
|
|
||||||
|
grunt.task.run(["newer:jshint", "test", buildType]);
|
||||||
|
});
|
||||||
|
|
||||||
|
grunt.registerTask("test", [
|
||||||
|
"connect:test",
|
||||||
|
"jasmine"
|
||||||
|
]);
|
||||||
|
|
||||||
|
grunt.registerTask("serve", function(target){
|
||||||
|
var buildTarget = "default";
|
||||||
|
if(target && target === "scss") {
|
||||||
|
buildTarget = "scss";
|
||||||
|
}
|
||||||
|
grunt.task.run([
|
||||||
|
"build:"+ buildTarget,
|
||||||
|
"connect:livereload",
|
||||||
|
"watch"
|
||||||
|
])
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -19,10 +19,15 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"grunt": "^0.4.5",
|
"grunt": "^0.4.5",
|
||||||
"grunt-autoprefixer": "^1.0.1",
|
"grunt-autoprefixer": "^1.0.1",
|
||||||
|
"grunt-contrib-connect": "^0.8.0",
|
||||||
"grunt-contrib-copy": "^0.6.0",
|
"grunt-contrib-copy": "^0.6.0",
|
||||||
"grunt-contrib-cssmin": "^0.10.0",
|
"grunt-contrib-cssmin": "^0.10.0",
|
||||||
|
"grunt-contrib-jasmine": "^0.8.0",
|
||||||
|
"grunt-contrib-jshint": "^0.10.0",
|
||||||
"grunt-contrib-less": "^0.11.4",
|
"grunt-contrib-less": "^0.11.4",
|
||||||
"grunt-contrib-sass": "^0.8.1",
|
"grunt-contrib-sass": "^0.8.1",
|
||||||
|
"grunt-contrib-watch": "^0.6.1",
|
||||||
|
"jshint-stylish": "^1.0.0",
|
||||||
"load-grunt-tasks": "^0.6.0"
|
"load-grunt-tasks": "^0.6.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
44
test/.jshintrc
Normal file
44
test/.jshintrc
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
{
|
||||||
|
"bitwise": true,
|
||||||
|
"camelcase": true,
|
||||||
|
"curly": true,
|
||||||
|
"eqeqeq": false,
|
||||||
|
"es3": false,
|
||||||
|
"forin": true,
|
||||||
|
"freeze": false,
|
||||||
|
"immed": true,
|
||||||
|
"indent": 4,
|
||||||
|
"latedef": true,
|
||||||
|
"newcap": true,
|
||||||
|
"noarg": true,
|
||||||
|
"noempty": true,
|
||||||
|
"nonbsp": true,
|
||||||
|
"nonew": true,
|
||||||
|
"plusplus": false,
|
||||||
|
"quotmark": "double",
|
||||||
|
"undef": true,
|
||||||
|
"unused": true,
|
||||||
|
"strict": false,
|
||||||
|
"trailing": true,
|
||||||
|
"maxparams": 5,
|
||||||
|
"maxdepth": 5,
|
||||||
|
"maxstatements": 50,
|
||||||
|
"maxlen": 150,
|
||||||
|
|
||||||
|
"eqnull": true,
|
||||||
|
|
||||||
|
"browser": false,
|
||||||
|
"devel": false,
|
||||||
|
"node": true,
|
||||||
|
|
||||||
|
"white": true,
|
||||||
|
|
||||||
|
"globals": {
|
||||||
|
"$": true,
|
||||||
|
"document": true,
|
||||||
|
"brackets": true,
|
||||||
|
"define": true,
|
||||||
|
"Mustache": true,
|
||||||
|
"window": true
|
||||||
|
}
|
||||||
|
}
|
26
test/SpecRunner.html
Normal file
26
test/SpecRunner.html
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
<!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>
|
8
test/materialSpec.js
Normal file
8
test/materialSpec.js
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
describe('Material', function (){
|
||||||
|
|
||||||
|
it('jquery should be loaded', function () {
|
||||||
|
expect($).toBeDefined();
|
||||||
|
});
|
||||||
|
});
|
0
test/ripplesSpec.js
Normal file
0
test/ripplesSpec.js
Normal file
Loading…
Reference in New Issue
Block a user