Expose _.toLength.

This commit is contained in:
Xotic750
2015-10-30 21:04:17 +01:00
committed by John-David Dalton
parent c7ef030ef5
commit 2b4a10c159
2 changed files with 44 additions and 4 deletions

View File

@@ -19338,6 +19338,29 @@
/*--------------------------------------------------------------------------*/
QUnit.module('lodash.toLength');
(function() {
QUnit.test('should return number literal integers in range unchanged', function(assert) {
assert.expect(3);
assert.strictEqual(_.toLength(0), 0);
assert.strictEqual(_.toLength(3), 3);
assert.strictEqual(_.toLength(MAX_ARRAY_LENGTH), MAX_ARRAY_LENGTH);
});
QUnit.test('should return number as integer clamped to range', function(assert) {
assert.expect(4);
assert.strictEqual(_.toLength(-1), 0);
assert.strictEqual(_.toLength('1'), 1);
assert.strictEqual(_.toLength(1.1), 1);
assert.strictEqual(_.toLength(MAX_INTEGER), MAX_ARRAY_LENGTH);
});
}());
/*--------------------------------------------------------------------------*/
QUnit.module('lodash.toPath');
(function() {
@@ -22023,7 +22046,7 @@
var acceptFalsey = lodashStable.difference(allMethods, rejectFalsey);
QUnit.test('should accept falsey arguments', function(assert) {
assert.expect(273);
assert.expect(274);
var emptyArrays = lodashStable.map(falsey, lodashStable.constant([]));