@samitouri / QOS-React-2 / commits / 03f92bb155
Fork 0

The library for web and native user interfaces.

Polyfill Function.prototype.bind during tests.

Ben Newman committed May 28, 2013 at 17:29 UTC 03f92bb15573e380cdf7261e3f952b8792e4cd17
2 files changed +21 -20
src/test/all.js
+21
@@ -2,6 +2,27 @@
2 // modules in src/test and to specify an ordering on those modules, since
3 // some still have implicit dependencies on others.
4
5 +var Ap = Array.prototype;
6 +var slice = Ap.slice;
7 +var Fp = Function.prototype;
8 +
9 +if (!Fp.bind) {
10 + // PhantomJS doesn't support Function.prototype.bind natively, so
11 + // polyfill it whenever this module is required.
12 + Fp.bind = function(context) {
13 + var func = this;
14 + var args = slice.call(arguments, 1);
15 + return args.length > 0 ? function() {
16 + return func.apply(
17 + context || this,
18 + args.concat(slice.call(arguments))
19 + );
20 + } : function() {
21 + return func.apply(context || this, arguments);
22 + };
23 + };
24 +}
25 +
26 require("ReactTestUtils");
27 require("reactComponentExpect");
28 require("mocks");
vendor/jasmine/phantom.js
-20
@@ -19,26 +19,6 @@
19
20 var console = require("./console");
21 var global = Function("return this")();
22 -var Ap = Array.prototype;
23 -var slice = Ap.slice;
24 -var Fp = Function.prototype;
25 -
26 -if (!Fp.bind) {
27 - // PhantomJS doesn't support Function.prototype.bind natively, so
28 - // polyfill it whenever this module is required.
29 - Fp.bind = function(context) {
30 - var func = this;
31 - var args = slice.call(arguments, 1);
32 - return args.length > 0 ? function() {
33 - return func.apply(
34 - context || this,
35 - args.concat(slice.call(arguments))
36 - );
37 - } : function() {
38 - return func.apply(context || this, arguments);
39 - };
40 - };
41 -}
22
23 if (global.callPhantom) {
24 // Phantom's onConsoleMessage support is lacking (only one argument