summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSolly Ross <sross@redhat.com>2016-09-03 13:53:47 -0400
committerSolly Ross <sross@redhat.com>2016-09-14 14:15:19 -0400
commit894c15911491ab3fea6ddf823b95bfeaf28036ac (patch)
treef53a00e667d228bf7c75465b4e710995d57d5dc0
parent5f4ae5e81458bc74109eb962d12b3f4afe48744b (diff)
downloadnovnc-894c15911491ab3fea6ddf823b95bfeaf28036ac.tar.gz
Switch to PhantomJS 2.x for testing
This commit switches over to use PhantomJS 2.x, bringing in a whole host of improvements (including `Function#bind`, so we can remove the `Function#bind` shim in core/util.js).
-rw-r--r--core/util.js35
-rw-r--r--package.json5
-rw-r--r--tests/run_from_console.casper.js2
-rwxr-xr-xtests/run_from_console.js2
4 files changed, 4 insertions, 40 deletions
diff --git a/core/util.js b/core/util.js
index cbc74dc..f2e12ae 100644
--- a/core/util.js
+++ b/core/util.js
@@ -11,41 +11,6 @@
var Util = {};
-
-var addFunc = function (cl, name, func) {
- if (!cl.prototype[name]) {
- Object.defineProperty(cl.prototype, name, { enumerable: false, value: func });
- }
-};
-
-// PhantomJS 1.x doesn't support bind,
-// so leave this in until PhantomJS 2.0 is released
-//This prototype is provided by the Mozilla foundation and
-//is distributed under the MIT license.
-//http://www.ibiblio.org/pub/Linux/LICENSES/mit.license
-addFunc(Function, 'bind', function (oThis) {
- if (typeof this !== "function") {
- // closest thing possible to the ECMAScript 5
- // internal IsCallable function
- throw new TypeError("Function.prototype.bind - " +
- "what is trying to be bound is not callable");
- }
-
- var aArgs = Array.prototype.slice.call(arguments, 1),
- fToBind = this,
- fNOP = function () {},
- fBound = function () {
- return fToBind.apply(this instanceof fNOP && oThis ? this
- : oThis,
- aArgs.concat(Array.prototype.slice.call(arguments)));
- };
-
- fNOP.prototype = this.prototype;
- fBound.prototype = new fNOP();
-
- return fBound;
-});
-
//
// requestAnimationFrame shim with setTimeout fallback
//
diff --git a/package.json b/package.json
index 3826223..22685b7 100644
--- a/package.json
+++ b/package.json
@@ -41,14 +41,13 @@
"karma-chai": "^0.1.0",
"karma-mocha": "^0.1.10",
"karma-mocha-reporter": "^1.0.0",
- "karma-phantomjs-launcher": "^0.1.4",
+ "karma-phantomjs-launcher": "^1.0.0",
"karma-sauce-launcher": "^0.2.10",
"karma-sinon": "^1.0.4",
"karma-sinon-chai-latest": "^0.1.0",
"mocha": "^2.1.0",
"open": "^0.0.5",
- "phantom": "^0.7.2",
- "phantomjs": "^1.9.15",
+ "phantomjs-prebuilt": "^2.1.4",
"sinon": "^1.12.2",
"sinon-chai": "^2.7.0",
"spooky": "^0.2.5",
diff --git a/tests/run_from_console.casper.js b/tests/run_from_console.casper.js
index 6a738a3..ba8546b 100644
--- a/tests/run_from_console.casper.js
+++ b/tests/run_from_console.casper.js
@@ -1,7 +1,7 @@
var Spooky = require('spooky');
var path = require('path');
-var phantom_path = require('phantomjs').path;
+var phantom_path = require('phantomjs-prebuilt').path;
var casper_path = path.resolve(__dirname, '../node_modules/casperjs/bin/casperjs');
process.env.PHANTOMJS_EXECUTABLE = phantom_path;
var casper_opts = {
diff --git a/tests/run_from_console.js b/tests/run_from_console.js
index d7d13da..1a2b800 100755
--- a/tests/run_from_console.js
+++ b/tests/run_from_console.js
@@ -92,7 +92,7 @@ if (program.autoInject) {
var template = {
header: "<html>\n<head>\n<meta charset='utf-8' />\n<link rel='stylesheet' href='" + get_path('node_modules/mocha/mocha.css') + "'/>\n</head>\n<body><div id='mocha'></div>",
script_tag: function(p) { return "<script src='" + p + "'></script>"; },
- footer: "<script>\nmocha.checkLeaks();\nmocha.globals(['navigator', 'create', 'ClientUtils', '__utils__']);\nmocha.run(function () { window.__mocha_done = true; });\n</script>\n</body>\n</html>"
+ footer: "<script>\nmocha.checkLeaks();\nmocha.globals(['navigator', 'create', 'ClientUtils', '__utils__', 'requestAnimationFrame', 'WebSocket']);\nmocha.run(function () { window.__mocha_done = true; });\n</script>\n</body>\n</html>"
};
template.header += "\n" + template.script_tag(get_path('node_modules/chai/chai.js'));