Skip to content

Commit

Permalink
Merge pull request #4 from straker/unitTests
Browse files Browse the repository at this point in the history
Finalizing unit tests and api
  • Loading branch information
straker committed Sep 25, 2015
2 parents ff6c19f + 0775f25 commit f1f5bbe
Show file tree
Hide file tree
Showing 24 changed files with 1,927 additions and 418 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,5 +1,6 @@
node_modules
.DS_Store
kontra.min.js.map
kontra.build.js
kontra.build.min.js
index.html
Expand Down
3 changes: 2 additions & 1 deletion .jshintrc
Expand Up @@ -14,5 +14,6 @@
"undef" : false, // Require all non-global variables be declared before they are used.
"strict" : true, // Require `use strict` pragma in every file.
"trailing" : true, // Prohibit trailing whitespaces.
"browser" : true // Standard browser globals e.g. `window`, `document`.
"browser" : true, // Standard browser globals e.g. `window`, `document`.
"boss" : true // Suppress warnings about assignments in comparisons
}
2 changes: 1 addition & 1 deletion LICENSE
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2013 Greg Thornton
Copyright (c) 2015 Steven Lambert

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion examples/galaxian/js/galaxian.js
Expand Up @@ -341,7 +341,7 @@ kontra.loadAssets(
kontra.audios.kick_shock.currentTime = 0;
kontra.audios.kick_shock.play();

player.position.init(280, 270);
player.position.init({x: 280, y: 270});
};

startGame();
Expand Down
20 changes: 9 additions & 11 deletions examples/tileEngine/index.html
Expand Up @@ -59,20 +59,20 @@
frameHeight: 64,
animations: {
walk_up: {
frames: '104..112',
frameSpeed: 4
frames: '105..112',
frameRate: 12
},
walk_left: {
frames: '117..125',
frameSpeed: 4
frames: '118..125',
frameRate: 12
},
walk_down: {
frames: '130..138',
frameSpeed: 4
frames: '131..138',
frameRate: 12
},
walk_right: {
frames: '143..151',
frameSpeed: 4
frames: '144..151',
frameRate: 12
}
}
});
Expand All @@ -81,8 +81,6 @@
var player = kontra.sprite({
x: 268,
y: 268,
width: 64,
height: 64,
speed: 3,
startX: 268,
startY: 268,
Expand Down Expand Up @@ -179,7 +177,7 @@
},
});

player.position.clamp(0, 0, kontra.canvas.width - player.width, kontra.canvas.height - player.height);
player.position.clamp(-16, -16, kontra.canvas.width - player.width + 16, kontra.canvas.height - player.height + 16);

var loop = kontra.gameLoop({
update: function() {
Expand Down
16 changes: 12 additions & 4 deletions gulpfile.js
Expand Up @@ -8,7 +8,7 @@ var rename = require('gulp-rename');
var size = require('gulp-size');
var sourcemaps = require('gulp-sourcemaps');
var uglify = require('gulp-uglify');
var karma = require('karma').server;
var Server = require('karma').Server;

var package = require('./package.json');

Expand Down Expand Up @@ -139,9 +139,17 @@ gulp.task('watch', function() {
});

gulp.task('test', function(done) {
karma.start({
configFile: __dirname + '/karma.conf.js'
}, done);
new Server({
basePath: '',
frameworks: ['mocha', 'chai', 'sinon'],
files: [
// assets
'test/phantom.polyfill.js',
'src/*.js',
'test/*.js'
],
browsers: ['Chrome', 'Firefox', 'Safari', 'IE']
}, done).start();
});

gulp.task('default', ['lint', 'scripts', 'connect', 'watch']);

0 comments on commit f1f5bbe

Please sign in to comment.