moar jshint fixes for tests

This commit is contained in:
Chad Engler 2013-12-08 17:00:30 -08:00
parent 5d516cfb81
commit 6dafb2524d
6 changed files with 51 additions and 20 deletions

View file

@ -37,11 +37,23 @@
"maxcomplexity" : false, // Restrict the cyclomatic complexity of the code.
"maxlen" : 220, // Require that all lines are 100 characters or less.
"globals" : { // Register globals that are used in the code.
//commonjs globals
"module": false,
"require": false,
// PIXI globals
"PIXI": false,
"spine": false
"spine": false,
//chai globals
"chai": false,
//mocha globals
"describe": false,
"it": false,
//resemble globals
"resemble": false
},
// == Relaxing Options ================================================

View file

@ -97,7 +97,7 @@ module.exports = function(grunt) {
},
files: {
srcBlob: '<%= dirs.src %>/**/*.js',
testBlob: '<%= dirs.test %>/{functional,lib/pixi,unit}/**/*.js',
testBlob: '<%= dirs.test %>/{functional,lib/pixi,unit/pixi}/**/*.js',
build: '<%= dirs.build %>/pixi.dev.js',
buildMin: '<%= dirs.build %>/pixi.js'
},
@ -122,10 +122,18 @@ module.exports = function(grunt) {
}
},
jshint: {
src: srcFiles.filter(function(v) { return v.match(/(Intro|Outro|Spine|Pixi)\.js$/) === null; }).concat('Gruntfile.js'),
test: ['<%= files.testBlob %>'],
options: {
jshintrc: '.jshintrc'
},
source: srcFiles.filter(function(v) { return v.match(/(Intro|Outro|Spine|Pixi)\.js$/) === null; }).concat('Gruntfile.js'),
test: {
src: ['<%= files.testBlob %>'],
options: {
jshintrc: undefined, //don't use jshintrc for tests
expr: true,
undef: false,
camelcase: false
}
}
},
uglify: {
@ -170,7 +178,7 @@ module.exports = function(grunt) {
grunt.registerTask('default', ['build', 'test']);
grunt.registerTask('build', ['jshint:src', 'concat', 'uglify']);
grunt.registerTask('build', ['jshint:source', 'concat', 'uglify']);
grunt.registerTask('build-debug', ['concat_sourcemap', 'uglify']);
grunt.registerTask('test', ['concat', 'jshint:test', 'karma']);

View file

@ -16,7 +16,7 @@ describe('Example 1 - Basics', function () {
function animate() {
currentFrame += 1;
requestAnimFrame( animate );
window.requestAnimFrame( animate );
// just for fun, lets rotate mr rabbit a little
bunny.rotation += 0.1;
@ -39,10 +39,10 @@ describe('Example 1 - Basics', function () {
// add the renderer view element to the DOM
document.body.appendChild(renderer.view);
requestAnimFrame( animate );
window.requestAnimFrame( animate );
// create a texture from an image path
var texture = PIXI.Texture.fromImage(baseUri + "/bunny.png");
var texture = PIXI.Texture.fromImage(baseUri + '/bunny.png');
// create a new Sprite using the texture
bunny = new PIXI.Sprite(texture);
@ -67,7 +67,7 @@ describe('Example 1 - Basics', function () {
// loader.on('onProgress', function (event) {
// console.log(event.content);
// });
loader.on('onComplete', function (event) {
loader.on('onComplete', function () {
done();
initScene();
});

View file

@ -2,9 +2,9 @@ describe('pixi/filters/MaskFilter', function () {
'use strict';
var expect = chai.expect;
// var MaskFilter = PIXI.MaskFilter;
var MaskFilter = PIXI.MaskFilter;
// it('Module exists', function () {
// expect(MaskFilter).to.be.a('function');
// });
it('Module exists', function () {
expect(MaskFilter).to.be.a('function');
});
});

View file

@ -2,7 +2,6 @@ describe('pixi/loaders/BitmapFontLoader', function () {
'use strict';
var expect = chai.expect;
var BitmapFontLoader = PIXI.BitmapFontLoader;
it('Module exists', function () {
expect(PIXI.BitmapFontLoader).to.be.a('function');

View file

@ -9,13 +9,17 @@ describe('pixi/utils/EventTarget', function () {
});
it('Confirm new instance', function () {
var obj = {}; EventTarget.call(obj);
var obj = {};
EventTarget.call(obj);
pixi_utils_EventTarget_like(obj);
});
it('addEventListener and dispatchEvent works', function (done) {
var myData = {},
obj = {}; EventTarget.call(obj);
obj = {};
EventTarget.call(obj);
obj.addEventListener('myevent', function (event) {
expect(event).to.be.an('object');
@ -28,7 +32,9 @@ describe('pixi/utils/EventTarget', function () {
});
it('removeEventListener works', function (done) {
var obj = {}; EventTarget.call(obj);
var obj = {};
EventTarget.call(obj);
function onMyEvent() {
done(new Error('addEventListener should not have been called'));
@ -42,7 +48,9 @@ describe('pixi/utils/EventTarget', function () {
it('multiple dispatches', function () {
var called = 0,
obj = {}; EventTarget.call(obj);
obj = {};
EventTarget.call(obj);
function onMyEvent() {
called++;
@ -58,7 +66,9 @@ describe('pixi/utils/EventTarget', function () {
it('multiple events', function () {
var called = 0,
obj = {}; EventTarget.call(obj);
obj = {};
EventTarget.call(obj);
function onMyEvent() {
called++;
@ -75,7 +85,9 @@ describe('pixi/utils/EventTarget', function () {
it('multiple events one removed', function () {
var called = 0,
obj = {}; EventTarget.call(obj);
obj = {};
EventTarget.call(obj);
function onMyEvent() {
called++;