Changeset 79a0317 for imaps-frontend/node_modules/call-bind/test
Legend:
- Unmodified
- Added
- Removed
-
imaps-frontend/node_modules/call-bind/test/index.js
r0c6b92a r79a0317 2 2 3 3 var callBind = require('../'); 4 var bind = require('function-bind');5 var gOPD = require('gopd');6 4 var hasStrictMode = require('has-strict-mode')(); 7 5 var forEach = require('for-each'); … … 15 13 * in io.js v3, it is configurable except on bound functions, hence the .bind() 16 14 */ 17 var functionsHaveConfigurableLengths = !!( 18 gOPD 19 && Object.getOwnPropertyDescriptor 20 && Object.getOwnPropertyDescriptor(bind.call(function () {}), 'length').configurable 21 ); 15 var boundFnsHaveConfigurableLengths = require('set-function-length/env').boundFnsHaveConfigurableLengths; 22 16 23 17 test('callBind', function (t) { … … 41 35 42 36 var bound = callBind(func); 43 t.equal(bound.length, func.length + 1, 'function length is preserved', { skip: ! functionsHaveConfigurableLengths });37 t.equal(bound.length, func.length + 1, 'function length is preserved', { skip: !boundFnsHaveConfigurableLengths }); 44 38 t.deepEqual(bound(), [undefined, undefined, undefined], 'bound func with too few args'); 45 39 t.deepEqual(bound(1, 2), [hasStrictMode ? 1 : Object(1), 2, undefined], 'bound func with right args'); … … 47 41 48 42 var boundR = callBind(func, sentinel); 49 t.equal(boundR.length, func.length, 'function length is preserved', { skip: ! functionsHaveConfigurableLengths });43 t.equal(boundR.length, func.length, 'function length is preserved', { skip: !boundFnsHaveConfigurableLengths }); 50 44 t.deepEqual(boundR(), [sentinel, undefined, undefined], 'bound func with receiver, with too few args'); 51 45 t.deepEqual(boundR(1, 2), [sentinel, 1, 2], 'bound func with receiver, with right args'); … … 53 47 54 48 var boundArg = callBind(func, sentinel, 1); 55 t.equal(boundArg.length, func.length - 1, 'function length is preserved', { skip: ! functionsHaveConfigurableLengths });49 t.equal(boundArg.length, func.length - 1, 'function length is preserved', { skip: !boundFnsHaveConfigurableLengths }); 56 50 t.deepEqual(boundArg(), [sentinel, 1, undefined], 'bound func with receiver and arg, with too few args'); 57 51 t.deepEqual(boundArg(2), [sentinel, 1, 2], 'bound func with receiver and arg, with right arg');
Note:
See TracChangeset
for help on using the changeset viewer.