diff --git a/Gruntfile.js b/Gruntfile.js index db349753..07680eff 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -14,11 +14,11 @@ module.exports = function (grunt) { grunt.initConfig({ jshint : { /*options: { - "evil": true, - "asi": true, - "smarttabs": true, - "eqnull": true - },*/ + "evil": true, + "asi": true, + "smarttabs": true, + "eqnull": true + },*/ files : [ 'Gruntfile.js', 'package.json', @@ -39,10 +39,10 @@ module.exports = function (grunt) { filesSrc : ['tests/integration/casperjs/*_test.js'], options : { args : { - baseUrl : 'http://localhost:' + '<%= connect.www.options.port %>/?debug' + baseUrl : 'http://localhost:' + '<%= connect.www.options.port %>/' }, direct : false, - logLevel : 'error', + logLevel : 'debug', printCommand : false, printFilePaths : true } diff --git a/index.html b/index.html index a14bfb1c..e453d74c 100644 --- a/index.html +++ b/index.html @@ -121,29 +121,30 @@ diff --git a/js/utils/core.js b/js/utils/core.js index bf87d6bc..1bc1c8ef 100644 --- a/js/utils/core.js +++ b/js/utils/core.js @@ -11,6 +11,19 @@ jQuery.namespace = function() { return o; }; +/** + * Need a polyfill for PhantomJS + */ +if (typeof Function.prototype.bind !== "function") { + Function.prototype.bind = function(scope) { + "use strict"; + var _function = this; + return function() { + return _function.apply(scope, arguments); + }; + }; +} + /* * @provide pskl.utils * diff --git a/tests/integration/casperjs/smoke_test.js b/tests/integration/casperjs/smoke_test.js index 671def22..17aefaca 100644 --- a/tests/integration/casperjs/smoke_test.js +++ b/tests/integration/casperjs/smoke_test.js @@ -1,8 +1,12 @@ casper -.start(casper.cli.get('baseUrl')) -.then(function () { - this.test.assertExists('#drawing-canvas-container canvas', 'Check if drawing canvas element is created'); -}) -.run(function () { - this.test.done(); -}); \ No newline at end of file + .start(casper.cli.get('baseUrl')+"?debug") + .then(function () { + // If there was a JS error after the page load, casper won't perform asserts + this.test.assertExists('html', 'Casper JS cannot assert DOM elements. A JS error has probably occured.'); + + this.test.assertExists('#drawing-canvas-container canvas', 'Check if drawing canvas element is created'); + + }) + .run(function () { + this.test.done(); + });