Update of multiple frontend libs.
This commit is contained in:
parent
de261dbde5
commit
a9c6ddc03b
276 changed files with 41257 additions and 19300 deletions
311
app/bower_components/lodash/test/test-fp.js
vendored
311
app/bower_components/lodash/test/test-fp.js
vendored
|
@ -1,4 +1,5 @@
|
|||
;(function() {
|
||||
'use strict';
|
||||
|
||||
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
|
||||
var undefined;
|
||||
|
@ -22,6 +23,7 @@
|
|||
/** Math helpers. */
|
||||
var add = function(x, y) { return x + y; },
|
||||
isEven = function(n) { return n % 2 == 0; },
|
||||
isEvenIndex = function(n, index) { return isEven(index); },
|
||||
square = function(n) { return n * n; };
|
||||
|
||||
// Leak to avoid sporadic `noglobals` fails on Edge in Sauce Labs.
|
||||
|
@ -140,11 +142,8 @@
|
|||
|
||||
if (!document) {
|
||||
var array = [1, 2, 3, 4],
|
||||
lodash = convert({ 'remove': _.remove }, allFalseOptions);
|
||||
|
||||
var actual = lodash.remove(array, function(n, index) {
|
||||
return isEven(index);
|
||||
});
|
||||
lodash = convert({ 'remove': _.remove }, allFalseOptions),
|
||||
actual = lodash.remove(array, isEvenIndex);
|
||||
|
||||
assert.deepEqual(array, [2, 4]);
|
||||
assert.deepEqual(actual, [1, 3]);
|
||||
|
@ -159,11 +158,8 @@
|
|||
assert.expect(3);
|
||||
|
||||
var array = [1, 2, 3, 4],
|
||||
lodash = convert(_.runInContext(), allFalseOptions);
|
||||
|
||||
var actual = lodash.remove(array, function(n, index) {
|
||||
return isEven(index);
|
||||
});
|
||||
lodash = convert(_.runInContext(), allFalseOptions),
|
||||
actual = lodash.remove(array, isEvenIndex);
|
||||
|
||||
assert.deepEqual(array, [2, 4]);
|
||||
assert.deepEqual(actual, [1, 3]);
|
||||
|
@ -175,11 +171,8 @@
|
|||
|
||||
var array = [1, 2, 3, 4],
|
||||
runInContext = convert('runInContext', _.runInContext, allFalseOptions),
|
||||
lodash = runInContext();
|
||||
|
||||
var actual = lodash.remove(array, function(n, index) {
|
||||
return isEven(index);
|
||||
});
|
||||
lodash = runInContext(),
|
||||
actual = lodash.remove(array, isEvenIndex);
|
||||
|
||||
assert.deepEqual(array, [2, 4]);
|
||||
assert.deepEqual(actual, [1, 3]);
|
||||
|
@ -192,7 +185,7 @@
|
|||
var array = [1, 2, 3, 4],
|
||||
value = _.clone(array),
|
||||
remove = convert('remove', _.remove, { 'cap': false }),
|
||||
actual = remove(function(n, index) { return isEven(index); })(value);
|
||||
actual = remove(isEvenIndex)(value);
|
||||
|
||||
assert.deepEqual(value, [1, 2, 3, 4]);
|
||||
assert.deepEqual(actual, [2, 4]);
|
||||
|
@ -280,6 +273,25 @@
|
|||
assert.strictEqual(fp.isArray(array), true);
|
||||
assert.strictEqual(isArray()(array), true);
|
||||
});
|
||||
|
||||
QUnit.test('should convert method aliases', function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
var all = fp.all.convert({ 'rearg': false }),
|
||||
actual = all([0])(_.identity);
|
||||
|
||||
assert.strictEqual(actual, false);
|
||||
});
|
||||
|
||||
QUnit.test('should convert remapped methods', function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
var extendAll = fp.extendAll.convert({ 'immutable': false }),
|
||||
object = {};
|
||||
|
||||
extendAll([object, { 'a': 1 }, { 'b': 2 }]);
|
||||
assert.deepEqual(object, { 'a': 1, 'b': 2 });
|
||||
});
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
@ -295,11 +307,8 @@
|
|||
|
||||
var array = [1, 2, 3, 4],
|
||||
lodash = func(allFalseOptions),
|
||||
remove = isFp ? lodash.remove : lodash;
|
||||
|
||||
var actual = remove(array, function(n, index) {
|
||||
return isEven(index);
|
||||
});
|
||||
remove = isFp ? lodash.remove : lodash,
|
||||
actual = remove(array, isEvenIndex);
|
||||
|
||||
assert.deepEqual(array, [2, 4]);
|
||||
assert.deepEqual(actual, [1, 3]);
|
||||
|
@ -311,11 +320,8 @@
|
|||
|
||||
var array = [1, 2, 3, 4],
|
||||
lodash = func({ 'cap': false }),
|
||||
remove = (isFp ? lodash.remove : lodash).convert({ 'rearg': false });
|
||||
|
||||
var actual = remove(array)(function(n, index) {
|
||||
return isEven(index);
|
||||
});
|
||||
remove = (isFp ? lodash.remove : lodash).convert({ 'rearg': false }),
|
||||
actual = remove(array)(isEvenIndex);
|
||||
|
||||
assert.deepEqual(array, [1, 2, 3, 4]);
|
||||
assert.deepEqual(actual, [2, 4]);
|
||||
|
@ -344,7 +350,7 @@
|
|||
var aryCap = index + 1;
|
||||
|
||||
var methodNames = _.filter(mapping.aryMethod[aryCap], function(methodName) {
|
||||
var key = _.result(mapping.remap, methodName, methodName),
|
||||
var key = _.get(mapping.remap, methodName, methodName),
|
||||
arity = _[key].length;
|
||||
|
||||
return arity != 0 && arity < aryCap;
|
||||
|
@ -384,7 +390,7 @@
|
|||
'method', 'methodOf', 'rest', 'runInContext'
|
||||
];
|
||||
|
||||
var exceptions = funcMethods.concat('mixin', 'template'),
|
||||
var exceptions = funcMethods.concat('mixin', 'nthArg', 'template'),
|
||||
expected = _.map(mapping.aryMethod[1], _.constant(true));
|
||||
|
||||
var actual = _.map(mapping.aryMethod[1], function(methodName) {
|
||||
|
@ -413,7 +419,7 @@
|
|||
'wrap'
|
||||
];
|
||||
|
||||
var exceptions = _.difference(funcMethods.concat('matchesProperty'), ['cloneDeepWith', 'cloneWith', 'delay']),
|
||||
var exceptions = _.without(funcMethods.concat('matchesProperty'), 'delay'),
|
||||
expected = _.map(mapping.aryMethod[2], _.constant(true));
|
||||
|
||||
var actual = _.map(mapping.aryMethod[2], function(methodName) {
|
||||
|
@ -642,7 +648,7 @@
|
|||
_.forOwn(mapping.placeholder, function(truthy, methodName) {
|
||||
var func = fp[methodName];
|
||||
|
||||
QUnit.test('`_.' + methodName + '` should have a `placeholder` property', function(assert) {
|
||||
QUnit.test('fp.' + methodName + '` should have a `placeholder` property', function(assert) {
|
||||
assert.expect(2);
|
||||
|
||||
assert.ok(_.isObject(func.placeholder));
|
||||
|
@ -711,7 +717,7 @@
|
|||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('assign methods');
|
||||
QUnit.module('object assignments');
|
||||
|
||||
_.each(['assign', 'assignIn', 'defaults', 'defaultsDeep', 'merge'], function(methodName) {
|
||||
var func = fp[methodName];
|
||||
|
@ -727,9 +733,19 @@
|
|||
});
|
||||
});
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
_.each(['assignAll', 'assignInAll', 'defaultsAll', 'defaultsDeepAll', 'mergeAll'], function(methodName) {
|
||||
var func = fp[methodName];
|
||||
|
||||
QUnit.module('assignWith methods');
|
||||
QUnit.test('`fp.' + methodName + '` should not mutate values', function(assert) {
|
||||
assert.expect(2);
|
||||
|
||||
var objects = [{ 'a': 1 }, { 'b': 2 }],
|
||||
actual = func(objects);
|
||||
|
||||
assert.deepEqual(objects[0], { 'a': 1 });
|
||||
assert.deepEqual(actual, { 'a': 1, 'b': 2 });
|
||||
});
|
||||
});
|
||||
|
||||
_.each(['assignWith', 'assignInWith', 'extendWith'], function(methodName) {
|
||||
var func = fp[methodName];
|
||||
|
@ -745,19 +761,31 @@
|
|||
|
||||
assert.deepEqual(args, [undefined, 2, 'b', { 'a': 1 }, { 'b': 2 }]);
|
||||
});
|
||||
});
|
||||
|
||||
_.each(['assignAllWith', 'assignInAllWith', 'extendAllWith', 'mergeAllWith'], function(methodName) {
|
||||
var func = fp[methodName];
|
||||
|
||||
QUnit.test('`fp.' + methodName + '` should not mutate values', function(assert) {
|
||||
assert.expect(2);
|
||||
|
||||
var object = { 'a': 1 };
|
||||
var objects = [{ 'a': 1 }, { 'b': 2 }],
|
||||
actual = func(_.noop)(objects);
|
||||
|
||||
var actual = func(function(objValue, srcValue) {
|
||||
return srcValue;
|
||||
})(object)({ 'b': 2 });
|
||||
|
||||
assert.deepEqual(object, { 'a': 1 });
|
||||
assert.deepEqual(objects[0], { 'a': 1 });
|
||||
assert.deepEqual(actual, { 'a': 1, 'b': 2 });
|
||||
});
|
||||
|
||||
QUnit.test('`fp.' + methodName + '` should work with more than two sources', function(assert) {
|
||||
assert.expect(2);
|
||||
|
||||
var pass = false,
|
||||
objects = [{ 'a': 1 }, { 'b': 2 }, { 'c': 3 }],
|
||||
actual = func(function() { pass = true; })(objects);
|
||||
|
||||
assert.ok(pass);
|
||||
assert.deepEqual(actual, { 'a': 1, 'b': 2, 'c': 3 });
|
||||
});
|
||||
});
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
@ -809,7 +837,7 @@
|
|||
_.each(['curry', 'curryRight'], function(methodName) {
|
||||
var func = fp[methodName];
|
||||
|
||||
QUnit.test('`_.' + methodName + '` should only accept a `func` param', function(assert) {
|
||||
QUnit.test('fp.' + methodName + '` should only accept a `func` param', function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
assert.raises(function() { func(1, _.noop); }, TypeError);
|
||||
|
@ -823,7 +851,7 @@
|
|||
_.each(['curryN', 'curryRightN'], function(methodName) {
|
||||
var func = fp[methodName];
|
||||
|
||||
QUnit.test('`_.' + methodName + '` should accept an `arity` param', function(assert) {
|
||||
QUnit.test('fp.' + methodName + '` should accept an `arity` param', function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
var actual = func(1)(function(a, b) { return [a, b]; })('a');
|
||||
|
@ -833,6 +861,19 @@
|
|||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('fp.defaultTo');
|
||||
|
||||
(function() {
|
||||
QUnit.test('should have an argument order of `defaultValue` then `value`', function(assert) {
|
||||
assert.expect(2);
|
||||
|
||||
assert.strictEqual(fp.defaultTo(1)(0), 0);
|
||||
assert.strictEqual(fp.defaultTo(1)(undefined), 1);
|
||||
});
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('fp.difference');
|
||||
|
||||
(function() {
|
||||
|
@ -910,10 +951,9 @@
|
|||
|
||||
var object = { 'a': 1 },
|
||||
extend = convert('extend', _.extend),
|
||||
value = _.clone(object),
|
||||
actual = extend(value)(new Foo);
|
||||
actual = extend(object)(new Foo);
|
||||
|
||||
assert.deepEqual(value, object);
|
||||
assert.deepEqual(object, { 'a': 1 });
|
||||
assert.deepEqual(actual, { 'a': 1, 'b': 2 });
|
||||
});
|
||||
}());
|
||||
|
@ -948,7 +988,7 @@
|
|||
_.each(['findFrom', 'findIndexFrom', 'findLastFrom', 'findLastIndexFrom'], function(methodName) {
|
||||
var func = fp[methodName];
|
||||
|
||||
QUnit.test('`_.' + methodName + '` should provide the correct `predicate` arguments', function(assert) {
|
||||
QUnit.test('fp.' + methodName + '` should provide the correct `predicate` arguments', function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
var args;
|
||||
|
@ -1007,13 +1047,13 @@
|
|||
var func = fp[methodName],
|
||||
resolve = methodName == 'findIndexFrom' ? fp.eq : _.identity;
|
||||
|
||||
QUnit.test('`_.' + methodName + '` should have an argument order of `value`, `fromIndex`, then `array`', function(assert) {
|
||||
QUnit.test('fp.' + methodName + '` should have an argument order of `value`, `fromIndex`, then `array`', function(assert) {
|
||||
assert.expect(2);
|
||||
|
||||
var array = [1, 2, 3, 1, 2, 3];
|
||||
|
||||
assert.deepEqual(func(resolve(1))(2)(array), 3);
|
||||
assert.deepEqual(func(resolve(2))(-3)(array), 4);
|
||||
assert.strictEqual(func(resolve(1))(2)(array), 3);
|
||||
assert.strictEqual(func(resolve(2))(-3)(array), 4);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -1025,13 +1065,13 @@
|
|||
var func = fp[methodName],
|
||||
resolve = methodName == 'findLastIndexFrom' ? fp.eq : _.identity;
|
||||
|
||||
QUnit.test('`_.' + methodName + '` should have an argument order of `value`, `fromIndex`, then `array`', function(assert) {
|
||||
QUnit.test('fp.' + methodName + '` should have an argument order of `value`, `fromIndex`, then `array`', function(assert) {
|
||||
assert.expect(2);
|
||||
|
||||
var array = [1, 2, 3, 1, 2, 3];
|
||||
|
||||
assert.deepEqual(func(resolve(2))(3)(array), 1);
|
||||
assert.deepEqual(func(resolve(3))(-3)(array), 2);
|
||||
assert.strictEqual(func(resolve(2))(3)(array), 1);
|
||||
assert.strictEqual(func(resolve(3))(-3)(array), 2);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -1273,7 +1313,7 @@
|
|||
var args,
|
||||
iteration = 0,
|
||||
objects = [{ 'a': 1 }, { 'a': 2 }],
|
||||
stack = { '__data__': { '__data__': [objects] } },
|
||||
stack = { '__data__': { '__data__': [objects, objects.slice().reverse()], 'size': 2 }, 'size': 2 },
|
||||
expected = [1, 2, 'a', objects[0], objects[1], stack];
|
||||
|
||||
fp.isEqualWith(function() {
|
||||
|
@ -1299,7 +1339,7 @@
|
|||
|
||||
var args,
|
||||
objects = [{ 'a': 1 }, { 'a': 2 }],
|
||||
stack = { '__data__': { '__data__': [] } },
|
||||
stack = { '__data__': { '__data__': [], 'size': 0 }, 'size': 0 },
|
||||
expected = [2, 1, 'a', objects[1], objects[0], stack];
|
||||
|
||||
fp.isMatchWith(function() {
|
||||
|
@ -1408,12 +1448,12 @@
|
|||
assert.expect(1);
|
||||
|
||||
var args,
|
||||
stack = { '__data__': { '__data__': [] } },
|
||||
expected = [[1], [2, 3], 'a', { 'a': [1] }, { 'a': [2, 3] }, stack];
|
||||
stack = { '__data__': { '__data__': [], 'size': 0 }, 'size': 0 },
|
||||
expected = [[1, 2], [3], 'a', { 'a': [1, 2] }, { 'a': [3] }, stack];
|
||||
|
||||
fp.mergeWith(function() {
|
||||
args || (args = _.map(arguments, _.cloneDeep));
|
||||
})({ 'a': [1] })({ 'a': [2, 3] });
|
||||
})({ 'a': [1, 2] })({ 'a': [3] });
|
||||
|
||||
args[5] = _.omitBy(args[5], _.isFunction);
|
||||
args[5].__data__ = _.omitBy(args[5].__data__, _.isFunction);
|
||||
|
@ -1424,17 +1464,35 @@
|
|||
QUnit.test('should not mutate values', function(assert) {
|
||||
assert.expect(2);
|
||||
|
||||
var object = { 'a': { 'b': 2, 'c': 3 } };
|
||||
object.a.b = [1];
|
||||
var objects = [{ 'a': [1, 2] }, { 'a': [3] }],
|
||||
actual = fp.mergeWith(_.noop, objects[0], objects[1]);
|
||||
|
||||
var actual = fp.mergeWith(function(objValue, srcValue) {
|
||||
if (_.isArray(objValue)) {
|
||||
return objValue.concat(srcValue);
|
||||
}
|
||||
}, object, { 'a': { 'b': [2, 3] } });
|
||||
assert.deepEqual(objects[0], { 'a': [1, 2] });
|
||||
assert.deepEqual(actual, { 'a': [3, 2] });
|
||||
});
|
||||
}());
|
||||
|
||||
assert.deepEqual(object, { 'a': { 'b': [1], 'c': 3 } });
|
||||
assert.deepEqual(actual, { 'a': { 'b': [1, 2, 3], 'c': 3 } });
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('fp.mergeAllWith');
|
||||
|
||||
(function() {
|
||||
QUnit.test('should provide the correct `customizer` arguments', function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
var args,
|
||||
objects = [{ 'a': [1, 2] }, { 'a': [3] }],
|
||||
stack = { '__data__': { '__data__': [], 'size': 0 }, 'size': 0 },
|
||||
expected = [[1, 2], [3], 'a', { 'a': [1, 2] }, { 'a': [3] }, stack];
|
||||
|
||||
fp.mergeAllWith(function() {
|
||||
args || (args = _.map(arguments, _.cloneDeep));
|
||||
})(objects);
|
||||
|
||||
args[5] = _.omitBy(args[5], _.isFunction);
|
||||
args[5].__data__ = _.omitBy(args[5].__data__, _.isFunction);
|
||||
|
||||
assert.deepEqual(args, expected);
|
||||
});
|
||||
}());
|
||||
|
||||
|
@ -1515,11 +1573,27 @@
|
|||
Foo.mixin = object.mixin;
|
||||
Foo.mixin(source);
|
||||
|
||||
assert.strictEqual(typeof Foo.a, 'function');
|
||||
assert.ok('a' in Foo);
|
||||
assert.notOk('a' in Foo.prototype);
|
||||
|
||||
object.mixin(source);
|
||||
assert.strictEqual(typeof object.a, 'function');
|
||||
assert.ok('a' in object);
|
||||
});
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('fp.nthArg');
|
||||
|
||||
(function() {
|
||||
QUnit.test('should return a curried function', function(assert) {
|
||||
assert.expect(2);
|
||||
|
||||
var func = fp.nthArg(1);
|
||||
assert.strictEqual(func(1)(2), 2);
|
||||
|
||||
func = fp.nthArg(-1);
|
||||
assert.strictEqual(func(1), 1);
|
||||
});
|
||||
}());
|
||||
|
||||
|
@ -1567,7 +1641,7 @@
|
|||
isPad = methodName == 'padChars',
|
||||
isStart = methodName == 'padCharsStart';
|
||||
|
||||
QUnit.test('`_.' + methodName + '` should truncate pad characters to fit the pad length', function(assert) {
|
||||
QUnit.test('fp.' + methodName + '` should truncate pad characters to fit the pad length', function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
if (isPad) {
|
||||
|
@ -1586,7 +1660,7 @@
|
|||
var func = fp[methodName],
|
||||
isPartial = methodName == 'partial';
|
||||
|
||||
QUnit.test('`_.' + methodName + '` should accept an `args` param', function(assert) {
|
||||
QUnit.test('fp.' + methodName + '` should accept an `args` param', function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
var expected = isPartial ? [1, 2, 3] : [0, 1, 2];
|
||||
|
@ -1598,7 +1672,7 @@
|
|||
assert.deepEqual(actual, expected);
|
||||
});
|
||||
|
||||
QUnit.test('`_.' + methodName + '` should convert by name', function(assert) {
|
||||
QUnit.test('fp.' + methodName + '` should convert by name', function(assert) {
|
||||
assert.expect(2);
|
||||
|
||||
var expected = isPartial ? [1, 2, 3] : [0, 1, 2],
|
||||
|
@ -1621,6 +1695,21 @@
|
|||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('fp.propertyOf');
|
||||
|
||||
(function() {
|
||||
QUnit.test('should be curried', function(assert) {
|
||||
assert.expect(2);
|
||||
|
||||
var object = { 'a': 1 };
|
||||
|
||||
assert.strictEqual(fp.propertyOf(object, 'a'), 1);
|
||||
assert.strictEqual(fp.propertyOf(object)('a'), 1);
|
||||
});
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('fp.pull');
|
||||
|
||||
(function() {
|
||||
|
@ -1689,13 +1778,55 @@
|
|||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('fp.range');
|
||||
QUnit.module('range methods');
|
||||
|
||||
(function() {
|
||||
QUnit.test('should have an argument order of `start` then `end`', function(assert) {
|
||||
_.each(['range', 'rangeRight'], function(methodName) {
|
||||
var func = fp[methodName],
|
||||
isRange = methodName == 'range';
|
||||
|
||||
QUnit.test('fp.' + methodName + '` should have an argument order of `start` then `end`', function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
assert.deepEqual(fp.range(1)(4), [1, 2, 3]);
|
||||
assert.deepEqual(func(1)(4), isRange ? [1, 2, 3] : [3, 2, 1]);
|
||||
});
|
||||
});
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('rangeStep methods');
|
||||
|
||||
_.each(['rangeStep', 'rangeStepRight'], function(methodName) {
|
||||
var func = fp[methodName],
|
||||
isRange = methodName == 'rangeStep';
|
||||
|
||||
QUnit.test('fp.' + methodName + '` should have an argument order of `step`, `start`, then `end`', function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
assert.deepEqual(func(2)(1)(4), isRange ? [1, 3] : [3, 1]);
|
||||
});
|
||||
});
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('fp.rearg');
|
||||
|
||||
(function() {
|
||||
function fn(a, b, c) {
|
||||
return [a, b, c];
|
||||
}
|
||||
|
||||
QUnit.test('should be curried', function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
var rearged = fp.rearg([1, 2, 0])(fn);
|
||||
assert.deepEqual(rearged('c', 'a', 'b'), ['a', 'b', 'c']);
|
||||
});
|
||||
|
||||
QUnit.test('should return a curried function', function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
var rearged = fp.rearg([1, 2, 0], fn);
|
||||
assert.deepEqual(rearged('c')('a')('b'), ['a', 'b', 'c']);
|
||||
});
|
||||
}());
|
||||
|
||||
|
@ -1707,7 +1838,7 @@
|
|||
var func = fp[methodName],
|
||||
isReduce = methodName == 'reduce';
|
||||
|
||||
QUnit.test('`_.' + methodName + '` should provide the correct `iteratee` arguments when iterating an array', function(assert) {
|
||||
QUnit.test('`fp.' + methodName + '` should provide the correct `iteratee` arguments when iterating an array', function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
var args;
|
||||
|
@ -1716,10 +1847,10 @@
|
|||
args || (args = slice.call(arguments));
|
||||
})(0)([1, 2, 3]);
|
||||
|
||||
assert.deepEqual(args, isReduce ? [0, 1] : [0, 3]);
|
||||
assert.deepEqual(args, isReduce ? [0, 1] : [3, 0]);
|
||||
});
|
||||
|
||||
QUnit.test('`_.' + methodName + '` should provide the correct `iteratee` arguments when iterating an object', function(assert) {
|
||||
QUnit.test('`fp.' + methodName + '` should provide the correct `iteratee` arguments when iterating an object', function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
var args,
|
||||
|
@ -1727,8 +1858,8 @@
|
|||
isFIFO = _.keys(object)[0] == 'a';
|
||||
|
||||
var expected = isFIFO
|
||||
? (isReduce ? [0, 1] : [0, 2])
|
||||
: (isReduce ? [0, 2] : [0, 1]);
|
||||
? (isReduce ? [0, 1] : [2, 0])
|
||||
: (isReduce ? [0, 2] : [1, 0]);
|
||||
|
||||
func(function() {
|
||||
args || (args = slice.call(arguments));
|
||||
|
@ -1881,7 +2012,7 @@
|
|||
}
|
||||
parts = parts.join(' and ');
|
||||
|
||||
QUnit.test('`_.' + methodName + '` should remove ' + parts + ' `chars`', function(assert) {
|
||||
QUnit.test('`fp.' + methodName + '` should remove ' + parts + ' `chars`', function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
var string = '-_-a-b-c-_-',
|
||||
|
@ -1951,11 +2082,8 @@
|
|||
QUnit.test('should work with an `iteratee` argument', function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
var expected = objects.slice(0, 3);
|
||||
|
||||
var actual = fp.uniqBy(function(object) {
|
||||
return object.a;
|
||||
})(objects);
|
||||
var expected = objects.slice(0, 3),
|
||||
actual = fp.uniqBy(_.property('a'))(objects);
|
||||
|
||||
assert.deepEqual(actual, expected);
|
||||
});
|
||||
|
@ -2135,6 +2263,18 @@
|
|||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('fp.zipAll');
|
||||
|
||||
(function() {
|
||||
QUnit.test('should zip together an array of arrays', function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
assert.deepEqual(fp.zipAll([[1, 2], [3, 4], [5, 6]]), [[1, 3, 5], [2, 4, 6]]);
|
||||
});
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('fp.zipObject');
|
||||
|
||||
(function() {
|
||||
|
@ -2169,5 +2309,6 @@
|
|||
if (!document) {
|
||||
QUnit.config.noglobals = true;
|
||||
QUnit.load();
|
||||
QUnit.start();
|
||||
}
|
||||
}.call(this));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue