From 03f92bb15573e380cdf7261e3f952b8792e4cd17 Mon Sep 17 00:00:00 2001 From: Ben Newman Date: Tue, 28 May 2013 17:29:57 -0400 Subject: [PATCH] Polyfill Function.prototype.bind during tests. --- src/test/all.js | 21 +++++++++++++++++++++ vendor/jasmine/phantom.js | 20 -------------------- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/src/test/all.js b/src/test/all.js index 80dec80e4f..5b07fb551c 100644 --- a/src/test/all.js +++ b/src/test/all.js @@ -2,6 +2,27 @@ // modules in src/test and to specify an ordering on those modules, since // some still have implicit dependencies on others. +var Ap = Array.prototype; +var slice = Ap.slice; +var Fp = Function.prototype; + +if (!Fp.bind) { + // PhantomJS doesn't support Function.prototype.bind natively, so + // polyfill it whenever this module is required. + Fp.bind = function(context) { + var func = this; + var args = slice.call(arguments, 1); + return args.length > 0 ? function() { + return func.apply( + context || this, + args.concat(slice.call(arguments)) + ); + } : function() { + return func.apply(context || this, arguments); + }; + }; +} + require("ReactTestUtils"); require("reactComponentExpect"); require("mocks"); diff --git a/vendor/jasmine/phantom.js b/vendor/jasmine/phantom.js index 1741beae81..af54e6f75e 100644 --- a/vendor/jasmine/phantom.js +++ b/vendor/jasmine/phantom.js @@ -19,26 +19,6 @@ var console = require("./console"); var global = Function("return this")(); -var Ap = Array.prototype; -var slice = Ap.slice; -var Fp = Function.prototype; - -if (!Fp.bind) { - // PhantomJS doesn't support Function.prototype.bind natively, so - // polyfill it whenever this module is required. - Fp.bind = function(context) { - var func = this; - var args = slice.call(arguments, 1); - return args.length > 0 ? function() { - return func.apply( - context || this, - args.concat(slice.call(arguments)) - ); - } : function() { - return func.apply(context || this, arguments); - }; - }; -} if (global.callPhantom) { // Phantom's onConsoleMessage support is lacking (only one argument