mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-12 11:57:49 +00:00
Cleanup fn declaration style in tests.
This commit is contained in:
32
test/test.js
32
test/test.js
@@ -2506,11 +2506,11 @@
|
|||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
test('should provide arguments to `func`', 3, function() {
|
test('should provide arguments to `func`', 3, function() {
|
||||||
function fn() {
|
var fn = function() {
|
||||||
var result = [this];
|
var result = [this];
|
||||||
push.apply(result, arguments);
|
push.apply(result, arguments);
|
||||||
return result;
|
return result;
|
||||||
}
|
};
|
||||||
|
|
||||||
var callback = _.callback(fn),
|
var callback = _.callback(fn),
|
||||||
actual = callback('a', 'b', 'c', 'd', 'e', 'f');
|
actual = callback('a', 'b', 'c', 'd', 'e', 'f');
|
||||||
@@ -2647,11 +2647,11 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('should work with functions created by `_.partial` and `_.partialRight`', 2, function() {
|
test('should work with functions created by `_.partial` and `_.partialRight`', 2, function() {
|
||||||
function fn() {
|
var fn = function() {
|
||||||
var result = [this.a];
|
var result = [this.a];
|
||||||
push.apply(result, arguments);
|
push.apply(result, arguments);
|
||||||
return result;
|
return result;
|
||||||
}
|
};
|
||||||
|
|
||||||
var expected = [1, 2, 3],
|
var expected = [1, 2, 3],
|
||||||
object = { 'a': 1 },
|
object = { 'a': 1 },
|
||||||
@@ -11952,16 +11952,16 @@
|
|||||||
QUnit.module('methods using `createWrapper`');
|
QUnit.module('methods using `createWrapper`');
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
function fn() {
|
||||||
|
return slice.call(arguments);
|
||||||
|
}
|
||||||
|
|
||||||
var ph1 = _.bind.placeholder,
|
var ph1 = _.bind.placeholder,
|
||||||
ph2 = _.bindKey.placeholder,
|
ph2 = _.bindKey.placeholder,
|
||||||
ph3 = _.partial.placeholder,
|
ph3 = _.partial.placeholder,
|
||||||
ph4 = _.partialRight.placeholder;
|
ph4 = _.partialRight.placeholder;
|
||||||
|
|
||||||
test('combinations of partial functions should work', 1, function() {
|
test('combinations of partial functions should work', 1, function() {
|
||||||
function fn() {
|
|
||||||
return slice.call(arguments);
|
|
||||||
}
|
|
||||||
|
|
||||||
var a = _.partial(fn),
|
var a = _.partial(fn),
|
||||||
b = _.partialRight(a, 3),
|
b = _.partialRight(a, 3),
|
||||||
c = _.partial(b, 1);
|
c = _.partial(b, 1);
|
||||||
@@ -11970,11 +11970,11 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('combinations of bound and partial functions should work', 3, function() {
|
test('combinations of bound and partial functions should work', 3, function() {
|
||||||
function fn() {
|
var fn = function() {
|
||||||
var result = [this.a];
|
var result = [this.a];
|
||||||
push.apply(result, arguments);
|
push.apply(result, arguments);
|
||||||
return result;
|
return result;
|
||||||
}
|
};
|
||||||
|
|
||||||
var expected = [1, 2, 3, 4],
|
var expected = [1, 2, 3, 4],
|
||||||
object = { 'a': 1, 'fn': fn };
|
object = { 'a': 1, 'fn': fn };
|
||||||
@@ -11999,10 +11999,6 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('combinations of functions with placeholders should work', 3, function() {
|
test('combinations of functions with placeholders should work', 3, function() {
|
||||||
function fn() {
|
|
||||||
return slice.call(arguments);
|
|
||||||
}
|
|
||||||
|
|
||||||
var expected = [1, 2, 3, 4, 5, 6],
|
var expected = [1, 2, 3, 4, 5, 6],
|
||||||
object = { 'fn': fn };
|
object = { 'fn': fn };
|
||||||
|
|
||||||
@@ -12026,10 +12022,6 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('combinations of functions with overlaping placeholders should work', 3, function() {
|
test('combinations of functions with overlaping placeholders should work', 3, function() {
|
||||||
function fn() {
|
|
||||||
return slice.call(arguments);
|
|
||||||
}
|
|
||||||
|
|
||||||
var expected = [1, 2, 3, 4],
|
var expected = [1, 2, 3, 4],
|
||||||
object = { 'fn': fn };
|
object = { 'fn': fn };
|
||||||
|
|
||||||
@@ -12053,9 +12045,9 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('recursively bound functions should work', 1, function() {
|
test('recursively bound functions should work', 1, function() {
|
||||||
function fn() {
|
var fn = function() {
|
||||||
return this.a;
|
return this.a;
|
||||||
}
|
};
|
||||||
|
|
||||||
var a = _.bind(fn, { 'a': 1 }),
|
var a = _.bind(fn, { 'a': 1 }),
|
||||||
b = _.bind(a, { 'a': 2 }),
|
b = _.bind(a, { 'a': 2 }),
|
||||||
|
|||||||
Reference in New Issue
Block a user